aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/compile/compile.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2751dfe..fbf7c9f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2021-01-09 Tom Tromey <tom@tromey.com>
+ PR compile/23672
+ * compile/compile.c (compile_to_object): Avoid crash when
+ osabi_triplet_regexp returns NULL.
+
+2021-01-09 Tom Tromey <tom@tromey.com>
+
* tracepoint.h (class collection_list) <append_exp>: Take a
std::string.
* tracepoint.c (collection_list::append_exp): Take a std::string.
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index d4c0034..074a865 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -703,7 +703,9 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
const char *arch_rx = gdbarch_gnu_triplet_regexp (gdbarch);
/* Allow triplets with or without vendor set. */
- triplet_rx = std::string (arch_rx) + "(-[^-]*)?-" + os_rx;
+ triplet_rx = std::string (arch_rx) + "(-[^-]*)?-";
+ if (os_rx != nullptr)
+ triplet_rx += os_rx;
compiler->set_triplet_regexp (triplet_rx.c_str ());
}