diff --git a/.debugusrc1.js b/.debugusrc1.js index 8110c1f..fc30ccc 100644 --- a/.debugusrc1.js +++ b/.debugusrc1.js @@ -3,7 +3,7 @@ lif("Loading user init script for program ./test"); ler("Test error message"); -var offset = "0x0000000000001145"; // dupa(), objdump -d ./test +var offset = "0x0000000000001169"; // dupa(), objdump -d ./test // Testing... pf(); diff --git a/Makefile b/Makefile index 1c6526e..8df3dcc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CC=gcc CXX=g++ -CFLAGS=-MD -MP -gdwarf -I./mujs +CFLAGS=-MD -MP -gdwarf-4 -I./mujs LDFLAGS=-lm -ldwarf++ -lelf++ -lstdc++ SRCS=debugus.c linenoise.c hash.c pmparser.c OBJS=$(patsubst %.c,%.o,$(SRCS)) @@ -9,7 +9,7 @@ DEPS=$(patsubst %.c,%.d,$(SRCS)) all: debugus .debugusrc1.js test test: test.o - $(CC) -gdwarf -o $@ $^ + $(CC) $(CFLAGS) -o $@ $^ debugus: $(OBJS) ./mujs/build/debug/libmujs.o ./libelfin_wrap.o $(CC) -o $@ $^ $(LDFLAGS) diff --git a/dupa.txt b/dupa.txt new file mode 100644 index 0000000..bb829ff --- /dev/null +++ b/dupa.txt @@ -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>: Abbrev Number: 1 (DW_TAG_compile_unit) + 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 + DW_AT_decl_file : 1 + DW_AT_decl_line : 8 + DW_AT_decl_column : 5 + DW_AT_prototyped : 1 + DW_AT_type : <0x57> + DW_AT_low_pc : 0x1183 + DW_AT_high_pc : 0x90 + DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) + DW_AT_GNU_all_tail_call_sites: 1 + DW_AT_sibling : <0xdd> + <2>: Abbrev Number: 11 (DW_TAG_lexical_block) + DW_AT_low_pc : 0x11ad + DW_AT_high_pc : 0x5f + <3>: Abbrev Number: 12 (DW_TAG_variable) + DW_AT_name : i + DW_AT_decl_file : 1 + DW_AT_decl_line : 12 + DW_AT_decl_column : 14 + DW_AT_type : <0x57> + DW_AT_location : 2 byte block: 91 6c (DW_OP_fbreg: -20) + <3>: Abbrev Number: 0 + <2>: Abbrev Number: 0 + <1>
: Abbrev Number: 13 (DW_TAG_subprogram) + DW_AT_external : 1 + DW_AT_name : (indirect string, offset: 0x114): dupa + DW_AT_decl_file : 1 + DW_AT_decl_line : 4 + DW_AT_decl_column : 6 + DW_AT_prototyped : 1 + DW_AT_low_pc : 0x1169 + DW_AT_high_pc : 0x1a + DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) + DW_AT_GNU_all_tail_call_sites: 1 + <1>: Abbrev Number: 0 +