Debugger (gdb): fixed finding src and line (lines were missing) from fpc mangled names. Issue #0024641

git-svn-id: trunk@47536 -
This commit is contained in:
martin 2015-01-26 23:07:13 +00:00
parent de12a42ac8
commit 91ef0ea2a5
4 changed files with 14 additions and 2 deletions

View File

@ -372,7 +372,10 @@ begin
if Source = '' then // we do not have a source file => just show an adress
Source := ':' + IntToHex(Entry.Address, 8);
Item.SubItems[1] := Source;
Item.SubItems[2] := IntToStr(Entry.Line); // TODO: if editor is open, map line SrcEdit.DebugToSourceLine
if (Entry.Line = 0) and (Entry.UnitInfo <> nil) and (Entry.UnitInfo.SrcLine > 0) then
Item.SubItems[2] := '~'+IntToStr(Entry.UnitInfo.SrcLine)
else
Item.SubItems[2] := IntToStr(Entry.Line); // TODO: if editor is open, map line SrcEdit.DebugToSourceLine
Item.SubItems[3] := GetFunction(Entry);
end;
end;
@ -529,6 +532,7 @@ begin
idx := FViewStart + Item.Index;
if idx >= GetSelectedCallstack.CountLimited(idx+1) then Exit;
Entry := GetSelectedCallstack.Entries[idx];
if Entry.Line <= 0 then exit;
if not DebugBoss.GetFullFilename(Entry.UnitInfo, FileName, False) then
Exit;
BreakPoint := BreakPoints.Find(FileName, Entry.Line);

View File

@ -116,6 +116,7 @@ type
FFunctionName: String;
FLocationName, FLocationOwnerName, FLocationFullFile: String;
FLocationType: TDebuggerLocationType;
FSrcLine: Integer;
FUnitName: String;
function GetFileName: String;
function GetDbgFullName: String;
@ -137,6 +138,7 @@ type
procedure SaveDataToXMLConfig(const AConfig: TXMLConfig;
const APath: string); virtual;
property FileName: String read GetFileName;
property SrcLine: Integer read FSrcLine write FSrcLine;
property DbgFullName: String read GetDbgFullName;
property LocationType: TDebuggerLocationType read GetLocationType write SetLocationType;
property LocationOwnerName: String read GetLocationOwnerName;
@ -147,6 +149,7 @@ type
property SrcClassName: String read FSrcClassName;
property FunctionName: String read FFunctionName;
property FunctionArgs: String read FFunctionArgs; // comma separated list of types. e.g. "integer, boolean"
// functions have result type at end, after ",,"
end;
{ TDebuggerUnitInfoList }
@ -2193,7 +2196,8 @@ begin
Result := Result and
(FLocationType = AnOther.FLocationType) and
(FLocationOwnerName = AnOther.FLocationOwnerName) and
(FLocationName = AnOther.FLocationName);
(FLocationName = AnOther.FLocationName) and
(FSrcLine = AnOther.FSrcLine);
end;
end;
@ -2213,6 +2217,7 @@ begin
else
exclude(FFlags, dlfSearchByFunctionName);
FFileName := AConfig.GetValue(APath + 'File', '');
FSrcLine := AConfig.GetValue(APath + 'SrcLine', 0);
FLocationOwnerName := AConfig.GetValue(APath + 'UnitOwner', '');
FLocationName := AConfig.GetValue(APath + 'UnitFile', '');
FDbgFullName := AConfig.GetValue(APath + 'DbgFile', '');
@ -2231,6 +2236,7 @@ begin
WriteStr(s{%H-}, LocationType);
AConfig.SetValue(APath + 'Type', s);
AConfig.SetValue(APath + 'File', FileName);
AConfig.SetValue(APath + 'SrcLine', FSrcLine);
AConfig.SetDeleteValue(APath + 'ByFunction', dlfSearchByFunctionName in FFlags, False);
AConfig.SetValue(APath + 'UnitOwner', LocationOwnerName);

View File

@ -367,6 +367,7 @@ begin
if DebugBoss.GetFullFilename(AnUnitInfo, Filename, False) then begin
debugln(DBG_LOCATION_INFO, ['JumpToUnitSource Filename=', Filename]);
ok := false;
if ALine <= 0 then ALine := AnUnitInfo.SrcLine;
if FilenameIsAbsolute(Filename) then
ok := MainIDEInterface.DoJumpToSourcePosition(Filename, 0, ALine, 0,
[jfAddJumpPoint, jfFocusEditor, jfMarkLine, jfMapLineFromDebug, jfSearchVirtualFullPath]

View File

@ -614,6 +614,7 @@ function TDebugManager.GetFullFilename(const AUnitinfo: TDebuggerUnitInfo;
exit;
debugln(['TDebugManager.GetFullFilename found ',CodePos.Code.Filename,' Line=',CodePos.Y,' Col=',CodePos.X]);
AUnitinfo.LocationFullFile := CodePos.Code.Filename;
AUnitinfo.SrcLine := CodePos.Y;
//DumpStack;
Result:=true;
end;