Debugging a Vlc dll with GDB.

Pedro Alves pedro_alves@portugalmail.pt
Fri Dec 7 00:42:00 GMT 2007


[RFC patch attached -- cc'ed to gdb-patches@]

Brian Dessent wrote:
> Daniel Jacobowitz wrote:
> 
>>>    (gdb) break libvlc_new
>>>     No symbol table is loaded. use the file command
>> Try "set pending on"?  Or you may need a newer version of GDB.
> 
> I don't think pending being off is the problem, but you do need a more
> recent gdb than what ships with Cygwin.  With recent CVS gdb I have had
> success with something like:
> 
> gdb VLCTest.exe
> add-shared-symbol-files libvlc.dll
> b libvlc_new
> run
> 
> I have always found debugging stripped binaries on Win32 with gdb to be
> somewhat unpleasant.  After the first time that the program has run and
> terminates, all the pending breakpoint stuff usually seems to work fine,
> it's just that initially when nothing has loaded yet it does not.  So
> that's another workaround, just run the inferior to completion without
> any breakpoints and then start debugging the second run.
> 

My opinion is that the pending support should kick in on this case, like
in the attached patch, like so:

  > gdb/gdb.exe gdb-stripped.exe
GNU gdb 6.7.50.20071206-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(no debugging symbols found)
(gdb) b LoadLibraryW
Function not found in loaded symbols: LoadLibraryW
Make breakpoint pending on future symbol file addition? (y or [n]) y
Breakpoint 1 (LoadLibraryW) pending.
(gdb) r
Starting program: /home/pedro/gdb/build/gdb-stripped.exe
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)

Breakpoint 1, 0x7c80ae4b in LoadLibraryW () from
/cygdrive/c/WINDOWS/system32/kernel32.dll
(gdb)

   (Those unconditional "(no debugging symbols found)" in
    symbol_file_add_with_addrs_or_offsets seem silly to me.
    An idea would be:
         if (mainline || from_tty || info_verbose)
           printf_filtered (_("(no debugging symbols found)"));
    ?
   )

And also:

  >gdb/gdb gdb-stripped.exe
GNU gdb 6.7.50.20071206-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(no debugging symbols found)
(gdb) b main
Function not found in loaded symbols: main
Make breakpoint pending on future symbol file addition? (y or [n]) y
Breakpoint 1 (main) pending.
(gdb) info b
Num     Type           Disp Enb  Address    What
1       breakpoint     keep y(p) <PENDING>  main
(gdb) file gdb/gdb.exe
Reading symbols from /home/pedro/gdb/build/gdb/gdb.exe...done.
(gdb) r
Starting program: /home/pedro/gdb/build/gdb/gdb.exe

Breakpoint 1, main (argc=1, argv=0xe336e0) at
../../gdb-server_submit/src/gdb/gdb.c:28
28        memset (&args, 0, sizeof args);
(gdb) info b
Num     Type           Disp Enb  Address    What
1       breakpoint     keep y    0x0040107a in main at
../../gdb-server_submit/src/gdb/gdb.c:28
          breakpoint already hit 1 time
(gdb)


I could swear there use to be a "pending resolved"
notice.  Did it go away with the multiple breakpoint
location support?

-- 
Pedro Alves

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pending.diff
Type: text/x-diff
Size: 2424 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20071207/33fac5be/attachment.bin>


More information about the Gdb-patches mailing list