- changed status to resolved
Segment index incorrectly parsed as hex
Issue #4
resolved
From: https://en.delphipraxis.net/topic/4853-map2pdb-profiling-with-vtune/?do=findComment&comment=68854
Excellent work ... Thanks !
I was using the tool with some map file and I got an AV error. I started investigating and I found a bug in the map parser :
// debug.info.reader.map.pas (line 349):
var SegmentID: Cardinal := HexToInt16(Reader.LineBuffer, n);
The SegmentID should be read as a DECIMAL value and not as a HEX ! if the map file contains more than 9 segment, the next segment is emitted like (0010:xxxxx) but you're reading it like a hex (so its ID becomes 16 !) and then there is this line
FSegments[ListIndex] := Result; // FSegments[10 .. ListIndex - 1] = nil => AV
A simple fix :
function DecToInt32(const s: string; var Offset: integer): integer;
var
P: PChar;
begin
Result := 0;
P := PChar(s);
while Ord(P^) in [$30 .. $39] do
begin
Result := (Result * 10) + (Ord(P^) - $30);
Inc(P);
Inc(Offset);
end;
end;
// ...
var SegmentID: Cardinal := DecToInt32(reader.LineBuffer, n);
Comments (2)
-
repo owner -
repo owner Segment index values are now parsed as decimal integers and logged as same. Fixes
#4→ <<cset b13720b4c5db>>
- Log in to comment
Segment index values are now parsed as decimal integers and logged as same. Fixes
#4→ <<cset a58b044f13b2>>