VitaDebugger: live GDB debugging and one-click VS Code deployment for PS Vita

Zm1231

Well-Known Member
Member
Joined
Jun 11, 2007
Messages
212
Reaction score
83
Trophies
1
Age
33
Location
Charlotte, North Carolina
XP
1,884
Country
United States
VitaDebugger: making live Vita homebrew debugging practical on retail hardware

Hi everyone,

I've been developing a project called VitaDebugger to make homebrew development and debugging on retail PS Vita systems much more practical without access to Sony's official development hardware or tools.

GitHub: https://github.com/zm2283145/VitaDebugger

Why I started this

This began while I was trying to debug and improve my Vita build of Render96ex/Super Mario 64. The normal workflow was extremely slow: add logging, rebuild, install, reproduce the problem, copy logs or crash dumps back to the PC, and repeat.

As an early real-world test, I connected VitaDebugger to my running Render96ex build and walked through the relevant code to locate a crashing path. That demonstrated that live source-level debugging on retail hardware is possible without repeatedly copying log files after every run.

A debugger cannot magically make broken software crash-proof, but it can stop execution before a suspicious code path, show the live program state, let the developer inspect or change values, and step through or temporarily steer around the problem while investigating it.

What is working now

VitaDebugger currently provides a GDB-compatible remote debugging foundation for VitaSDK applications. The completed and tested pieces include:

  • Remote GDB attachment over the network
  • Source-level ARM and Thumb stepping
  • Software breakpoints and breakpoint step-over
  • Core register reading and writing
  • VFP floating-point register support for safely supported stopped contexts
  • Thread discovery, selection, stopping, resuming, and GDB Hc, Hg, and vCont handling
  • Memory inspection through GDB
  • Clean detach and persistent reconnect support
  • ASLR-aware symbol loading for the main executable and loaded user modules
  • Verification that the installed Vita executable matches the unstripped ELF on the PC
  • Automatic rejection of mismatched builds before incorrect symbols are loaded
  • Captured stdout and stderr in GDB's Debug Console
  • DebugNet-compatible network log streaming
  • Read-only GDB monitor commands for status, threads, modules, console statistics, and display diagnostics
  • Initial profiler infrastructure and named profiling-zone groundwork
  • VitaDevDeploy for remotely installing and launching development VPKs

One-click VS Code debugging now works

The latest milestone is a working VS Code workflow.

I can open the included sample project, place a source breakpoint, and press F5. The workflow then:

  1. Builds the application with VitaSDK.
  2. Creates and signs the VPK.
  3. Sends it to the Vita.
  4. Installs and launches it through VitaDevDeploy.
  5. Verifies that the installed eboot.bin matches the local debug build.
  6. Reads the application's current ASLR layout.
  7. Loads the matching unstripped ELF and module symbols.
  8. Connects GDB.
  9. Stops at the source breakpoint inside VS Code.

I completed the full hardware test by stopping at the breakpoint, adding a global variable to VS Code's Watch panel, changing its value from 1 to 42, resuming execution, and seeing the change immediately on the Vita's screen. I also paused the application again and successfully used the normal source-stepping controls.

Stopping the VS Code session closes only the known test application rather than issuing a dangerous system-wide command.

This is the development loop I wanted when the project began: edit, press F5, deploy, attach, inspect, modify, step, and continue from one desktop environment.

Hardware tested so far

The debugger has been tested on retail systems running firmware 3.65, including both a handheld PS Vita and a PlayStation TV.

Firmware 3.60 and other firmware versions have not yet completed the same validation, so I do not want to claim support for them until they have been tested properly.

Current limitations

This is still an active development project, not yet a complete substitute for every feature of an official Vita development kit.

  • The primary debugging path is currently compiled into the application being debugged.
  • Attaching to an arbitrary application that was not built with VitaDebugger is still planned.
  • Hardware breakpoints and watchpoints remain disabled on the tested retail hardware because access to the ARM debug registers is not currently available through a safe, supported path.
  • Unsafe register operations fail closed instead of risking corruption.
  • Foreign-thread core and VFP mutation needs a separately restorable kernel API before it will be enabled.
  • The profiler capture receiver and complete desktop viewer are still being developed.
  • VitaDevDeploy and Vita Companion should currently be used only on a private, trusted network because their transports are not yet authenticated or encrypted.

What I'm working on next

  • A restorable kernel mutation API for safe foreign-thread core and VFP register writes
  • A complete profiler receiver and desktop viewer
  • Named application profiling zones
  • CPU and guarded PMU performance counters
  • VitaGL and SceGxm profiling hooks
  • Attaching to applications that do not embed VitaDebugger
  • Hot-loaded module symbol refresh
  • Authentication and device pairing
  • Reusable VitaSDK/CMake project integration
  • LLDB compatibility and a native Debug Adapter Protocol bridge
  • More firmware, plugin-combination, and long-duration hardware testing

Future open-source Vita cheat project

The research from VitaDebugger will also form the technical foundation for a new open-source Vita cheat and memory-analysis tool.

The goal for that separate project is to provide:

  • Memory searching and value editing directly on the Vita
  • Pointer and repeated-value search tools
  • A PC companion application for faster searches and cheat creation over the network
  • Live inspection and editing while a title is running
  • An online cheat database that the Vita can browse and download from directly
  • Clearer safety controls and better documentation than the older tools available to the community

The Vita interface would remain fully usable by itself, while the optional PC companion would make large searches, comparisons, and cheat development much easier.

Longer term, I would also like to investigate PSP and PS1 titles running inside the Vita's PSP emulator environment. That part requires additional emulator and kernel research, so I consider it a long-term goal rather than a finished capability.

Why make this public?

Unofficial Vita development is much harder than it needs to be. VitaSDK is a great foundation, but most developers do not have access to an official devkit, official debugger, or the original Sony development environment.

I want to help close that gap using ordinary homebrew-enabled retail hardware and freely available PC tools. The goal is to make Vita development more approachable, reduce the rebuild-and-log-copy cycle, and give current developers a better way to diagnose difficult crashes and performance problems.

The repository includes the debugger sources, host-side tools, hardware validation records, documentation, tests, VitaDevDeploy, and the new VS Code sample workflow:

https://github.com/zm2283145/VitaDebugger

Feedback, testing, code review, and information about behavior on other firmware versions would all be welcome.
 
  • Love
Reactions: MopSec
That sounds amazing dude!
it already works build the library and link it into one of your projects and you can attach the live debugger and walk through your code/catch exceptions. I'm still trying to figure out a way to break into the hardware breakpoint registers though.

I'm using part of this as a base for a modern VitaCheat also since a lot of the work overlaps. I'm researching into hook psp, ps1 game natively as well so we don't have to rely on the old cwcheat, an ARCheat from the psp days.
 

Site & Scene News

Popular threads in this forum