質問

First of all, I cannot use a debugger[1]. But I can access the Program Counter of a program, and can also compile the binary (written in C) with all the flags I need. And I can even change the code (although I prefer not to). Given a PC I want to be able to know which line it corresponds.

I'm sure there has to be an automated, practical, quick way to do this. But I haven't succeeded.

Edit: Forgot to mention: Linux system, binaries are PPC, host is i386. I do have access to PPC hardware.

[1] The application is being emulated, and it is cross compiled, I have a gdb in the host emulator. But I cannot connect a gdbserver on the emulated guest application. And real hardware is not an option, I'm trying to build a simulator based on the emulator.

役に立ちましたか?

解決

If the binary is compiled with debugging information, then you can use the PC to find the right location in the source by groping through the ELF sections that contain the debug information. Automated, quick and practical aren't the terms that spring to mind for the process, though!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top