Matthew Schell
Matthew Schell

Reputation: 679

Why is gdb throwing internal errors and telling me that there is a bug?

I'm trying to debug a simple program but gdb is acting up. I get internal errors and then gdb saying that there's a bug. This happens when I try to stop the running program. After sending Keyboard Interrupt to go back to the debugger, I try to exit the whole debugger with quit. But when I do that, I get this (I also include what happens when I go through the questions):

A debugging session is active.

    Inferior 1 [process 1239] will be killed.

Quit anyway? (y or n) y
../../gdb/target.c:2149: internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' 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/target.c:2149: internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Abort trap: 6 (core dumped)

Can someone tell me what is going on, why it's happening, and how to fix it please?

Upvotes: 5

Views: 5986

Answers (2)

John Bollinger
John Bollinger

Reputation: 180266

Can someone tell me what is going on

GDB has already told you:

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.

If a program ever reports that it itself has a bug then it is always right. Even if the behavior it thinks is buggy in fact is not, then the program is buggy to say otherwise.

In this particular case, GDB is reporting the failure of an assertion in its own code. This is definitely an implementation bug, not a bug-reporting bug.

why it's happening

It is likely triggered by something unusual about the program being debugged -- which may be buggy itself -- but that doesn't make it any less a GDB bug.

and how to fix it please?

You are unlikely to be able to fix the gdb bug yourself, but it may be that there is a newer version to which you could upgrade, in which the bug has been fixed.

Upvotes: 6

Employed Russian
Employed Russian

Reputation: 213576

what is going on

There is a bug in your version of GDB.

why it's happening

GDB is a program. Programs have bugs. You managed to hit one of them. Perhaps this one?

and how to fix it please?

If you are on MacOS, update above bug with the simplest program which demonstrates this behavior and hope that some GDB developer will fix that bug soon.

Upvotes: 0

Related Questions