MCPcopy Index your code
hub / github.com/1024bees/dang

github.com/1024bees/dang @0.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.0.1 ↗ · + Follow
236 symbols 477 edges 17 files 37 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

JPDB: GDB for waveforms

JPDB is a GDB inspired debugger for debugging pre-silicon CPUs.

Usage

to get started

  • a waveform
  • a python mapping file, that translates signals in the waveform
  • the elf file that is being executed in the waveform
jpdb test_data/ibex/sim.fst --mapping-path test_data/ibex/signal_get.py

your system python must be 3.10 or newer, otherwise jpdb might bark at you

installation

jpdb can be installed via cargo

cargo install jpdb --locked

the releases page on github

mapping file

The mapping file for JPDB is the translation layer that makes signals understandable for JPDB's internal gdb server stub.

the mapping file MUST contain a function named get_gdb_signals that returns a python dict. The returned python dictionary MUST contain the following keys: * pc: signal for the current retired pc * x0-x31: signals for each architectural general purpose register

an example mapping file is below ```python def get_gdb_signals(wave: Waveform) -> Dict[str, Signal]: pc = wave.get_signal_from_path( "TOP.ibex_simple_system.u_top.u_ibex_top.u_ibex_core.wb_stage_i.pc_wb_o" ) gprs = { f"x{i}": wave.get_signal_from_path( f"TOP.ibex_simple_system.u_top.u_ibex_top.gen_regfile_ff.register_file_i.rf_reg.[{i}]" ).sliced(0, 31) for i in range(32) }

rv = {"pc": pc, **gprs}
return rv

To just verify that the mapping file is well formed, you can execute 

```bash
jpdb test_data/ibex/sim.fst --mapping-path test_data/ibex/signal_get.py --verify-only

although this will happen when you launch jpdb normally

FAQ

  • does JPDB support superscalar CPUs?

not yet, but if you give me a wave dump of a superscalar CPU, i will add support and thank you kindly

  • what instruction sets are supported?

only RV32G, but if you have a dump of another instruction set, i will add support and thank you kindly

  • do i NEED to supply the elf file to use JPDB?

probably not, file an issue and i'll make that optional

  • n always steps into function calls whats up with that?

yeah i need to fix that sorry

  • does jpdb hook into waveform viewers?

no, but it could integrate with vaporview or surfer fairly easily

acknowledgements

wellen library made this easy, thank you kevin laeufer

also tom verbeure did something similar a while back, shoutout

Extension points exported contracts — how you extend this code

Mappable (Interface)
Trait to easily convert between existing data types [1 implementers]
dang/src/convert.rs
WellenSignalExt (Interface)
(no doc) [1 implementers]
dang/src/waveloader.rs

Core symbols most depended-on inside this repo

len
called by 34
shucks/src/response.rs
init_test_logger
called by 18
shucks/src/lib.rs
send_command_parsed
called by 12
shucks/src/client.rs
create_test_listener
called by 8
shucks/src/client.rs
start_dang_instance
called by 8
shucks/src/client.rs
initialize_gdb_session
called by 7
shucks/src/client.rs
get_item
called by 7
dang/src/waveloader.rs
write
called by 6
shucks/src/packet.rs

Shape

Method 155
Function 46
Class 19
Enum 14
Interface 2

Languages

Rust99%
Python1%

Modules by API surface

dang/src/gdb.rs57 symbols
shucks/src/client.rs38 symbols
shucks/src/response.rs33 symbols
dang/src/waveloader.rs17 symbols
dang/src/runtime.rs17 symbols
jpdb/src/main.rs16 symbols
shucks/src/lib.rs12 symbols
jpdb/src/user_commands.rs12 symbols
dang/src/cli.rs12 symbols
shucks/src/packet.rs6 symbols
shucks/src/commands.rs6 symbols
dang/src/convert.rs4 symbols

For agents

$ claude mcp add dang \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact