aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/gdbserver/ChangeLog30
-rw-r--r--gdb/gdbserver/inferiors.c4
-rw-r--r--gdb/gdbserver/linux-low.c13
-rw-r--r--gdb/gdbserver/linux-x86-low.c6
-rw-r--r--gdb/gdbserver/mem-break.c3
-rw-r--r--gdb/gdbserver/regcache.c13
-rw-r--r--gdb/gdbserver/tdesc.c3
-rw-r--r--gdb/gdbserver/thread-db.c9
-rw-r--r--gdb/gdbserver/tracepoint.c88
9 files changed, 117 insertions, 52 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 8d42982..778500f 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,33 @@
+2014-08-28 Gary Benson <gbenson@redhat.com>
+
+ * inferiors.c (get_thread_process): Replace check with gdb_assert.
+ * linux-low.c (linux_wait_for_event_filtered): Replace fatal with
+ internal_error.
+ (linux_resume_one_lwp): Likewise.
+ * linux-x86-low.c (x86_siginfo_fixup): Replace checks with
+ gdb_assert.
+ * mem-break.c (raw_bkpt_type_to_target_hw_bp_type): Replace fatal
+ with internal_error.
+ * regcache.c (get_thread_regcache): Replace check with gdb_assert.
+ (init_register_cache): Replace fatal with gdb_assert_not_reached.
+ (find_register_by_name): Replace fatal with internal_error.
+ (find_regno): Likewise.
+ * tdesc.c (init_target_desc): Replace check with gdb_assert.
+ * thread-db.c (thread_db_create_event): Likewise.
+ (thread_db_load_search): Likewise.
+ (try_thread_db_load_1): Likewise.
+ * tracepoint.c (get_jump_space_head): Replace fatal with
+ internal_error.
+ (claim_trampoline_space): Likewise.
+ (have_fast_tracepoint_trampoline_buffer): Likewise.
+ (cmd_qtstart): Likewise.
+ (stop_tracing): Likewise.
+ (fast_tracepoint_collecting): Likewise.
+ (target_malloc): Likewise.
+ (download_tracepoint): Likewise.
+ (download_trace_state_variables): Replace check with gdb_assert.
+ (upload_fast_traceframes): Replace fatal with internal_error.
+
2014-08-19 Tom Tromey <tromey@redhat.com>
Gary Benson <gbenson@redhat.com>
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index 608a997..29a07e0 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -355,8 +355,6 @@ get_thread_process (struct thread_info *thread)
struct process_info *
current_process (void)
{
- if (current_inferior == NULL)
- fatal ("Current inferior requested, but current_inferior is NULL\n");
-
+ gdb_assert (current_inferior != NULL);
return get_thread_process (current_inferior);
}
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 543987a..f8b3e68 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -2026,7 +2026,11 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
if (requested_child->suspended
&& requested_child->status_pending_p)
- fatal ("requesting an event out of a suspended child?");
+ {
+ internal_error (__FILE__, __LINE__,
+ "requesting an event out of a"
+ " suspended child?");
+ }
if (requested_child->status_pending_p)
{
@@ -3432,8 +3436,11 @@ linux_resume_one_lwp (struct lwp_info *lwp,
if (can_hardware_single_step ())
step = 1;
else
- fatal ("moving out of jump pad single-stepping"
- " not implemented on this target");
+ {
+ internal_error (__FILE__, __LINE__,
+ "moving out of jump pad single-stepping"
+ " not implemented on this target");
+ }
/* Postpone any pending signal. It was enqueued above. */
signal = 0;
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 7a8a473..a47fcbe 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -1227,8 +1227,7 @@ x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
/* Is the inferior 32-bit? If so, then fixup the siginfo object. */
if (!is_64bit_tdesc ())
{
- if (sizeof (siginfo_t) != sizeof (compat_siginfo_t))
- fatal ("unexpected difference in siginfo");
+ gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
if (direction == 0)
compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
@@ -1240,8 +1239,7 @@ x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
/* No fixup for native x32 GDB. */
else if (!is_elf64 && sizeof (void *) == 8)
{
- if (sizeof (siginfo_t) != sizeof (compat_x32_siginfo_t))
- fatal ("unexpected difference in siginfo");
+ gdb_assert (sizeof (siginfo_t) == sizeof (compat_x32_siginfo_t));
if (direction == 0)
compat_x32_siginfo_from_siginfo ((struct compat_x32_siginfo *) inf,
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index 2ce3ab2..07f9b20 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -189,7 +189,8 @@ raw_bkpt_type_to_target_hw_bp_type (enum raw_bkpt_type raw_type)
case raw_bkpt_type_access_wp:
return hw_access;
default:
- fatal ("bad raw breakpoing type %d", (int) raw_type);
+ internal_error (__FILE__, __LINE__,
+ "bad raw breakpoint type %d", (int) raw_type);
}
}
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 916a479..fda2069 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -41,8 +41,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
{
struct process_info *proc = get_thread_process (thread);
- if (proc->tdesc == NULL)
- fatal ("no target description");
+ gdb_assert (proc->tdesc != NULL);
regcache = new_register_cache (proc->tdesc);
set_inferior_regcache_data (thread, regcache);
@@ -126,7 +125,7 @@ init_register_cache (struct regcache *regcache,
regcache->register_status = xcalloc (1, tdesc->num_registers);
gdb_assert (REG_UNAVAILABLE == 0);
#else
- fatal ("init_register_cache: can't allocate memory from the heap");
+ gdb_assert_not_reached ("can't allocate memory from the heap");
#endif
}
else
@@ -239,8 +238,8 @@ find_register_by_name (const struct target_desc *tdesc, const char *name)
for (i = 0; i < tdesc->num_registers; i++)
if (strcmp (name, tdesc->reg_defs[i].name) == 0)
return &tdesc->reg_defs[i];
- fatal ("Unknown register %s requested", name);
- return 0;
+ internal_error (__FILE__, __LINE__, "Unknown register %s requested",
+ name);
}
int
@@ -251,8 +250,8 @@ find_regno (const struct target_desc *tdesc, const char *name)
for (i = 0; i < tdesc->num_registers; i++)
if (strcmp (name, tdesc->reg_defs[i].name) == 0)
return i;
- fatal ("Unknown register %s requested", name);
- return -1;
+ internal_error (__FILE__, __LINE__, "Unknown register %s requested",
+ name);
}
struct reg *
diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c
index 9710128..0c56f5c 100644
--- a/gdb/gdbserver/tdesc.c
+++ b/gdb/gdbserver/tdesc.c
@@ -35,8 +35,7 @@ init_target_desc (struct target_desc *tdesc)
/* Make sure PBUFSIZ is large enough to hold a full register
packet. */
- if (2 * tdesc->registers_size + 32 > PBUFSIZ)
- fatal ("Register packet size exceeds PBUFSIZ.");
+ gdb_assert (2 * tdesc->registers_size + 32 <= PBUFSIZ);
}
#ifndef IN_PROCESS_AGENT
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index d69c9e4..eabfe20 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -193,8 +193,7 @@ thread_db_create_event (CORE_ADDR where)
struct lwp_info *lwp;
struct thread_db *thread_db = current_process ()->private->thread_db;
- if (thread_db->td_ta_event_getmsg_p == NULL)
- fatal ("unexpected thread_db->td_ta_event_getmsg_p == NULL");
+ gdb_assert (thread_db->td_ta_event_getmsg_p != NULL);
if (debug_threads)
debug_printf ("Thread creation event.\n");
@@ -561,8 +560,7 @@ thread_db_load_search (void)
struct thread_db *tdb;
struct process_info *proc = current_process ();
- if (proc->private->thread_db != NULL)
- fatal ("unexpected: proc->private->thread_db != NULL");
+ gdb_assert (proc->private->thread_db == NULL);
tdb = xcalloc (1, sizeof (*tdb));
proc->private->thread_db = tdb;
@@ -607,8 +605,7 @@ try_thread_db_load_1 (void *handle)
struct thread_db *tdb;
struct process_info *proc = current_process ();
- if (proc->private->thread_db != NULL)
- fatal ("unexpected: proc->private->thread_db != NULL");
+ gdb_assert (proc->private->thread_db == NULL);
tdb = xcalloc (1, sizeof (*tdb));
proc->private->thread_db = tdb;
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 302b9c7..a9a4062 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -2942,7 +2942,10 @@ get_jump_space_head (void)
{
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer,
&gdb_jump_pad_head))
- fatal ("error extracting jump_pad_buffer");
+ {
+ internal_error (__FILE__, __LINE__,
+ "error extracting jump_pad_buffer");
+ }
}
return gdb_jump_pad_head;
@@ -2973,15 +2976,15 @@ claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline)
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
&trampoline_buffer_tail))
{
- fatal ("error extracting trampoline_buffer");
- return 0;
+ internal_error (__FILE__, __LINE__,
+ "error extracting trampoline_buffer");
}
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
&trampoline_buffer_head))
{
- fatal ("error extracting trampoline_buffer_end");
- return 0;
+ internal_error (__FILE__, __LINE__,
+ "error extracting trampoline_buffer_end");
}
}
@@ -3016,8 +3019,8 @@ have_fast_tracepoint_trampoline_buffer (char *buf)
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
&trampoline_end))
{
- fatal ("error extracting trampoline_buffer_end");
- return 0;
+ internal_error (__FILE__, __LINE__,
+ "error extracting trampoline_buffer_end");
}
if (buf)
@@ -3027,8 +3030,8 @@ have_fast_tracepoint_trampoline_buffer (char *buf)
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_error,
&errbuf))
{
- fatal ("error extracting errbuf");
- return 0;
+ internal_error (__FILE__, __LINE__,
+ "error extracting errbuf");
}
read_inferior_memory (errbuf, (unsigned char *) buf, 100);
@@ -3370,14 +3373,25 @@ cmd_qtstart (char *packet)
if (agent_loaded_p ())
{
if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 1))
- fatal ("Error setting tracing variable in lib");
+ {
+ internal_error (__FILE__, __LINE__,
+ "Error setting tracing variable in lib");
+ }
if (write_inferior_data_pointer (ipa_sym_addrs.addr_stopping_tracepoint,
0))
- fatal ("Error clearing stopping_tracepoint variable in lib");
+ {
+ internal_error (__FILE__, __LINE__,
+ "Error clearing stopping_tracepoint variable"
+ " in lib");
+ }
if (write_inferior_integer (ipa_sym_addrs.addr_trace_buffer_is_full, 0))
- fatal ("Error clearing trace_buffer_is_full variable in lib");
+ {
+ internal_error (__FILE__, __LINE__,
+ "Error clearing trace_buffer_is_full variable"
+ " in lib");
+ }
stop_tracing_bkpt = set_breakpoint_at (ipa_sym_addrs.addr_stop_tracing,
stop_tracing_handler);
@@ -3429,7 +3443,10 @@ stop_tracing (void)
if (agent_loaded_p ())
{
if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 0))
- fatal ("Error clearing tracing variable in lib");
+ {
+ internal_error (__FILE__, __LINE__,
+ "Error clearing tracing variable in lib");
+ }
}
tracing_stop_time = get_timestamp ();
@@ -5607,17 +5624,29 @@ fast_tracepoint_collecting (CORE_ADDR thread_area,
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer,
&ipa_gdb_jump_pad_buffer))
- fatal ("error extracting `gdb_jump_pad_buffer'");
+ {
+ internal_error (__FILE__, __LINE__,
+ "error extracting `gdb_jump_pad_buffer'");
+ }
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer_end,
&ipa_gdb_jump_pad_buffer_end))
- fatal ("error extracting `gdb_jump_pad_buffer_end'");
+ {
+ internal_error (__FILE__, __LINE__,
+ "error extracting `gdb_jump_pad_buffer_end'");
+ }
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
&ipa_gdb_trampoline_buffer))
- fatal ("error extracting `gdb_trampoline_buffer'");
+ {
+ internal_error (__FILE__, __LINE__,
+ "error extracting `gdb_trampoline_buffer'");
+ }
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
&ipa_gdb_trampoline_buffer_end))
- fatal ("error extracting `gdb_trampoline_buffer_end'");
+ {
+ internal_error (__FILE__, __LINE__,
+ "error extracting `gdb_trampoline_buffer_end'");
+ }
if (ipa_gdb_jump_pad_buffer <= stop_pc
&& stop_pc < ipa_gdb_jump_pad_buffer_end)
@@ -5937,7 +5966,10 @@ target_malloc (ULONGEST size)
/* We have the pointer *address*, need what it points to. */
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_tp_heap_buffer,
&target_tp_heap))
- fatal ("could get target heap head pointer");
+ {
+ internal_error (__FILE__, __LINE__,
+ "couldn't get target heap head pointer");
+ }
}
ptr = target_tp_heap;
@@ -6161,7 +6193,10 @@ download_tracepoint (struct tracepoint *tpoint)
if (read_inferior_data_pointer (tp_prev->obj_addr_on_target
+ offsetof (struct tracepoint, next),
&tp_prev_target_next_addr))
- fatal ("error reading `tp_prev->next'");
+ {
+ internal_error (__FILE__, __LINE__,
+ "error reading `tp_prev->next'");
+ }
/* tpoint->next = tp_prev->next */
write_inferior_data_ptr (tpoint->obj_addr_on_target
@@ -6238,10 +6273,7 @@ download_trace_state_variables (void)
name_addr);
}
- if (tsv->getter != NULL)
- {
- fatal ("what to do with these?");
- }
+ gdb_assert (tsv->getter == NULL);
}
if (prev_ptr != 0)
@@ -6414,9 +6446,13 @@ upload_fast_traceframes (void)
error ("Uploading: couldn't read traceframe at %s\n", paddress (tf));
if (ipa_tframe.tpnum == 0)
- fatal ("Uploading: No (more) fast traceframes, but "
- "ipa_traceframe_count == %u??\n",
- ipa_traceframe_write_count - ipa_traceframe_read_count);
+ {
+ internal_error (__FILE__, __LINE__,
+ "Uploading: No (more) fast traceframes, but"
+ " ipa_traceframe_count == %u??\n",
+ ipa_traceframe_write_count
+ - ipa_traceframe_read_count);
+ }
/* Note that this will be incorrect for multi-location
tracepoints... */