rx, rl78: Don't use internal_error() in dwarf_reg_to_regnum method
Commit Message
This change fixes a failure found by gdb.dwarf2/dw2-regno-invalid.exp.
It simply substitutes a call to warning() for a call to
internal_error() when an unmapped dwarf register number is
encountered. Additionally, -1 is returned as the result of the
function instead of not returning at all - which is what happened when
internal_error() was used.
gdb/ChangeLog:
* rl78-tdep.c (rl78_dwarf_reg_to_regnum): Don't call
internal_error for bad dwarf numbers; issue a warning instead.
* rx-tdep.c (rx_dwarf_reg_to_regnum): Likewise.
---
gdb/rl78-tdep.c | 7 ++++---
gdb/rx-tdep.c | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
Comments
I'm withdrawing this patch from consideration.
I see that Doug Evans recently pushed a patch which eliminates
internal_error for the files in my patch (and many other files too).
Kevin
On Thu, 29 Oct 2015 21:30:13 -0700
Kevin Buettner <kevinb@redhat.com> wrote:
> This change fixes a failure found by gdb.dwarf2/dw2-regno-invalid.exp.
>
> It simply substitutes a call to warning() for a call to
> internal_error() when an unmapped dwarf register number is
> encountered. Additionally, -1 is returned as the result of the
> function instead of not returning at all - which is what happened when
> internal_error() was used.
>
> gdb/ChangeLog:
>
> * rl78-tdep.c (rl78_dwarf_reg_to_regnum): Don't call
> internal_error for bad dwarf numbers; issue a warning instead.
> * rx-tdep.c (rx_dwarf_reg_to_regnum): Likewise.
> ---
> gdb/rl78-tdep.c | 7 ++++---
> gdb/rx-tdep.c | 7 ++++---
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
> index c97e7c8..a792af3 100644
> --- a/gdb/rl78-tdep.c
> +++ b/gdb/rl78-tdep.c
> @@ -1217,9 +1217,10 @@ rl78_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
> else if (reg == 37)
> return RL78_PC_REGNUM;
> else
> - internal_error (__FILE__, __LINE__,
> - _("Undefined dwarf2 register mapping of reg %d"),
> - reg);
> + {
> + warning (_("Unmapped DWARF Register #%d encountered."), reg);
> + return -1;
> + }
> }
>
> /* Implement the `register_sim_regno' gdbarch method. */
> diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
> index a95c6d3..8627003 100644
> --- a/gdb/rx-tdep.c
> +++ b/gdb/rx-tdep.c
> @@ -1011,9 +1011,10 @@ rx_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
> else if (reg == 17)
> return RX_PC_REGNUM;
> else
> - internal_error (__FILE__, __LINE__,
> - _("Undefined dwarf2 register mapping of reg %d"),
> - reg);
> + {
> + warning (_("Unmapped DWARF Register #%d encountered."), reg);
> + return -1;
> + }
> }
>
> /* Allocate and initialize a gdbarch object. */
>
@@ -1217,9 +1217,10 @@ rl78_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
else if (reg == 37)
return RL78_PC_REGNUM;
else
- internal_error (__FILE__, __LINE__,
- _("Undefined dwarf2 register mapping of reg %d"),
- reg);
+ {
+ warning (_("Unmapped DWARF Register #%d encountered."), reg);
+ return -1;
+ }
}
/* Implement the `register_sim_regno' gdbarch method. */
@@ -1011,9 +1011,10 @@ rx_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
else if (reg == 17)
return RX_PC_REGNUM;
else
- internal_error (__FILE__, __LINE__,
- _("Undefined dwarf2 register mapping of reg %d"),
- reg);
+ {
+ warning (_("Unmapped DWARF Register #%d encountered."), reg);
+ return -1;
+ }
}
/* Allocate and initialize a gdbarch object. */