Code Monkey home page Code Monkey logo

natvis4gdb's Introduction

natvis4gdb

image

natvis4gdb is a single script natvis implementation for GDB debugger.

Natvis Documentation: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2015#BKMK_Using_Natvis_files

Supported features

  • <Type> element with partial matching of template types.
  • <DisplayString> with optional Condition attribute and expression evaluation within {}.
  • Access to template parameters inside expressions through $T1..N variable.
  • Format specifiers for expression evaluation:
    • sb
    • d
  • <ArrayItems><Size/><ValuePointer/></ArrayItems> elements.

Features unsupported at this time will be silently ignored by the script.

Usage

Enable script by editing ~/.gdbinit and add following:

python
sys.path.insert(0, '/path/to/natvis4gdb')
import natvis4gdb
natvis4gdb.register()
end

Load natvis files by executing command add-natvis /path/to/your.natvis

Debugging

  1. Modify your ~/.gdbinit file and add following
python
sys.path.insert(0, '/path/to/natvis4gdb')
sys.path.insert(0, os.getenv('HOME') + '/.local/lib/python3.7/site-packages')
import natvis4gdb
natvis4gdb.register(True)
end
  1. Also install required python library like pip install --user pydevd-pycharm.
  2. Create Python Remote Debug configuration in PyCharm and set it to connect to port 41879.
  3. Start remote debugging session in PyCharm.
  4. Run C++ application that will be inspecting some variables.
  5. Inspect some variables in your C++ application and breakpoints in PyCharm should trigger.

Parts and ideas salvaged from https://github.com/asarium/gdb-natvis

natvis4gdb's People

Contributors

rokups avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.