GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - redthing1/gdbstub_cpp: modern gdbstub/rsp server library

BranchesTags
Open more actions menu

Latest commit

 

History

70 Commits
70 Commits

Folders and files

NameName
Last commit message
Last commit date
bindings
bindings
 
 
doc
doc
 
 
lib/third_party
lib/third_party
 
 
src
src
 
 
test/gdbstub
test/gdbstub
 
 
.clang-format
.clang-format
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
README.md
README.md
 
 

Repository files navigation

gdbstub_cpp

a c++20 gdb rsp server library, focused on lldb

what

  • a gdb remote serial protocol (rsp) server
  • a neat, incremental api for wiring up to any sort of target (registers, memory, run control, breakpoints, threads, etc.)

integration

  1. implement the required capability objects: regs, mem, run.
  2. optionally implement breakpoints, threads, memory_layout, host, process, shlib, register_info.
  3. build an arch_spec (target xml + reg count + pc reg number).
  4. create a server with make_target(...), arch_spec, and a transport.
  5. integrate with simple serve_forever(), or flexible async poll().

here's a minimal sketch:

auto target = gdbstub::make_target(regs, mem, run);
gdbstub::arch_spec arch{
  .target_xml = target_xml,
  .xml_arch_name = xml_arch_name,
  .osabi = osabi,
  .reg_count = reg_count,
  .pc_reg_num = pc_reg_num,
};

auto transport = std::make_unique<gdbstub::transport_tcp>();
gdbstub::server server(target, arch, std::move(transport));
server.listen("127.0.0.1:5555");
server.wait_for_connection();
server.serve_forever();

build

cmake -G Ninja -B build-release
cmake --build build-release --parallel

test

ctest --test-dir build-release --output-on-failure

a sample target

see the full-featured demo target under src/gdbstub_tool/toy/.

run debug server:

./build-release/bin/gdbstub_tool --listen 127.0.0.1:5555 --arch 32 --mode polling

lldb

connect with lldb:

lldb -O "gdb-remote 127.0.0.1:5555"

if disassembly looks wrong, set a default arch: settings set target.default-arch riscv32

gdbstub_cpp serves target.xml and also supports lldb's qRegisterInfo fallback. if the lldb build doesn't know the arch, you may still see registers but disassembly/stack can be limited.

to enable RSP packet logging:

lldb -O "log enable gdb-remote packets" -O "gdb-remote 127.0.0.1:5555"

to log into a file:

lldb -O "log enable -f /tmp/lldb-gdb-remote.log gdb-remote packets" -O "gdb-remote 127.0.0.1:5555"

reference

protocol specifications and documentation under doc.

About

modern gdbstub/rsp server library

Topics

debuggergdbgdbservergdbstubremote-debug

Resources

Readme
Activity

Stars

18 stars

Watchers

0 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.