?

Log in

No account? Create an account
im in ur object file, unmangling ur identifiers - Lindsey Kuper [entries|archive|friends|userinfo]
Lindsey Kuper

[ website | composition.al ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

im in ur object file, unmangling ur identifiers [Jul. 23rd, 2010|04:52 pm]
Lindsey Kuper
[Tags|]

I just found out about c++filt.

<lkuper@moreau> nm liblook_thru.a | head

look_thru.o:
0000002d T _Z18look_thru_get_dataijPhi
00000134 T _Z18look_thru_put_dataijPhi
00000000 T _Z23get_instruction_pointeri
00000050 r _ZL9word_size
000000a0 r _ZZ18look_thru_get_dataijPhiE19__PRETTY_FUNCTION__
00000060 r _ZZ18look_thru_put_dataijPhiE19__PRETTY_FUNCTION__
         U __gxx_personality_v0
         U memcpy

Mangled identifiers: not all that helpful! But check it:

<lkuper@moreau> nm liblook_thru.a | head | c++filt

look_thru.o:
0000002d T look_thru_get_data(int, unsigned int, unsigned char*, int)
00000134 T look_thru_put_data(int, unsigned int, unsigned char*, int)
00000000 T get_instruction_pointer(int)
00000050 r word_size
000000a0 r look_thru_get_data(int, unsigned int, unsigned char*, int)::__PRETTY_FUNCTION__
00000060 r look_thru_put_data(int, unsigned int, unsigned char*, int)::__PRETTY_FUNCTION__
         U __gxx_personality_v0
         U memcpy

I didn't even know you could do that until yesterday. And that's how I figured out that I'd left the unsigned off of one of those unsigned char*s, causing the prototype and the implementation to disagree and eventually leading to a linker error. Apparently, not every linker error is SCons's fault. Just...most of them.

Also, apparently I became a C++ programmer at some point? What?

LinkReply

Comments:
[User Picture]From: floydcollins
2010-07-24 04:21 am (UTC)
-- Also, apparently I became a C++ programmer at some point? What?

I know a doctor who can take care of that for you.
(Reply) (Thread)
[User Picture]From: lindseykuper
2010-07-26 02:17 pm (UTC)
Oh, I know a lot of doctors who want to cure people of C++. Either that or they just want to cure C++.
(Reply) (Parent) (Thread)
[User Picture]From: pixelherder
2010-07-24 07:20 am (UTC)
Or, you know, there's nm -C liblook_thru.a if you're on a box with the GNU versions.

Of course if you've got the GNU tools, you might as well be using objdump instead.
(Reply) (Thread)
[User Picture]From: lindseykuper
2010-07-26 02:15 pm (UTC)
Yep, we're using GNU everything. I didn't know about -C; thanks! (I did know about objdump, but whenever I use it, it takes about ten tries to remember the particular combination of options I want. I guess I've hit the "read options from file" threshold.)
(Reply) (Parent) (Thread)
[User Picture]From: tristmasjedi
2010-07-26 06:45 am (UTC)
jooooiiiiiiin uuuussssssss...
(Reply) (Thread)