From: Julian Seward Date: Wed, 5 Dec 2012 22:15:14 +0000 (+0000) Subject: Add a new command line flag, --extra-debuginfo-path=path, that allows X-Git-Tag: svn/VALGRIND_3_9_0~518 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4180623ef8c19d255b20871da7396e6a1087f200;p=thirdparty%2Fvalgrind.git Add a new command line flag, --extra-debuginfo-path=path, that allows 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 --- diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index 1d046805bd..7c88ad363f 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -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); + } + } } } diff --git a/coregrind/m_main.c b/coregrind/m_main.c index dae95011c3..24abb9e0e8 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -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, diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 5d419d12c1..07086216b9 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -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 diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h index 1a3ef1f1bd..87c67107e3 100644 --- a/coregrind/pub_core_options.h +++ b/coregrind/pub_core_options.h @@ -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 ) */ diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index e4cb9eb5b6..3938d868c8 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -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 diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index b513b7a552..533984fddb 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -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