diff options
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/compile/compile.c | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e353b3..938b0ac 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2021-03-29 Luis Machado <luis.machado@linaro.org> + + * compile/compile.c (get_args): Don't add empty argv entries. + 2021-03-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gdb: diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index d9c99bf..5c5d517 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -600,8 +600,14 @@ static gdb_argv get_args (const compile_instance *compiler, struct gdbarch *gdbarch) { const char *cs_producer_options; + gdb_argv result; - gdb_argv result (gdbarch_gcc_target_options (gdbarch).c_str ()); + std::string gcc_options = gdbarch_gcc_target_options (gdbarch); + + /* Make sure we have a non-empty set of options, otherwise GCC will + error out trying to look for a filename that is an empty string. */ + if (!gcc_options.empty ()) + result = gdb_argv (gcc_options.c_str ()); cs_producer_options = get_selected_pc_producer_options (); if (cs_producer_options != NULL) |