summaryrefslogtreecommitdiff
path: root/plugins/python/exectracer/exectracer.py
blob: 76e2ce4933ed1aa4263261012df58b1fd25d90ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python
# -*- coding: utf-8 -*-

from pyoida import Plugin


class ExecTracer(Plugin):
    """Trace and replay debug executions."""

    def get_action(self):
        """Register the plugin for given actions."""

        return Plugin.PGA_DEBUGGER_ATTACH

    def handle_debugger(self, debugger, action):
        """Be notify about debugger attaching or detaching."""

        print "Python Hello !"
        print debugger

        for i in debugger.list_all_threads():

            print "Thread %d '%s'" % (i[0], i[1])

            frames = debugger.get_frames_stack(i[0])

            for frame in frames:
                print " 0x%08x" % frame[0]

            if len(frames) == 0:
                print " -"