It turns out that GDB's `info proc mappings` reads $PID instead of $TID and there are cases where the /proc/$pid/maps file renders no content, for example when the main thread of a process exitted.
This then causes us to fail to render memory mappings and falling back to memory maps exploration which is actually bugged.
This was found out by a flaky test which I reported initially as broken Arch Linux CI build: https://github.com/pwndbg/pwndbg/issues/1976 but it turned out it is two bugs:
1) us not taking `/proc/$tid/maps` into account instead of `$pid`
2) vmmap exploration having a recursion error
This commit fixes the former and the latter is still unfixed.
I also reported this GDB behavior to their bugzilla in https://sourceware.org/bugzilla/show_bug.cgi?id=31207 - not sure if this is going to be considered a bug or a "correct behavior" but lets see.
This commit reverts a previous commit that removed check against the frame register.
* FIX: revert c37030633a as pwndbg.gdblib.regs.frame can be None
The reason for that is that when you debug Chrome on arm64 using a gdbserver, we may end up with a "Unknown register type: None" message printed out due to lack of this check.
The stacktrace for this message can be found below:
```
Unknown register type: None
Traceback (most recent call last):
File "/home/pwndbg/pwndbg/commands/__init__.py", line 181, in __call__
return self.function(*args, **kwargs)
File "/home/pwndbg/pwndbg/commands/__init__.py", line 328, in _OnlyWhenRunning
return function(*a, **kw)
File "/home/pwndbg/pwndbg/commands/telescope.py", line 197, in telescope
bp = pwndbg.gdblib.regs[pwndbg.gdblib.regs.frame]
File "/home/pwndbg/pwndbg/lib/cache.py", line 138, in decorator
value = func(*a, **kw)
File "/home/pwndbg/pwndbg/gdblib/regs.py", line 66, in __getitem__
```
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
* FIX: Upgraded devcontainer image to bookworm and added some useful extensions
* FIX: use ubuntu jammy image and add .gdbinit file in docker container user home folder not root
* FIX: Switch to root users as other tests are failing with permission denied
* FIX: update devcontainer file to remove unnecessary extensions, and unused dot files as we removed the extensions
* FIX: only add the .gdbinit file if it does not exists
* FIX: minor change
* Update Dockerfile
* Update .devcontainer/devcontainer.json
---------
Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
Hopefully fixes#1947 by fetching stacks only when they are used instead
of doing it on each stop event. It will also first try to compute stacks
dictionary based on vmmap and if it fallbacks to exploring stacks if
vmmap is not present.
* [WIP] Port gdb-tests from bash to python
* Use threads instead of processes
* Port gdb tests to python
* Linting
* Fix coverage "again"
* Remove bash tests
---------
Co-authored-by: intrigus <abc123zeus@live.de>
Currently the only way to circumvent the venv checks is setting an
environment variable. However, this is not sufficient for distro site
packaging:
- if the variable is not set, its a rather bad and unexpected user
experience to somehow magically set PWNDBG_PLEASE_SKIP_VENV
- if the variable is set globally as login shell profile, this means
skipping venv is always enforced which means if gdb is loaded with a
pwndbg gdbinit.py from a git clone, its rather unexpected to skip the
venv
This patch checks for a `.skip-venv` file alongside the `gdbinit.py`
which means for site installations that use de-vendored dependencies
like during distro packaging, this file can simply be touched. It would
skip the venv when pwndbg is loaded from the site installation but at
the same time would not skip loading the venv when pwndbg is started
from a git clone.