GithubHelp home page GithubHelp logo

mahdisafsafi / debugengine Goto Github PK

View Code? Open in Web Editor NEW
174.0 43.0 41.0 1.42 MB

Delphi debug framework

License: Mozilla Public License 2.0

Pascal 99.92% Batchfile 0.01% Perl 0.08%
debug stacktrace disassembler portable-executable runtime x86-64 delphi exception

debugengine's People

Contributors

mahdisafsafi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

debugengine's Issues

AV in procedure TCallTrace32.RemoveSealedCalls;

unit DebugEngine.Trace;

procedure TCallTrace32.RemoveSealedCalls; can raise an AV in sub function TargetExists if PItem^.Info.ProcedureAddress is nil then (PPointer(PItem^.Info.ProcedureAddress)^ = Address) raises an AV

I suggest the following change in order for fixing it : change function TStackItem.IsValid: Boolean; to the following implementation:

function TStackItem.IsValid: Boolean;
begin
Result := (Rank <> 0) and (Info.ProcedureAddress <> nil);
end;

Is Sort in TDebugInfoExport.CreateExportList necessary?

The final statement in TTDebugInfoExport.CreateExportList is

FExportList.Sort(ExportFunctionsSortCompare);

Is it necessary?
Would it be possible to provide a Sort property that determines whether to sort or not?

I've already added the necessary code, and would be happy to make a pull request.

Don't compile on XE3: FinalizeRecord not found

I could not compile with XE3 because of the two occurences of FinalizeRecord in DebugEngine.DebugInfo (Line 1672) and DebugEngine.Disasm (Line 606).

I fixed it with
PExportInfo(FExportList[I])^ := Default(TExportInfo); // DebugEngine.DebugInfo Line 1672
and
DisasmInfo := Default(TDisasmInfo); // DebugEngine.Disasm Line 606

As I don't know, in which Version of Delphi FinalizeRecord arrived and how you would resolve it (ifdef or something else) I commit no pull request.

Insert debug info does'nt work on release builds

Insert debug info does'nt work on release builds. I've tried both the DD tool and the ConvertMapToSMap function in the project. It fails on both 32 and 64 bit.

How to reproduce:

  1. Build the demo as release.
  2. press "Insert debug info" button.

Or use the DD tool

  1. Build the demo as release.
  2. Call the DD tool: dd -c "./Win64/Release/ExceptionTest.map"

Bug in ConvertMapToSMap

Hello

I belive there is a bug in ConvertMapToSMap, atleast it raises an exception parsing a certain map file, and that leads to an endless loop.

I've attatched a small demo application reproducing the exception.

I've made a small modification to the DebugEngine.DebugInfo unit. I've introduced a global variable called DebugCount. It's jous used for counting iterations.

But in short. Set a breakpoint in line 1083 in my version of DebugEngine.DebugInfo. Run the application and press the button.

The code can be found here: http://borrisholt.dk/GitHub/ExceptionTest.7z

Jens Borrisholt

Can DebugEngine work without .map files attached?

Most developers agree that in applications given to the wide public map information (method names, line numbers, etc) must not be included. Stack trace should contain addresses only which can be translated "back" to readable names by the developer with the .map file in place.
My question is, does DebugEngine support this behavior? Can it work without the .map file attached to the executable, and can it somehow be forced to "load" a .map file and look up an address and translate it to names and line numbers?

If yes, is there a guide which I can read on this topic?

Thanks!

if not IsBadCodePtr(Pointer(Arg.Imm.Value)) then

Using Delphi berlin free.
if not IsBadCodePtr(Pointer(Arg.Imm.Value)) then
On DebugEngine.Disasm;
Getting access violation.!!!!!
Cannot debug since i do not have the source.
With out the Delphi IDE the exe run OK.

Erro compiling ASM code under XE4 (only 64bit mode)

[dcc64 Error] DebugEngine.Core.pas(148): E2107 Operand size mismatch
[dcc64 Error] DebugEngine.Core.pas(149): E2107 Operand size mismatch
[dcc64 Error] DebugEngine.Core.pas(150): E2116 Invalid combination of opcode and operands
[dcc64 Error] DebugEngine.Core.pas(152): E2107 Operand size mismatch
[dcc64 Error] DebugEngine.Core.pas(154): E2107 Operand size mismatch
[dcc64 Error] DebugEngine.Core.pas(160): E2116 Invalid combination of opcode and operands

Compiling with Delphi 10.2 Tokyo generate integer overflow

Using Delphi 10.2 Version 25.0.27659.1188
Using provided demo, compiling with debug configuration, changing compiler options to enable overflow checking and range checking, an EintOverflow is produced in TDebugInfoSMap.ProcessMap on the line:
Result^.SegStartAddress := Pointer((PSegment^.SegStartAddress - LModuleImageBase) + Module.ModuleHandle);
Actually SegStartAddress is 0 and both LModuleImageBase and ModuleHandle have same value ($400000).

Typo in DebugEngine.Core

In DebugEngine.Core, perhaps correctly

...
procedure GetDelphiExceptionHandlersPtr(var Info: THandlersPtr);
asm
  {$IFDEF CPU64BITS }
  mov  rax,  offset System.@DelphiExceptionHandler
  mov  qword [rcx].THandlersPtr.SEHandler ,              rax
  { Fill all the rest with nil }
  xor rax,rax
  mov qword  [rcx].THandlersPtr.HandleFinallyPtr,        rax
  mov qword  [rcx].THandlersPtr.HandleAnyExceptionPtr,   rax
  mov qword  [rcx].THandlersPtr.HandleOnExceptionPtr,    rax
  mov qword  [rcx].THandlersPtr.HandleAutoException,     rax
  {$ELSE CPU64BITS }
  mov dword  [eax].THandlersPtr.SEHandler,               $00000000
  mov dword  [eax].THandlersPtr.HandleFinallyPtr,        offset System.@HandleFinally
  mov dword  [eax].THandlersPtr.HandleAnyExceptionPtr,   offset System.@HandleAnyException
  mov dword  [eax].THandlersPtr.HandleOnExceptionPtr,    offset System.@HandleOnException
  mov dword  [eax].THandlersPtr.HandleAutoException,     offset System.@HandleAutoException
  {$ENDIF CPU64BITS}
end;

Annoying exceptions Using Delphi 10.2 Version 25.0.27659.1188

When using Delphi 10.2 Version 25.0.27659.1188, 32 bits debug configuration, there are very annoying exceptions triggered in DecodeBranch_Ev on the line "AM_32: P := PByte(PUInt32(P)^);".

They are ignored by a try/except but this make DebugEngine almost unusable in a real project while debugging. The exception pops up while working as soon as a stack trace is build.

Instead of capturing the exception with try/except, it should be avoided.

By the way, the exceptions I saw where triggered because the address (Variable P in the code) fall in the first KB of memory which is a protected area. A simple test would avoid the exception.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.