Commit Graph

72 Commits

Author SHA1 Message Date
joevt 7866675a55 debugger: Auto increment after disassemble.
Pressing return after disassembling some instructions should cause the next instruction to disassemble.
2024-03-11 07:13:40 -07:00
joevt 619579bee3 debugger: Add instruction bytes to disassembly.
8 characters for address, 8 characters for instruction hex, followed by instruction.
2024-03-11 07:13:07 -07:00
joevt b5dbaff748 debugger: Don't echo auto-repeated commands. 2024-03-11 07:12:57 -07:00
Mihai Parparita 57e6e90002 Add support for the CUDA_RESTART_SYSTEM command
There are cases where when it's necessary (e.g. given uninitialized NVRAM,
the Beige G3 with the 10.2 install CD inserted will update the boot
device and restart to boot from it).

Restart support was done by wrapping the ppc_exec function in a loop and
checking for a restart power off reason. We also need to disconnect all
event listeners, since they will be recreated when the machine is
re-initialized.
2024-03-07 23:32:23 -08:00
joevt ebb51addd7 debugger: Allow interrupt of disassembly.
Part of the "debugger: Fix interrupt signal." commit.
2024-03-03 14:36:24 -07:00
joevt 177098c957 debugger: Fix interrupt signal.
Typing Control-C in Terminal app causes an interrupt signal that should enter the DPPC debugger but this only worked once since the signal handler never returned. Even if the signal handler reenabled the signal somehow, it calls enter_debugger recursively which is strange since the earlier calls to enter_debugger would never return.

Now the signal handler just sets a flag (power_on) which can be used to exit any loop (emulator loops, stepping loops, disassembly loops, dumping loops).

Main always calls enter_debugger now which calls the ppc_exec loop. The power_on flag will exit the ppc_exec loop to return to the debugger. Recursion of enter_debugger is eliminated except for calls to loguru's ABORT_F.

An enum power_off_reason is used to indicate why the power_on flag is set to false and to determine what happens next.
2024-03-02 12:57:02 -07:00
joevt 6a51e8a1c9 debugger: regs command needs to reset setfill.
So printenv will fill with spaces after regs.
2024-03-01 07:28:58 -07:00
joevt 006a90f681 debugger: Some commands should not repeat.
Entering a blank command causes the last command to repeat. This doesn't make sense for the following commands:
help, quit, regs, context, printenv, setenv, nvedit, amicint, viaint.
2024-03-01 07:26:34 -07:00
joevt 17983e7fad debugger: Fix setenv command to allow spaces.
To allow setting boot-command to "0 bootr -v debug=0x144" for example.
2024-03-01 07:13:41 -07:00
joevt a15b1805fb debugger: Fix handling of empty commands.
An empty command should not be reported as an unknown command.
An empty command should not repeat an unknown command.
2024-03-01 07:08:12 -07:00
joevt 11e0bd79b0 debugger: Work around Xcode Terminal.app issue.
If debugging with Xcode using Terminal.app for the console, Terminal.app may send empty lines to the dingusppc debugger while resizing the Terminal.app window and it will do this forever.
As a workaround, use std::cin.clear() to clear the input buffer before getline and loop until the terminal window size is not changing or the input line is not empty.
2024-03-01 06:56:20 -07:00
dingusdev 229509a067 Add help for mregs 2024-02-29 21:48:04 -07:00
joevt ff5c43e6cb debugger: Add mregs command.
To dump more registers.
2024-02-29 21:46:44 -07:00
Maxim Poliakovski c188d0251a ofnvram: support CHRP style OF config partition. 2023-02-25 18:14:42 +01:00
joevt 64fec88436 Fix compiler warnings: cast loses precision.
Use explicit cast when converting large integer types to smaller integer types when it is known that the most significant bytes are not required.
For pcidevice, check the ROM file size before casting to int. We'll allow expansion ROM sizes up to 4MB but usually they are 64K, sometimes 128K, rarely 256K.
for machinefactory, change the type to size_t so that it can correctly get the size of files that are larger than 4GB; it already checks the file size is 4MB before we need to cast to uint32_t.
For floppyimg, check the image size before casting to int. For raw images, only allow files up to 2MB. For DiskCopy42 images, it already checks the file size, so do the cast after that.
2023-01-11 01:17:12 -08:00
Maxim Poliakovski 5b08f283e5 Hacks for debugging HW interrupts. 2022-08-27 17:38:53 +02:00
Maxim Poliakovski 50053a52dc debugger: disable nvedit command on Windows hosts. 2022-08-26 11:13:33 +02:00
joevt 1c1300ce5a Add nvedit
setenv doesn't allow entering strings that include multiple lines which is useful for nvramrc.

nvedit uses CTRL-C to end editing, like Open Firmware. It does not support deleting characters from a line or editing previous lines or any other special keys. It doesn't have nvstore or nvquit or nvrecover commands. Basically, you should edit your nvramrc in a text editor, then copy and paste into the debugger.
2022-08-22 17:21:58 -07:00
Maxim Poliakovski b8915f11a2 debugger: fix ofnvram commands for Nubus machines. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski 898c677ffb debugger: add printenv and setenv commands. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski 932a6ae01e debugger: GO command. 2022-02-26 12:47:51 +01:00
Maxim Poliakovski f1ed56ae9a debugger: a couple of cosmetic improvements. 2022-02-26 10:57:13 +01:00
Maxim Poliakovski c0cd6eb38f Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
Maxim Poliakovski e66979d30f debugger: improve disassembling of 68k F-Traps. 2021-10-13 09:04:52 +02:00
Maxim Poliakovski e9fcc51b93 Debugger fixes for PDM. 2021-09-26 14:21:31 +02:00
Maxim Poliakovski e052eb4a87 Merge branch 'atirage-hacks'. 2021-09-25 23:16:38 +02:00
Maxim Poliakovski 212cd58f40 ppcmmu: refactor and clean up. 2021-09-25 19:13:40 +02:00
Maxim Poliakovski 84e111290f Fix includes for loguru and SDL. 2021-09-16 00:46:38 +02:00
Maxim Poliakovski 6f9ee10de5 Rework PPC CPU profiler. 2021-04-29 02:26:17 +02:00
Maxim Poliakovski ed6c316c82 profiler: add reset command. 2021-04-14 17:04:14 +02:00
Maxim Poliakovski 31b5290ac9 New profiler API. 2021-04-14 01:27:07 +02:00
Maxim Poliakovski d8f7588693 debugger: some fixes and improvements. 2021-01-12 15:17:51 +01:00
Maxim Poliakovski 180cb0d25f Make 68k debugger optional and disabled by default. 2020-12-03 02:18:13 +01:00
Maxim Poliakovski f0315e98ee Add Capstone submodule. 2020-12-03 00:53:28 +01:00
Maxim Poliakovski 2be8e7b542 Set minimum Capstone version to 4.0.2
This version has fixed a bug with Capstone's main header.
2020-11-28 02:23:47 +01:00
Maxim Poliakovski 353035e9ca Prevent clobbering during debugging. 2020-07-20 23:02:07 +02:00
Maxim Poliakovski 660d227ac7 debugger: fix string formatting. 2020-07-20 18:00:04 +02:00
Maxim Poliakovski b9dcfef551 debugger: debugging commands for 68k code. 2020-07-16 14:26:34 +02:00
Maxim Poliakovski 6b74e358dc WIP: basic 68k debugging environment. 2020-07-15 02:19:05 +02:00
Waqar Ahmed 0ab9380be3 clang-format everything 2020-05-12 23:55:45 +05:00
Maxim Poliakovski 7154e51d86 Make debugger standalone component. 2020-04-20 20:32:09 +02:00
dingusdev 60ffa5bfac Initial attempt at fixing SDL2 building for Windows 2020-03-22 20:15:12 -07:00
Maxim Poliakovski cea840fc09 debugger: add command to control log level. 2020-03-02 23:48:02 +01:00
dingusdev 055445e04a Merge branch 'master' of https://github.com/dingusdev/dingusppc 2020-02-28 09:04:30 -07:00
dingusdev 354409812e Updating files with proper licensing header 2020-02-28 09:04:28 -07:00
Maxim Poliakovski e08bf39af3 debugger: more checks for user input. 2020-02-28 08:58:14 +01:00
Maxim Poliakovski 3ffa680f6d debugger: fix address printing under Windows. 2020-02-23 18:52:09 +01:00
Maxim Poliakovski f29a63acd4 debugger: fix disasm command. 2020-02-23 18:42:42 +01:00
Maxim Poliakovski b6768d7168 debugger: add dump command for dumping memory. 2020-02-23 17:52:30 +01:00
Maxim Poliakovski 461d859e73 ppcmmu: add debug memory reading function.
This function saves and restores the MMU state
so no invalid user input can break CPU execution.
2020-02-23 16:41:58 +01:00