Gianluca Magnani

External ELF Debugging and Virtual Memory

Discussion created by Gianluca Magnani on Oct 30, 2011
Latest reply on Nov 2, 2011 by Tom Thompson

Hello everybody,

my name is Gianluca Magnani and this is my first post in the forum.

 

I would like to ask your help in order to solve a little problem that I've encountered once I started to debug external ELF files: I have developed a simple application that read and launches threads starting from ELF files. The application works with MMU enabled and so each thread has its own Virtual Memory. I found a very useful manual that explains how to debug an external ELF: basically, this is done performing the following steps:

 

1. Load the main application (my application)

2. Drag and drop the external ELF file into the project. This will result in the creation of a new project containing the source of the ELF. I set up the project in order to be suitable for the target.

3. Add the ELF file to "Other executables" list in the project settings.

4. Start a debug session (so, I start to debug my main application)

5. Load the ELF file into the memory (Load/Save Memory)
6. Load Symbolic window (this will show two executables, my application and the external ELF)

7. Start to debug.

 

If I perform these steps with Virtual Memory disabled, there is no problem at all. Once the application starts the external ELF, the debug shows the code and I can perform a normal debug (I also see the variables values and I can change them). If i perform these steps with Virtual Memory enabled, I succeed (sometimes) in entering into the external ELF code once the control passed to it, but I'm not able to:

1. see variables values
2. change them (if I try to change a value of a variable, an entire portion of memory is changed!! It is really weird)

 

I cannot figure how I can debug my external ELF file with Virtual Memory enabled. I even tried to use a Memory Configuration file, but It seems not to work: the External ELF file has its entry point at 0x10000094, and starts at 0x10000000; I observed that the first physical address for the mapping that my MMU gives to the application is 0x00119000, so I set the memory configuration file as following:

 

translate 0x10000000 0x001190000 0x1000000

 

But it seems that nothing changed.

Someone have experience in external ELF debugging and Virtual Memory? Maybe I missed something in the set up phase?

 

Thank you for your help.

Gianluca

Outcomes