Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22047

.dbug_loc is missing from binary

$
0
0

I was inspecting ELF binary for the code mentioned below. I compiled it on gcc 7.4.0 on Ubuntu x86_64 system in Virtual Box as :

gcc -g scratch1.c -o scratch1.out

#include <stdio.h>
void do_stuff(int my_arg){
    int my_local = my_arg + 2;
    int i;
    for (i = 0; i < my_local; ++i) printf("i = %d\n", i);
}

int main(){
    do_stuff(2);
    return 0;
}

However when I tried to refer to .debug_loc section, it was empty.

objdump --dwarf=loc scratch1.out

scratch1.out:     file format elf64-x86-64

Although, I do see some other debug_ sections

[26] .debug_aranges    PROGBITS         0000000000000000  0000103b
       0000000000000030  0000000000000000           0     0     1
[27] .debug_info       PROGBITS         0000000000000000  0000106b
       000000000000035f  0000000000000000           0     0     1
[28] .debug_abbrev     PROGBITS         0000000000000000  000013ca
       0000000000000125  0000000000000000           0     0     1
[29] .debug_line       PROGBITS         0000000000000000  000014ef
       00000000000000e6  0000000000000000           0     0     1
[30] .debug_str        PROGBITS         0000000000000000  000015d5
       00000000000002b5  0000000000000001  MS       0     0     1

Need your help why this section is missing.


Viewing all articles
Browse latest Browse all 22047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>