Building gdb with python

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Embedded Debugging

Clone this wiki locally

Using build_gdb.sh to build latest GDB for ARM target with embedded-Python3

You can use build_gdb.sh to build your own GDB w/ Python3 support for ARM target. The script will also create a special command for using GDBFrontend on your own GDB build. (Like gdbfrontend-gdb-11.2 .)

./build_gdb.sh --target=arm-none-eabi

Now you can use gdbfrontend-gdb- command. Just like:

or How to build GDB for ARM with embedded-Python3

GDBFrontend needs GDB-embedded Python3. Sometimes, you could not find a GDB build for ARM target ( arm-none-eabi ) with Python3 support on GDB. In this situation you can quickly build your own GDB with Python3 support and arm-none-eabi target.

You may need some build-time dependencies

Читайте также:  Java sort comparable collections

You must install GDB’s build dependencies that are listed here: https://sourceware.org/gdb/onlinedocs/gdb/Requirements.html

If you have some missing build dependencies, configure script will say the missing library, just find it in your package management system and install.

Please edit and update this article if you have an issue about build dependencies and you know how to install them.

cd ~ wget https://ftp.gnu.org/gnu/gdb/gdb-11.1.tar.xz tar zxvf gdb-11.1.tar.gz mkdir gdb-11.1-build cd gdb-11.1-build ../gdb-11.1/configure --with-python=/usr/bin/python3 --target=arm-none-eabi --enable-interwork --enable-multilib make

As you see, you should pass your Python3 executable to configure script’s —with-python paramter just like —with-python=/usr/bin/python3 .

Starting GDBFrontend with your GDB build

After build is successful, you should be able to run GDBFrontend like this:

gdbfrontend -g $(realpath ~/gdb-11.1-build/gdb/gdb) -G --data-directory=$(realpath ~/gdb-11.1-build/gdb/data-directory/)

Источник

Embedded Debugging with GDBFrontend

Using build_gdb.sh to build latest GDB for ARM target with embedded-Python3

You can use build_gdb.sh to build your own GDB w/ Python3 support for ARM target. The script will also create a special command for using GDBFrontend on your own GDB build. (Like gdbfrontend-gdb-11.2 .)

./build_gdb.sh --target=arm-none-eabi 

Now you can use gdbfrontend-gdb- command. Just like:

or How to build GDB for ARM with embedded-Python3

GDBFrontend needs GDB-embedded Python3. Sometimes, you could not find a GDB build for ARM target ( arm-none-eabi ) with Python3 support on GDB. In this situation you can quickly build your own GDB with Python3 support and arm-none-eabi target.

You may need some build-time dependencies

You must install GDB’s build dependencies that are listed here: https://sourceware.org/gdb/onlinedocs/gdb/Requirements.html

If you have some missing build dependencies, configure script will say the missing library, just find it in your package management system and install.

Please edit and update this article if you have an issue about build dependencies and you know how to install them.

Follow these steps

cd ~ wget https://ftp.gnu.org/gnu/gdb/gdb-11.1.tar.xz tar zxvf gdb-11.1.tar.gz mkdir gdb-11.1-build cd gdb-11.1-build ../gdb-11.1/configure --with-python=/usr/bin/python3 --target=arm-none-eabi --enable-interwork --enable-multilib make 

As you see, you should pass your Python3 executable to configure script’s —with-python paramter just like —with-python=/usr/bin/python3 .

Starting GDBFrontend with your GDB build

After build is successful, you should be able to run GDBFrontend like this:

gdbfrontend -g $(realpath ~/gdb-11.1-build/gdb/gdb) -G --data-directory=$(realpath ~/gdb-11.1-build/gdb/data-directory/) 

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Python extension for the GNU project debugger (GDB)

License

ucphhpc/pygdb

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

This package provides a set of tools for debugging python code with GDB, including python code breakpoints. GDB breakpoints operate on native shared libraries (C/assembler code). Since python is an interpreted language it’s not possible to set python code breakpoints directly from the GDB console. In this package python code breakpoints are supported by utilizing a python-c-extension breakpoint-mark function which is accessible from the GDB console. This method requires that python code breakpoints are set explictly in the python code.

Latest release: pip install pygdb

Breakpoints are set explicitly in the python code:

import pygdb.breakpoint pygdb.breakpoint.enable() def Test(): print "Before breakpoint" pygdb.breakpoint.set() print "After breakpoint" 

NOTE: pygdb.breakpoint.set() busy-waits until the python process is attached to the GDB console using the py-attach command (see below)

Pygdb breakpoint messages are written to stderr unless a Python logger is provided:

import logging import pygdb.breakpoint logging.basicConfig(level=logging.INFO) pygdb.breakpoint.enable(logger=logging.getLogger()) 

Launch GDB in python-mode from the shell

Add source-path if not current shell directory

Attach GDB console to the python process with PID, notify pygdb.breakpoint that the console is connected and continue until the native GDB breakpoint

NOTE: The GDB console supports tab-completion.

All GDB console commands added by this packages are prefixed with py-

For each command use —help for detailed help.

py-init: Initializes pygdb commands and extensions py-info-procs: Display list of attached processes py-info-threads: Display list of attached process threads py-attach: Attach python process to gdb console py-detach: Detach python process from gdb console py-thread: Change python thread in attached process py-breakpoint: Find and display code for python breakpoint py-step: Continue until control reaches a different python source line py-next: Continue until control reaches a different python source line in current frame py-continue: Continue until next python breakpoint and display code py-list: Display code for current python frame py-backtrace: Display current python frame and all the frames within its call stack (if any) py-inspect-frame: Display information about the current python frame py-builtins: Display builtin varialbes for current python frame py-globals: Display global variables for current python frame py-locals: Display local variables for current python frame py-print: Display python frame variable (if it exists) py-set-local: Set local variable in current python frame py-up: Select and display code for the python stack frame that called this one (if any) py-down: Select and display code for the python stack frame called by this one (if any) py-inject: Inject python code into current python frame 

About

Python extension for the GNU project debugger (GDB)

Источник

Оцените статью