This is the mail archive of the cygwin mailing list for the Cygwin 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: gdb hangs


On 2/6/06, Brian Dessent <brian@dessent.net> wrote:
> The actual source of the problem is the SECT_OFF_DATA macro around line
> 910 in coffread.c.  I'm not sure exactly what's broken here, but it
> seems like it might be related to the fact that (at least on my system)
> the DLL gets assigned the default image base and has to be relocated and
> ends up loading very low in memory at 0x003f0000.  If you enable auto
> image basing (add -Wl,--enable-auto-image-base to the link line) you get
> a DLL that loads much higher and doesn't require relocation, and
> everything works fine.

Thanks for the tip. I've got working library. But I still have
problems with settings
breakpoints in shared libraries before the executable is run.
Is gdb able to stop programs on "pending breakpoints" under Windows?
Here is the log of gdb session that I've got

-----------------------------8<-----------------------------
$ gdb dlcheck.exe
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) dll-symbols helloworld.dll
(gdb) b helloworld.c:4
Breakpoint 1 at 0x63e01006: file helloworld.c, line 4.
(gdb) r
Starting program: /cygdrive/c/dllcheck/dlcheck.exe
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x63e01006: Input/Output error.
-----------------------------8<-----------------------------

In gdb's docs there is a section describing support for DLLs without debugging
symbols. According this I forced gdb to load  the library symbols. If the
invocation of dll-symbols is ommited, the program is not stopped at breakpoints
at all.

BTW, I exercised the '-g' option of gcc i.e. to compile the library with this
option and without one. Every time I got identical binaries. What can be wrong?

Probably, the cause of the problem with "pending breakpoints" may be not in gdb.
Perhaps, I incorrectly specified compiler options to get library with
debug info...

> By the way, this is pretty bad C:
>
> >     *(void**)(&helloworld_func) = dlsym(handle, "helloworld");
>

Thanks for your comments. Now I see the problem with such construction.

Thank you,
Vitaly

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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