www.digitalmars.com         C & C++   DMDScript  

c++ - Viewing symbols

reply comeau panix.com (Greg Comeau) writes:
I see various dump* utility commands, which have some
capability to emit symbols, in both .obj's and .exe's,
but they are within a hex core dump.  Is their an equivalent
to MS's link -dump -symbols for .obj's and .exe's?

Also, how do I get symbols in a map file by invoking sc?
-- 
Greg Comeau   What's next: additional Windows backends and 'export'!
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 12 2002
next sibling parent comeau panix.com (Greg Comeau) writes:
In article <a1q8ih$549$1 panix3.panix.com>,
Greg Comeau <comeau comeaucomputing.com> wrote:
I see various dump* utility commands, which have some
capability to emit symbols, in both .obj's and .exe's,
but they are within a hex core dump.  Is their an equivalent
to MS's link -dump -symbols for .obj's and .exe's?

Also, how do I get symbols in a map file by invoking sc?

Ok, I now see -L/XREF and -L/DETAILEDMAP which I think addresses the latter. Still curious on the former, and for .obj's. -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 12 2002
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1q8ih$549$1 panix3.panix.com...
 I see various dump* utility commands, which have some
 capability to emit symbols, in both .obj's and .exe's,
 but they are within a hex core dump.  Is their an equivalent
 to MS's link -dump -symbols for .obj's and .exe's?

For .obj's: obj2asm file.obj For .exe's: dumpexe file.exe (all the symbols will be in there, as well as the hex data)
 Also, how do I get symbols in a map file by invoking sc?

sc file.c -L/map
Jan 12 2002
parent reply comeau panix.com (Greg Comeau) writes:
In article <a1qd2g$1i0g$3 digitaldaemon.com>,
Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1q8ih$549$1 panix3.panix.com...
 I see various dump* utility commands, which have some
 capability to emit symbols, in both .obj's and .exe's,
 but they are within a hex core dump.  Is their an equivalent
 to MS's link -dump -symbols for .obj's and .exe's?

For .obj's: obj2asm file.obj For .exe's: dumpexe file.exe (all the symbols will be in there, as well as the hex data)

I see the symbols in the records, but they're not too readable. For instance, this: 0000 THEADR b 5f 63 6f 6d 6f 69 6e 74 63 2e 63 ._comointc.c .... 0086 COMDEF 14 5f 55 6e 49 6e 69 74 65 64 47 6c 6f 62 61 6c ._UnInitedGlobal 41 72 72 61 79 0 62 81 8c 1 Array.b... 00a4 PUB386 1 2 12 5f 44 65 66 69 6e 65 64 57 69 74 68 4e ..._DefinedWithN 6f 49 6e 69 74 0 0 0 0 0 11 5f 49 6e 69 74 oInit......_Init 64 47 6c 6f 62 61 6c 41 72 72 61 79 4 0 0 0 dGlobalArray.... 0 b 5f 45 78 74 65 72 6e 64 49 44 32 10 0 0 .._ExterndID2... 0 0 10 5f 44 65 66 69 6e 65 64 57 69 74 68 49 ..._DefinedWithI 6e 69 74 14 0 0 0 0 nit..... 0109 EXTDEF e 5f 5f 61 63 72 74 75 73 65 64 5f 63 6f 6e 0 .__acrtused_con. e 5f 45 78 74 65 72 6e 46 6f 6f 5f 5f 46 76 0 ._ExternFoo__Fv. 8 5f 66 6f 6f 5f 5f 46 76 0 a 5f 45 78 74 65 ._foo__Fv.._Exte 72 6e 64 49 44 0 6 5f 5f 6d 61 69 6e 0 rndID..__main. 014b PUB386 0 1 f 5f 44 65 66 69 6e 65 64 66 6f 6f 5f 5f ..._Definedfoo__ 46 76 1 0 0 0 0 5 5f 6d 61 69 6e 2 0 0 Fv......_main... .... would look nice as such: 0000 THEADR _comointc.c 0086 COMDEF _UnInitedGlobalArray 0086 COMDEF b 00a4 PUB386 _DefinedWithNoInit 00a4 PUB386 _InitdGlobalArray 00a4 PUB386 _ExterndID2 00a4 PUB386 _DefinedWithInit 0109 EXTDEF __acrtused_con 0109 EXTDEF _ExternFoo__Fv 0109 EXTDEF _foo__Fv 0109 EXTDEF _ExterndID 0109 EXTDEF __main 014b PUB386 _Definedfoo__Fv 014b PUB386 _main .... ...... .... at least in terms of symbols, similar to the output from UNIX's nm command. obj2asm has such a form, using extrn, comm, and public, but I don't need to see the code and other things, just symbols. And not just for .obj's but for .libs too. Is there any such option and/or command? -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 13 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1s5gm$53h$1 panix3.panix.com...
 In article <a1qd2g$1i0g$3 digitaldaemon.com>,
 at least in terms of symbols, similar to the output from UNIX's nm

 obj2asm has such a form, using extrn, comm, and public, but I don't need

 see the code and other things, just symbols.  And not just for .obj's
 but for .libs too.  Is there any such option and/or command?

No, but for libs there is. Try: libunres -l file.lib
Jan 13 2002
parent reply comeau panix.com (Greg Comeau) writes:
In article <a1sdrv$2p4c$1 digitaldaemon.com>,
Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1s5gm$53h$1 panix3.panix.com...
 In article <a1qd2g$1i0g$3 digitaldaemon.com>,
 at least in terms of symbols, similar to the output from UNIX's nm

 obj2asm has such a form, using extrn, comm, and public, but I don't need

 see the code and other things, just symbols.  And not just for .obj's
 but for .libs too.  Is there any such option and/or command?

No, but for libs there is. Try: libunres -l file.lib

Ok, I'll play more. In the meantime I just ran libunres on a .obj and it seem to produce something meaningful, no? -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 13 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1sf4b$adg$1 panix3.panix.com...
 In article <a1sdrv$2p4c$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1s5gm$53h$1 panix3.panix.com...
 In article <a1qd2g$1i0g$3 digitaldaemon.com>,
 at least in terms of symbols, similar to the output from UNIX's nm

 obj2asm has such a form, using extrn, comm, and public, but I don't



to
 see the code and other things, just symbols.  And not just for .obj's
 but for .libs too.  Is there any such option and/or command?

No, but for libs there is. Try: libunres -l file.lib

Ok, I'll play more. In the meantime I just ran libunres on a .obj and it seem to produce something meaningful, no?

I wrote libunres so long ago I don't remember if it works on .obj files!
Jan 13 2002
parent reply comeau panix.com (Greg Comeau) writes:
In article <a1sgg6$2qor$1 digitaldaemon.com>,
Walter <walter digitalmars.com> wrote:
I wrote libunres so long ago I don't remember if it works on .obj files!

It seems to. I don't seem to be able to get COMDEF's emitted in a list from it though. Any thoughts? -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 13 2002
parent reply "Walter" <walter digitalmars.com> writes:
I think comdef's are newer than the utility <g>.

"Greg Comeau" <comeau panix.com> wrote in message
news:a1sv6n$oou$1 panix3.panix.com...
 In article <a1sgg6$2qor$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
I wrote libunres so long ago I don't remember if it works on .obj files!

It seems to. I don't seem to be able to get COMDEF's emitted in a list from it though. Any thoughts? -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

Jan 13 2002
parent reply comeau panix.com (Greg Comeau) writes:
In article <a1tdh8$anv$1 digitaldaemon.com>,
Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1sv6n$oou$1 panix3.panix.com...
 In article <a1sgg6$2qor$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
I wrote libunres so long ago I don't remember if it works on .obj files!

It seems to. I don't seem to be able to get COMDEF's emitted in a list from it though. Any thoughts?

I think comdef's are newer than the utility <g>.

Any chance of making the utility newer than comdef's then? :) And also letting one output combo's of the different sections? I know I know... easy for me to ask... -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 14 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1ulik$o2a$1 panix3.panix.com...
 In article <a1tdh8$anv$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1sv6n$oou$1 panix3.panix.com...
 In article <a1sgg6$2qor$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
I wrote libunres so long ago I don't remember if it works on .obj




 It seems to.   I don't seem to be able to get COMDEF's emitted
 in a list from it though.  Any thoughts?

I think comdef's are newer than the utility <g>.

Any chance of making the utility newer than comdef's then? :) And also letting one output combo's of the different sections? I know I know... easy for me to ask...

I'm curious - what would it be used for?
Jan 14 2002
parent reply comeau panix.com (Greg Comeau) writes:
In article <a1vs4t$1t9k$1 digitaldaemon.com>,
Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1ulik$o2a$1 panix3.panix.com...
 In article <a1tdh8$anv$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1sv6n$oou$1 panix3.panix.com...
 In article <a1sgg6$2qor$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
I wrote libunres so long ago I don't remember if it works on .obj
files!

It seems to. I don't seem to be able to get COMDEF's emitted in a list from it though. Any thoughts?

I think comdef's are newer than the utility <g>.

Any chance of making the utility newer than comdef's then? :) And also letting one output combo's of the different sections? I know I know... easy for me to ask...

I'm curious - what would it be used for?

We put out special names tell the Comeau template instantiation mechanism what to do. W/o seeing the names, it assumes no template instantiation is necessary. -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 14 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Greg Comeau" <comeau panix.com> wrote in message
news:a20b50$k1f$1 panix3.panix.com...
 In article <a1vs4t$1t9k$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1ulik$o2a$1 panix3.panix.com...
 In article <a1tdh8$anv$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a1sv6n$oou$1 panix3.panix.com...
 In article <a1sgg6$2qor$1 digitaldaemon.com>,
 Walter <walter digitalmars.com> wrote:
I wrote libunres so long ago I don't remember if it works on .obj
files!

It seems to. I don't seem to be able to get COMDEF's emitted in a list from it though. Any thoughts?

I think comdef's are newer than the utility <g>.

Any chance of making the utility newer than comdef's then? :) And also letting one output combo's of the different sections? I know I know... easy for me to ask...

I'm curious - what would it be used for?

We put out special names tell the Comeau template instantiation mechanism what to do. W/o seeing the names, it assumes no template instantiation is necessary.

Ok. It helps to know what the problem is, so the solution will be the right one!
Jan 14 2002
parent comeau panix.com (Greg Comeau) writes:
In article <a20b5r$26pg$1 digitaldaemon.com>,
Walter <walter digitalmars.com> wrote:
"Greg Comeau" <comeau panix.com> wrote in message
news:a20b50$k1f$1 panix3.panix.com...
 We put out special names tell the Comeau template instantiation
 mechanism what to do.  W/o seeing the names, it assumes no
 template instantiation is necessary.

Ok. It helps to know what the problem is, so the solution will be the right one!

Name encoding details aside, we output something like this: char vector_int_can_be_instantiated; We then look for these, and determine which object files will "own" that instantiation, since many may request it. This analysis is done program-wide, and then the instantiations are distributed. But we can't seem to get the id name. If used as above, the utility won't output it. If we = 0 it, then I recall it will get output, however, if it's in multiple source files, then a duplicate definition occurs. If we extern it, I recall we can also see it, but then an unrevolved reference error occurs. -- Greg Comeau What's next: additional Windows backends and 'export'! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jan 14 2002