diff options
author | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-08-09 19:38:14 -0700 |
---|---|---|
committer | Vladimir Mezentsev <vladimir.mezentsev@oracle.com> | 2023-08-12 19:46:52 -0700 |
commit | 84004b2a709e4773b0fb1b01d629b0eb2fe81bbc (patch) | |
tree | c3749c6b82ffa42251bd1938daee2afadea0b310 /gprofng | |
parent | e15197c8040b9e985a6164f13947dae881d792d8 (diff) | |
download | gdb-84004b2a709e4773b0fb1b01d629b0eb2fe81bbc.zip gdb-84004b2a709e4773b0fb1b01d629b0eb2fe81bbc.tar.gz gdb-84004b2a709e4773b0fb1b01d629b0eb2fe81bbc.tar.bz2 |
gprofng: pass gprofng location to gp-display-gui
gprofng GUI can be installed to the other directory.
In this case, $PATH is used to find gp-display-gui from gprofng
and option --gprofngdir is passed to gp-display-gui.
gprofng/ChangeLog
2023-08-09 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
* src/gprofng.cc (Gprofng::exec_cmd): Add option --gprofngdir.
Diffstat (limited to 'gprofng')
-rw-r--r-- | gprofng/src/gprofng.cc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gprofng/src/gprofng.cc b/gprofng/src/gprofng.cc index 23dcfe3..30e07eb 100644 --- a/gprofng/src/gprofng.cc +++ b/gprofng/src/gprofng.cc @@ -226,21 +226,34 @@ Gprofng::exec_cmd (char *tool_name, int argc, char **argv) exit (1); } - const char *aname = app_names[first].app_name;; + const char *aname = app_names[first].app_name; - char **arr = (char **) malloc ((argc + 3) * sizeof (char *)); - int n = 0; + char **arr = (char **) malloc ((argc + 5) * sizeof (char *)); char *pname = get_name (); - arr[n++] = dbe_sprintf ("%.*s%s", (int) (get_basename (pname) - pname), - pname, aname); + char *exe_name = dbe_sprintf ("%.*s%s", + (int) (get_basename (pname) - pname), pname, aname); + int n = 1; if (app_names[first].keyword) arr[n++] = dbe_sprintf ("--whoami=%s %s %s", whoami, tool_name, app_names[first].keyword); else arr[n++] = dbe_sprintf ("--whoami=%s %s", whoami, tool_name); + if (strcmp (aname, "gp-display-gui") == 0) + { + if (access (exe_name, X_OK | F_OK) != 0) + { // gprofng GUI can be installed to the other directory. + if (verbose) + printf ("gprofng: Cannot find '%s'\n", exe_name); + free (exe_name); + exe_name = get_realpath (aname); // Use $PATH to find gprofng GUI + } + arr[n++] = dbe_sprintf ("--gprofngdir=%.*s", + (int) (get_basename (pname) - pname), pname); + } for (int i = 1; i < argc; i++) arr[n++] = argv[i]; arr[n] = NULL; + arr[0] = exe_name; if (verbose) { printf ("gprofng::exec\n"); |