]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a new command line flag, --extra-debuginfo-path=path, that allows
authorJulian Seward <jseward@acm.org>
Wed, 5 Dec 2012 22:15:14 +0000 (22:15 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 5 Dec 2012 22:15:14 +0000 (22:15 +0000)
specification of an extra directory in which to look for debuginfo
objects.  Fixes #310792.  (Alex Chiang, achiang@canonical.com)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13154

coregrind/m_debuginfo/readelf.c
coregrind/m_main.c
coregrind/m_options.c
coregrind/pub_core_options.h
none/tests/cmdline1.stdout.exp
none/tests/cmdline2.stdout.exp

index 1d046805bdaf37b9b331b9a31a5ee27d1a678560..7c88ad363ff6c238099610a1fd8892f6d268ddd1 100644 (file)
@@ -1212,6 +1212,7 @@ void find_debug_file( struct _DebugInfo* di,
                       /*OUT*/SizeT* n_dimage )
 {
    HChar* debugpath = NULL;
+   HChar* extrapath = VG_(clo_extra_debuginfo_path);
    Addr  addr = 0;
    UWord size = 0;
 
@@ -1241,7 +1242,8 @@ void find_debug_file( struct _DebugInfo* di,
 
       debugpath = ML_(dinfo_zalloc)(
                      "di.fdf.3",
-                     VG_(strlen)(objdir) + VG_(strlen)(debugname) + 32);
+                     VG_(strlen)(objdir) + VG_(strlen)(debugname) + 32 +
+                     (extrapath ? VG_(strlen)(extrapath) : 0));
 
       VG_(sprintf)(debugpath, "%s/%s", objdir, debugname);
 
@@ -1250,6 +1252,13 @@ void find_debug_file( struct _DebugInfo* di,
          if ((addr = open_debug_file(debugpath, NULL, crc, rel_ok, &size)) == 0) {
             VG_(sprintf)(debugpath, "/usr/lib/debug%s/%s", objdir, debugname);
             addr = open_debug_file(debugpath, NULL, crc, rel_ok, &size);
+            if ((addr = open_debug_file(debugpath, NULL, crc, rel_ok, &size)) == 0) {
+               if (extrapath) {
+                  VG_(sprintf)(debugpath, "%s%s/%s", extrapath,
+                              objdir, debugname);
+                  addr = open_debug_file(debugpath, NULL, crc, rel_ok, &size);
+               }
+            }
          }
       }
 
index dae95011c3574578aef479b070dff08d0d3a98fd..24abb9e0e8567072520983d28e6aa01165f7b9fb 100644 (file)
@@ -172,6 +172,9 @@ static void usage_NORETURN ( Bool debug_help )
 "                              part of the path after 'string'.  Allows removal\n"
 "                              of path prefixes.  Use this flag multiple times\n"
 "                              to specify a set of prefixes to remove.\n"
+"    --extra-debuginfo-path=path    absolute path to search for additional\n"
+"                              debug symbols, in addition to existing default\n"
+"                              well known search paths.\n"
 "    --smc-check=none|stack|all|all-non-file [stack]\n"
 "                              checks for self-modifying code: none, only for\n"
 "                              code found in stacks, for all code, or for all\n"
@@ -678,6 +681,9 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
          VG_(clo_n_fullpath_after)++;
       }
 
+      else if VG_STR_CLO (arg, "--extra-debuginfo-path",
+                      VG_(clo_extra_debuginfo_path)) {}
+
       else if VG_STR_CLO(arg, "--require-text-symbol", tmp_str) {
          if (VG_(clo_n_req_tsyms) >= VG_CLO_MAX_REQ_TSYMS) {
             VG_(fmsg_bad_option)(arg,
index 5d419d12c161c5a4b10b88452e5184f1c219a91d..07086216b9c05a7fd40c28b69b1966de53282d34 100644 (file)
@@ -79,6 +79,7 @@ Int    VG_(clo_n_suppressions) = 0;
 const HChar* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
 Int    VG_(clo_n_fullpath_after) = 0;
 const HChar* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER];
+HChar* VG_(clo_extra_debuginfo_path) = NULL;
 UChar  VG_(clo_trace_flags)    = 0; // 00000000b
 UChar  VG_(clo_profile_flags)  = 0; // 00000000b
 Int    VG_(clo_trace_notbelow) = -1;  // unspecified
index 1a3ef1f1bd0659d87ea2e65d33f733a84c4c6ad9..87c67107e32e723dbccf020a217ec530cfd863df 100644 (file)
@@ -126,6 +126,9 @@ extern const HChar* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
 extern Int   VG_(clo_n_fullpath_after);
 extern const HChar* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER];
 
+/* Full path to additional path to search for debug symbols */
+extern HChar* VG_(clo_extra_debuginfo_path);
+
 /* DEBUG: print generated code?  default: 00000000 ( == NO ) */
 extern UChar VG_(clo_trace_flags);
 /* DEBUG: do bb profiling?  default: 00000000 ( == NO ) */
index e4cb9eb5b67b55f58e43816ef23eeb66f0700947..3938d868c818fd1ebe85133056f88392a1d77cad 100644 (file)
@@ -61,6 +61,9 @@ usage: valgrind [options] prog-and-args
                               part of the path after 'string'.  Allows removal
                               of path prefixes.  Use this flag multiple times
                               to specify a set of prefixes to remove.
+    --extra-debuginfo-path=path    absolute path to search for additional
+                              debug symbols, in addition to existing default
+                              well known search paths.
     --smc-check=none|stack|all|all-non-file [stack]
                               checks for self-modifying code: none, only for
                               code found in stacks, for all code, or for all
index b513b7a552f9717bd579106cb931c268c455cb8d..533984fddb4ac34849212e0cb7fe8fe7af1a9fa1 100644 (file)
@@ -61,6 +61,9 @@ usage: valgrind [options] prog-and-args
                               part of the path after 'string'.  Allows removal
                               of path prefixes.  Use this flag multiple times
                               to specify a set of prefixes to remove.
+    --extra-debuginfo-path=path    absolute path to search for additional
+                              debug symbols, in addition to existing default
+                              well known search paths.
     --smc-check=none|stack|all|all-non-file [stack]
                               checks for self-modifying code: none, only for
                               code found in stacks, for all code, or for all