TartanLlama / minidbg

A mini x86 linux debugger for teaching purposes
MIT License
592 stars 104 forks source link

address read from dwarf is not absolute #6

Closed 9chu closed 6 years ago

9chu commented 6 years ago

Thank you for your good tutorial!

But I can't make a breakpoint on a simple function following the code. It seems dwarf++ read a relative PC offset, which begins from 0x0000000, thus I cannot write INT 3 on it.

How can I solve it?

TartanLlama commented 6 years ago

Hi! It seems I need to update my posts and code for position-independent executables.

In the mean time, you have two options:

  1. Compile your test programs with -fno-pie so they are not position-independent
  2. Offset your PC-relative addresses by the load address of the executable, which you can find in /proc/<pid>/maps
9chu commented 6 years ago

Thanks! I'm trying to read the base address from /proc/.../maps.