On 19/07/14 10:35, C Western wrote:
On 16/07/14 08:53, Joost van der Sluis wrote:
 > Looks promising, but (on current SVN):
 >
 > an explicit raise Exception.Create causes an assembler window to
appear,
 > trying to show ../inc/except.inc rather than the source line with the
 > raise as the standard debugger does.

Do you have a rtl with debug-info enabled? In that case it's normal, as
this is the location where the exception actually takes place.

I do indeed have debug info enabled in the RTL. I can live with the rtl
showing, though I would encourage a special case test for an explicit
call to raise, as I assume is in the gdb interfaces.

However the inability to show the rtl source is a problem - again gdb
handles it fine, so I assume it is an issue with the way filenames like
../inc/except.inc are handled - any change of fixing this? Or an
indication of where I might look?


Follow up to this - a simple patch (attached) allows the rtl source to show, rather than the assembler window. However there seems to be a more fundamental problem, in that a "step into" that ends up stepping into a rtl routine like fpc_shortstr_SInt reports a SIGSEGV in the debugged program, when no such exception has occurred.

Colin

diff -uwNr '--exclude=.svn' '--exclude=Makefile' '--exclude=Makefile.fpc' '--exclude=Makefile.compiled' '--exclude=*.rsj' '--exclude=*.bak' '--exclude=*.po' lazarus/components/fpdebug/fpdbgdwarfdataclasses.pas lazarus.w/components/fpdebug/fpdbgdwarfdataclasses.pas
--- lazarus/components/fpdebug/fpdbgdwarfdataclasses.pas	2014-07-05 10:32:19.458170514 +0100
+++ lazarus.w/components/fpdebug/fpdbgdwarfdataclasses.pas	2014-07-19 12:34:20.493380536 +0100
@@ -474,6 +474,7 @@
     
     FInfoData: Pointer;
     FFileName: String;
+    FCompDir:  String;
     FUnitName: String;
     FIdentifierCase: Integer;
     FProducer: String;
@@ -538,6 +539,7 @@
     function GetLineAddressMap(const AFileName: String): PDWarfLineMap;
     function GetLineAddress(const AFileName: String; ALine: Cardinal): TDbgPtr;
     procedure BuildLineInfo(AAddressInfo: PDwarfAddressInfo; ADoAll: Boolean);
+    function FullFileName(const AFileName:string): String;
 
     property Valid: Boolean read FValid;
     property FileName: String read FFileName;
@@ -3246,7 +3248,7 @@
 procedure TDwarfLineInfoStateMachine.SetFileName(AIndex: Cardinal);
 begin
   if (Aindex > 0) and (AIndex <= FOwner.FLineInfo.FileNames.Count)
-  then FFileName := FOwner.FLineInfo.FileNames[AIndex - 1]
+  then FFileName := FOwner.FullFileName(FOwner.FLineInfo.FileNames[AIndex - 1])
   else FFileName := Format('Unknown fileindex(%u)', [AIndex]);
 end;
 
@@ -3361,6 +3363,13 @@
   Result := FAddressMap;
 end;
 
+function TDwarfCompilationUnit.FullFileName(const AFileName: String): String;
+begin
+  Result := AFileName;
+  if FCompDir = '' then exit;
+  Result := LazFileUtils.ResolveDots(FCompDir+AFileName);
+end;
+
 function TDwarfCompilationUnit.GetUnitName: String;
 begin
   Result := FUnitName;
@@ -3604,6 +3613,9 @@
   if LocateAttribute(Scope.Entry, DW_AT_name, AttribList, Attrib, Form)
   then ReadValue(Attrib, Form, FFileName);
 
+  if LocateAttribute(Scope.Entry, DW_AT_comp_dir, AttribList, Attrib, Form)
+  then ReadValue(Attrib, Form, FCompDir);
+
   if LocateAttribute(Scope.Entry, DW_AT_producer, AttribList, Attrib, Form)
   then ReadValue(Attrib, Form, FProducer);
 
diff -uwNr '--exclude=.svn' '--exclude=Makefile' '--exclude=Makefile.fpc' '--exclude=Makefile.compiled' '--exclude=*.rsj' '--exclude=*.bak' '--exclude=*.po' lazarus/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas lazarus.w/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas
--- lazarus/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas	2014-07-17 20:51:23.060036838 +0100
+++ lazarus.w/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas	2014-07-19 12:28:17.965977467 +0100
@@ -1563,7 +1563,7 @@
     if sym = nil then
       Exit;
 
-    result.SrcFile := sym.FileName;
+    result.SrcFile := ExtractFileName(sym.FileName);
     result.SrcLine := sym.Line;
     result.SrcFullName := sym.FileName;
 
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to