summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraburgess <aburgess>2013-09-18 11:41:38 +0000
committeraburgess <aburgess>2013-09-18 11:41:38 +0000
commit189e4ff0f9ca44e68ac2cebf15a674ce88955920 (patch)
treec47fc7950305a6e1f0129c78a15bdcfa6f487de6
parent3821a0aa66a5c5513cf30ca594707c46cd68a421 (diff)
downloadgdb-189e4ff0f9ca44e68ac2cebf15a674ce88955920.tar.gz
Add new function to access gdb_program_name.
https://sourceware.org/ml/gdb-patches/2013-09/msg00225.html gdb/ChangeLog * main.h (get_gdb_program_name): Add declaration. * main.c (get_gdb_program_name): Add definition.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/main.c7
-rw-r--r--gdb/main.h6
3 files changed, 18 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f2077371454..abb83ab4874 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-18 Andrew Burgess <aburgess@broadcom.com>
+
+ * main.h (get_gdb_program_name): Add declaration.
+ * main.c (get_gdb_program_name): Add definition.
+
2013-09-17 Doug Evans <dje@google.com>
* dwarf2read.c: Move definitions of complaint functions to after
diff --git a/gdb/main.c b/gdb/main.c
index 11f4b03a3da..3e0e1fe8c9c 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -98,6 +98,13 @@ int return_child_result_value = -1;
/* GDB as it has been invoked from the command line (i.e. argv[0]). */
static char *gdb_program_name;
+/* Return read only pointer to GDB_PROGRAM_NAME. */
+const char *
+get_gdb_program_name (void)
+{
+ return gdb_program_name;
+}
+
static void print_gdb_help (struct ui_file *);
/* Relocate a file or directory. PROGNAME is the name by which gdb
diff --git a/gdb/main.h b/gdb/main.h
index a5260b16bc6..a846d9f369a 100644
--- a/gdb/main.h
+++ b/gdb/main.h
@@ -42,4 +42,10 @@ extern int batch_flag;
return value is in malloc'ed storage. */
extern char *windows_get_absolute_argv0 (const char *argv0);
+/* Return read only pointer to the name of gdb as it was invoked. This
+ might have been expanded to an absolute path if required by the
+ platform. Could return NULL if called before gdb has had a chance to
+ parse the argv array. */
+extern const char * get_gdb_program_name (void);
+
#endif