[vox-tech] gdb question: rbreak

Peter Jay Salzman vox-tech@lists.lugod.org
Tue, 10 Sep 2002 20:00:39 -0700


hi mike,

for the test program:

   #include <stdio.h>
   
   int main(void)
   {
      printf("hello world\n");
      return 0;
   }

the list of local functions is:

   (gdb) i func
   All defined functions:
   
   File 1.c:
   int main();
   
   Non-debugging symbols:
   0x08048298  _init
   0x080482d0  __register_frame_info
   0x080482e0  __deregister_frame_info
   0x080482f0  __libc_start_main
   0x08048300  printf
   0x08048310  _start
   0x08048334  Letext
   0x08048334  call_gmon_start
   0x08048360  __do_global_dtors_aux
   0x080483b0  fini_dummy
   0x080483b8  frame_dummy
   0x080483dc  init_dummy
   0x08048412  Letext
   0x08048420  __do_global_ctors_aux
   0x08048444  init_dummy
   0x0804844c  _fini

and rbreaking on "m.*":

   (gdb) rbreak m.*
   Breakpoint 1 at 0x80483f6: file 1.c, line 5.
   int main();
   Breakpoint 2 at 0x80482d0
   <function, no debug info> __register_frame_info;
   Breakpoint 3 at 0x80482e0
   <function, no debug info> __deregister_frame_info;
   Breakpoint 4 at 0x80482f0
   <function, no debug info> __libc_start_main;
   Breakpoint 5 at 0x8048347
   <function, no debug info> call_gmon_start;
   Breakpoint 6 at 0x80483b6
   <function, no debug info> fini_dummy;
   Breakpoint 7 at 0x80483be
   <function, no debug info> frame_dummy;
   Breakpoint 8 at 0x80483e2
   <function, no debug info> init_dummy;
   Note: breakpoint 8 also set at pc 0x80483e2.
   Breakpoint 9 at 0x80483e2
   <function, no debug info> init_dummy;

sets the following breakpoints:

   (gdb) i b
   Num Type           Disp Enb Address    What
   1   breakpoint     keep y   0x080483f6 in main at 1.c:5
   2   breakpoint     keep y   0x080482d0 <__register_frame_info>
   3   breakpoint     keep y   0x080482e0 <__deregister_frame_info>
   4   breakpoint     keep y   0x080482f0 <__libc_start_main>
   5   breakpoint     keep y   0x08048347 <call_gmon_start+19>
   6   breakpoint     keep y   0x080483b6 <fini_dummy+6>
   7   breakpoint     keep y   0x080483be <frame_dummy+6>
   8   breakpoint     keep y   0x080483e2 <init_dummy+6>
   9   breakpoint     keep y   0x080483e2 <init_dummy+6>

now if i look at crtbegin.o:

   p@satan% gdb -quiet /usr/lib/gcc-lib/i386-linux/2.95.4/crtbegin.o 
   gdb: Symbol `emacs_ctlx_keymap' has different size in shared object,
   consider re-linking
   (no debugging symbols found)...(gdb) 
   (gdb) info functions
   All defined functions:

   Non-debugging symbols:
   0x00000000  __do_global_dtors_aux
   0x00000050  fini_dummy
   0x00000058  frame_dummy
   0x0000007c  init_dummy

even here, with no debugging symbols, rbreak catches glibc stuff:

   (gdb) rbreak f.*
   Breakpoint 1 at 0x6
   <function, no debug info> __do_global_dtors_aux;
   Breakpoint 2 at 0x56
   <function, no debug info> fini_dummy;
   Breakpoint 3 at 0x5e
   <function, no debug info> frame_dummy;
   Breakpoint 4 at 0x82
   <function, no debug info> init_dummy;

   (gdb) i b
   Num Type           Disp Enb Address    What
   1   breakpoint     keep y   0x00000006 <p.3+2>
   2   breakpoint     keep y   0x00000056 <fini_dummy+6>
   3   breakpoint     keep y   0x0000005e <frame_dummy+6>
   4   breakpoint     keep y   0x00000082 <init_dummy+6>

hrm, i'm not sure how init_dummy+6 matches f.*.

as far as libc goes:

   p@satan% dpkg -l "libc6*" | grep -v 'no description'
   ii  libc6          2.2.5-10       GNU C Library: Shared libraries and Timezone
   ii  libc6-dev      2.2.5-10       GNU C Library: Development Libraries and Hea

   p@satan% dpkg -l "libc6*" | grep 'no description'
   un  libc6-bin      <none>         (no description available)
   pn  libc6-dbg      <none>         (no description available)
   un  libc6-doc      <none>         (no description available)
   pn  libc6-i586     <none>         (no description available)
   pn  libc6-i686     <none>         (no description available)
   pn  libc6-pic      <none>         (no description available)
   pn  libc6-prof     <none>         (no description available)
   un  libc6-v9       <none>         (no description available)
   un  libc6.1        <none>         (no description available)

i'm at a loss here.  any advice?  :(

pete



begin msimons@moria.simons-clan.com <msimons@moria.simons-clan.com> 
> On Tue, Sep 10, 2002 at 04:19:18PM -0700, Peter Jay Salzman wrote:
> > i don't currently have libc-dbg (and in fact, never had it installed).
> > 
> > having gdb mention anything about libc functions is a big nuissance.
> > what do you suggest i do to make rbreak ignore libc function?
> 
>   I've done a quick test here, and with a simple program the only 
> functions I see gdb making breakpoints on that aren't in the source
> I gave belong to the crtbegin.o and crtend.o which are part of the
> c compiler interface to the operating system 
> (/usr/lib/gcc-lib/i386-linux/2.95.4/*.o). 
> 
>   So just so we are on the same page, can you paste a small list of 
> which functions you were having problems with?
> 
>   If you could startup the debugger on something and run "info functions"
> if you see more than about 20 functions in the 'Non-debugging symbols'
> section which you didn't define could you paste them here.

-- 
Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D