Showing posts with label gdb. Show all posts
Showing posts with label gdb. Show all posts

Friday, August 20, 2010

Debugging lzo(.lzo) file in maemo

If you are facing segmentation fault in Maemo device than there are some tools available to retrieve core dump files from the device. These tools are in the sp‐rich‐core package. sp‐rich‐core  will produce a core dump file and also additional information about process, most of /proc data, last lines from syslog, df, ifconfig output and much more.  All of such information is added to a
rich core dump package (.rcore) and then, it is compressed in .lzo file.

The core dumps by default are saved on directory /media/mmc1/core‐dumps on device.

To uncompressed core dump you need to use rich-core-extract tool. The package sp‐rich‐core‐postproc provides the rich‐core‐extract utility, which extracts the information from a rich core dump file that GDB can read.

To install this tool type following

apt-get install sp-rich-core sp-rich-core-postproc

Now to uncompress lzo file and to get core dump file use following command.

rich-core-extract core_file.lzo

For more information using gdb in maemo environment visit this post.

Also visit this link for more information on debugging on maemo platform.

Thursday, February 25, 2010

Debugging Qt application on maemo

When i started development on qt Maemo platform, it was quite difficult to debug Qt application because Qt creator is not supporting debugging inside scratch box and at that time i was unaware of using gdb and my only hope was to use qDebug() to print function name at start of each function.

But now I know how to use gdb to debug qt application inside scratchbox environment. To be able to debug application on scratchbox you need to install maemo debug script.

run "fakeroot apt-get install maemo-debug-scripts" inside scratchbox. This will install necessary tool required to debug maemo application.

Now on command prompt type "native-gdb", normal gdb command will not work, it will crash immediately. you need to use native-gdb command.

native-gdb command will bring gdb prompt. If gdb prompt comes then setup is ready to debug application.

Now you can use native-gdb to debug application. To start debugging run "native-gbd applicationName" command. applicaitonName is name of binary file that you want to debug.

To put break point you can use "break" gdb commnad.

"break filename:line number" will put break point in mentioned file at mentioned line number.

"break className::functionName()" will put break point at mentioned function.

To run application, type "run" command, now when instruction at breakpoint will execute gdb will stop at that break point and will ask you for command.

to run next line number in code type "next" command.

to run next instruction in code type "step" commnad.

to go to end of current function type "finish" command.

to continue execution until next breakpoint type "continue" command.

to know call stack type "where" command.

to list current function type "list" or "list numberOfLine" commanad.

to run previous command you can just press enter key and it will run previous command.

If you want to exit gdb type quit or q, to bring gdb prompt you can press ctrl + c.

Hope this will help you to start debugging with gdb on maemo platform.