Add calls to di_load_di in search_one_{symtab,loctab,cfitab} to ensure
that debuginfo is always loaded before searching these tables.
This fixes a bug introduced in commit
60f7e89ba32 that results in
callgrind failing to read source filenames from debuginfo.
Also add a test which checks that callgrind successfully finds a
filename from debuginfo.
Co-Authored-By: Philippe Waroquiers <philippe.waroquiers@skynet.be>
notpower2-hwpref.vgtest notpower2-hwpref.stderr.exp \
notpower2-use.vgtest notpower2-use.stderr.exp \
threads.vgtest threads.stderr.exp \
- threads-use.vgtest threads-use.stderr.exp
+ threads-use.vgtest threads-use.stderr.exp \
+ find-source.vgtest find-source.stderr.exp find-source.post.exp
check_PROGRAMS = clreq simwork threads
--- /dev/null
+
+
+Events : Ir
+Collected :
+
+I refs:
--- /dev/null
+# The 'prog' doesn't matter because we don't use its output. Instead we test
+# the post-processing of the cgout-test file.
+prog: ../../tests/true
+vgopts: --callgrind-out-file=callgrind.out
+post: grep -q 'tests/true\.c' callgrind.out
+cleanup: rm callgrind.out
/* Find a symbol-table index containing the specified pointer, or -1
if not found. Binary search. */
-extern Word ML_(search_one_symtab) ( const DebugInfo* di, Addr ptr,
+extern Word ML_(search_one_symtab) ( DebugInfo* di, Addr ptr,
Bool findText );
/* Find a location-table index containing the specified pointer, or -1
if not found. Binary search. */
-extern Word ML_(search_one_loctab) ( const DebugInfo* di, Addr ptr );
+extern Word ML_(search_one_loctab) ( DebugInfo* di, Addr ptr );
/* Find a CFI-table index containing the specified pointer, or -1 if
not found. Binary search. */
-extern Word ML_(search_one_cfitab) ( const DebugInfo* di, Addr ptr );
+extern Word ML_(search_one_cfitab) ( DebugInfo* di, Addr ptr );
/* Find a FPO-table index containing the specified pointer, or -1
if not found. Binary search. */
/* Find a symbol-table index containing the specified pointer, or -1
if not found. Binary search. */
-Word ML_(search_one_symtab) ( const DebugInfo* di, Addr ptr,
+Word ML_(search_one_symtab) ( DebugInfo* di, Addr ptr,
Bool findText )
{
+ VG_(di_load_di)(di);
Addr a_mid_lo, a_mid_hi;
Word mid,
lo = 0,
/* Find a location-table index containing the specified pointer, or -1
if not found. Binary search. */
-Word ML_(search_one_loctab) ( const DebugInfo* di, Addr ptr )
+Word ML_(search_one_loctab) ( DebugInfo* di, Addr ptr )
{
+ VG_(di_load_di)(di);
Addr a_mid_lo, a_mid_hi;
Word mid,
lo = 0,
/* Find a CFI-table index containing the specified pointer, or -1
if not found. Binary search. */
-Word ML_(search_one_cfitab) ( const DebugInfo* di, Addr ptr )
+Word ML_(search_one_cfitab) ( DebugInfo* di, Addr ptr )
{
+ VG_(di_load_di)(di);
Word mid,
lo = 0,
hi = di->cfsi_used-1;