aboutsummaryrefslogtreecommitdiff
path: root/gdb/jit.c
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@google.com>2019-09-09 12:55:39 -0500
committerChristian Biesinger <cbiesinger@google.com>2019-09-11 16:31:36 -0500
commitf2aec7f6d149c8a534e8246b0d3a50038864fa2d (patch)
tree66de5d6e1111cd053eade24c57ecc45283406f7c /gdb/jit.c
parent9224a01377868604ce4a7eb9c0d97736f7349dcd (diff)
downloadbinutils-f2aec7f6d149c8a534e8246b0d3a50038864fa2d.zip
binutils-f2aec7f6d149c8a534e8246b0d3a50038864fa2d.tar.gz
binutils-f2aec7f6d149c8a534e8246b0d3a50038864fa2d.tar.bz2
Make relocate_{path,gdb_directory} return std::string
This simplifies memory management. I've also changed some global variables to std::string accordingly (which store the result of these functions), but not all because some are used with add_setshow_optional_filename_cmd which requires a char*. gdb/ChangeLog: 2019-09-11 Christian Biesinger <cbiesinger@google.com> * auto-load.c (auto_load_expand_dir_vars): Update. * defs.h (gdb_datadir): Change to std::string. (python_libdir): Likewise. (relocate_gdb_directory): Change return type to std::string. * guile/guile.c (gdbscm_data_directory): Update. (initialize_scheme_side): Update. * jit.c (jit_reader_dir): Change to std::string. (jit_reader_load_command): Update. * main.c (gdb_datadir): Change to std::string. (python_libdir): Likewise. (set_gdb_data_directory): Update. (relocate_path): Change to return std::string. (relocate_gdb_directory): Change to return std::string. (relocate_gdbinit_path_maybe_in_datadir): Update. (captured_main_1): Update. * python/python.c (do_start_initialization): Update. * top.c (show_gdb_datadir): Update. * xml-syscall.c (xml_init_syscalls_info): Update. (init_syscalls_info): Update.
Diffstat (limited to 'gdb/jit.c')
-rw-r--r--gdb/jit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/jit.c b/gdb/jit.c
index 5fef037..4722d6c 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -42,7 +42,7 @@
#include "readline/tilde.h"
#include "completer.h"
-static const char *jit_reader_dir = NULL;
+static std::string jit_reader_dir;
static const struct objfile_data *jit_objfile_data;
@@ -216,7 +216,7 @@ jit_reader_load_command (const char *args, int from_tty)
error (_("JIT reader already loaded. Run jit-reader-unload first."));
if (!IS_ABSOLUTE_PATH (file.get ()))
- file.reset (xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING,
+ file.reset (xstrprintf ("%s%s%s", jit_reader_dir.c_str (), SLASH_STRING,
file.get ()));
loaded_jit_reader = jit_reader_load (file.get ());