The previous pattern assumed addresses beginning with 0x7ffff and a limited
hex-length, which caused jemalloc heap tests to fail on some systems where
extents are mapped at addresses like 0x7ec7... with more digits.
Relax the regex to 0x[0-9a-fA-F]{6,16} so we still validate that a hex address
is printed, but support different virtual address layouts and jemalloc mappings.
* Fix plist to support pointer-sized integer fields like size_t
Resolves#3448
The plist command previously rejected fields that were not pointer types,
even if they were pointer-sized integers (like size_t, uintptr_t) used to
store addresses.
Changes:
- Accept integer types with size equal to architecture pointer size
- Handle type validation for pointer-sized integers
- Assume pointer-sized integers point to outer structure type
This allows plist to work with structs like:
struct node {
size_t next; // Previously rejected, now works
size_t prev;
};
* Strip typedefs before checking if field is pointer-sized int
size_t and similar types are TypeCode.TYPEDEF, not TypeCode.INT.
We need to call strip_typedefs() to get the underlying type
(e.g., size_t -> unsigned long) before checking the type code.
Thanks to @jackmisbach for catching this issue!
* Add test cases for plist with size_t fields
- Add test struct with size_t next pointer to linked-lists.c
- Add test_command_plist_size_t_field() to both GDB and DBG test suites
- Tests verify plist correctly handles typedef-wrapped pointer-sized integers
* Fix include placement in linked-lists.c
Move stdint.h include to top of file with other includes
* Set dereference-limit in size_t test cases
Ensure the test runs with a sufficient dereference limit to traverse all 3 nodes
* Use explicit count flag instead of dereference-limit in size_t test
Use -c 3 flag to explicitly request 3 nodes, matching the pattern used in other plist tests
* Simplify size_t test to use -f value flag
Use -f value flag to only display the value field, avoiding issues with
size_t formatting. This matches the pattern in test_command_plist_flat_field
and provides a cleaner, more focused test of the core functionality.
* Remove regs __getattr__, convert uses to read_reg(). Make .pc and .sp special properties to fetch current program counter and stack pointer
* Remove register lookup handler helper function, fixup docs
* Update comment
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
* Enable cross-architecture instruction patching. Use Zig with the patch command, Capstone to disassemble in patch-list.
* remove old comments
* update comment
* rename variable
* Replace pc with . Mark the test as xfail given the qemu-version in CI doesn't support GDB writing to process memory
* Fix nearpc command disassembly instruction count
* Add -r parameter to nearpc to set number of previous instructions to show
* Add -t argument to nearpc
* docs
* Remove old comments
* Fix function parameter type for dev docs check
* Correct number of instructions to pull from cache
* Fix if condition edge case
* Rebase and fix typos
* Support system Zig in addition to the one bundled in a Python package
Add support for locating the Zig executable with the following precedence:
1. ziglang module - if installed, use bundled Zig.
2. zig in PATH - fallback to system installation.
On Arch Linux we don't package the ziglang Python package. This change makes it
possible for pwndbg to use the Zig executable from our zig0.14 package [0].
[0]: https://archlinux.org/packages/extra/x86_64/zig0.14/
Disclaimer: Authored with assistance from Claude Code.
* Fail if found Zig has unsupported version
Only version 0.14.1 works, 0.15+ doesn't
* Address PR comments
- Increase version check timeout from 1s to 15s (necessary on MacOS).
- Cache get_zig_executable() result.
- Only check version of system Zig. Python packaged one is locked.
* Manually propagate register values across instructions while disassembling, allowing better annotations when emulation is unavailable
* Add comment
* More comments
* Comment
* Comment fix
* Local variable change
* Print register writes in instruction debug print
* Clear register set when encountering branch with undetermined result
* Update tests
* lint
* Fix dbg tests
* Update dev docs related to reasoning about process state
* klookup
* using lief to create a blank elf and add symbols to it
* added lief in dependencies
* doc
* fixed add_symbol_file
* changes to tuple
* fix tests
* fix compiler warnings
* fix div by 0 issue
* removed redundant bracket
* gracefully handle the case when `char_ptr` points to a string that contains none utf-8 chars
* handling `struct kmem_cache` recovery edge case
* improved slub warning message handling
* added emphasize
* slab free obj addr bound checking
* refactored a bit
* linting
* added head of list error handling
* updated error message
* cleaning up
* cleaning up
* Update to CapstoneV6 alpha 5
* Add riscv32 test
* Add loongarch64 test to ensure branch targets are resolved correctly
* Makefile cleanup
* Upgrade version of uv
* Refine `vmmap` based on shared cache information
* Remove support for partial overlaps of mappings with the shared cache
* Coaless contiguous vmmap ranges
* Omit Shared Cache entries in `vmmap` by default
* Remove nesting in _refine_memory_map
* Document differences between `aglib` and Debugger API `vmmap`
* Change display format
* implement ng-dump
* clarify index
* fix rebase
* add ability for a property to override color
* make color usage more consistent
* handle ansii in descriptions properly
* add ng-dump test
* finish rename
* add --meta-area flag to ng-dump
* remark on the coloring difference in the command description
* clarify nominal size on freed slots
* port test to lldb
* Update scripts/_docs/gen_docs_generic.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix function name change
* Update pwndbg/lib/pretty_print.py
* Update pwndbg/commands/mallocng.py
* lint
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add dbg tests to test suite
* Fix 0
* Check for OSError in OpportunisticTerminalControl
* Split tests tasks
* Fix go tests in LLDB
* Update TLS tests to handle LLDB failing to resolve %GS on LLDB
* Disable go-based x86 test for windbg commands on LLDB
* Fix listening to new modules being loaded in LLDB
* Force LLDB tests to run in series
Parallel execution is broken, anyway
* Fix mallocng tests in LLDB
* ptmalloc2: Always cast tcache counts to pointer during try-free
* Catch LLDB_INVALID_ADDRESS in LLDB symbol lookup
* Handle the binary formatting from LLDB in `test_vis_heap_chunks`
* Split GDB and DBG GDB Nix tests, remove DBG LLDB Nix tests
* Replace ParamSpec in type param list with explicit use
* Add mising dependencies in Ubuntu test targets
* Revert "Add mising dependencies in Ubuntu test targets"
This reverts commit bd56a6b9dc.
* Disable -fcf-protection in test binaries
* Disable LLDB tests on Ubuntu 22.04
We don't seem to even officially support it for pwndbg-lldb
* ng-vis add simple dumping and coloring
* highlight all the in-band metadata
* pull out coloring, add legend, add decoration
* better colors
* add config option for default count
* add an ng-vis test
* swap alloc colors
* make coloring consistent in ng-slotu
* move ng-explain to the bottom of the file
* Fix mallocng tests in LLDB
* port vis test to /dbg
---------
Co-authored-by: Matt <4922458+mbrla0@users.noreply.github.com>
* Add even even more tests
* Fix 0
* Fix 1
* Add heap tests
* Fix 0
* Match new module layout
* Fix a couple of tests
* Backport test binary changes to GDB suite
* build the mallocng binary as static and dynamic
* ng-slots and ng-slotu tests
* add musl to apt and pacman dev deps
* lint
* dont test for heap addr since donation is flaky
* add ng-group check
* add ng-meta test
* remove inconsistent check
* add ng-ctx test
* test ng-find
* ng-metaarea test
* make tests debugger agnostic
* buffer1 typo
* recoverying from rm -rf
* refactored kconfig
* collapsing merge history
* cleaning up
* refactored out buddydump and slab type helpers
* improving bud and slub
* improved arch specific symbol handling
* improved handling of vmemmap and vmalloc bases when symbols do not exist
* misc
* doc
* properly naming kernel symbol files
* try except for cases where ptrace_scope is enabled
* fixing test