Download Simics User Guide for Unix
Transcript
12.3. Symbolic Debugging Using Symtable
that executes the binary ’zsh’.
simics> @conf.zsh_context.symtable = conf.zsh_sym
We would like to start debugging the program at the beginning of its main function.
The symbol table can tell us where that is:
simics> psym main
{int (int, char **)} 0x100001f8
simics> whereis (sym main)
in main() at /home/jane/zsh-4.2.3/Src/main.c:92
sym is like psym, except that it only returns the value, and not its type—which is exactly
what other commands are expecting as input.
Let us set a breakpoint at main, and let the simulation run:
simics> zsh_context.break -x (sym main)
Breakpoint 1 set on address 0x100001f8 with access mode ’x’
1
simics> c
Note that as long as you do not execute a binary named “zsh”, you can run whatever
program you want without triggering this breakpoint. That is because it is set on the zsh_
context context, which will not be activated until zsh is run:
$ ls /
bin
dev home lib
boot etc host lost+found
$ sh -c ’echo foo’
foo
$ zsh
mnt
opt
proc
root
sbin
tmp
usr
var
Now the simulation stops:
Code breakpoint 1 reached.
main (argc=0, argv=0x0) at /home/jane/zsh-4.2.3/Src/main.c:92
92
{
[cpu0] v:0x100001f8 p:0x079d41f8 stwu r1,-32(r1)
We can single-step through the code:
simics> zsh_context.step
93
simics>
return (zsh_main(argc, argv));
153