Nm/Objdump

Aspect technique général

  • Lecture de fichier ELF

   typedef struct {
       unsigned char e_ident[EI_NIDENT];
       uint16_t      e_type;
       uint16_t      e_machine;
       uint32_t      e_version;
       ElfN_Addr     e_entry;
       ElfN_Off      e_phoff;
       ElfN_Off      e_shoff;
       uint32_t      e_flags;
       uint16_t      e_ehsize;
       uint16_t      e_phentsize;
       uint16_t      e_phnum;
       uint16_t      e_shentsize;
       uint16_t      e_shnum;
       uint16_t      e_shstrndx;
   } ElfN_Ehdr;

Aspect technique: nm

  • Affichage des symboles

000005fc R _IO_stdin_used
         w _ITM_deregisterTMCloneTable
         w _ITM_registerTMCloneTable
00001ef4 d __JCR_END__
00001ef4 d __JCR_LIST__
         w _Jv_RegisterClasses
000005e0 T __libc_csu_fini
00000580 T __libc_csu_init
         U __libc_start_main@@GLIBC_2.0
00000560 T main
00000480 t register_tm_clones
000003f0 T _start
00002018 D __TMC_END__
   typedef struct {
       uint32_t      st_name;
       unsigned char st_info;
       unsigned char st_other;
       uint16_t      st_shndx;
       Elf64_Addr    st_value;
       uint64_t      st_size;
   } Elf64_Sym;

Aspect technique: objdump

  • Affichage des sections

Contents of section .got:
 1fe8 00000000 00000000 00000000 60050000  ............`...
 1ff8 00000000 00000000                    ........        
Contents of section .got.plt:
 2000 f81e0000 00000000 00000000 d6030000  ................
Contents of section .data:
 2010 00000000 14200000                    ..... ..        
Contents of section .comment:
 0000 4743433a 20284465 6269616e 20362e33  GCC: (Debian 6.3
 0010 2e302d31 38292036 2e332e30 20323031  .0-18) 6.3.0 201
 0020 37303531 3600                        70516.   
   typedef struct {
       uint32_t   sh_name;
       uint32_t   sh_type;
       uint64_t   sh_flags;
       Elf64_Addr sh_addr;
       Elf64_Off  sh_offset;
       uint64_t   sh_size;
       uint32_t   sh_link;
       uint32_t   sh_info;
       uint64_t   sh_addralign;
       uint64_t   sh_entsize;
   } Elf64_Shdr;

Amélioration

nm:

  • buffer

objdump:

  • buffer

  • flags

Organisation

  1. ​Base commune

  2. nm 64 puis 32bits

  3. objdump 64 puis 32bits

Coding Style

=== CODING STYLE ===

G1 rule has been violated 1 times: you must start your source code with a correctly formatted Epitech standard header
F4 rule has been violated 2 times: too long function
H1 rule has been violated 2 times: bad separation between source file and header file
implicit_L001 rule has been violated 1 times: trailing space
implicit_T005 rule has been violated 2 times: keyword not immediately followed by a semicolon
implicit_T002 rule has been violated 2 times: reserved name used for macro
L4 rule has been violated 2 times: curly brackets misplaced
F3 rule has been violated 10 times: too long line
G4 rule has been violated 4 times: global variable must be const
L3 rule has been violated 8 times: misplaced space(s)
implicit_L003 rule has been violated 1 times: leading or trailing empty lines
L2 rule has been violated 12 times: bad indentation on start of a line
Activité : nm/objdump
Note : 1
Non-compliant coding style - style major: 15 - style minor: 26 - style info: 6 

Tests (bonus)

Any

Question

?

Review nmobjdump

By thibautcornolti

Review nmobjdump

  • 78