X-Spam-Check-By: sourceware.org Message-ID: Date: Wed, 8 Feb 2006 11:17:30 +0600 From: Vitaly Provodin To: cygwin AT cygwin DOT com Subject: Re: gdb hangs In-Reply-To: <43E7546E.9C1AF962@dessent.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline References: <43E7546E DOT 9C1AF962 AT dessent DOT net> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k19HHbgT025881 On 2/6/06, Brian Dessent 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/