Lindsey Kuper (lindseykuper) wrote,
Lindsey Kuper
lindseykuper

im in ur object file, unmangling ur identifiers

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?

Tags: programming
Subscribe

  • The Rust object system struggles to its feet (plus, a little brainteaser)

    When I last wrote about my work on Rust a month ago, I had just finished implementing some very basic support for extending Rust objects with new…

  • Redexing

    For the last two weeks at work, my little PLT Redex model of Rust has been taking shape. It's been a lot of fun. I started with lambda calculus,…

  • My first month at Mozilla

    As it turns out, I picked an interesting month to start working at Mozilla. On Tuesday of my second week, Firefox 4 launched, followed by the…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 5 comments