nm for .exe extensions?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

nm for .exe extensions?

Benjamin Cao
Hi,

I am working with a customer on using the nm command in Cygwin for Windows. The customer wants to be able to generate a symbol table on *.exe files similar to what nm does on unix platforms. The executable, when run with nm in Cygwin, results in a "no symbols" result, whereas it generates a symbol table in unix.

I understand that these commands will certainly be different in both Cygwin for Windows and the unix platforms, but is there any way that *.exe will generate a symtab with nm?

Note: The customer said the Windows "dumpbin" does not satisfy his needs either... what fun.

Thanks,
Ben Cao

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

Reply | Threaded
Open this post in threaded view
|

Re: nm for .exe extensions?

marco atzeri-4
On 24/05/2016 14:43, Benjamin Cao wrote:

> Hi,
>
> I am working with a customer on using the nm command in Cygwin for Windows. The customer wants to be able to generate a symbol table on *.exe files similar to what nm does on unix platforms. The executable, when run with nm in Cygwin, results in a "no symbols" result, whereas it generates a symbol table in unix.
>
> I understand that these commands will certainly be different in both Cygwin for Windows and the unix platforms, but is there any way that *.exe will generate a symtab with nm?
>
> Note: The customer said the Windows "dumpbin" does not satisfy his needs either... what fun.
>
> Thanks,
> Ben Cao
>

How was compiled the *.exe file ?

For both Unix and Windows stripped programs do not contain any more any
symbol. Example from one of my package:

$ nm ncview.exe |wc -l
5540

$ nm ncview.exe |tail
00440824 T _XUndefineCursor
00424b8b t _xy_track_pointer
0062a230 b _y0.4078
0062a270 b _y0.4110
00424864 t _yaxis_range_callback
00626a68 b _ydim_selection_widget
00626a6c b _ydimlist_label_widget
00626a70 b _ydimlist_widget
00632890 i fthunk
00632498 i hname

but
$ nm /usr/bin/ncview.exe
nm: /usr/bin/ncview.exe: no symbols

As the installed version was stripped.




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

Reply | Threaded
Open this post in threaded view
|

Re: nm for .exe extensions?

Ken Brown-6
In reply to this post by Benjamin Cao
On 5/24/2016 8:43 AM, Benjamin Cao wrote:
> I am working with a customer on using the nm command in Cygwin for Windows. The customer wants to be able to generate a symbol table on *.exe files similar to what nm does on unix platforms. The executable, when run with nm in Cygwin, results in a "no symbols" result, whereas it generates a symbol table in unix.

Is he running nm on stripped executables?

Ken

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

Reply | Threaded
Open this post in threaded view
|

Re: nm for .exe extensions?

Warren Young-2
In reply to this post by Benjamin Cao
On May 24, 2016, at 6:43 AM, Benjamin Cao <[hidden email]> wrote:
>
> The executable, when run with nm in Cygwin, results in a "no symbols" result, whereas it generates a symbol table in unix.

That’s not what I see here.  Given hello.c containing a “Hello, world!” program:

  $ make hello
  cc     hello.c   -o hello
  $ nm hello.exe | wc -l
  389

If I strip the exe, I get “No symbols,” as expected.  There’s no reason a finished executable should have much in the way of exported symbols without debug info, since it is self-contained.  You would only expect to get useful output from nm on a stripped binary if it’s an object file or a DLL.

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

Reply | Threaded
Open this post in threaded view
|

Re: nm for .exe extensions?

Bill Smith
Warren Young-2 wrote
On May 24, 2016, at 6:43 AM, Benjamin Cao <[hidden email]> wrote:
>
> The executable, when run with nm in Cygwin, results in a "no symbols" result, whereas it generates a symbol table in unix.

That’s not what I see here.  Given hello.c containing a “Hello, world!” program:

  $ make hello
  cc     hello.c   -o hello
  $ nm hello.exe | wc -l
  389

If I strip the exe, I get “No symbols,” as expected.  There’s no reason a finished executable should have much in the way of exported symbols without debug info, since it is self-contained.  You would only expect to get useful output from nm on a stripped binary if it’s an object file or a DLL.
Hi, I'm picking this issue up from my colleague, Ben Cao.  We're using Visual Studio C++ to compile the executables/objects.  Is the issue that Visual Studio places the information in the .pdb file?  That's why nm doesn't display any info on an *.exe ?
Reply | Threaded
Open this post in threaded view
|

Re: nm for .exe extensions?

Corinna Vinschen-2
On Jun  7 08:43, Bill Smith wrote:

> Warren Young-2 wrote
> > On May 24, 2016, at 6:43 AM, Benjamin Cao &lt;
>
> > becao@
>
> > &gt; wrote:
> >>
> >> The executable, when run with nm in Cygwin, results in a "no symbols"
> >> result, whereas it generates a symbol table in unix.
> >
> > That’s not what I see here.  Given hello.c containing a “Hello, world!”
> > program:
> >
> >   $ make hello
> >   cc     hello.c   -o hello
> >   $ nm hello.exe | wc -l
> >   389
> >
> > If I strip the exe, I get “No symbols,” as expected.  There’s no reason a
> > finished executable should have much in the way of exported symbols
> > without debug info, since it is self-contained.  You would only expect to
> > get useful output from nm on a stripped binary if it’s an object file or a
> > DLL.
>
> Hi, I'm picking this issue up from my colleague, Ben Cao.  We're using
> Visual Studio C++ to compile the executables/objects.  Is the issue that
> Visual Studio places the information in the .pdb file?  That's why nm
> doesn't display any info on an *.exe ?
PDB is an undocumented and potentially patent-encumbered format, that's
why the binutils tools can't read or write it.


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: nm for .exe extensions?

Ismail Donmez
Hi,

On Tue, Jun 7, 2016 at 7:12 PM, Corinna Vinschen
<[hidden email]> wrote:

> On Jun  7 08:43, Bill Smith wrote:
>> Warren Young-2 wrote
>> > On May 24, 2016, at 6:43 AM, Benjamin Cao &lt;
>>
>> > becao@
>>
>> > &gt; wrote:
>> >>
>> >> The executable, when run with nm in Cygwin, results in a "no symbols"
>> >> result, whereas it generates a symbol table in unix.
>> >
>> > That’s not what I see here.  Given hello.c containing a “Hello, world!”
>> > program:
>> >
>> >   $ make hello
>> >   cc     hello.c   -o hello
>> >   $ nm hello.exe | wc -l
>> >   389
>> >
>> > If I strip the exe, I get “No symbols,” as expected.  There’s no reason a
>> > finished executable should have much in the way of exported symbols
>> > without debug info, since it is self-contained.  You would only expect to
>> > get useful output from nm on a stripped binary if it’s an object file or a
>> > DLL.
>>
>> Hi, I'm picking this issue up from my colleague, Ben Cao.  We're using
>> Visual Studio C++ to compile the executables/objects.  Is the issue that
>> Visual Studio places the information in the .pdb file?  That's why nm
>> doesn't display any info on an *.exe ?
>
> PDB is an undocumented and potentially patent-encumbered format, that's
> why the binutils tools can't read or write it.

This will hopefully be no longer true in the future:
https://github.com/Microsoft/microsoft-pdb

ismail

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

Reply | Threaded
Open this post in threaded view
|

Re: nm for .exe extensions?

Corinna Vinschen-2
On Jun  7 19:23, Ismail Donmez wrote:

> Hi,
>
> On Tue, Jun 7, 2016 at 7:12 PM, Corinna Vinschen
> <[hidden email]> wrote:
> > On Jun  7 08:43, Bill Smith wrote:
> >> Warren Young-2 wrote
> >> > On May 24, 2016, at 6:43 AM, Benjamin Cao &lt;
> >>
> >> > becao@
> >>
> >> > &gt; wrote:
> >> >>
> >> >> The executable, when run with nm in Cygwin, results in a "no symbols"
> >> >> result, whereas it generates a symbol table in unix.
> >> >
> >> > That’s not what I see here.  Given hello.c containing a “Hello, world!”
> >> > program:
> >> >
> >> >   $ make hello
> >> >   cc     hello.c   -o hello
> >> >   $ nm hello.exe | wc -l
> >> >   389
> >> >
> >> > If I strip the exe, I get “No symbols,” as expected.  There’s no reason a
> >> > finished executable should have much in the way of exported symbols
> >> > without debug info, since it is self-contained.  You would only expect to
> >> > get useful output from nm on a stripped binary if it’s an object file or a
> >> > DLL.
> >>
> >> Hi, I'm picking this issue up from my colleague, Ben Cao.  We're using
> >> Visual Studio C++ to compile the executables/objects.  Is the issue that
> >> Visual Studio places the information in the .pdb file?  That's why nm
> >> doesn't display any info on an *.exe ?
> >
> > PDB is an undocumented and potentially patent-encumbered format, that's
> > why the binutils tools can't read or write it.
>
> This will hopefully be no longer true in the future:
> https://github.com/Microsoft/microsoft-pdb
Interesting.  Now somebody just have to pick this up and port it to
binutils...  (the good old SHTDI meme ;))


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

signature.asc (836 bytes) Download Attachment