X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: From: Mike Marchywka To: Subject: RE: MS or cygwin dll debug tools/ was "sys/sockio.h" etc. Date: Wed, 28 May 2008 15:38:27 -0400 In-Reply-To: <483D7C01.EAE5ADA1@dessent.net> References: <17275355 DOT post AT talk DOT nabble DOT com> <17290164 DOT post AT talk DOT nabble DOT com> <4830F08D DOT 6040505 AT cygwin DOT com> <17345729 DOT post AT talk DOT nabble DOT com> <4833813A DOT 7B6F7FAF AT dessent DOT net> <17405074 DOT post AT talk DOT nabble DOT com> <483583EE DOT 8030605 AT cygwin DOT com> <00e501c8bc1e$a44d0190$2708a8c0 AT CAM DOT ARTIMI DOT COM> <20080523000735 DOT GA23793 AT ednor DOT casa DOT cgf DOT cx> <483BBE3D DOT EDF663D3 AT dessent DOT net> <483D7849 DOT 5010505 AT sbcglobal DOT net> <483D7C01 DOT EAE5ADA1 AT dessent DOT net> Content-Type: text/plain; charset="Windows-1252" MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: 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 m4SJd9jc028650 > first instruction of the binary. There is no such "can't debug before > main" restriction. > I think what bothered me is I just tried to step it to get minimum initial increment and that bombed- so I just assumed it wouldn't be early enough. In any case, it looked like I needed to instrument the loading process, (gdb) info functions CRT All functions matching regular expression "CRT": Non-debugging symbols: 0x00401000 WinMainCRTStartup 0x00401000 mainCRTStartup (gdb) info target Symbols from "/cygdrive/e/new/temp/nmap/src3/nmap-4.62/a.exe". Local exec file: `/cygdrive/e/new/temp/nmap/src3/nmap-4.62/a.exe', file type pei-i386. Entry point: 0x401000 0x00401000 - 0x004e9608 is .text 0x004ea000 - 0x004ebaa0 is .data 0x004ec000 - 0x00509c24 is .rdata 0x0050a000 - 0x00519b50 is .bss 0x0051a000 - 0x0051bfa8 is .idata (gdb) b *0x0401000 Breakpoint 1 at 0x401000 (gdb) run Starting program: /cygdrive/e/new/temp/nmap/src3/nmap-4.62/a.exe Program received signal SIGSEGV, Segmentation fault. Program received signal SIGSEGV, Segmentation fault. Program received signal SIGSEGV, Segmentation fault. Program exited with code 0200. You can't do that without a process to debug. (gdb) > Date: Wed, 28 May 2008 08:36:33 -0700 > From: brian AT dessent DOT net > To: gchicares AT sbcglobal DOT net > CC: cygwin AT cygwin DOT com > Subject: Re: MS or cygwin dll debug tools/ was "sys/sockio.h" etc. > > Greg Chicares wrote: > >> Using cygwin's gdb on a MinGW app, I can set this breakpoint >> b '__mingw_CRTStartup' >> on the function that invokes main(), and then examine variables >> before main() is invoked. For a Cygwin app, I guess you'd break >> on 'mainCRTStartup'. Does that breakpoint happen early enough to >> meet your needs? > > You can also do "info target" to display the entry point and then set a > breakpoint on it as e.g. "b *0x401000" if you want to start at the very > first instruction of the binary. There is no such "can't debug before > main" restriction. > > Brian > > -- > 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/ > _________________________________________________________________ Give to a good cause with every e-mail. Join the i’m Initiative from Microsoft. http://im.live.com/Messenger/IM/Join/Default.aspx?souce=EML_WL_ GoodCause -- 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/