[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Debugging with less memory?
From:       "Robert Knight" <robertknight () gmail ! com>
Date:       2007-06-10 23:08:14
Message-ID: 13ed09c00706101608l60cb66ffg732f03a0e7d389fa () mail ! gmail ! com
[Download RAW message or body]

Hi,

Before you start running the program, tell GDB not to automatically
load symbols for shared libraries:

set auto-solib-add off

Then when you need to debug a particular part of an application, use
"shar" to load symbols for the libraries you are interested in.   For
example,

shar Qt

Would load all libraries containing "Qt" somewhere in their path.

When you type "bt" to get a backtrace, GDB will only list function
names for libraries which it has loaded symbols for.  If say an
application crashes, GDB catches the signal and gives you a prompt,
running "bt" will initially give you a very short backtrace.  Type
"shar <part of name of library at the top of backtrace>" and run bt
again, and the list will be longer with more details.  You can repeat
this process until the backtrace has enough information.  For example:

gdb kate
> set auto-solib-add off
> run

... < crash happens >

> bt

... < gives a short list with just some "???"s in the libc library >

> shar libc
> bt

... < gives a longer list now showing ???s in QtCore >

> shar QtCore
> bt

... < gives a longer list now showing ???s in some kate code >

> shar kate
> bt

... < now gives a useful backtrace >


If you want to put a breakpoint on a specific place before running the
application ( eg. if you are doing something other than intercepting a
crash ), you need to first put a breakpoint right at the start of the
application using

br main

And then when it stops there, use "shar" to load the library
containing the function of interest, "br" to set a breakpoint on the
relevant function and "c" to continue.

Regards,
Robert.

On 10/06/07, Thiago Macieira <thiago@kde.org> wrote:
> Thomas McGuire wrote:
> >> I was wondering whether you know some way to avoid this high memory
> >> usage. Is it possible to get a backtrace without all those symbols
> >> loaded? Or how do I skip loading some symbols, libQt3support for
> >> example, which I'm sure I'm not using?
> >
> >I unfortunately don't know how to load less symbols, I would use that
> > myself I guess.
>
> Remove the .debug files for the libraries you don't want to have symbols
> or debugging information for. If there is no .debug file, strip the
> library.
>
> --
>   Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
>     PGP/GPG: 0x6EF45358; fingerprint:
>     E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic