This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: guessing where address belongs to


On Thu, 2008-03-06 at 12:45 +0200, Yakov Lerner wrote:
> On Thu, Mar 6, 2008 at 12:05 PM, Andreas Schwab <schwab@suse.de> wrote:
> > "Yakov Lerner" <iler.ml@gmail.com> writes:
> >
> >  > Gdb has no integration with malloc, correct ?
> >  > Gdb has no  way of enumerating all malloced
> >  >  pieces ("heap objects"), correct ?
> >  >
> >  > Or gdb does have a way of guessing which "heap
> >  > object" some address X (that points inside the heap) belongs to ?
> >
> >  The details are highly dependent on the malloc implementation.  There is
> >  no way to find that out without intimate knowledge of the
> >  implementation.
> 
> You don't need details of malloc guts for that.
> 
> It's enough to hook to the entry and return  from malloc,free,realloc.

Yep, and there are tools that do that -- but gdb isn't one of them.

OTOH, it would be possible to set user breakpoints at malloc and 
free, and then write user gdb commands to collect whatever 
information you want...




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]