Discussion:
[Bug cli/23340] New: crash in "run" on Mac OS when gdb is not code-signed
tromey at sourceware dot org
2018-06-26 16:29:04 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23340

Bug ID: 23340
Summary: crash in "run" on Mac OS when gdb is not code-signed
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: cli
Assignee: unassigned at sourceware dot org
Reporter: tromey at sourceware dot org
Target Milestone: ---

I tried "gdb /bin/ls" on OS X.
However, I hadn't code-signed gdb.

When I did "run", gdb crashed:

thread.c:93: internal-error: struct thread_info *inferior_thread(): Assertion
`tp' failed.

The crash is happening because darwin-nat.c:darwin_attach_pid throws
an exception. Then, bpstat_clear_actions is called via a cleanup.
This in turn calls inferior_thread, which asserts.

Offhand I am not sure what the fix should be.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-06-28 17:58:07 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23340

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
cvs-commit at gcc dot gnu.org
2018-07-03 15:29:16 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23340

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <***@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a50c11c666e07b922d64aa5bb2747f180ce17c03

commit a50c11c666e07b922d64aa5bb2747f180ce17c03
Author: Tom Tromey <***@tromey.com>
Date: Thu Jun 28 11:57:39 2018 -0600

Fix crash in "run" on macOS when gdb is not signed

On macOS, when gdb is not code-signed, it will throw an exception from
darwin_attach_pid. However, gdb also then crashes:

thread.c:93: internal-error: struct thread_info *inferior_thread():
Assertion `tp' failed.

I think the problem here is that darwin_attach_pid does not clean up
inferior_ptid and inf->pid on failure. This leads to a situation
where gdb tries to find a thread, but cannot.

In other cases, gdb would mourn the inferior at this point; but here
this is not possible because the target has not been pushed. Instead
this patch works by simply updating the inferior and inferior_ptid on
failure.

Tested by building an unsigned gdb on macOS and trying to run an
inferior.

gdb/ChangeLog
2018-07-03 Tom Tromey <***@tromey.com>

PR cli/23340:
* darwin-nat.c (darwin_attach_pid): Reset inferior and
inferior_ptid on error.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-07-03 15:30:03 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23340

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |8.2

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...