Using the simulator

The instructions for starting the simulator from within GDB involve typing lengthy lines to set up proper parameters. One way to reduce the amount of typing is to put the following code in your personal GDB start-up file (gdb.ini on Windows and .gdbinit on UNIX). You can then connect to the simulators by typing psim, tsim, msim, or ssim for the PowerPC, TX39, MN10300, or SPARClite simulators respectively:

define psim
target sim -f BASE_DIR/packages/hal/powerpc/sim/v1_2_1/runtime/tree
rbreak cyg_test_exit
rbreak cyg_assert_fail
end

define tsim
target sim --board=jmr3904pal --memory-region 0xffff8000,0x900 --memory-region 0xffffe000,0x4 --memory-region 0xb2100000,0x4
rbreak cyg_test_exit
rbreak cyg_assert_fail
end

define msim
target sim --board=stdeval1
rbreak cyg_test_exit
rbreak cyg_assert_fail
end

define ssim
target sim -nfp -sparclite -dumbio
rbreak cyg_test_exit
rbreak cyg_assert_fail
end

In the remainder of this guide, only these short-form macros will be used. If you do not define these macros, it’s possible to get the same effect by typing out the macro contents instead of the macro name.

For example, instead of:

$ (gdb) psim

type:

$ (gdb) target sim -f BASE_DIR/packages/hal/powerpc/sim/v1_2_1/runtime/tree$ break cyg_test_exit$ break cyg_assert_fail

Setting the breakpoints is optional.