help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying headers and code


From: Maett
Subject: Re: Displaying headers and code
Date: Tue, 08 Mar 2005 22:26:57 +0100
User-agent: Opera M2/7.54 (Win32, build 3929)

Gary Labowitz <glabowitz@comcast.net> wrote:

Are there command line flags to display the included headers' content and to
show the generated code?
I've explored all the -d and -f options output and didn't see what I want.
Thanks.


Try to run "objdump -S" on the object file.
With test.cpp containing
        #include <stdio.h>

        int main()
        {
          printf("Hello\n");
        }

and compiling it with
        g++ test.cpp -c -g -o test.o

I get with
        objdump -S test.o

this output:

test.o:     file format pe-i386

Disassembly of section .text:

00000000 <.text>:
   0:   48                      dec    %eax
   1:   65                      gs
   2:   6c                      insb   (%dx),%es:(%edi)
   3:   6c                      insb   (%dx),%es:(%edi)
   4:   6f                      outsl  %ds:(%esi),(%dx)
   5:   0a 00                   or     (%eax),%al
   7:   90                      nop

00000008 <_main>:
#include <stdio.h>

int main()
{
   8:   55                      push   %ebp
   9:   89 e5                   mov    %esp,%ebp
   b:   83 ec 08                sub    $0x8,%esp
   e:   83 e4 f0                and    $0xfffffff0,%esp
  11:   b8 00 00 00 00          mov    $0x0,%eax
  16:   89 45 fc                mov    %eax,0xfffffffc(%ebp)
  19:   8b 45 fc                mov    0xfffffffc(%ebp),%eax
  1c:   e8 00 00 00 00          call   21 <_main+0x19>
  21:   e8 00 00 00 00          call   26 <_main+0x1e>
  printf("Hello\n");
  26:   c7 04 24 00 00 00 00    movl   $0x0,(%esp)
  2d:   e8 00 00 00 00          call   32 <_main+0x2a>
}
  32:   b8 00 00 00 00          mov    $0x0,%eax
  37:   c9                      leave
  38:   c3                      ret
  39:   90                      nop
  3a:   90                      nop
  3b:   90                      nop
  3c:   90                      nop
  3d:   90                      nop
  3e:   90                      nop
  3f:   90                      nop


Greetings
Maett


reply via email to

[Prev in Thread] Current Thread [Next in Thread]