This one has annoyed me a lot during the last few days while debugging
some assembly code: The display of the cpu registers always reverted
to rdDefault (which is decimal for the registers I was interested in)
every time I restarted my application, it was so annoying and time
consuming setting them back to hex (each of them individually!) on
every restart that I started using kdbg instead of Lazarus.

The attached small patch for gdbmidebugger.pp would solve this problem
once and for all. It will prevent the re-initialization of the
FFormats array if it is already initialized (if it already has the
correct size).

Would this patch qualify for inclusion?

Bernd

Attachment: gdbmidebugger_dont_reset_displayformats.patch
Index: debugger/gdbmidebugger.pp
===================================================================
--- debugger/gdbmidebugger.pp	(Revision 34097)
+++ debugger/gdbmidebugger.pp	(Arbeitskopie)
@@ -8318,12 +8318,18 @@
   Cmd: TGDBMIDebuggerCommandRegisterNames;
   n: Integer;
   f: TRegisterDisplayFormat;
+  MustInitFormats: Boolean;
 begin
   Cmd := TGDBMIDebuggerCommandRegisterNames(Sender);
 
   SetLength(FRegNames, Cmd.Count);
   SetLength(FRegModified, Cmd.Count);
-  SetLength(FFormats, Cmd.Count);
+  if Cmd.Count <> Length(FFormats) then begin
+    SetLength(FFormats, Cmd.Count);
+    MustInitFormats := True;
+  end
+  else // don't reset to rdDefault on every restart, keep the existing ones
+    MustInitFormats := False;
   for f := low(TRegisterDisplayFormat) to high(TRegisterDisplayFormat) do begin
     SetLength(FRegValues[f], Cmd.Count);
     FValuesReqState[f] := esInvalid;
@@ -8335,7 +8341,8 @@
     for f := low(TRegisterDisplayFormat) to high(TRegisterDisplayFormat) do
       FRegValues[f][n] := '';
     FRegModified[n] := False;
-    FFormats[n] := rdDefault;
+    if MustInitFormats then
+      FFormats[n] := rdDefault;
   end;
 
   FGetRegisterCmdObj:= nil;
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to