Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-30 Thread Brian Dessent
Mike Marchywka wrote:
 
  .rdata relocs it is then.
 
 This is why I lurk as I now remember something about this and, sure, I can 
 find it on google.
 Of course, it would still be nice to have a fully instrumented load ( so 
 where do I find the
 unreolcatable data?) .
 I relinked with -strip and used dumpbin to find all the symbols in rdata but 
 there are several hundred.
 I thought I could grep the code for suspicious consts but no luck so far.

The simplest method is just to tweak the linker script to make .rdata
writable (or rather, to map both .data and .rdata input segments into
the same .data output section.)

There is no method that I'm aware of to find the name of the offending
symbol.  Actually, that's not quite true, see
http://cygwin.com/ml/cygwin-patches/2008-q1/msg00067.html.  As I said
in that message though, those might just be coindicental and certainly
not guaranteed across OS versions or whatever.

 Isn't there some way to find the offending relocation attempt? What does 
 strace know
 about the stituation or does it just echo stuff from Windoze?

strace under Cygwin is not like strace on other operating systems, it is
really just a glorified viewer for a bunch of debug_printf statements
that exist in the Cygwin code.  The error occurs before the process even
begins execution, during the period where NTLDR loads libraries into its
address space.  So, strace will be of no use.

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/



RE: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-29 Thread Mike Marchywka

 .rdata relocs it is then.

This is why I lurk as I now remember something about this and, sure, I can find 
it on google.
Of course, it would still be nice to have a fully instrumented load ( so where 
do I find the 
unreolcatable data?) .
I relinked with -strip and used dumpbin to find all the symbols in rdata but 
there are several hundred.
I thought I could grep the code for suspicious consts but no luck so far.
Isn't there some way to find the offending relocation attempt? What does strace 
know
about the stituation or does it just echo stuff from Windoze? 


Thanks.




Mike Marchywka
586 Saint James Walk
Marietta GA 30067-7165
404-788-1216 (C)- leave message
989-348-4796 (P)- emergency only
[EMAIL PROTECTED]
Note: If I am asking for free stuff, I normally use for hobby/non-profit
information but may use in investment forums, public and private.
Please indicate any concerns if applicable.
Note: Hotmail is possibly blocking my mom's entire
ISP - try  me on [EMAIL PROTECTED] if no reply
here. Thanks.


 Date: Wed, 28 May 2008 14:08:31 -0700
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 CC: cygwin@cygwin.com
 Subject: Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

 Mike Marchywka wrote:

 I think I mentioned the windoze invokation before and got the definitive  
 The app failed to initialize ...
 meesage. I didn't know about strace, let me see if I can expand on this,

 .rdata relocs it is then.

 Brian

_
E-mail for the greater good. Join the i’m Initiative from Microsoft.
http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ GreaterGood

--
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/



MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Mike Marchywka

Regarding recent comments on dll problems and understanding cygwin1.dll versus 
msvcrt,
I was curious to know if anyone has used these ( free? ) MS tools or has 
comments on competing
products?

http://msdn.microsoft.com/en-us/library/cc267862.aspx
http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx

I thought I may be able to download a few pieces like some of the sysinternals 
products
but AFAIK you now need to download 17MB and hope the msi doesn't do anything 
funny. It may be worth it but if there is a better alternative I'd like to try 
that first.
Apparently gdb didn't let you do anything until getting to main() which is 
after the initial
process loads but some of the pages for the above tools suggest you can examine 
loading.

Also, fwiw, that glut program I cited earlier as an example of something that 
seems
to work but that invokes msvcrt and cygwin1, is available here,

http://www.spottext.com/marchywka/distroform.cfm?src=cygwindll

but I will warn you that there is nothing ready for distribution and the pages 
are a bit confusing. 
I collected a bunch of works-in-progress and started to make them available as 
part of
other work I was doing. I finally did determine that the streaming data viewer 
and
molecule viewer uses for the glut program were in fact useful to me and tried to
document some of the features but I'm not sure I will ever document or clean 
anything
up to the point of being coherent. The glut program does not always seem to 
start up reliably
on first invokation after a reboot and does have odd response to ctrl-C but 
otherwise seems
fine ( I assumed this was an issue with opengl,  not cygwin). 


Thanks.




 From: [EMAIL PROTECTED]
 To: cygwin@cygwin.com
 Subject: RE: fate/resolution/location of things like sys/sockio.h
 Date: Tue, 27 May 2008 07:03:55 -0400


 Date: Tue, 27 May 2008 00:54:37 -0700
 From: [EMAIL PROTECTED]
 Mike Marchywka wrote:

 $ g++ nmapjunk.a libdnet-stripped/src/junkbin.a liblua/junkbin.a -Lnbase 
 -lnbase -Lnsock/src -lnsock -Llibpcap -lpcap -liphlpapi -lws2_32 -lpcre -L. 
 -lPacket

 I would not expect this to work in any case. Cygwin has no libpcap, so
 you must be using the native windows winpcap, which is not a Cygwin
 library (it's linked with MSVCRT.)


 I have winpcap for an earlier install of ShowTraffic which runs fine. The 
 nmap download
 comes with its own and getting everything consistent may be a problem but I 
 can't
 come up with a diagnostic that confirms death during packet.dll load. I guess 
 that is
 why I am more interested in diagnostic tools rather than expecting to find 
 someone who
 knows offhand how to link my c++ version of nmap :)

 Is there some simple way to get gdb to tell you what it was trying to do if 
 it dies before getting
 to main()? From what I could tell, you couldn't set a break point etc to 
 diagnose the
 CRT initialization stuff. As far as that goes, what tools are there for 
 dumping object or a files?


 Thanks.




 Mike Marchywka
 586 Saint James Walk
 Marietta GA 30067-7165
 404-788-1216 (C)- leave message
 989-348-4796 (P)- emergency only
 [EMAIL PROTECTED]
 Note: If I am asking for free stuff, I normally use for hobby/non-profit
 information but may use in investment forums, public and private.
 Please indicate any concerns if applicable.
 Note: Hotmail is possibly blocking my mom's entire
 ISP - try me on [EMAIL PROTECTED] if no reply
 here. Thanks.


 Date: Tue, 27 May 2008 00:54:37 -0700
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 CC: cygwin@cygwin.com
 Subject: Re: fate/resolution/location of things like sys/sockio.h

 Mike Marchywka wrote:

 $ g++ nmapjunk.a libdnet-stripped/src/junkbin.a liblua/junkbin.a -Lnbase 
 -lnbase -Lnsock/src -lnsock -Llibpcap -lpcap -liphlpapi -lws2_32 -lpcre -L. 
 -lPacket

 I would not expect this to work in any case. Cygwin has no libpcap, so
 you must be using the native windows winpcap, which is not a Cygwin
 library (it's linked with MSVCRT.)

 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/


 _
 Make every e-mail and IM count. Join the i’m Initiative from Microsoft.
 http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ MakeCount

 --
 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/


_
Make every e-mail and IM count. Join the i’m Initiative from Microsoft.
http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ MakeCount

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

Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Greg Chicares
On 2008-05-28 14:15Z, Mike Marchywka wrote:

 I was curious to know if anyone has used these ( free? ) MS tools

Probably not free as in freedom; I haven't used them.

 Apparently gdb didn't let you do anything until getting to main() which is 
 after the initial
 process loads but some of the pages for the above tools suggest you can 
 examine loading.

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?

--
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/



Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Brian Dessent
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/



Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Spiro Trikaliotis
Hello,

* On Wed, May 28, 2008 at 10:15:05AM -0400 Mike Marchywka wrote:
 
 Regarding recent comments on dll problems and understanding cygwin1.dll 
 versus msvcrt,
 I was curious to know if anyone has used these ( free? ) MS tools or has 
 comments on competing
 products?
 
 http://msdn.microsoft.com/en-us/library/cc267862.aspx
 http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx

These a free in the sense that you do not have to pay to use them.
Additionally, you can get in contact with users and even some of the
developers on the Usenet (news:microsoft.public.windbg).

I use WinDBG rather frequently, and I like it very much. However, I must
tell you that I mainly use it for kernel-mode debugging. The Symbol
Server allows you to put the debugging symbols on a server. You can even
have a history of them; that is, for ever version of the executables you
give to customers (or to others), you put the symbols on the server.

If you get a crash dump afterwards from someone, WinDBG automatically
determines the right symbols. If you have also set up the source server,
it even gets the right sources out of your source control system. This
is very handy.

Note, however, that this mechanism relies on .PDB files for the
debugging information (I think the old-style .SYM work, also, but I have
not tested it). I never tried to use this with Cygwin or Mingw, however.

Regards,
Spiro.

-- 
Spiro R. Trikaliotis  http://opencbm.sf.net/
http://www.trikaliotis.net/ http://www.viceteam.org/

--
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/



RE: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Mike Marchywka

 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: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 CC: cygwin@cygwin.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/



Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Brian Dessent
Mike Marchywka wrote:

 (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)

The fact that it never actually begins execution therefore implies that
it encounters a fault by the OS loader during process initialization,
such as the const data in .rdata needing relocation due to
auto-imports situation.  I bet that if you invoke it via strace or from
a native command prompt (not bash) you will see a dialog box explaining
the fault since the SetErrorMode (SEM_FAILCRITICALERRORS) stuff won't
be active.

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/



Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Christopher Faylor
On Wed, May 28, 2008 at 12:47:44PM -0700, Brian Dessent wrote:
Mike Marchywka wrote:

 (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)

The fact that it never actually begins execution therefore implies that
it encounters a fault by the OS loader during process initialization,
such as the const data in .rdata needing relocation due to
auto-imports situation.  I bet that if you invoke it via strace or
from a native command prompt (not bash) you will see a dialog box
explaining the fault since the SetErrorMode (SEM_FAILCRITICALERRORS)
stuff won't be active.

Aren't we still talking about using msvcrt and cygwin1 in the same
application where something like a SIGSEGV prior to initialization would
be the expected consequences of mixing the two dlls?

I'd think it likely that either msvcrt or cygwin1.dll to become confused
during dll initialization if one or the other was present.

cgf

--
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/



Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Brian Dessent
Christopher Faylor wrote:

 Aren't we still talking about using msvcrt and cygwin1 in the same
 application where something like a SIGSEGV prior to initialization would
 be the expected consequences of mixing the two dlls?

Right, that too I suppose.  You'd have to set breakpoints at the DllMain
of each of those.  Or use a startup-profiler like dependency walker.

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/



RE: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Mike Marchywka

 a native command prompt (not bash) you will see a dialog box explaining
 the fault since the SetErrorMode (SEM_FAILCRITICALERRORS) stuff won't
 be active.


I think I mentioned the windoze invokation before and got the definitive  The 
app failed to initialize ...
meesage. I didn't know about strace, let me see if I can expand on this,

$ strace a.exe
--- Process 1380, exception C005 at 77F84E71
--- Process 1380, exception C005 at 77FAC57C




Mike Marchywka
586 Saint James Walk
Marietta GA 30067-7165
404-788-1216 (C)- leave message
989-348-4796 (P)- emergency only
[EMAIL PROTECTED]
Note: If I am asking for free stuff, I normally use for hobby/non-profit
information but may use in investment forums, public and private.
Please indicate any concerns if applicable.
Note: Hotmail is possibly blocking my mom's entire
ISP - try  me on [EMAIL PROTECTED] if no reply
here. Thanks.


 Date: Wed, 28 May 2008 12:47:44 -0700
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 CC: cygwin@cygwin.com
 Subject: Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

 Mike Marchywka wrote:

 (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)

 The fact that it never actually begins execution therefore implies that
 it encounters a fault by the OS loader during process initialization,
 such as the const data in .rdata needing relocation due to
 auto-imports situation. I bet that if you invoke it via strace or from
 a native command prompt (not bash) you will see a dialog box explaining
 the fault since the SetErrorMode (SEM_FAILCRITICALERRORS) stuff won't
 be active.

 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/


_
Keep your kids safer online with Windows Live Family Safety.
http://www.windowslive.com/family_safety/overview.html?ocid=TXT_TAGLM_WL_Refresh_family_safety_052008

--
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/



Re: MS or cygwin dll debug tools/ was sys/sockio.h etc.

2008-05-28 Thread Brian Dessent
Mike Marchywka wrote:

 I think I mentioned the windoze invokation before and got the definitive  
 The app failed to initialize ...
 meesage. I didn't know about strace, let me see if I can expand on this,

.rdata relocs it is then.

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/