コード例 #1
0
ファイル: gdbSpawner.py プロジェクト: eldipa/ConcuDebug
    def _spawn_a_gdb(self, _):
        gdb = Gdb()
        gdb_pid = gdb.get_gdb_pid()

        self.gdb_by_its_pid[gdb_pid] = gdb

        self.ev.publish("spawner.debugger-started", {"debugger-id": gdb_pid})

        return gdb_pid
コード例 #2
0
ファイル: pydb.py プロジェクト: carlgao/lenga
 def __init__(self, completekey='tab', stdin=None, stdout=None,
              siglist=None):
     Gdb.__init__(self, completekey, stdin, stdout, siglist)
     self.annotate = 0     # if > 0, print annotations (for better emacs
                           # integration)
     self.__show_breakpoints_postcmd = set(["break", "b", "tbreak", 
                                            "disable", "enable", "condition",
                                            "cl", "clear", "delete"])
     self.__show_annotations_preloop = set(["s", "step", "c", "continue",
                                            "n", "next", "return", "jump"])
     self.__show_annotations_postcmd = set(["down", "frame", "up"])
     self.__show_annotations = True
     return
コード例 #3
0
ファイル: pydb.py プロジェクト: amazingguni/codevisualizer
 def __init__(self,
              completekey='tab',
              stdin=None,
              stdout=None,
              siglist=None):
     Gdb.__init__(self, completekey, stdin, stdout, siglist)
     self.annotate = 0  # if > 0, print annotations (for better emacs
     # integration)
     self.__show_breakpoints_postcmd = set([
         "break", "b", "tbreak", "disable", "enable", "condition", "cl",
         "clear", "delete"
     ])
     self.__show_annotations_preloop = set(
         ["s", "step", "c", "continue", "n", "next", "return", "jump"])
     self.__show_annotations_postcmd = set(["down", "frame", "up"])
     self.__show_annotations = True
     self.precmd_hooks = []
     self.preloop_hooks = []
     self.postcmd_hooks = []
     self.postloop_hooks = []
     return
コード例 #4
0
ファイル: server.py プロジェクト: tashanji/pydb
def invoke_server(signum, frame):
    """This function sets up a signal handler, which when it
    traps a signal, starts a debugging server suitable for other
    debugging clients to connect to.
    """
    p = Gdb()
    p._sys_argv = list(sys.argv)

    from remote import RemoteWrapperServer
    p = RemoteWrapperServer(p)
    p.do_pydbserver(server_addr)

    p.set_trace(frame)

    import signal
    signal.signal(signum, old_handler)
コード例 #5
0
ファイル: server.py プロジェクト: rocky/pydb
def invoke_server(signum, frame):
    """This function sets up a signal handler, which when it
    traps a signal, starts a debugging server suitable for other
    debugging clients to connect to.
    """
    p = Gdb()
    p._sys_argv = list(sys.argv)
    
    from remote import RemoteWrapperServer
    p = RemoteWrapperServer(p)
    p.do_pydbserver(server_addr)

    p.set_trace(frame)
    
    import signal
    signal.signal(signum, old_handler)
コード例 #6
0
ファイル: tracer.py プロジェクト: yieldthought/codechart
class Tracer:
    def __init__(self, pid):
        self.process = Process(pid)
        self.gdb = Gdb(pid)
        self.io_read_bytes = 0
        self.io_write_bytes = 0
        self.about = (self.process.name, pid, datetime.now())

    def snapshot(self):
        cpu = self.process.get_cpu_percent()
        mem = self.process.get_memory_info()[0] # only RSS for now
        io = self.get_io_bytes()
        stack = self.gdb.get_stack()
        return (cpu, mem, io, stack)

    def get_io_bytes(self):
        _, _, read_bytes, write_bytes = self.process.get_io_counters()
        io = (read_bytes - self.io_read_bytes, write_bytes - self.io_write_bytes)
        self.io_read_bytes, self.io_write_bytes = read_bytes, write_bytes
        return io
コード例 #7
0
ファイル: tracer.py プロジェクト: yieldthought/codechart
class Tracer:
    def __init__(self, pid):
        self.process = Process(pid)
        self.gdb = Gdb(pid)
        self.io_read_bytes = 0
        self.io_write_bytes = 0
        self.about = (self.process.name, pid, datetime.now())

    def snapshot(self):
        cpu = self.process.get_cpu_percent()
        mem = self.process.get_memory_info()[0]  # only RSS for now
        io = self.get_io_bytes()
        stack = self.gdb.get_stack()
        return (cpu, mem, io, stack)

    def get_io_bytes(self):
        _, _, read_bytes, write_bytes = self.process.get_io_counters()
        io = (read_bytes - self.io_read_bytes,
              write_bytes - self.io_write_bytes)
        self.io_read_bytes, self.io_write_bytes = read_bytes, write_bytes
        return io
コード例 #8
0
import sys
import struct

from gdb import Gdb
from ptrace.debugger import PtraceDebugger, ProcessSignal, ProcessExit

pid = sys.argv[1]
gdb = Gdb()
gdb.debugger = PtraceDebugger()
gdb.process = None

gdb.attachProcess(pid)
print("[!] attached to {0}".format(pid))

#gdb.breakpoint("0x80487e0")
gdb.breakpoint("0x080487d6")
gdb.breakpoint("0x08048802")
while (True):

    try:
        gdb.cont()
        eip = gdb.process.getreg("eip")
        print("EIP: {0}".format(hex(eip)))

        #if eip == 0x80487e0:
        #    print("pipe descriptor: {0}".format(hex(gdb.process.getreg("eax"))))

        # WRITE WHERE
        if eip == 0x80487d6:
            eax = gdb.process.getreg("eax")
            i = gdb.process.readBytes(eax, 4)
コード例 #9
0
ファイル: remote.py プロジェクト: rocky/pydb
 def __init__(self, pydb_object):
     Gdb.__init__(self)
     self.pydb = pydb_object
     self.connection = None
     self.use_rawinput = False
     self.running = True
コード例 #10
0
 def __init__(self, vim):
     self.vim = vim
     self.gdb = Gdb(vim)
コード例 #11
0
class DbugPlugin(object):
    def __init__(self, vim):
        self.vim = vim
        self.gdb = Gdb(vim)

    @pynvim.command('Dbg', sync=True)
    def dbg(self):
        self.gdb.start()

        remote_address = self.vim.vars.get('dbug_remote_hint')
        if remote_address:
            self.gdb.target_connect_remote(remote_address)

        fname = self.vim.vars.get('dbug_file')
        if fname:
            self.gdb.load_exec_and_symbol_file(fname)

        if remote_address:
            self.gdb.download()

        self.gdb.stack_info()
        self.gdb.bp_list()

    @pynvim.command('DbgAttach', sync=True)
    def dbg_attach(self):
        self.gdb.start()

        remote_address = self.vim.vars.get('dbug_remote_hint')
        if remote_address:
            self.gdb.target_connect_remote(remote_address)

        fname = self.vim.vars.get('dbug_file')
        if fname:
            self.gdb.load_exec_and_symbol_file(fname)

        self.gdb.stack_info()
        self.gdb.bp_list()

    @pynvim.command('DbgStart', sync=True)
    def dbg_start(self):
        self.gdb.start()

    @pynvim.command('DbgStop', sync=False)
    def dbg_stop(self):
        self.gdb.stop()

    @pynvim.command('DbgFile', nargs='?', complete="file", sync=True)
    def dbg_file(self, args):
        if len(args) == 0:
            fname = self.vim.vars.get('dbug_file')
        else:
            fname = args[0]

        self.gdb.load_exec_and_symbol_file(fname)

    @pynvim.command('DbgRemote', nargs='?', sync=True)
    def dbg_remote(self, args):
        if len(args) == 0:
            address = self.vim.vars.get('dbug_remote_hint')
        else:
            address = args[0]

        self.gdb.target_connect_remote(address)

    @pynvim.command('DbgLoad', sync=False)
    def dbg_load(self):
        self.gdb.download()

    @pynvim.command('DbgRun', sync=True)
    def dbg_run(self):
        self.gdb.run()

    @pynvim.command('DbgContinue', sync=True)
    def dbg_continue(self):
        self.gdb.cont()

    @pynvim.command('DbgStep', sync=True)
    def dbg_step(self):
        self.gdb.step()

    @pynvim.command('DbgNext', sync=True)
    def dbg_next(self):
        self.gdb.next()

    @pynvim.command('DbgBreakpoint', sync=True)
    def dbg_breakpoint_toggle(self):
        line = self.vim.current.window.api.get_cursor()[0]
        fname = self.vim.current.buffer.api.get_name()
        self.gdb.bp_toggle(fname, line)

    @pynvim.command('DbgBreakpointList', sync=True)
    def dbg_breakpoint_list(self):
        self.gdb.bp_list()

    @pynvim.command('DbgWatchExpression', nargs='1', sync=True)
    def dbg_expr_watch(self, args):
        self.gdb.expr_watch(args[0])

    @pynvim.command('DbgExpressionUpdate', sync=True)
    def dbg_expr_update(self):
        self.gdb.expr_update()

    @pynvim.command('DbgWatchDelete', range=True, sync=True)
    def dbg_watch_del(self, args):
        line = int(args[0]) - 1
        self.gdb.watch_del(line)

    @pynvim.command('DbgBacktrace', sync=True)
    def dbg_backtrace(self):
        self.gdb.stack_list()
コード例 #12
0
ファイル: main.py プロジェクト: alexeRadu/dotfiles
handler = logging.FileHandler('/tmp/dbug.log', 'w')
handler.formatter = logging.Formatter(
    '%(msecs)6d %(levelname)-5s   %(message)s')
logger = logging.getLogger(__name__)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)

bpdb = BreakpointDB()
from gdb import Gdb

try:
    logger.info("\n\n\n\n\n")

    if len(sys.argv) == 1:
        gdb = Gdb()
        logger.info("GDB server started")
    elif len(sys.argv) == 2:
        gdb_path = sys.argv[1]
        gdb = Gdb(gdb_path=gdb_path)
        logger.info("GDB server started %s" % (gdb_path))

    while True:
        msg = vim.recv_msg()

        if msg["name"] == "file":
            filepath = msg["path"]

            gdb.file_and_exec_symbols(filepath)

        elif msg["name"] == "remote":
コード例 #13
0
ファイル: rtvtrace.py プロジェクト: ekse/naga3
import sys
import struct

from gdb import Gdb
from ptrace.debugger import PtraceDebugger, ProcessSignal, ProcessExit

pid = sys.argv[1]
gdb = Gdb()
gdb.debugger = PtraceDebugger()
gdb.process  = None

gdb.attachProcess(pid)
print("[!] attached to {0}".format(pid))

#gdb.breakpoint("0x80487e0")
gdb.breakpoint("0x080487d6")
gdb.breakpoint("0x08048802")
while(True):

    try:
        gdb.cont()
        eip = gdb.process.getreg("eip")
        print("EIP: {0}".format(hex(eip)))

        #if eip == 0x80487e0:
        #    print("pipe descriptor: {0}".format(hex(gdb.process.getreg("eax"))))

        # WRITE WHERE
        if eip == 0x80487d6:
            eax = gdb.process.getreg("eax")
            i = gdb.process.readBytes(eax, 4)
コード例 #14
0
 def __init__(self, pydb_object):
     Gdb.__init__(self)
     self.pydb = pydb_object
     self.connection = None
     self.use_rawinput = False
     self.running = True
コード例 #15
0
ファイル: tracer.py プロジェクト: yieldthought/codechart
 def __init__(self, pid):
     self.process = Process(pid)
     self.gdb = Gdb(pid)
     self.io_read_bytes = 0
     self.io_write_bytes = 0
     self.about = (self.process.name, pid, datetime.now())
コード例 #16
0
ファイル: tracer.py プロジェクト: yieldthought/codechart
 def __init__(self, pid):
     self.process = Process(pid)
     self.gdb = Gdb(pid)
     self.io_read_bytes = 0
     self.io_write_bytes = 0
     self.about = (self.process.name, pid, datetime.now())