Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Odd behavior with souce files
@ 2001-12-10 10:47 Kevin R.J. Ellwood
  2001-12-10 11:21 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin R.J. Ellwood @ 2001-12-10 10:47 UTC (permalink / raw)
  To: gdb

Hello All,

I sure hope this is not an FAQ -- I tried to check the manual and could
not find anything.

I am using gdb to debug a project and, as expected, gdb found the source
files.  Unfortunately, when I step through the code, gdb complains that it
can't find souce code for libraries used by the project (including system
libraries).  Below is a snippet from a gdb session.

233       else if (n == 0)
(gdb)
236         pntr = (double *) malloc((unsigned) n);
(gdb)
__libc_malloc (bytes=192) at malloc.c:2791
2791    malloc.c: No such file or directory.
        in malloc.c
(gdb) s
2794    in malloc.c
(gdb)
2785    in malloc.c
(gdb)
2794    in malloc.c
(gdb)
2806    in malloc.c

Needless to say, I don't want to debug malloc.  Is there an option for gdb
such that, if a source file is not found, it won't try to step into that
particular routine.  I have similar problem when gdb encouters, printf,
fprintf, etc.

Thanks,
Kevin

-------------------------------
 Kevin R.J. Ellwood
 Materials Science Dept.
 Scientific Research Lab
 Dearborn, MI 48121-2153 MD3182

 Phone: (313) 322-5535
 Fax:   (313) 323-1129



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Odd behavior with souce files
  2001-12-10 10:47 Odd behavior with souce files Kevin R.J. Ellwood
@ 2001-12-10 11:21 ` Eli Zaretskii
  2001-12-10 13:20   ` David Relson
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2001-12-10 11:21 UTC (permalink / raw)
  To: kellwood; +Cc: gdb

> Date: Mon, 10 Dec 2001 13:46:30 -0500 (EST)
> From: "Kevin R.J. Ellwood" <kellwood@ford.com>
> 
> (gdb)
> 2806    in malloc.c
> 
> Needless to say, I don't want to debug malloc.

Does it help to say "finish" whenever you wind up inside a library
function?

> Is there an option for gdb such that, if a source file is not found,
> it won't try to step into that particular routine.

GDB does that for me if the library functions have no debug info.  You
could say "strip --strip-debug libc.a", for example.  But given the
"finish" trick, I'd not bother (you could need the library debug info
some day).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Odd behavior with souce files
  2001-12-10 11:21 ` Eli Zaretskii
@ 2001-12-10 13:20   ` David Relson
  2001-12-11  0:13     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: David Relson @ 2001-12-10 13:20 UTC (permalink / raw)
  To: gdb

At 02:19 PM 12/10/01, you wrote:
> > Date: Mon, 10 Dec 2001 13:46:30 -0500 (EST)
> > From: "Kevin R.J. Ellwood" <kellwood@ford.com>
> >
> > (gdb)
> > 2806    in malloc.c
> >
> > Needless to say, I don't want to debug malloc.

Sounds like you're using "step" when you should be using "next" ...

>Does it help to say "finish" whenever you wind up inside a library
>function?
>
> > Is there an option for gdb such that, if a source file is not found,
> > it won't try to step into that particular routine.
>
>GDB does that for me if the library functions have no debug info.  You
>could say "strip --strip-debug libc.a", for example.  But given the
>"finish" trick, I'd not bother (you could need the library debug info
>some day).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Odd behavior with souce files
  2001-12-10 13:20   ` David Relson
@ 2001-12-11  0:13     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2001-12-11  0:13 UTC (permalink / raw)
  To: David Relson; +Cc: gdb


On Mon, 10 Dec 2001, David Relson wrote:

> Sounds like you're using "step" when you should be using "next" ...

Using `next' is not always convenient, especially if you don't know
where the program goes awry.  To use `next', you need to mentally
parse every line, find out whether it involves a function call (might
not be easy, what with all the macros lying around), and decide
whether this is a library function or your own function.  That's a lot
of thinking about secondary problems when your mind should concentrate
on finding bugs.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-11  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-10 10:47 Odd behavior with souce files Kevin R.J. Ellwood
2001-12-10 11:21 ` Eli Zaretskii
2001-12-10 13:20   ` David Relson
2001-12-11  0:13     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox