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
  2024-01-28 17:50 ` ssbssa at sourceware dot org
  0 siblings, 2 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2024-01-28 17:50 UTC | newest]

Thread overview: 3+ 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

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).