Enforce DWARF-4

This commit is contained in:
2025-03-12 08:36:55 +01:00
parent 6363c89afc
commit dc66bc84ae
3 changed files with 120 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
lif("Loading user init script for program ./test"); lif("Loading user init script for program ./test");
ler("Test error message"); ler("Test error message");
var offset = "0x0000000000001145"; // dupa(), objdump -d ./test var offset = "0x0000000000001169"; // dupa(), objdump -d ./test
// Testing... // Testing...
pf(); pf();

View File

@@ -1,6 +1,6 @@
CC=gcc CC=gcc
CXX=g++ CXX=g++
CFLAGS=-MD -MP -gdwarf -I./mujs CFLAGS=-MD -MP -gdwarf-4 -I./mujs
LDFLAGS=-lm -ldwarf++ -lelf++ -lstdc++ LDFLAGS=-lm -ldwarf++ -lelf++ -lstdc++
SRCS=debugus.c linenoise.c hash.c pmparser.c SRCS=debugus.c linenoise.c hash.c pmparser.c
OBJS=$(patsubst %.c,%.o,$(SRCS)) OBJS=$(patsubst %.c,%.o,$(SRCS))
@@ -9,7 +9,7 @@ DEPS=$(patsubst %.c,%.d,$(SRCS))
all: debugus .debugusrc1.js test all: debugus .debugusrc1.js test
test: test.o test: test.o
$(CC) -gdwarf -o $@ $^ $(CC) $(CFLAGS) -o $@ $^
debugus: $(OBJS) ./mujs/build/debug/libmujs.o ./libelfin_wrap.o debugus: $(OBJS) ./mujs/build/debug/libmujs.o ./libelfin_wrap.o
$(CC) -o $@ $^ $(LDFLAGS) $(CC) -o $@ $^ $(LDFLAGS)

117
dupa.txt Normal file
View File

@@ -0,0 +1,117 @@
./test: file format elf64-x86-64
Contents of the .debug_info section:
Compilation Unit @ offset 0:
Length: 0xf4 (32-bit)
Version: 4
Abbrev Offset: 0
Pointer Size: 8
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
<c> DW_AT_producer : (indirect string, offset: 0): GNU C17 13.3.0 -mtune=generic -march=x86-64 -gdwarf-4 -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection
<10> DW_AT_language : 12 (ANSI C99)
<11> DW_AT_name : (indirect string, offset: 0xc4): test.c
<15> DW_AT_comp_dir : (indirect string, offset: 0xee): /home/kamil/Sources/debugus
<19> DW_AT_low_pc : 0x1169
<21> DW_AT_high_pc : 0xaa
<29> DW_AT_stmt_list : 0
<1><2d>: Abbrev Number: 2 (DW_TAG_base_type)
<2e> DW_AT_byte_size : 8
<2f> DW_AT_encoding : 7 (unsigned)
<30> DW_AT_name : (indirect string, offset: 0x9f): long unsigned int
<1><34>: Abbrev Number: 2 (DW_TAG_base_type)
<35> DW_AT_byte_size : 4
<36> DW_AT_encoding : 7 (unsigned)
<37> DW_AT_name : (indirect string, offset: 0xa4): unsigned int
<1><3b>: Abbrev Number: 2 (DW_TAG_base_type)
<3c> DW_AT_byte_size : 1
<3d> DW_AT_encoding : 8 (unsigned char)
<3e> DW_AT_name : (indirect string, offset: 0xb1): unsigned char
<1><42>: Abbrev Number: 2 (DW_TAG_base_type)
<43> DW_AT_byte_size : 2
<44> DW_AT_encoding : 7 (unsigned)
<45> DW_AT_name : (indirect string, offset: 0xd4): short unsigned int
<1><49>: Abbrev Number: 2 (DW_TAG_base_type)
<4a> DW_AT_byte_size : 1
<4b> DW_AT_encoding : 6 (signed char)
<4c> DW_AT_name : (indirect string, offset: 0xb3): signed char
<1><50>: Abbrev Number: 2 (DW_TAG_base_type)
<51> DW_AT_byte_size : 2
<52> DW_AT_encoding : 5 (signed)
<53> DW_AT_name : (indirect string, offset: 0x10a): short int
<1><57>: Abbrev Number: 3 (DW_TAG_base_type)
<58> DW_AT_byte_size : 4
<59> DW_AT_encoding : 5 (signed)
<5a> DW_AT_name : int
<1><5e>: Abbrev Number: 2 (DW_TAG_base_type)
<5f> DW_AT_byte_size : 8
<60> DW_AT_encoding : 5 (signed)
<61> DW_AT_name : (indirect string, offset: 0xcb): long int
<1><65>: Abbrev Number: 2 (DW_TAG_base_type)
<66> DW_AT_byte_size : 1
<67> DW_AT_encoding : 6 (signed char)
<68> DW_AT_name : (indirect string, offset: 0xba): char
<1><6c>: Abbrev Number: 4 (DW_TAG_const_type)
<6d> DW_AT_type : <0x65>
<1><71>: Abbrev Number: 5 (DW_TAG_pointer_type)
<72> DW_AT_byte_size : 8
<73> DW_AT_type : <0x6c>
<1><77>: Abbrev Number: 6 (DW_TAG_typedef)
<78> DW_AT_name : (indirect string, offset: 0x95): uintptr_t
<7c> DW_AT_decl_file : 2
<7d> DW_AT_decl_line : 79
<7e> DW_AT_decl_column : 27
<7f> DW_AT_type : <0x2d>
<1><83>: Abbrev Number: 7 (DW_TAG_subprogram)
<84> DW_AT_external : 1
<84> DW_AT_name : (indirect string, offset: 0xe7): printf
<88> DW_AT_decl_file : 3
<89> DW_AT_decl_line : 363
<8b> DW_AT_decl_column : 12
<8c> DW_AT_prototyped : 1
<8c> DW_AT_type : <0x57>
<90> DW_AT_declaration : 1
<90> DW_AT_sibling : <0x9b>
<2><94>: Abbrev Number: 8 (DW_TAG_formal_parameter)
<95> DW_AT_type : <0x71>
<2><99>: Abbrev Number: 9 (DW_TAG_unspecified_parameters)
<2><9a>: Abbrev Number: 0
<1><9b>: Abbrev Number: 10 (DW_TAG_subprogram)
<9c> DW_AT_external : 1
<9c> DW_AT_name : (indirect string, offset: 0xbf): main
<a0> DW_AT_decl_file : 1
<a1> DW_AT_decl_line : 8
<a2> DW_AT_decl_column : 5
<a3> DW_AT_prototyped : 1
<a3> DW_AT_type : <0x57>
<a7> DW_AT_low_pc : 0x1183
<af> DW_AT_high_pc : 0x90
<b7> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<b9> DW_AT_GNU_all_tail_call_sites: 1
<b9> DW_AT_sibling : <0xdd>
<2><bd>: Abbrev Number: 11 (DW_TAG_lexical_block)
<be> DW_AT_low_pc : 0x11ad
<c6> DW_AT_high_pc : 0x5f
<3><ce>: Abbrev Number: 12 (DW_TAG_variable)
<cf> DW_AT_name : i
<d1> DW_AT_decl_file : 1
<d2> DW_AT_decl_line : 12
<d3> DW_AT_decl_column : 14
<d4> DW_AT_type : <0x57>
<d8> DW_AT_location : 2 byte block: 91 6c (DW_OP_fbreg: -20)
<3><db>: Abbrev Number: 0
<2><dc>: Abbrev Number: 0
<1><dd>: Abbrev Number: 13 (DW_TAG_subprogram)
<de> DW_AT_external : 1
<de> DW_AT_name : (indirect string, offset: 0x114): dupa
<e2> DW_AT_decl_file : 1
<e3> DW_AT_decl_line : 4
<e4> DW_AT_decl_column : 6
<e5> DW_AT_prototyped : 1
<e5> DW_AT_low_pc : 0x1169
<ed> DW_AT_high_pc : 0x1a
<f5> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<f7> DW_AT_GNU_all_tail_call_sites: 1
<1><f7>: Abbrev Number: 0