Don't pass empty options to GCC
[deliverable/binutils-gdb.git] / gdb / compile / compile.c
index d9c99bf432830b646a4d96cb7ce628fb3b511a75..5c5d51782c902e05a0bd33412089bfa7b290f9c2 100644 (file)
@@ -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)
This page took 0.023976 seconds and 4 git commands to generate.