Rockstart
Rockstart

Reputation: 2377

Using Logger.exe in windbg to print method calls

I need windbg to print the method calls using Logger.exe.

After analyzing Logexts.dll , i learnt that !logexts.logm i sampleapplication.dll will print the calls made in sampleapplication.dll on to the windbg screen.

But I am not able to see the method calls made in sampleapplication.dll. How do I do that?

Suppose If there is a method, print() in sampleapplication, when this method is called, it should be printed in windbg screen.

How do i do that?

Upvotes: 2

Views: 2357

Answers (3)

mpderbec
mpderbec

Reputation: 364

The LogExts.dll extension will only log calls that are specified in the "header" files within winext\manifest of the WinDBG folder. It can only log native/unmanaged calls (i.e., no .NET/managed stuff).

I was the original author of this tool… It was written in 1999 and so much of the manifest reflects the Microsoft APIs that existed at that time. The original purpose was to debug third-party applications to figure out how to make them compatible with what eventually became Windows XP.

Upvotes: 4

Rockstart
Rockstart

Reputation: 2377

@EdChum :

Logs are seen. But not the method calls.

I have a button on a form . I am calling method1() when that button is clicked. But in logging i am seeing only this,

`Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "GetDlgItem") -> 0x77648510
Thrd 1bcc 0012B8A9 GetDlgItem( 0x0001083A 0x00000000) -> NULL [FAIL]
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "IsWindowVisible") -> 0x77656939
Thrd 1bcc 009718E6 IsWindowVisible( 0x0001083C) -> TRUE
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "IsWindowEnabled") -> 0x7764C921
Thrd 1bcc 009718E6 IsWindowEnabled( 0x0001083C) -> TRUE
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "SetCapture") -> 0x77676B2A
Thrd 1bcc 0012BBFE SetCapture( 0x0001083C) -> NULL [FAIL]
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "NotifyWinEvent") -> 0x7765F299
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "InvalidateRect") -> 0x77657BC9
Thrd 1bcc 00972610 InvalidateRect( 0x0001083C [0x0024E88C] -> 0 , 0 , 75 , 23  FALSE) -> TRUE
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "MapWindowPoints") -> 0x77657915
Thrd 1bcc 009726C7 MapWindowPoints( 0x0001083C NULL 0x00000001) -> 16711916 ( [0x01B30B24] -> 286 , 269 )
Thrd 1bcc 00972610 InvalidateRect( 0x0001083C [0x0024E804] -> 0 , 0 , 75 , 23  FALSE) -> TRUE
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "UpdateWindow") -> 0x77652BD9
Thrd 1bcc 009718E6 UpdateWindow( 0x0001083C) -> TRUE
Thrd 1bcc 009726C7 MapWindowPoints( 0x0001083C NULL 0x00000001) -> 16711916 ( [0x01B32AE8] -> 286 , 269 )
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "WindowFromPoint") -> 0x77676D0C
Thrd 1bcc 0012B98C WindowFromPoint( 286 269) -> 0x0001083C
Thrd 1bcc 7243DD89 GetProcAddress( 0x77640000 "ReleaseCapture") -> 0x7764C49E
Thrd 1bcc 0012B11F ReleaseCapture() -> TRUE

Upvotes: 0

EdChum
EdChum

Reputation: 394439

So you want logging to output to WinDbg output window? use the following:

!logexts.logo e d

this enables logging and should output to the output window

the one you listed is for creating a module inclusion or exclusion list (from the F1 help):

The !logexts.logm extension creates or displays a module inclusion list or a module exclusion list.

    !logexts.logm i Modules 
!logexts.logm x Modules 
!logexts.logm 

Parameters

i Causes Logger to use a module inclusion list. It will consist of the specified Modules.

x Causes Logger to use a module exclusion list. It will consist of Logexts.dll, kernel32.dll, and the specified Modules.

Modules Specifies the modules to be included or excluded. This list is not cumulative; each use of this command creates an entirely new list. If multiple modules are listed, separate them with spaces. An asterisk (*) can be used to indicate all modules.

Remarks With no parameters, the !logexts.logm extension displays the current inclusion list or exclusion list.

The extensions !logexts.logm x * and !logexts.logm i are equivalent: they result in a completely empty inclusion list.

The extensions !logexts.logm i * and !logexts.logm x are equivalent: they result in an exclusion list that contains only Logexts.dll and kernel32.dll. These two modules are always excluded, because Logger is not permitted to log itself.

Here are some examples:

0:001> !logm
Excluded modules:
  LOGEXTS.DLL      [mandatory]
  KERNEL32.DLL     [mandatory]
  USER32.DLL
  GDI32.DLL
  ADVAPI32.DLL

0:001> !logm x winmine.exe
Excluded modules:
  Logexts.dll      [mandatory]
  kernel32.dll     [mandatory]
  winmine.exe

0:001> !logm x user32.dll gdi32.dll
Excluded modules:
  Logexts.dll      [mandatory]
  kernel32.dll     [mandatory]
  user32.dll
  gdi32.dll

0:001> !logm i winmine.exe mymodule2.dll
Included modules:
  winmine.exe
  mymodule2.dll

Upvotes: 1

Related Questions