+2019-10-15 Tom Tromey <tromey@adacore.com>
+
+ * gdbarch.h, gdbarch.c: Rebuild.
+ * gdbarch.sh (gcc_target_options): Change return type to
+ std::string.
+ * compile/compile.c (get_args): Update.
+ * nios2-tdep.c (nios2_gcc_target_options): Return std::string.
+ * arm-linux-tdep.c (arm_linux_gcc_target_options): Return
+ std::string.
+ * aarch64-linux-tdep.c (aarch64_linux_gcc_target_options): Return
+ std::string.
+ * arch-utils.c (default_gcc_target_options): Return std::string.
+ * arch-utils.h (default_gcc_target_options): Return std::string.
+ * s390-tdep.c (s390_gcc_target_options): Return std::string.
+
2019-10-15 Christian Biesinger <cbiesinger@google.com>
* breakpoint.c (breakpoint_chain): Make static.
/* Implement the "gcc_target_options" gdbarch method. */
-static char *
+static std::string
aarch64_linux_gcc_target_options (struct gdbarch *gdbarch)
{
/* GCC doesn't know "-m64". */
- return NULL;
+ return {};
}
static void
/* -mcmodel=large is used so that no GOT (Global Offset Table) is needed to be
created in inferior memory by GDB (normally it is set by ld.so). */
-char *
+std::string
default_gcc_target_options (struct gdbarch *gdbarch)
{
- return xstrprintf ("-m%d%s", gdbarch_ptr_bit (gdbarch),
- gdbarch_ptr_bit (gdbarch) == 64 ? " -mcmodel=large" : "");
+ return string_printf ("-m%d%s", gdbarch_ptr_bit (gdbarch),
+ (gdbarch_ptr_bit (gdbarch) == 64
+ ? " -mcmodel=large" : ""));
}
/* gdbarch gnu_triplet_regexp method. */
extern CORE_ADDR default_infcall_mmap (CORE_ADDR size, unsigned prot);
extern void default_infcall_munmap (CORE_ADDR addr, CORE_ADDR size);
-extern char *default_gcc_target_options (struct gdbarch *gdbarch);
+extern std::string default_gcc_target_options (struct gdbarch *gdbarch);
extern const char *default_gnu_triplet_regexp (struct gdbarch *gdbarch);
extern int default_addressable_memory_unit_size (struct gdbarch *gdbarch);
/* Implement the gcc_target_options gdbarch method. */
-static char *
+static std::string
arm_linux_gcc_target_options (struct gdbarch *gdbarch)
{
/* GCC doesn't know "-m32". */
- return NULL;
+ return {};
}
static void
int argc_compiler;
char **argv_compiler;
- build_argc_argv (gdbarch_gcc_target_options (gdbarch),
+ build_argc_argv (gdbarch_gcc_target_options (gdbarch).c_str (),
argcp, argvp);
cs_producer_options = get_selected_pc_producer_options ();
gdbarch->infcall_munmap = infcall_munmap;
}
-char *
+std::string
gdbarch_gcc_target_options (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
/* Return string (caller has to use xfree for it) with options for GCC
to produce code for this target, typically "-m64", "-m32" or "-m31".
These options are put before CU's DW_AT_producer compilation options so that
- they can override it. Method may also return NULL. */
+ they can override it. */
-typedef char * (gdbarch_gcc_target_options_ftype) (struct gdbarch *gdbarch);
-extern char * gdbarch_gcc_target_options (struct gdbarch *gdbarch);
+typedef std::string (gdbarch_gcc_target_options_ftype) (struct gdbarch *gdbarch);
+extern std::string gdbarch_gcc_target_options (struct gdbarch *gdbarch);
extern void set_gdbarch_gcc_target_options (struct gdbarch *gdbarch, gdbarch_gcc_target_options_ftype *gcc_target_options);
/* Return a regular expression that matches names used by this
# Return string (caller has to use xfree for it) with options for GCC
# to produce code for this target, typically "-m64", "-m32" or "-m31".
# These options are put before CU's DW_AT_producer compilation options so that
-# they can override it. Method may also return NULL.
-m;char *;gcc_target_options;void;;;default_gcc_target_options;;0
+# they can override it.
+m;std::string;gcc_target_options;void;;;default_gcc_target_options;;0
# Return a regular expression that matches names used by this
# architecture in GNU configury triplets. The result is statically
}
/* Implement the gcc_target_options gdbarch method. */
-static char *
+static std::string
nios2_gcc_target_options (struct gdbarch *gdbarch)
{
/* GCC doesn't know "-m32". */
- return NULL;
+ return {};
}
/* Initialize the Nios II gdbarch. */
/* Implement gdbarch_gcc_target_options. GCC does not know "-m32" or
"-mcmodel=large". */
-static char *
+static std::string
s390_gcc_target_options (struct gdbarch *gdbarch)
{
- return xstrdup (gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31");
+ return gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31";
}
/* Implement gdbarch_gnu_triplet_regexp. Target triplets are "s390-*"