mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
Change gcc_target_options to return std::string
This patch was inspired by a recent review that recommended using std::string in a new implementation of the gcc_target_options gdbarch function. It changes this function to return std::string rather than an ordinary xmalloc'd string. I believe this caught a latent memory leak in compile.c:get_args. Tested on x86-64 Fedora 29. gdb/ChangeLog 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. Change-Id: I51f61703426a323089e646da8f22320a2cafbc1f
This commit is contained in:
@@ -903,11 +903,12 @@ default_infcall_munmap (CORE_ADDR addr, CORE_ADDR size)
|
||||
/* -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. */
|
||||
|
||||
Reference in New Issue
Block a user