public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug remote/31303] New: attach calls python hooks which can crash gdb
@ 2024-01-28 0:51 grazfather at gmail dot com
2024-01-28 1:08 ` [Bug remote/31303] " grazfather at gmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: grazfather at gmail dot com @ 2024-01-28 0:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31303
Bug ID: 31303
Summary: attach calls python hooks which can crash gdb
Product: gdb
Version: 13.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: remote
Assignee: unassigned at sourceware dot org
Reporter: grazfather at gmail dot com
Target Milestone: ---
Created attachment 15337
--> https://sourceware.org/bugzilla/attachment.cgi?id=15337&action=edit
stacktrace
On GDB 13.2, when debugging a target using `target extended-remote` with a
continue hook setup which tries to get the selected frame, when I `attach 1`,
this hook is called and gdb crashes with a failed assertion.
../../gdb/thread.c:85: internal-error: inferior_thread: Assertion
`current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
This hook does not seem to be called when I attach to a local process (by pid).
Stack trace is attached.
I reproduce with a blackmagic probe connected to a tty.
.gdbinit:
source hook_continue.py
target extended-remote /dev/cu.usbmodel72AE15F41
monitor tpwr enable
monitor swdp_scan
attach 1
hook_continue.py:
def f(_):
gdb.selected_frame()
gdb.events.cont.connect(f)
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread* [Bug remote/31303] attach calls python hooks which can crash gdb
2024-01-28 0:51 [Bug remote/31303] New: attach calls python hooks which can crash gdb grazfather at gmail dot com
@ 2024-01-28 1:08 ` grazfather at gmail dot com
2024-01-28 17:50 ` ssbssa at sourceware dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: grazfather at gmail dot com @ 2024-01-28 1:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31303
--- Comment #1 from grazfather at gmail dot com ---
I can reproduce with `gdbserver`
root@bc1eb47da197:~/gef# gdbserver --multi localhost:1234 &
[1] 1314
root@bc1eb47da197:~/gef# Listening on port 1234
root@bc1eb47da197:~/gef# /bin/cat &
[2] 1316
root@bc1eb47da197:~/gef# gdb -q --nx --ex "source hook_attach.py" --ex "tar ext
localhost:1234" --ex "attach 1316"
attaching
Remote debugging using localhost:1234
Remote debugging from host 127.0.0.1, port 35800
Attaching to process 1316
Attached; pid = 1316
called
/build/gdb-n1n9Yr/gdb-12.1/gdb/thread.c:85: internal-error: inferior_thread:
Assertion `current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread* [Bug remote/31303] attach calls python hooks which can crash gdb
2024-01-28 0:51 [Bug remote/31303] New: attach calls python hooks which can crash gdb grazfather at gmail dot com
2024-01-28 1:08 ` [Bug remote/31303] " grazfather at gmail dot com
@ 2024-01-28 17:50 ` ssbssa at sourceware dot org
2024-11-23 22:57 ` grazfather at gmail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-28 17:50 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31303
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread* [Bug remote/31303] attach calls python hooks which can crash gdb
2024-01-28 0:51 [Bug remote/31303] New: attach calls python hooks which can crash gdb grazfather at gmail dot com
2024-01-28 1:08 ` [Bug remote/31303] " grazfather at gmail dot com
2024-01-28 17:50 ` ssbssa at sourceware dot org
@ 2024-11-23 22:57 ` grazfather at gmail dot com
2025-08-12 18:48 ` patryk.sondej at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: grazfather at gmail dot com @ 2024-11-23 22:57 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31303
--- Comment #2 from grazfather at gmail dot com ---
Just confirmed that this issue still exists on GDB 15.2.
❯ gdb -q --nx --ex "source hook_attach.py" --ex "tar ext x:1234" --ex "attach
1608809"Remote debugging using x:1234
Attaching to process 1608809
../../gdb/thread.c:87: internal-error: inferior_thread: Assertion
`current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
---------------------
../../gdb/thread.c:87: internal-error: inferior_thread: Assertion
`current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
This is a bug, please report it. For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.
../../gdb/thread.c:87: internal-error: inferior_thread: Assertion
`current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread* [Bug remote/31303] attach calls python hooks which can crash gdb
2024-01-28 0:51 [Bug remote/31303] New: attach calls python hooks which can crash gdb grazfather at gmail dot com
` (2 preceding siblings ...)
2024-11-23 22:57 ` grazfather at gmail dot com
@ 2025-08-12 18:48 ` patryk.sondej at gmail dot com
2025-08-13 0:01 ` sam at gentoo dot org
2025-08-13 0:02 ` sam at gentoo dot org
5 siblings, 0 replies; 7+ messages in thread
From: patryk.sondej at gmail dot com @ 2025-08-12 18:48 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31303
Patryk Sondej <patryk.sondej at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |patryk.sondej at gmail dot com
--- Comment #3 from Patryk Sondej <patryk.sondej at gmail dot com> ---
I can confirm gdb crash.., and there is same issue for "new_thread" event.
My repro:
```
echo "gdb.events.cont.connect(lambda *args: gdb.selected_frame())" >
hook_attach.py
echo "gdb.events.new_thread.connect(lambda *args: gdb.selected_frame())" >>
hook_attach.py
gdbserver --multi localhost:1234 &
gdb -q -nx -ex "source hook_attach.py" -ex "target extended localhost:1234" -ex
"attach 1"
```
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread* [Bug remote/31303] attach calls python hooks which can crash gdb
2024-01-28 0:51 [Bug remote/31303] New: attach calls python hooks which can crash gdb grazfather at gmail dot com
` (3 preceding siblings ...)
2025-08-12 18:48 ` patryk.sondej at gmail dot com
@ 2025-08-13 0:01 ` sam at gentoo dot org
2025-08-13 0:02 ` sam at gentoo dot org
5 siblings, 0 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2025-08-13 0:01 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31303
Sam James <sam at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://github.com/pwndbg/p
| |wndbg/pull/3232
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread* [Bug remote/31303] attach calls python hooks which can crash gdb
2024-01-28 0:51 [Bug remote/31303] New: attach calls python hooks which can crash gdb grazfather at gmail dot com
` (4 preceding siblings ...)
2025-08-13 0:01 ` sam at gentoo dot org
@ 2025-08-13 0:02 ` sam at gentoo dot org
5 siblings, 0 replies; 7+ messages in thread
From: sam at gentoo dot org @ 2025-08-13 0:02 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31303
Sam James <sam at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://github.com/pwndbg/p
| |wndbg/issues/3231
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-13 0:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28 0:51 [Bug remote/31303] New: attach calls python hooks which can crash gdb grazfather at gmail dot com
2024-01-28 1:08 ` [Bug remote/31303] " grazfather at gmail dot com
2024-01-28 17:50 ` ssbssa at sourceware dot org
2024-11-23 22:57 ` grazfather at gmail dot com
2025-08-12 18:48 ` patryk.sondej at gmail dot com
2025-08-13 0:01 ` sam at gentoo dot org
2025-08-13 0:02 ` sam at gentoo dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).