Prev | Home | Next
Popup menu |  | Screenshots

# 7. Debugger

Debugging mode is entered when a breakpoint is encountered or when the user launches the debugger by the popup menu or by pressing the F11 key. This will stop the emulation engine but the LCD is still refreshed.
Note: debugger windows are preloaded at startup in order to display them quicker. The source code window may take a while to be displayed the first time: this is due to ROM call parsing.
TiEmu shows two debuggers simultaneously: a built-in assembly-level debugger, and the GDB/Insight-derived source-level debugger (+gdb release). These two debuggers have been adapted to interoperate seamlessly.
The assembly-level debugger is made-up of several frames:
- source code
- registers
- memory
- breakpoints
- PC trace
- stack
- heap (handles)
The source-level debugger is also made-up of several frames:

- Breakpoint Window
- Console Window
- Function Browser
- Locals Window
- Memory Window
- Register Window
- Source Window
- Stack Window
- Watch Window

These frames can be moved and/or resized (TiEmu saves/restores this with the configuration).
Frames are automatically refreshed when a change occurs from another frame.
Moreover, these frames can be controlled (maximize/minimize & show/hide) from the Windows menu of the source code window (considered as the main window).
You can also change the transient mode. When enabled, all of the TiEmu windows are grouped together as there was a single window.

## 7.1 Source code

This frame is the main one:
You can browse the source code with the arrow and PageUp/Down keys. The green bar shows the current PC location. The blue one is the selection. The red cross is a breakpoint.
By right-clicking, you get the popup menu:
- go to address: enter the address to go,
- go to PC: jump to PC location,
- set breakpoint (F2): place a breakpoint at the selection. The bkpt frame is updated,
- set temporary breakpoint (F3): place a breakpoint at the selection. This bkpt will be automatically removed when encountered.
- set PC to selection (F6): load PC with the address at the selection,
- view memory (Ctrl+M): open a tab in the memory frame with the address at the selection.
The combo box lets you choose a ROM call by using the arrow. You can type it, too. It has automatic completion. Once selected, the view is updated to begin on the ROM call's address.
Debugging facilities provided are:
- run (F5) / break (F11): start/stop emulation engine without closing frames,
- step in/out/over (F7/F8/F9):
step in equals to step by step
step out runs PC until a RTS/RTR/RTD/RTE/STOP instruction is reached (go out of the sub-routine)
step over runs PC until the instruction after the current one is reached (skips all code in a sub-routine for instance), except for branches.
This works for JSR/BSR/FLINE/DBCC/TRAP,
- run to cursor (F4): runs PC until the address under the cursor is reached.
Miscellaneous shortcuts:
- F1: set selection and PC to next line
- 'd': copy source code window content to C:\disasm.txt (unofficial feature, for various purposes)
- 'g': go to address (box)

## 7.2 Registers

| This frame displays all of the registers of the MC68000 processor. Take a look at the m68k user's manual if needed. USP = User Stack Pointer (A7 in user mode, S=0). SSP = System Stack Pointer (A7 is supervisor mode, S=1). The active pointer is displayed in the stack frame. SR is displayed in 2 modes: hexadecimal and single flags. Each field is in-place editable. By right-clicking on the address/data registers content, you will open a tab in the memory view at the adress contained in the register. Useful for browsing pointers and/or arrays.

## 7.3 Memory

| You can add/remove as many tabs as you want by clicking on +/-. Use the arrow keys or Page Up/Down keys to browse memory. The fifth button allow to refresh the current view. The last button (not shown) open a menu with a memory map of the calculator. By clicking an item, you automatically create a new tab at the given address. Very helpful! Each value can be edited in-place. Click the cell and you will be able to enter an hexadecimal string (like 12, 1234, 567890). By right-clicking, you will get the popup menu: - find / find next: opens a search dialog, - go to address: lets you enter a hexadecimal address to go to, - dis-assemble: updates the source frame at the selected address. F1 to F6 keys are equivalent to pressing the corresponding toolbar button. F7 and F8 allow you to move backward/forward into tabs.

Note: The memory window may show aliases (ghosts) which does not really exist on the real calculator. For instance, RAM on the TI-89 Titanium exists at 0x00000-0x3ffff only but if you open a tab at 0x40000, you will see RAM content at 0x000000. So, be careful!
About the search dialog:

| You can search for hexadecimal values or strings with or without case sensitivity (strings only). Click the right button to start a search. Click the middle button to find the next occurrence. The occurrence is highlighted in green in the memory frame.

## 7.4 Breakpoints

| This frame lets you manage several kinds of breakpoints: - bit change (*) - code (added from the source frame) - exception (traps, auto-ints, ...) - data access or range (*) - program entry (the debugger is raised at the beginning of the program you have just launched). Each breakpoint can be added or removed and enabled or disabled (except for prgm entry bkpts). You can go to the breakpoint location, too (last toolbar button). (*) Warning: those breakpoints occur after instruction execution so the PC is pointing the instruction right after.

## 7.5 PC trace

This frame shows the 10 latest PC values. Double-clicking the row will update the source frame with the address in the row.

## 7.6 Stack frame

| The 'A7 (stack) is' shows the current active stack pointer (user/supervisor). The frame displays the stack pointer (A7) and the frame pointer (A6) used on the TI for function call and data storage. Content is displayed as word values only. You can browse it by using the arrow or Page Up/Down keys.

## 7.7 Heap

| This frame displays all the handles the calculator has. It shows: - handle number, - address in memory, - and size. Double click the row to open a tab in the memory frame at the address pointed by the handle.

## 7.8 Logging

At the time being, only link logging is implemented.

### 7.8.1 Link

| You can: - log data sent and/or received from/to link port, - increase/decrease size of buffer. To start logging, press Start button and close (Close button or cross). To stop logging, press Stop button and close (Close button or cross). The list contents is updated whenever you launch this box. Contents can be saved at any time in text format by pressing the Save button.

## 7.9 Source-Level Debugger