TODO:
- commit log
- testcase
This is exposed by some pre-existing test. Need to check which one it
was.
(gdb) interpreter-exec mi "222-break-insert -g i100 foo"
&"../../src/gdb/breakpoint.c:9165: internal-error: find_program_space_for_breakpoint: Assertion `inf != nullptr' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable."
&"\n"
&"----- Backtrace -----\n"
&"Backtrace unavailable\n"
&"---------------------\n"
~"../../src/gdb/breakpoint.c:9165: internal-error: find_program_space_for_breakpoint: Assertion `inf != nullptr' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nQuit this debugging session? (y or n) "
From here:
(top-gdb) bt
#0 internal_error_loc (file=0x555556187e56 "../../src/gdb/breakpoint.c", line=9165, fmt=0x555556187bc8 "%s: Assertion `%s' failed.") at ../../src/gdbsupport/errors.cc:53
#1 0x0000555555791a55 in find_program_space_for_breakpoint (thread=-1, inferior=100) at ../../src/gdb/breakpoint.c:9165
#2 0x0000555555791f96 in create_breakpoint (gdbarch=0x5555568db900, locspec=0x5555567e7100, cond_string=0x0, thread=-1, inferior=100, extra_string=0x0, force_condition=false, parse_extra=0, tempflag=0, type_wanted=bp_breakpoint, ignore_count=0, pending_break_support=AUTO_BOOLEAN_FALSE, ops=0x555556642aa0 <code_breakpoint_ops>, from_tty=0, enabled=1, internal=0, flags=0) at ../../src/gdb/breakpoint.c:9275
#3 0x0000555555bb9d15 in mi_cmd_break_insert_1 (dprintf=0, command=0x5555567e6fd0 "break-insert", argv=0x5555567e7070, argc=3) at ../../src/gdb/mi/mi-cmd-break.c:366
#4 0x0000555555bb9e15 in mi_cmd_break_insert (command=0x5555567e6fd0 "break-insert", argv=0x5555567e7070, argc=3) at ../../src/gdb/mi/mi-cmd-break.c:383
...
Change-Id: Ibde0d4d098bf0b5d7b057e818a77a63c84806a3c
return NULL;
}
+/* See inferior.h. */
+
+bool
+valid_inferior_id (int num)
+{
+ inferior *inf = find_inferior_id (num);
+ return inf != nullptr;
+}
+
struct inferior *
find_inferior_pid (process_stratum_target *targ, int pid)
{
/* Search function to lookup an inferior by GDB 'num'. */
extern struct inferior *find_inferior_id (int num);
+/* Return true if inferior NUM exists, false otherwise. */
+extern bool valid_inferior_id (int num);
+
/* Find an inferior bound to PSPACE, giving preference to the current
inferior. */
extern struct inferior *
#include "linespec.h"
#include <ctype.h>
#include "tracepoint.h"
+#include "inferior.h"
enum
{
break;
case THREAD_GROUP_OPT:
thread_group = mi_parse_thread_group_id (oarg);
+ if (!valid_inferior_id (thread_group))
+ error (_("Non-existent thread-group id '%d'"), thread_group);
break;
case PENDING_OPT:
pending = 1;