gdb: Don't skip prologue for explicit line breakpoints in assembler
[deliverable/binutils-gdb.git] / gdb / common / common-exceptions.c
index d3c01e53387fb21284608a141cd33261339f7316..9f210250a6f1313d2e90aeba691f307af6d35059 100644 (file)
@@ -21,8 +21,6 @@
 #include "common-exceptions.h"
 #include <forward_list>
 
-const struct gdb_exception exception_none;
-
 /* Possible catcher states.  */
 enum catcher_state {
   /* Initial state, a new catcher has just been created.  */
@@ -47,7 +45,7 @@ struct catcher
   /* Jump buffer pointing back at the exception handler.  */
   jmp_buf buf;
   /* Status buffer belonging to the exception handler.  */
-  struct gdb_exception exception = exception_none;
+  struct gdb_exception exception;
 };
 
 /* Where to go for throw_exception().  */
@@ -168,54 +166,40 @@ exceptions_state_mc_action_iter_1 (void)
 /* Return EXCEPTION to the nearest containing CATCH_SJLJ block.  */
 
 void
-throw_exception_sjlj (struct gdb_exception exception)
+throw_exception_sjlj (const struct gdb_exception &exception)
 {
   /* Jump to the nearest CATCH_SJLJ block, communicating REASON to
      that call via setjmp's return value.  Note that REASON can't be
      zero, by definition in common-exceptions.h.  */
   exceptions_state_mc (CATCH_THROWING);
+  enum return_reason reason = exception.reason;
   catchers.front ().exception = exception;
-  longjmp (catchers.front ().buf, exception.reason);
+  longjmp (catchers.front ().buf, reason);
 }
 
 /* Implementation of throw_exception that uses C++ try/catch.  */
 
-static ATTRIBUTE_NORETURN void
-throw_exception_cxx (struct gdb_exception exception)
+void
+throw_exception (gdb_exception &&exception)
 {
   if (exception.reason == RETURN_QUIT)
-    {
-      gdb_exception_quit ex (exception);
-      throw ex;
-    }
+    throw gdb_exception_quit (std::move (exception));
   else if (exception.reason == RETURN_ERROR)
-    {
-      gdb_exception_error ex (exception);
-      throw ex;
-    }
+    throw gdb_exception_error (std::move (exception));
   else
     gdb_assert_not_reached ("invalid return reason");
 }
 
-void
-throw_exception (struct gdb_exception exception)
-{
-  throw_exception_cxx (exception);
-}
-
 static void ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0)
 throw_it (enum return_reason reason, enum errors error, const char *fmt,
          va_list ap)
 {
-  struct gdb_exception e;
-
-  /* Create the exception.  */
-  e.reason = reason;
-  e.error = error;
-  e.message.reset (new std::string (string_vprintf (fmt, ap)));
-
-  /* Throw the exception.  */
-  throw_exception (e);
+  if (reason == RETURN_QUIT)
+    throw gdb_exception_quit (fmt, ap);
+  else if (reason == RETURN_ERROR)
+    throw gdb_exception_error (error, fmt, ap);
+  else
+    gdb_assert_not_reached ("invalid return reason");
 }
 
 void
This page took 0.025116 seconds and 4 git commands to generate.