reading binarys
I'm working on a project where every so often one of our games comes back and we pull the ram off the game for saving, and sometimes for anaylisis. Currently the only varibles in ram that we can physically look at are the static members. The information that we would love to get to is the heap memory and be able to know what dynamically allocated structure that heap memory belongs to. I have the source code, I have the binarys, I have the ram dumps, I have the boards. Our games have the ability to recover back to the original state that they were in before a power hit, so even though the memory is dynamically allocated, our code is the only running code on the machine and since it runs the code in the same order every time, the pointers get put into the same memory locations every time. What I need to know, is there some way to read the binary with some program to figure out which order everything in memory is being allocated, so that I can write a program to read the memory dump and figure out which memory locations belong to which pointer varibles. Our code is written in C with litteraly tons of pointers. It runs on the i960 processor (yeah I know...soo old...but it works and it costs a lot of money to change once its been approved). Any ideas would be appricated to be able to read the binary to figure out the order in which varibles get loaded onto the heap.
Re: reading binarys
I''l give that a shot. Thanks On 1/25/07, Mike Stump <[EMAIL PROTECTED]> wrote: On Jan 25, 2007, at 2:11 PM, Jason Erickson wrote: > I'm working on a project where every so often one of our games comes > back and we pull the ram off the game for saving, and sometimes for > anaylisis. Currently the only varibles in ram that we can physically > look at are the static members. The information that we would love to > get to is the heap memory and be able to know what dynamically > allocated structure that heap memory belongs to. Heap objects can be found by looking at stack and global variables. > What I need to know, is there some way to read the binary with some > program to figure out which order everything in memory is being > allocated, so that I can write a program to read the memory dump and > figure out which memory locations belong to which pointer varibles. > Our code is written in C with litteraly tons of pointers. It runs on > the i960 processor (yeah I know...soo old...but it works and it costs > a lot of money to change once its been approved). > > Any ideas would be appricated to be able to read the binary to figure > out the order in which varibles get loaded onto the heap. First, wrong list. gcc-help is closer, but that is for compiler help. Your question really has little to do with the compiler, but rather, debugging. You could create a gdb remote stub for your game and then just fire up gdb with the `core file'. Assumes that you've enhanced gdb to read your core files. You can save off the -g built game and point the debugger at that code. You then debug any data structures you want, using gdb. If you just want a memory map, see the ld documentation. If you're question is how do I write a debugger, please, don't do that, just reuse gdb. It supports remote debugging and i960s just fine. -- Jennys Website http://www.dontbflat.com
Re: reading binarys
Ok, well that didnt work. First off our game has too many safety protocols that prevent me from creating a stub and not clearing the memory, so that goes out the window. I actually found the structure I needed (luckly) by looking at the map file, howevernow I'm stuck going through the memory (outputed into HEX) and associating each portion in memory with a specific varible. Its a long and tedious process. Is there anything out there that I can give it a .h file and I can say "this structure starts here, output the full listing of my variables"? Or , is there anything that can take a .h file and output a nice easy to parse listing that can give me type, name, and structure it belongs too? I tried Etags/Ctags, but that doesnt give me type. Any other ideas? On 1/25/07, Jason Erickson <[EMAIL PROTECTED]> wrote: I''l give that a shot. Thanks On 1/25/07, Mike Stump <[EMAIL PROTECTED]> wrote: > On Jan 25, 2007, at 2:11 PM, Jason Erickson wrote: > > I'm working on a project where every so often one of our games comes > > back and we pull the ram off the game for saving, and sometimes for > > anaylisis. Currently the only varibles in ram that we can physically > > look at are the static members. The information that we would love to > > get to is the heap memory and be able to know what dynamically > > allocated structure that heap memory belongs to. > > Heap objects can be found by looking at stack and global variables. > > > What I need to know, is there some way to read the binary with some > > program to figure out which order everything in memory is being > > allocated, so that I can write a program to read the memory dump and > > figure out which memory locations belong to which pointer varibles. > > Our code is written in C with litteraly tons of pointers. It runs on > > the i960 processor (yeah I know...soo old...but it works and it costs > > a lot of money to change once its been approved). > > > > Any ideas would be appricated to be able to read the binary to figure > > out the order in which varibles get loaded onto the heap. > > First, wrong list. gcc-help is closer, but that is for compiler > help. Your question really has little to do with the compiler, but > rather, debugging. You could create a gdb remote stub for your game > and then just fire up gdb with the `core file'. Assumes that you've > enhanced gdb to read your core files. You can save off the -g built > game and point the debugger at that code. You then debug any data > structures you want, using gdb. If you just want a memory map, see > the ld documentation. > > If you're question is how do I write a debugger, please, don't do > that, just reuse gdb. It supports remote debugging and i960s just fine. > -- Jennys Website http://www.dontbflat.com -- Jennys Website http://www.dontbflat.com