Bug 338791

Summary: alt dwz files can be relative of debug/main file
Product: [Developer tools] valgrind Reporter: Mark Wielaard <mark>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Handle debug alt dwz files that are relative to the debug file.

Description Mark Wielaard 2014-09-03 21:28:23 UTC
Currently valgrind supports alt/dwz files, but only using build-id lookup. The altfile can also be relative to the debug file if not installed in the system wide build-id directory. The following patch supports this and is needed for writing small testcases that use debug dwz altfiles.



Reproducible: Always
Comment 1 Mark Wielaard 2014-09-03 21:30:15 UTC
Created attachment 88552 [details]
Handle debug alt dwz files that are relative to the debug file.

Proposed patch. Would like someone to double check this works correctly with a debugserverpath.
Comment 2 Mark Wielaard 2014-09-03 21:42:15 UTC
On thing this patch fixes is the interpretation of the et_rel boolean argument to find_debug_file.
The et_rel boolean just indicates whether a ET_REL file is allowed. But the implementation of find_debug_file seem to have misinterpreted as "is a relative path to a debug file allowed"?
So find_debug_file should only pass this flag on to open_debug_file and not try to interpret it. find_debug_file then checks the file opened is or isn't an ET_REL file.
Comment 3 Julian Seward 2014-09-05 08:29:01 UTC
(In reply to Mark Wielaard from comment #1)
> Proposed patch. Would like someone to double check this works correctly with
> a debugserverpath.

Looks OK to me:

device:

--773-- Arch and hwcaps: ARM, LittleEndian, ARMv7-vfp
--773-- Page sizes: currently 4096, max supported 4096
--773-- Valgrind library directory: /data/local/Inst/lib/valgrind
--773-- Reading syms from /data/local/bz2-arm-nosyms
--773--   Using (POSSIBLY MISMATCHED) bz2-arm-nosyms on 192.168.2.99:1500

server:

~/VgTRUNK/merge$ ./valgrind-di-server
valgrind-di-server started at Fri Sep  5 10:20:28 2014
(1) SessionID 1: open successful for "bz2-arm-nosyms"
(1) SessionID 1:   sent 6 frames, 0 MB (unz), 0 MB (z), ratio 1.56:1
(1) SessionID 1: closed
Comment 4 Mark Wielaard 2014-09-05 14:25:47 UTC
Thanks for testing I checked this in as valgrind svn r14464.
Comment 5 Mark Wielaard 2014-09-05 22:58:24 UTC
Plus a small followup patch to unbreak debain/ubuntu style setups as r14474.