aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-10-17 17:12:20 +0100
committerPedro Alves <pedro@palves.net>2022-10-19 15:32:36 +0100
commitf34652de0b68c4ee3050828b43a2839b852b5821 (patch)
tree851720f14f2ac022c3e82428254edf161d619e91 /gdb/infrun.c
parent5c831a3c7f3ca98d6aba1200353311e1a1f84c70 (diff)
downloadgdb-f34652de0b68c4ee3050828b43a2839b852b5821.zip
gdb-f34652de0b68c4ee3050828b43a2839b852b5821.tar.gz
gdb-f34652de0b68c4ee3050828b43a2839b852b5821.tar.bz2
internal_error: remove need to pass __FILE__/__LINE__
Currently, every internal_error call must be passed __FILE__/__LINE__ explicitly, like: internal_error (__FILE__, __LINE__, "foo %d", var); The need to pass in explicit __FILE__/__LINE__ is there probably because the function predates widespread and portable variadic macros availability. We can use variadic macros nowadays, and in fact, we already use them in several places, including the related gdb_assert_not_reached. So this patch renames the internal_error function to something else, and then reimplements internal_error as a variadic macro that expands __FILE__/__LINE__ itself. The result is that we now should call internal_error like so: internal_error ("foo %d", var); Likewise for internal_warning. The patch adjusts all calls sites. 99% of the adjustments were done with a perl/sed script. The non-mechanical changes are in gdbsupport/errors.h, gdbsupport/gdb_assert.h, and gdb/gdbarch.py. Approved-By: Simon Marchi <simon.marchi@efficios.com> Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index cdfe023..2e462be 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -847,8 +847,7 @@ follow_fork ()
/* Nothing to follow. */
break;
default:
- internal_error (__FILE__, __LINE__,
- "Unexpected pending_follow.kind %d\n",
+ internal_error ("Unexpected pending_follow.kind %d\n",
tp->pending_follow.kind ());
break;
}
@@ -2007,8 +2006,7 @@ start_step_over (void)
|| tp->resumed ()
|| tp->executing ())
{
- internal_error (__FILE__, __LINE__,
- "[%s] has inconsistent state: "
+ internal_error ("[%s] has inconsistent state: "
"trap_expected=%d, resumed=%d, executing=%d\n",
tp->ptid.to_string ().c_str (),
tp->control.trap_expected,
@@ -5515,8 +5513,7 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
}
- internal_error (__FILE__, __LINE__,
- _("unhandled stop_soon: %d"), (int) stop_soon);
+ internal_error (_("unhandled stop_soon: %d"), (int) stop_soon);
}
case TARGET_WAITKIND_SPURIOUS:
@@ -5967,8 +5964,7 @@ restart_threads (struct thread_info *event_thread, inferior *inf)
above. */
if (thread_still_needs_step_over (tp))
{
- internal_error (__FILE__, __LINE__,
- "thread [%s] needs a step-over, but not in "
+ internal_error ("thread [%s] needs a step-over, but not in "
"step-over queue\n",
tp->ptid.to_string ().c_str ());
}
@@ -8492,7 +8488,7 @@ print_stop_location (const target_waitstatus &ws)
do_frame_printing = 0;
break;
default:
- internal_error (__FILE__, __LINE__, _("Unknown value."));
+ internal_error (_("Unknown value."));
}
/* The behavior of this routine with respect to the source
@@ -9523,8 +9519,7 @@ show_exec_direction_func (struct ui_file *out, int from_tty,
gdb_printf (out, _("Reverse.\n"));
break;
default:
- internal_error (__FILE__, __LINE__,
- _("bogus execution_direction value: %d"),
+ internal_error (_("bogus execution_direction value: %d"),
(int) execution_direction);
}
}