Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Universal Trace Debugger Engine. Currently, only support windbg on Windows, but the long term goal is to also support GDB or LLDB

Notifications You must be signed in to change notification settings

Baoqi/uni-trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

* uni-trace

Universal Trace Debugger Engine. Currently, only support windbg on Windows, but the long term goal is to also support GDB or LLDB.

Introduction

History

This project is mainly inspired by BTrace for JAVA and DTrace. The initial purpose is to bring btrace like support for Windows (by using WinDBG), but since both GDB and LLDB support Python scripting, there is no reason we couldn’t port this to also support GDB or LLDB later.

Dependents

Pykd: Python extension to access Debug Engine

This is a great project, which allows us to write windbg extensions by Python 2.7, for current uni-trace, we will highly depends on this project to execute windbg commands.

MacroPy: Bring Macros to Python

Pykd is great, but to setup a break point, we need to do the following things.

from pykd import *
def SomeBreakPointerHandler(bpId):
    # do some handling for the break pointers.
    pass

setBp(expr("MyModule!MyNameSpace::MyClass::MyClass"), SomeBreakPointerHandler)

go()

There is many code to write. When there are a lot of code (especially book keeping code), it is less likely we will write some script to trace the program execution (It may be easier to manually debug the program in visual studio). So, the goal of this project is to make us write less code to trace our program.

Here Macros come into play. So, to trace all functions with name like “Create*” of a special class, one can write the following code in uni-trace.

with TraceFunctionEnter('MyModule', 'MyNameSpace::MyClass::Create*', 'TestTrace1'):
    dprintln("Trace Function Begin for MyNameSpace::MyClass::Create*")
    dprintln(dbgCommand("k 5"))    # this is a windbg command to show the top 5 call stack.

Some kind of DTrace like, right?

Usage

Install dependent softwares: Pykd and MacroPy

Download Uni-trace

The only file you need to change is the “utrace_sample1.py”.

Inside WinDBG

First load Pykd extension

.load pykd.pyd

Then, Run:

!py ~/uni_trace_folder/run_trace.py

Continue to run your target program, during this time, you will see the break point’s handler print your log messages in the windbg console. Press CTRL+BREAK to stop trace.

Happy Debugging (even on Windows)

About

Universal Trace Debugger Engine. Currently, only support windbg on Windows, but the long term goal is to also support GDB or LLDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published