Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH] use error, not internal_error, in dwarf2-frame.c
Date: Wed, 13 Nov 2013 20:51:00 -0000	[thread overview]
Message-ID: <1384375392-32110-1-git-send-email-tromey@redhat.com> (raw)

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"));
     }
 }
 \f
-- 
1.8.1.4


             reply	other threads:[~2013-11-13 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13 20:51 Tom Tromey [this message]
2013-11-14  9:52 ` Joel Brobecker
2013-11-14 12:26 ` Andrew Burgess
2013-11-14 18:11   ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384375392-32110-1-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox