News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Complementary macros for debugging

Started by HSE, December 13, 2020, 04:18:48 AM

Previous topic - Next topic

HSE

Hi all!

Here some macros that help me to follow execution of complex objects.

At program beginning, previous to object making:
carteleria = 0
carteleriat = 0
include TitulosMacs.asm

When using several libraries, I 'm making carteleria = 1000 in one library, carteleria = 2000 in other library, and so on.

Inside objects methods:Method SerieGraph.Clear , uses esi
DbgMtit   <----
SetObject esi
OCall [esi].Puntos::LinkedList.Clear
DbgMsal   <----
MethodEnd


Then at runtime you obtain indented text, with some values to keep execution track :    + OA_ExperimentalTest._Init  pSelf = 00186600  esi = 00000000  dir = 0043B976
       + OA_ExperimentalUnit._Init  pSelf = 001866B0  esi = 00186600  dir = 00415AA1
          + OA_IntgSim._Init  pSelf = 00191658  esi = 001866B0  dir = 00413EF5
          - OA_IntgSim._Init  pSelf = 00191658  esi = 00191658  dir = 00414118
       - OA_ExperimentalUnit._Init  pSelf = 001866B0  esi = 001866B0  dir = 0043B447
    - OA_ExperimentalTest._Init  pSelf = 00186600  esi = 00186600  dir = 0043BBE1

pSelf is the object called, esi is the callee object (usually), and dir is memory position of method that you can see with Olly.

Use in place you want begin /end to follow:mov DbgGlobalActivated,1 (or 0)

Also you can use words and colors to follow execution (TODO and TODOLOG in this case).

Regards. HSE
Equations in Assembly: SmplMath

Biterider

Hi HSE
Thanks for sharing  :thumbsup:

Regards, Biterider

HSE

Hi Biterider!

Perhaps could be interesting something like StrMake procedure in the library.

Regards. HSE
Equations in Assembly: SmplMath

Biterider


HSE

Hi Biterider!

I think is based in the procedure to draw lines in DebugCenter or some other function, not sure, and I just invented a name (not very creative indeed  :biggrin:).

HSE

PD. not DebugCenter  :cool:
Equations in Assembly: SmplMath

Biterider

Hi HSE
Sorry i misunderstood you
In the current version of ObjMem there is a procedure called StrRepChrA and StrRepChrW that do what you want.
I'm not sure if it's in the C.1.0 distribution, but it sure is in the GitHub repo.  :biggrin:

A variation on how to fill a pre-allocated buffer could be a new procedure called FillRepChar. :icon_idea:

Biterider

HSE

Hi Biterider!

Quote from: Biterider on December 16, 2020, 08:19:32 AM
In the current version of ObjMem, there is a proc called StrRepChrA and StrRepChrW, which do exactly what you want.

I found the procs, not the same (requires allocation and deallocation) but they can to make the work. :thumbsup:

I don't wanted, just thinking in thousands of ObjAsm users  :biggrin:

Regards. HSE
Equations in Assembly: SmplMath

Biterider

Hi HSE
A quick fix solution may be using the MemFillB procedure, but you have to set the zero terminating char yourself.
Unfortunately, there is no MemFillW proc yet, but it can be added easily.

With this building block we can create a new proc like:


StrFillA proc pBuffer:POINTER, Char:CHRA, dRep:DWORD
  invoke MemFillB, pBuffer, dRep, Chr
  mov eax, pBuffer
  add eax, dRep
  mov [eax], 0
  ret
StrFillA endp


Biterider

HSE

Equations in Assembly: SmplMath

Biterider

Good News  :cool:
I added MemFillW, StrFillChrA/W in 32 and 64 bit to the ObjMem library.
The code is available on the GitHub repo.


Biterider

HSE

Equations in Assembly: SmplMath