FpDebug, small x86 disassembler bug lazarus / 12-Debugger ---------------------------------------------------------------------- mika · 2022-11-30 18:18 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program testdbg18;{$apptype console}{$mode objfpc}{$h+} uses FpDbgDisasX86, FpDbgClasses, FpDbgUtil; const  testCode : shortstring = #$a3#$1a#$00#$00#$00; {mov [$0000001a],eax} var    p : pointer  ;     codeBytes, asmInstr : string;       pr : TDbgProcess;       de : TX86AsmDecoder; begin     pr:= TDbgProcess.create(dm32);     de := TX86AsmDecoder.create( pr );     p:=@testCode[1];     de.Disassemble(p, codeBytes, asmInstr );     writeln;     writeln( codeBytes:20,'    ', asmInstr);     readln;end. output           A31A000000    mov dword ptr [$0000001A],al output should be           A31A000000    mov [$0000001A],eax file fpdbgdisasx86.pas Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       $A3: begin        SetOpcode(OPmov);        AddOv;        AddReg(regGeneral, os8, REG_A);  fix Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       $A3: begin        SetOpcode(OPmov);        AddOv;        AddReg(regGeneral, OperandSize, REG_A); ---------------------------------------------------------------------- PascalDragon · 2022-11-30 21:19 Please report on the bug tracker. ---------------------------------------------------------------------- mika · 2022-11-30 22:47 Quote from: PascalDragon on November 30, 2022, 10:19:21 pmPlease report on the bug tracker. Not registered there. Not going to report. Your suggestion i will take as a hint to not report bugs in forum. But if some one is going to investigate this, then look at lds,les,.. instructions with operand and address size modifiers. ---------------------------------------------------------------------- Martin_fr · 2022-12-01 10:33 Quote from: mika on November 30, 2022, 11:47:14 pmQuote from: PascalDragon on November 30, 2022, 10:19:21 pmPlease report on the bug tracker. Not registered there. Not going to report. Your suggestion i will take as a hint to not report bugs in forum. But if some one is going to investigate this, then look at lds,les,.. instructions with operand and address size modifiers. You can mention bugs here. Sometimes they will be spotted. And then it's a question if they will be remembered. For now, I noted this one. Hopefully it wont fall through the cracks.... The bug tracker makes sure it will be remembered. ---------------------------------------------------------------------- Martin_fr · 2022-12-02 02:19 Fixed ---------------------------------------------------------------------- Bogen85 · 2022-12-02 20:49 Quote from: Martin_fr on December 02, 2022, 03:19:58 amFixed Fixed, as in, fixed in the source code? If so, what is the issue tracker number for this? I did not know this existed for FPC (disassembly functions), though due to this Topic I now see that it is the Lazarus sources. ---------------------------------------------------------------------- Martin_fr · 2022-12-02 21:07 Quote from: Bogen85 on December 02, 2022, 09:49:51 pmQuote from: Martin_fr on December 02, 2022, 03:19:58 amFixed Fixed, as in, fixed in the source code? If so, what is the issue tracker number for this? The commit is 4c879cc73cc403526099b3eadde64c03c9a82f31 There is no bug tracker id, since - as you may have read - the reporter did not want to create an account to the tracker. Which means, it is lucky I got time now. Otherwise it might easily have been forgotten. - "Time" just doesn't mean the 30 seconds to change one word, and commit it. - "Time" means everything from checking that this is currently wrong, and that the suggest disassemble is the correct one. We are all humans, the reporter could have mis-reported too. Then checking that the changed line returns the new desired value. Checking desired, current, and fixed results for other op-sizes (which would be expected to exist). So "Time" amounts. And had I been in the middle of something else, I might not have interrupted that (even if that be a project taking a few month). QuoteI did not know this existed for FPC (disassembly functions), though due to this Topic I now see that it is the Lazarus sources. They exist in Lazarus => FpDebug. Since the debugger should be able to display disassembly. ---------------------------------------------------------------------- Bogen85 · 2022-12-02 21:19 Quote from: Martin_fr on December 02, 2022, 10:07:12 pmThe commit is 4c879cc73cc403526099b3eadde64c03c9a82f31 There is no bug tracker id, since - as you may have read - the reporter did not want to create an account to the tracker. Which means, it is lucky I got time now. Otherwise it might easily have been forgotten. Got it! I understand. Quote from: Martin_fr on December 02, 2022, 10:07:12 pmThey exist in Lazarus => FpDebug. Since the debugger should be able to display disassembly. Thanks! Per the code in the reporter's example this will be useful to me in non-gui programs. ---------------------------------------------------------------------- Martin_fr · 2022-12-03 14:47 Btw, if anyone has spare time.... Quote from: mika on November 30, 2022, 11:47:14 pmBut if some one is going to investigate this, then look at lds,les,.. instructions with operand and address size modifiers. This indicates that there may or may not be other similar cases. But I don't have time to verify this currently.