News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

How to use Gieger's Debugger

Started by dewhi100, December 04, 2016, 06:19:49 PM

Previous topic - Next topic

dewhi100

Currently, I'm using Geiger's debugger for QuickMet so as to skip straight to the gameplay. I wait until Samus can move around, and then try some of the buttons in the debugger. So far, so good.

If I press "Step Out" long enough, I begin to see
$88/8508 AE B2 18    LDX $18B2  [$88:18B2]
$82/894F 22 11 81 80 JSL $808111[$80:8111]

repeating. I assume this is the main game loop?

I'd like to get a log of all the instructions in the loop, however the only thing I know to do is to keep pressing the "Step Into" button many, many times and then copy what's displayed. I see a "Logs" folder in the same place as Geiger's debugger, but no logs apart from a "QuickMet.usage" which I can't open in a text editor and don't know what else to do with.

I figure the first step is to set a breakpoint for EXEC 888508, but how do I configure the log output? I know those "CPU Trace Options" must be involved, possibly "Trace Once"... but where does it log to?

Logging the whole loop is probably overkill, but it's at least a starting point.

Smiley

Read the "release notes.html" that should've been included with the program.

In case it wasn't or you're lazy or whatever:

[spoiler]

Geiger's Snes9x Debugger Mark 10

Coded by: Michael Springer (t.geiger@gmail.com)



This version of Snes9x was compiled by Michael Springer (aka Geiger).  The official Snes9x team will not support it.

GSD does not support either Glide, Fmod, or JMA.



GSD was built with Visual Studio 2005 and the latest Microsoft development kits.  As such, you may need:



Microsoft Visual C++ 2005 SP1+ Redistributable Package (x86)

DirectX End-User Runtime Web Installer



Due to the way some things work, and to save myself a ton of support headaches, this application will convert your ROM to be both headerless and non-interleaved if necessary.  It will also use this format for saving.





Features:



Debugger

Many of these features were originally coded as part of the commandline debugger, but have been ported to MFC.

- Run . execute (until next break)

- Next Op . displays current operation (the next instruction to be executed)

- Step Into . goes to next instruction, stepping into any subroutines

- Step Over . goes to next instruction, stepping over any subroutines (they are still executed)

- Step Out . executes until current subroutine returns

- Skip Op . goes to next instruction without executing the current operation (be careful with jumps and branches)

- Clear Text . Empties tracing buffer

- Reset . reset ROM execution

- Reset Debug . resets all internal debug and tracing variables back to their bootup values.

- Frame Adv . execute and advance one frame

- Vector Info . display CPU and APU vectors

- Sprite Status . display various information about onscreen sprites

- APU State . display various information related to the APU

- Sample Address . displays addresses for samples stored in the APU

- What's Used . displays SNES features currently used by ROM

- Breakpoints . Set breakpoints

- Show Hex . show hex editor window

- Edit Registers . Edit registers PC, DP, Stack, A, X, Y, and Flags.

- Disassemble . disassembles specified range to display

- Trace From . Set auto-logging

- Dump Palette . displays color data

- What's Missing . displays SNES features currently used by ROM that are not implemented



Breakpoints

- Exec . break on execution of a SNES byte address (works for any address in instruction)

- Read . break on reading from a SNES byte address

- Write . break on writing to a SNES byte address



Tracing

- Logging . log execution of CPU, APU, SA1, and Sound DSP instructions

- Trace From, To . trace from a SNES address after its been executed a certain number of times until it reaches another SNES address a certain number of times.  Place a zero in any unwanted fields.

- Capture Every Pass . available on the Trace From dialog, this setting will trace a section of code to file every time its executed.

- Special Tracing . display data for DMA, HDMA, VRAM, DSP-1, or "Unknown Registers"



Trace Options

- Trace Once . trace each instruction once only

- Squelch . squelches some of the less useful information (reduces trace file size by 25%)

- Split . splits trace files after 65535 lines (around 5 megs in squelch mode)

- Tabbed Output . produces tabbed fields for spreadsheets or databases



Misc Options

- Tilde FF . use the tilde key (~) for fast forward, like ZSNES

- Alt Menu Behavior . causes the escape key to call the menu and pause emulation

- Auto Usage Map . automatically creates a usage map (see below)



Usage Maps

Similar in purpose to the CDL files in FCEUXD, these maps contain usage information about what bytes in ROM and RAM are executed or read as data.

- Open Usage . open a usage map, wiping out current usage log

- Merge Usage . open a usage map, combining with current usage log

- Save Usage . save usage log to file

- Gen Offsets . generate a readable offsets file from the current usage log (tab-delimited text format)



Hex Editor

Shows data being emulated.  Data is live for both read and write.

- View selector . choose which of ROM, RAM, VRAM, SRAM, or ARAM to view

- Set Range . limit range of view

- Freeze . keep a range of RAM from changing (only one range in this version)

- Open TBL . open a TBL file for ASCII column

- Save ROM . save changes to file

- Dump . dump current hex view to a binary file




Version History

Mark 10 Release 2 (1.51 code base)

Changed

- Dump RAM moved to Hex Editor. Can now dump anything the editor can see (ROM, RAM, ARAM, VRAM, SRAM, etc).

Fixed

- Interpreted a DMA flag the wrong way. Read/Write was reversed.



Mark 10 Release 1 (1.51 code base)

Released: 2010-01-26

New

- All log, usage, and dump files are saved to the Log subdirectory (user configurable)

- Hotkeys for Run, NextOp, StepInto, StepOver, StepOut, and SkipOp

- All hotkeys are user configurable (hotkey page 5)

- APU and SA1 now obey TraceOnce and Split

- SA1 breaks up code blocks and obeys Squelch.

- SRAM viewable in Hex Editor

- Register editing

Changed

- GSD has been integrated into the system changes the 1.51 base uses. This includes directory structures, config files, and other changes.

- SkipOp no longer reprints the previous line if its the same one being skipped.

- DMA trace now prints length in hex

- Breakpoint addresses and the PC register will accept up to eight characters and will filter out common address notation ("$x:\/")

Fixed

- Merging usage files caused a crash due to incorrect array sizes

- Execution breakpoints work for alternate RAM addresses (7E vs 00)

- Usage maps were saved even if Auto Usage was off

- Wrong bank for Opcode 4C (JMP)

- Write breakpoints in PPU operations caused data errors (which frequently caused code to take branches it otherwise wouldn't)

- Tab stops in breakpoint window



Mark 9 Release 8 (1.43 code base)

Released: 2005-04-19

Fixed

- Accessing the valid extension list caused the Open ROM dialog to crash



Mark 9 Release 7 (1.43 code base)

Released: 2005-04-11

Fixed
- Breakpoints no longer reset when resetting emulation
- Proper read / write breaking and usage map marking for MV and other dual mode commands
- Trace flag now resets when resetting emulation.  Keeps certain visual problems from occurring when tracing is not enabled (Zelda: LttP).  Visual issues will still be present when tracing is enabled though, due to the way the Snes9x code handles the trace flag.



Mark 9 Release 6 (1.43 code base)

Released: 2005-02-22

Fixed

- Read / write breakpoints for DMA had some faulty logic, which often signaled a false positive



Mark 9 Release 5 (1.43 code base)

Released: 2005-02-21

New

- Read / write breakpoint support for DMA and Fill RAM operations

Changed

- Fill RAM operation now displays RAM address for disassembly

- Hex Editor now displays LoROM as upper bank only



Mark 9 Release 4 (1.43 code base)

Released: 2005-02-16

New

- Smarter disassembler.  Allows setting of accumulator and x/y register status.  Changes status flags for REP/SEP commands.

- Save ROM support for JMA archives (to an uncompressed file)

Fixed

- Memory Freeze

Removed

- Duplicate zlib code



Mark 9 Release 3 (1.43 code base)

Released: 2005-02-15

New

- Debugger and Hex Editor windows now retain their position and size

Fixed

- Optimization problems caused some special chip games to work incorrectly (Super Mario Kart, Super Mario RPG)

- Occasionally, the main window will just disappear on startup.  I have applied a band-aid style fix, so hopefully this will no longer occur

- Step Over no longer turns off an Execution breakpoint

- Step Out can now continue past a breakpoint

Changed

- Registry settings were being saved to the wrong name.  All settings will be reset.

- PNG and Zip libraries updated



Mark 9 Release 2 (1.43 code base)

Released: 2005-02-11

Fixed

- Write breakpoints did not always work correctly

- Saving the ROM no longer crashes if the file cannot be opened for write access

Changed

- Hex editor did not "live" update when in step mode



Mark 9 (1.43 code base)

Released: 2005-02-10

Changed

- Build recreated from scratch.  Essentially, this is a brand new product.



Mark 8 (1.43-dev code base)

Released: 2004-08-13

Fixed

- The last release was not an up-to-date compile, so some of the features I mentioned were missing

- NMI / IRQ messages silenced

- Ending a trace log with Num-Mult or Num-Div will now reset the line counter.  The first log will no longer be only a few hundred kilobytes long.

- A debug log file for Windows messaging, left accidentally in the last release, has been removed

 

Mark 7 (1.43-dev code base)

Released: 2004-07-13

New

- Incorporated 1.43-dev code base

Changed

- Split registry settings off from normal Snes9x (you will need to manually reset everything)

- Converted the following dialogs to MFC:

    About

    Add Cheat From Search

    Cheat Search

    Play Movie

    Record Movie

- Cheat Search dialog has been slightly rearranged

- Some code optimization

Fixed

- Reset trace memory now resets all trace variables and stops tracing if active

- Trace files now always append a four digit hex sequence number



Mark 6 (1.42 code base)

Released: 2004-06-11

New

- Alternate menu behavior (ESC will call menu and pause emulation)

- Trace To added to Trace From dialog.  Only trace what you want.

- Capture Every Pass added to Trace From dialog.  Every time a section of code is executed, it is traced to file.

- Reset Trace Memory command added to menu

- Aspect Ratio stretch available in Display Settings

Fixed

- Trace memory now resets when a new game is loaded

- No longer produces a meaningless "out.txt" file

Changed

- Open ROM dialog converted to MFC (major internal changes)

- Trace and Trace All will now show a checkmark in the menu when active

- Some code optimization

Removed

- Trace command line support



Mark 5 (1.42 code base)

Released: 2004-03-22

New

- Requires MFC

- Menu driven support for tracing commands

- Some trace settings now stored in the registry

Fixed

- Some general code optimization



Mark 4 (1.42 code base)

Released: 2004-01-07

New

- Added Trace From, Trace Squelch, and Trace Split commands

Fixed

- Removed abbreviated commands



Mark 3 (1.42 code base)

Released: 2003-12-05

New

- Switched to C Core (ASM Core crashes)



Mark 2 (1.41-1 code base)

Released: 2003-10-16

New

- Supports trace and trace all functionality

- Trace can be activated by either NumDiv key press or using -trace as a command line argument

- Trace All requires either NumMult or -traceall

- Trace files can use -tabbed for tabbed field output (for spreadsheets or databases)

- All trace files have extra line breaks after subroutine jumps and returns

- A function level field has been appended to the end of each line.  Indicates the function depth for any particular instruction.



Mark 1 (1.41-1 code base)

- Test version only

[/spoiler]

dewhi100

Quote from: SMILEuser96 on December 04, 2016, 06:47:32 PM
lazy

Mostly that, yes. I do have the release notes, should have looked there when I didn't see a README. Thanks.

P.JBoy

You indeed found the main game loop. You can always check to see if a routine you're looking at is documented here
...