gdb-imagewatch

Downloading GDB ImageWatch

git clone https://github.com/csantosbh/gdb-imagewatch
cd gdb-imagewatch
git submodule init
git submodule update

Build plugin and configure GDB

mkdir build && cd build
qmake ../ BUILD_MODE=release PREFIX=/home/shihyu/.mybin/gdb-imagewatch
make -j4
make install

No module named 'gdbbridge'

qtcreator.register_symbol_fetch_hook(event_handler.refresh_handler) 註解掉

https://github.com/csantosbh/gdb-imagewatch/issues/36

  • gdb-imagewatch.py
#!/usr/bin/python3

# -*- coding: utf-8 -*-

"""
GDB-ImageWatch entry point. Can be called with --test for opening the watcher
window with a couple of sample buffers; otherwise, should be invoked by the
debugger (GDB).
"""

import argparse
import os
import sys


def get_debugger_bridge():
    """
    Instantiate the debugger bridge. If we ever decide to support other
    debuggers, this will be the place to instantiate its bridge object.
    """
    from giwscripts.debuggers import gdbbridge
    from giwscripts import typebridge

    try:
        return gdbbridge.GdbBridge(typebridge.TypeBridge())
    except Exception as err:
        print(err)

    print('[gdb-imagewatch] Error: Could not instantiate any debugger bridge')
    exit(1)


def main():
    """
    Main entry point.
    """
    # Add script path to Python PATH so submodules can be found
    script_path = os.path.dirname(os.path.realpath(__file__))
    sys.path.append(script_path)

    # Load dependency modules
    from giwscripts import events
    from giwscripts import giwwindow
    from giwscripts import test
    from giwscripts.ides import qtcreator

    parser = argparse.ArgumentParser()
    parser.add_argument('--test',
                        help='Open a test window with sample buffers',
                        action='store_true')
    args = parser.parse_args()

    if args.test:
        # Test application
        test.giwtest(script_path)
    else:
        # Setup GDB interface
        debugger = get_debugger_bridge()
        window = giwwindow.GdbImageWatchWindow(script_path, debugger)
        event_handler = events.GdbImageWatchEvents(window, debugger)

        #qtcreator.register_symbol_fetch_hook(event_handler.refresh_handler)
        debugger.register_event_handlers(event_handler)


main()