X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fexceptions.c;h=7e15551e015e5274cca83fbaeac897b12ee6f69c;hb=13aa5ceb01cc94a0e617f397c0c5434fc22bb1e5;hp=49af8a29859d5750df3cedaa6a9b8920594bb5a3;hpb=e2882c85786571175a0b0bfc3bcd2f14620b1ea3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 49af8a2985..7e15551e01 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -1,6 +1,6 @@ /* Exception (throw catch) mechanism, for GDB, the GNU debugger. - Copyright (C) 1986-2018 Free Software Foundation, Inc. + Copyright (C) 1986-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -27,7 +27,7 @@ #include "serial.h" #include "gdbthread.h" #include "top.h" -#include "common/gdb_optional.h" +#include "gdbsupport/gdb_optional.h" static void print_flush (void) @@ -70,14 +70,14 @@ print_flush (void) } static void -print_exception (struct ui_file *file, struct gdb_exception e) +print_exception (struct ui_file *file, const struct gdb_exception &e) { - /* KLUGE: cagney/2005-01-13: Write the string out one line at a time + /* KLUDGE: cagney/2005-01-13: Write the string out one line at a time as that way the MI's behavior is preserved. */ const char *start; const char *end; - for (start = e.message; start != NULL; start = end) + for (start = e.what (); start != NULL; start = end) { end = strchr (start, '\n'); if (end == NULL) @@ -85,7 +85,7 @@ print_exception (struct ui_file *file, struct gdb_exception e) else { end++; - ui_file_write (file, start, end - start); + file->write (start, end - start); } } fprintf_filtered (file, "\n"); @@ -106,7 +106,7 @@ print_exception (struct ui_file *file, struct gdb_exception e) } void -exception_print (struct ui_file *file, struct gdb_exception e) +exception_print (struct ui_file *file, const struct gdb_exception &e) { if (e.reason < 0 && e.message != NULL) { @@ -116,7 +116,7 @@ exception_print (struct ui_file *file, struct gdb_exception e) } void -exception_fprintf (struct ui_file *file, struct gdb_exception e, +exception_fprintf (struct ui_file *file, const struct gdb_exception &e, const char *prefix, ...) { if (e.reason < 0 && e.message != NULL) @@ -137,15 +137,11 @@ exception_fprintf (struct ui_file *file, struct gdb_exception e, /* See exceptions.h. */ int -exception_print_same (struct gdb_exception e1, struct gdb_exception e2) +exception_print_same (const struct gdb_exception &e1, + const struct gdb_exception &e2) { - const char *msg1 = e1.message; - const char *msg2 = e2.message; - - if (msg1 == NULL) - msg1 = ""; - if (msg2 == NULL) - msg2 = ""; + const char *msg1 = e1.message == nullptr ? "" : e1.what (); + const char *msg2 = e2.message == nullptr ? "" : e2.what (); return (e1.reason == e2.reason && e1.error == e2.error