Adapt test files

This commit is contained in:
Théophile Bastian 2018-04-05 19:18:06 +02:00
parent 97032ee31b
commit 18d3655890
2 changed files with 12 additions and 5 deletions

View file

@ -1,5 +1,5 @@
CXX=g++
CXXFLAGS=-Wall -Wextra -O1 -g --std=c++14
CXXFLAGS=-Wall -Wextra -O0 -g --std=c++14
CXXLIBS=-ldwarfpp -ldwarf -lelf -lc++fileno -ldwarfinterpret
CXXDIRS=-I../include -L../lib

View file

@ -8,11 +8,19 @@ volatile int optim_stopper = 0;
void dump_my_stack() {
DwarfInterpret& dw = DwarfInterpret::acquire();
uintptr_t pc = dw.get_current_pc();
DwarfInterpret::UnwindContext unw_context =
DwarfInterpret::get_current_unwind_context();
MemoryMap mmap;
while(true) {
printf(">> PC = %p <<\n", pc);
printf(">> PC = %lX ", unw_context.rip);
MemoryMap::MapEntry cur_map_entry =
mmap[mmap.id_of_address(unw_context.rip)];
uintptr_t inelf_pc = unw_context.rip
- cur_map_entry.mem_region.begin + cur_map_entry.offset;
printf("(in ELF: %lX) <<\n", inelf_pc);
fflush(stdout);
pc = dw.get_return_address(pc);
unw_context = dw.unwind_context(unw_context);
}
}
@ -20,7 +28,6 @@ void fill_my_stack(int stack_depth) {
if(stack_depth == 0)
dump_my_stack();
optim_stopper++;
fill_my_stack(stack_depth - 1);
}