This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] use error, not internal_error, in dwarf2-frame.c
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Wed, 13 Nov 2013 13:43:12 -0700
- Subject: [PATCH] use error, not internal_error, in dwarf2-frame.c
- Authentication-results: sourceware.org; auth=none
While writing a test case, I happened to introduce a bit of invalid
CFI. This caused gdb to call internal_error.
I think that gdb should not call internal_error for bad DWARF.
Instead, it should simply throw an ordinary exception.
This patch changes dwarf2-frame.c to follow this rule.
No test case; but I could write one for one of the errors if you want.
2013-11-13 Tom Tromey <tromey@redhat.com>
* dwarf2-frame.c (execute_cfa_program, dwarf2_compile_cfa_to_ax)
(dwarf2_frame_cache, dwarf2_frame_prev_register)
(encoding_for_size, read_encoded_value): Use error, not
internal_error.
---
gdb/ChangeLog | 7 +++++++
gdb/dwarf2-frame.c | 20 ++++++++------------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index e05236f..8f55e9f 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -680,8 +680,7 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
break;
default:
- internal_error (__FILE__, __LINE__,
- _("Unknown CFI encountered."));
+ error (_("Unknown CFI encountered."));
}
}
}
@@ -954,7 +953,7 @@ dwarf2_compile_cfa_to_ax (struct agent_expr *expr, struct axs_value *loc,
break;
default:
- internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
+ error (_("Unknown CFA rule."));
}
}
@@ -1112,7 +1111,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
break;
default:
- internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
+ error (_("Unknown CFA rule."));
}
}
if (ex.reason < 0)
@@ -1364,7 +1363,7 @@ dwarf2_frame_prev_register (struct frame_info *this_frame, void **this_cache,
return cache->reg[regnum].loc.fn (this_frame, this_cache, regnum);
default:
- internal_error (__FILE__, __LINE__, _("Unknown register rule."));
+ error (_("Unknown register rule."));
}
}
@@ -1577,7 +1576,7 @@ encoding_for_size (unsigned int size)
case 8:
return DW_EH_PE_udata8;
default:
- internal_error (__FILE__, __LINE__, _("Unsupported address size"));
+ error (_("Unsupported address size"));
}
}
@@ -1593,8 +1592,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
/* GCC currently doesn't generate DW_EH_PE_indirect encodings for
FDE's. */
if (encoding & DW_EH_PE_indirect)
- internal_error (__FILE__, __LINE__,
- _("Unsupported encoding: DW_EH_PE_indirect"));
+ error (_("Unsupported encoding: DW_EH_PE_indirect"));
*bytes_read_ptr = 0;
@@ -1626,8 +1624,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
}
break;
default:
- internal_error (__FILE__, __LINE__,
- _("Invalid or unsupported encoding"));
+ error (_("Invalid or unsupported encoding"));
}
if ((encoding & 0x07) == 0x00)
@@ -1674,8 +1671,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
*bytes_read_ptr += 8;
return (base + bfd_get_signed_64 (unit->abfd, (bfd_byte *) buf));
default:
- internal_error (__FILE__, __LINE__,
- _("Invalid or unsupported encoding"));
+ error (_("Invalid or unsupported encoding"));
}
}
--
1.8.1.4