Giter Site home page Giter Site logo

rohanrhu / gdb-frontend Goto Github PK

View Code? Open in Web Editor NEW
2.8K 54.0 97.0 31.81 MB

☕ GDBFrontend is an easy, flexible and extensible gui debugger. Try it on https://debugme.dev

Home Page: https://oguzhaneroglu.com/projects/gdb-frontend/

License: GNU General Public License v3.0

Python 30.25% JavaScript 68.55% Shell 1.20%
gdb debug debugger debugging-tool debugging gdb-frontend gdb-gui gdb-extension gdb-plugin gdb-ui

gdb-frontend's Introduction

GDBFrontend

GitHub release GitHub issues GitHub forks GitHub stars GDBFrontend Discord Support me on Patreon Donate with BTC

GDBFrontend is an easy, flexible and extensionable gui debugger. Try it online!

gdb-frontend

Installing

Requirements

  • GDB => 8.2 (with python3)
  • python3 => 3.6
  • tmux

PIP Package (Python Wheel) [Recommended]

You can install GDBFrontend with pip.

sudo python3 -m pip install gdbfrontend

if it is already installed and you are upgrading

sudo python3 -m pip install --upgrade gdbfrontend

or if you want to install specific GIT snapshot:

sudo python3 setup.py install

and you can run

gdbfrontend

Running From GIT

You can download latest source and run it.

You can run gdb-frontend with following commands:

git clone https://github.com/rohanrhu/gdb-frontend.git gdb-frontend
cd gdb-frontend
./gdbfrontend

and you can open it with:

http://127.0.0.1:5550/

You can open GDB shell with the command:

tmux a -t gdb-frontend

Arch Linux (AUR)

You can install Arch Linux package for Arch-based distributions. (AUR Package)

yay -S gdb-frontend-bin

and you can run it:

gdbfrontend

Flatpak

Flatpak package is a TODO.

Follow this quick tutorial for debugging embedded devices with GDBFrontend.

Follow this quick tutorial for debugging native C Python extensions with GDBFrontend.

GDBFrontend has powerful and extensible APIs. Follow this quick tutorial to learn developing GDBFrontend plugins.

Follow this quick tutorial for integration ideas for special development/debugging requirements.

Follow this tutorial for debugging STM32 with OpenOCD and GDBFrontend.

Features

Expression Evaluator

GDBFrontend has an expression evaluator that you can use multiple in sametime.

Pointer Visualisation

Linked-List Visualization

Conditional Breakpoints

Right click to a breakpoint for setting its condition.

Connected Expressions

Expressions of all variables, members and items are connected in GDBFrontend's VariablesExplorer.

Process Manager

You can watch, filter or manage processes with Process Manager.

Array-Graph Visualization

Enhanced Collabration

GDBFrontend has a set of some features for collabration named as "Enhanced Collabration".

Collabration Draw

Collabration draw is available when you enable Enhanced Collabration. Click to Draw or use Ctrl + Shift + X shortcut to draw and Ctrl + Shift + C to clear all drawings.

Synced Source Viewing

With Enhanced Collabration all debugger clients are synchronized on source viewing.

Expression hover popup variable explorer

Extensibility

GDBFrontend is very extensible and has powerful APIs. Some examples of GDBFrontend's extensibility.

./gdbfrontend

$ gdbfrontend --help
GDBFrontend is a easy, flexible and extensionable gui debugger.

Options:
  --help, -h:                                   Shows this help message.
  --version, -v:                                Shows version.
  --gdb-args="ARGS", -G "ARGS":                 Specifies GDB command line arguments. (Optional)
  --gdb-executable=PATH, -g PATH:               Specifies GDB executable path (Default is "gdb" command on PATH environment variable.)
  --tmux-executable=PATH, -tmux PATH:           Specifies Tmux executable path (Default is "tmux" command on PATH environment variable.)
  --terminal-id=NAME, -t NAME:                  Specifies tmux terminal identifier name (Default is "gdb-frontend".)
  --credentials=USER:PASS, -c USER:PASS:        Specifies username and password for accessing to debugger.
  --host=IP, -H IP:                             Specifies current host address that you can access via for HTTP and WS servers.
  --listen=IP, -l IP:                           Specifies listen address for HTTP and WS servers.
  --port=PORT, -p PORT:                         Specifies HTTP port. (0 for random port.)
  --url-base=PATH, -u PATH:                     Specifies URL base path. (Default: /)
  --readonly, -r:                               Makes code editor readonly. (Notice: This option is not related to security.)
  --workdir, -w:                                Specifies working directory.
  --plugin-dir, -P:                             Specifies plugins directory.
  --dontopenuionstartup, -D:                    Avoids opening UI just after startup.
  --verbose, -V:                                Enables verbose output.

Options

--help, -h

Shows help text.

--version, -v

Shows version.

--gdb-args="ARGS", -G "ARGS"

Specifies GDB command line arguments. (Optional)

--gdb-executable=PATH, -g PATH

You can specify GDB executable path like gdbfrontend --gdb-executable=/path/to/gdb. (Optional)

--tmux-executable=PATH, -tmux PATH

You can specify Tmux executable path like gdbfrontend --tmux-executable=/path/to/tmux. (Optional)

--terminal-id=PATH, -t PATH

You can specify Tmux terminal id like gdbfrontend --terminal-id=terminal-name. (Default: gdb-frontend)

--credentials=USER:PASS, -c USER:PASS

Specifies username and password for accessing to debugger.

--host=IP, -H IP

Specifies current host address that you can access via for HTTP and WS servers.

--listen=IP, -l IP

Specifies listen address for HTTP and WS servers.

--port=PORT, -p PORT

Specifies HTTP port. (0 for random port.)

--url-base=PATH, -u PATH

Specifies URL base path. (Default: /)

--readonly, -r

Makes code editor readonly. (Notice: This option is not related to security.)

--workdir, -w

Specifies working directory.

--plugin-dir, -P

Specifies plugins directory.

--dontopenuionstartup, -D

Avoids opening UI just after startup.

--verbose, -V

Enables verbose output.

GDB Commands

GDBFrontend's GDB commands starts with gf-.

gf-refresh

Refreshes all browser clients.

gf-theme [theme-name]

Switch to desired theme. For example: gf-theme light, gf-theme red or gf-theme default for default theme.

gf-list-plugins

Lists all GDBFrontend plugins in the plugin directory.

gf-load-plugin [plugin-name]

Loads GDBFrontend plugin.

gf-unload-plugin [plugin-name]

Unloads GDBFrontend plugin.

Shortcuts / Hotkeys

Current hotkeys are listed below.

Action Hotkey Context
General: Open a source file Ctrl + O GDBFrontend
General: New ExpressionEvaluator Ctrl + R GDBFrontend
General: New ExpressionEvaluator on native window Ctrl + Shift + R GDBFrontend
General: Fuzzy source finder Ctrl + P GDBFrontend
Runtime: Run F5 GDBFrontend
Runtime: Continue F6 GDBFrontend
Runtime: Pause/Interrupt F7 GDBFrontend
Runtime: Step Over F8 GDBFrontend
Runtime: Step Into F9 GDBFrontend
Runtime: Step Instruction F10 GDBFrontend
Runtime: Stop F11 GDBFrontend
Enhanced Collabration: Toggle drawing mode Ctrl + Shift + X GDBFrontend / Enhanced Collabration: Enabled
Enhanced Collabration: Clear all drawings Ctrl + Shift + C GDBFrontend / Enhanced Collabration: Enabled

Themes

GDBFrontend has built-in themes.

For switching between themes use gf-theme [THEME] command on GDB shell.

(gdb) gf-theme doki
(gdb) gf-theme sky
(gdb) gf-theme sakura
(gdb) gf-theme waifu
(gdb) gf-theme cyberpunk
(gdb) gf-theme dark
(gdb) gf-theme green
(gdb) gf-theme light
(gdb) gf-theme red

For switching back to the default theme.

(gdb) gf-theme

Also you may want to look to Plugin Development Tutorial.

GDBFrontend Python API

You can access GDBFrontend's Python API via gdbfrontend module.

(gdb) python-interactive
>>> dir(gdbfrontend)

For example, you can get all client sockets like this:

>>> gdbfrontend.api.globalvars.httpServer.ws_clients
{1: <server.GDBFrontendSocket object at 0x...>}

or you can get all plugins:

>>> gdbfrontend.plugin.getAll()
['hello', 'theme_cyberpunk', 'theme_dark', 'theme_doki', 'theme_green', 'theme_light', 'theme_red', 'theme_sakura', 'theme_sky', 'theme_waifu']

Security with Sharing Sessions

You can use --credentials=USER:PASS option for adding HTTP authentication to your debugger session.

Browser Compatibility

GDBFrontend is mainly developing with testing on Chromium-based browsers. It will work properly with other browsers especially with Firefox but if you face some problems on other browsers, you can send a bug-report.

Troubleshooting

Blocking GDB shell/main-thread

Most of GDBFrontend functions are thread-safe and work on GDB's main-thread. So, if you run something that is blocking on the GDB shell, GDBFrontend functions have to wait it until finish.

You will get this warning when a thread-safe GDBFrontend function needs to work and you are blocking GDB's main thread.

(gdb) shell
$ ...

When you exit shell, blocking GDBFrontend functions will continue working.

Note: Sometimes you may get this warning without running anything in GDB shell, it means something (in GDB's event-loop) is taking a long time; in this case just ignore this warning.

Zombie Processes

GDBFrontend sends SIGTERM to its sub-processes, your application and its sub-processes. If your application is forking new processes and setting their PGIDs, GDBFrontend may not close them. In this case you should send SIGKILL to your processes.

pkill -f gdb

Expression Evaluator Performance Tips

If you are using ExpressionEvaluator with very long depth expanded variables/members, your scroll and evaluator window move performance may be affected bad for pointer visualization. In this situation, you can turn off signal and slot pointings for that evaluator window.

Evaluator Pointer Visualization Buttons

GDB-Related Issues and Tips

  • GDB may not give sources of dynamic linked object until stepping a line that calls a function from the dynamic linked object once. You can add break point a line and step it once, then you will see sources from dynamic linked object hereafter during the session.

Windows

In fact, gdb-frontend is able to run on Windows but there are some serious issues in the GDB's Windows version those avoid using gdb-frontend on Windows. Of course you can use gdb-frontend on WSL if you are using Windows 10.

Issues about Windows-GDB

  • GDB's main-thread is being blocked during running process. (gdb-frontend has an interrupting mechanism to fixing this but it is not enough yet.)
  • Windows-GDB's prompt is being blocked during running process and there are some issues about interrupting the application.

WSL

You can use gdb-frontend on WSL (Windows Subsystem for Linux).

Issues about WSL

  • On WSL 1, Random port option is not usable on WSL becasue/proc/net/tcp interface is not working on WSL. (WSL 2 does not has this problem.)

Versioning

Since v0.2.0-beta, GDBFrontend switched to a new versioning strategy.

Reading Versions

In vX.Y.Z-STABILITY:

  • X ismajor versions, changes long term with major features and enhancements.
  • Y ismain versions that include new features and enhancements.
  • Z isbugfix releases of main versions.
  • STABILITY is stability level of the release. (alpha,beta,rcN,stable)

Documentation

Documentation is TODO yet.

API Documentation

API Documentation is TODO yet.

Plugin Development

You can read the Plugin Development Tutorial.

Theme Development

Themes are developed as plugins.

Discord

Join to Discord community.

GDBFrontend Discord

🎊 Contributing

You can contribute with commiting to project or developing a plugin. All commits are welcome.

❤️ Donate

Patreon

Support me on Patreon

Bitcoin

You can donate for supporting me :)

QR Code Bitcoin address for donations
Bitcoin address QR code for donate bc1qhvlc762kwuzeawedl9a8z0duhs8449nwwc35e2

Other currencies:

Currency Address
BTC bc1qhvlc762kwuzeawedl9a8z0duhs8449nwwc35e2
ETH 0x1D99B2a2D85C34d478dD8519792e82B18f861974
USDT 0x1D99B2a2D85C34d478dD8519792e82B18f861974
USDC 0x1D99B2a2D85C34d478dD8519792e82B18f861974
XMR 88qvS4sfUnLZ7nehFrz3PG1pWovvEgprcUhkmVLaiL8PVAFgfHjspjKPLhWLj3DUcm92rwNQENbJ1ZbvESdukWvh3epBUty

License

Copyright (C) 2019, Oğuzhan Eroğlu [email protected] (https://oguzhaneroglu.com/)

GNU General Public License v3 (GPL-3)

You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions.

gdb-frontend's People

Contributors

epiccmoment avatar rohanrhu avatar shlomif avatar

Stargazers

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

Watchers

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

gdb-frontend's Issues

Will not open the executable

I have a program, compiled in the Windows 10 Linux shell. When I navigate to the executable I get this error: "Path not found."
The 'Sources' frame on the left side opens all the correct directories, the file browser shows the executable.
It would also be nice if I could specify the executable on the command line.

Options per each tree item for including non-source files

This is what happens when I load my executable, as you can see just main.c pops up:

Screenshot from 2020-10-08 09-31-13

This wouldn't be an issue if the tree shown to the left would actually allow me to browse the project folder for the other files. However, for some reason it doesn't, and opening them all up manually via "Load File" would take forever (since load file is unsorted as mentioned in #12 and doesn't start out in the directory I previously picked something from, making it really tedious to open up multiple files form the same folder). So some sort of "Show other files from this directory" context menu or button in the tree view to the left would really help, or alternatively a fix for whatever causes the other source files to not get detected in the first place. If you need more info for fixing that detection please tell me what you need, I'm happy to provide what I can.

Can't load sources at all

I have tried and tried but nothing in the user interface lets me load sources.

I've loaded a debug executable complied using Rust. Other debuggers find the sources automatically. In this case, no sources load automatically and there is no apparent means of loading sources at all. No widget in the UI allows this. No folders appear. No files appear. No source text appears.

If you can provide a usable debugger for Rust in Linux you will be my heroes forever.

But right now, I sadly cannot use your tool.

How to load additional source files?

I'm a little confused by the file manager - when I load and run my binary, it loads some of the source files that it uses, but not all of them. If I try to load a source file manually, I get the following stacktrace (it doesn't seem to be copyable as text):

image

Observe how so few files under src/ are available. If I try and load TLuaInterpreter.cpp, I get the following stacktrace.

My project is https://github.com/mudlet/mudlet if you'd like to replicate it. How can I view all source files?

macOS support?

Hi!

I tried giving gdbfrontend a test drive on my macOS laptop this morning, and was only treated with an error message:

GDBFrontend v0.6.1-beta
Traceback (most recent call last):
 File "/Users/x99/.pyenv/versions/3.9.5/lib/python3.9/runpy.py", line 197, in _run_module_as_main
   return _run_code(code, main_globals, None,
 File "/Users/x99/.pyenv/versions/3.9.5/lib/python3.9/runpy.py", line 87, in _run_code
   exec(code, run_globals)
 File "/Users/x99/.pyenv/versions/3.9.5/lib/python3.9/site-packages/gdbfrontend/__main__.py", line 22, in <module>
   spec.loader.exec_module(run)
 File "<frozen importlib._bootstrap_external>", line 855, in exec_module
 File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
 File "/Users/x99/.pyenv/versions/3.9.5/lib/python3.9/site-packages/gdbfrontend/run.py", line 348, in <module>
   gotty = subprocess.Popen(
 File "/Users/x99/.pyenv/versions/3.9.5/lib/python3.9/subprocess.py", line 951, in __init__
   self._execute_child(args, executable, preexec_fn, close_fds,
 File "/Users/x99/.pyenv/versions/3.9.5/lib/python3.9/subprocess.py", line 1821, in _execute_child
   raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: './bin/gotty'

macOS Version: Big Sur 11.5.2
pip 21.2.4
python 3.8.5

Any help is greatly appreciated 😅

OSX support

Any chance we might get a mac + lldb version?

I tried modifying it and solving the issues, but ultimately stopped because lldb doesn't support the -ex flag and I thought you might have a better idea on how to circumvent that.

Failure with Python 3.6: unexpected keyword argument 'capture_output'

Hey there! I'm running gdbfrontend v0.10.0-beta on a system with Python 3.6. When attempting to run the gdbfrontend command, it crashes with the following output:

GDBFrontend v0.10.0-beta
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/u/theksong/.local/lib/python3.6/site-packages/gdbfrontend/__main__.py", line 22, in <module>
    spec.loader.exec_module(run)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/u/theksong/.local/lib/python3.6/site-packages/gdbfrontend/run.py", line 308, in <module>
    proc = subprocess.run([gdb_executable, "--configuration"], capture_output=True)
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'
Sending SIGKILL to PGID: 28463.
Stopped GDBFrontend.

I believe the issue is at run.py:308. The capture_output argument is not supported by subprocess in Python 3.6.. Replacing it with the following line (which I lifted from stackoverflow) gets rid of the error for me:

proc = subprocess.run([gdb_executable, "--configuration"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

I can open a PR for this if you'd like, but since it's only one line I figured it might be easier for you to deal with it.

Maybe something other than tmux is available for Windows?

GDB can be used on Windows with MinGW projects. There is no problem.
But Tmux is not used, compiled for Windows, or nobody has tried it.
Is there another alternative to tmux for Windows?
Maybe we can use it on Windows. This way GDB Frontend will also support Windows.

PoC Flatpak packaging

This is a quick Flatpak packaging, and without much testing.

As far as I can tell, this would be mostly useful for remote debugging, and debugging with the Flatpak runtime.

I'm not sure how GDBFrontend works, but maybe it would be also possible to access GDB on the host using a host running tmux session. I haven't tried this as I don't have GDB on the host, and my system is immutable.
Another possible alternative is to have a flatpak-spawn wrapper executing GDB from the host, and have GDBFrontend select the wrapper instead of the default GDB executable.

A few notes about the packaging:

  • Tmux vars were unsetted as I'm running a tmux session on the host and this seems to break GDBFrontend.
  • The app is using the Freedesktop SDK as the runtime, but with the --runtime option, it's possible to run the app with another Flatpak SDK that is based on the same version of the Freedesktop SDK.
  • The home filesystem access might seem superfluous, but some of us users globally block permissive permissions, so I think that being explicit is more correct.
  • An AppStream appdata/metainfo should be added.
  • Maybe also add a desktop file and icon.
  • It's likely you would want to set the app-id as com.oguzhaneroglu.GDBFrontend.

Security suggestion: prompt for password when running `./gdb-frontend`, and ask for whatever is set when browser connects

Sadly, at least firefox (and at least up until recently chrome, I'm not sure they fixed it yet) will allow any external website to connect to any local http port, including something like gdb-frontend. There are plans underway to require a special HTTP header to be sent such that browsers will abort requests if it's not advertised as a safe target by the local server it connects to, but again I don't think these are widely available just yet. So this means in theory external websites could take over gdb-frontend, and browse the filesystem, mess around with gdb, ... unless there is any sort of trivial measure, like a simple password set by the user (doesn't even need to be HTTPS or anything) to prevent this. < Update: Seems like Same Origin does actually apply, so I'm not sure if only intranet sites could attack and probably not any external one. It's not as bad as I thought at least. However, this can also be a problem in a hot seat situation where multiple users work on one machine and not all ports are locked down by default, or a sandboxed program (flatpak, ...) which may not have access to most system resources but probably does to networking interfaces.

In overall, I think it'd be a lot safer with just a simple prompt for any short password, first set at launch on command line via ./gdb-forntend and then it'd be required via basic http auth when a browser connects. The password doesn't even need to be ever stored on disk or whatever, or be absolutely required - the launch script could allow an empty password as a skip for those who don't care.

OSX support

Any chance we might get a mac + lldb version?

I tried modifying it and solving the issues, but ultimately stopped because lldb doesn't support the -ex flag and I thought you might have a better idea on how to circumvent that.

How can I change the host and port of gdbfrontend?

This is somewhat very basic, but cannot fiigure it out apart from changing the code of config.py .
However seams like 127.0.0.1 is hard coded on may levels.

Any trick to bind the server on 0.0.0.0 and different port?

Add registers display support with x86 ISA?

Just like gdbgui, it can display the common registers and vector registers(xmm ymm zmm, etc).

It is very unfortunately for gdbgui that has not been updated for a long time, making the registers unavailable.

Are there any plans to add this feature?

gdbgui

(Not sure if bug?) Opening a .c file will sometimes not actually open it as a source code file tab

In the project of mine I'm trying to debug, when I open a specific .c file via "Load File" then instead of showing up as an additional source code tab (which is what I wanted) instead the tree view disappears. It almost seems like gdb-frontend thought it was a binary, but it is not - it's really just a very boring text file. Am I supposed to open source files via some other button, or is that a bug? In any case, it'd be cool if "Load File" actually detected a code file vs a binary and magically did "the right thing" for both which at least for this case doesn't seem to have worked out.

Here is the issue in a short clip where I open the .c file:

output

gdb main thread is bloocking ...

Thanks for making gdb so convenient. I've met with two problems.

One is when I'm debugging mariadbd program whose binary size is 195M, but show "gdb main thread is bloocking". I don't know what it means

another problem is that when I step over or step into, it's really slower than using gdb on the commandline. Can it be faster ?

image

Firefox WebSocket problem

Hi,

I tried to run it as mentioned in the readme but I keep getting "Connection closed to GDBFrontend server!" alerts in the browser.

How to debug a GDB Python extension (pdb)?

The docs have https://rohanrhu.github.io/gdb-frontend/tutorials/python-c-extension-debugging/ which is "kind of the other way around".

This question is about how to debug a GDB python extension with GDBFrontend. This is the way I've doing it on "plain GDB", but it only works sub-optimal on command line:

(gdb) source /path/to/extension/myext.py
(gdb) py import pdb
(gdb) py pdb.run('gdb.execute("myext-command")')
> <string>(1)<module>()
(Pdb) import sys
(Pdb) import myext
(Pdb) sys.path.insert(0, '/path/to/extension') 
(Pdb) from myext import MyCommand
(Pdb) b MyCommand.invoke
(Pdb) b CPrint.invoke
Breakpoint 1 at /path/to/extension/myext.py:688
(Pdb) c
> /path/to/extension/myext.py(688)invoke()
-> try: 

Is debugging python extensions for GDB possible in a way that GDBFrontend will show all the variables and let us use step/next/... directly (not in the command line)?

View base class elements

Is there a way to view variables apart of the base class when only a derived class variable is available in scope?
I know you can access them but I was wondering if I could have an expanded view rather than have to set a window manually for each member of the base class.

GDB executable not found due to $PWD is modified by gdbfrontend

The command I ran is:

$ gdbfrontend -D -G "iceprog/iceprog -n -x ~/.gdbinit"

The problem is the executable iceprog/iceprog cannot be found
The working directory is "~/.local/lib/python3.7/site-packages/gdbfrontend" after I ran the command, thus, the executable "iceprog/iceprog" cannot be found.
Temporary solution is:

gdbfrontend  -D -G "`pwd`/iceprog/iceprog -n -x ~/.gdbinit"

There may be 2 solutions, first, pass $PATH environment variable to gdb; second, retain the working directory same as where the user runs the gdbfrontend.

move src to new path, breakpoints not work

i made a demo project with debug info. in the original path, gdbfrontend works great.
if a move the whole project dir to new dir, i click "Load Executable", it shows the original src path, and when i click the src file appeared in the left panel, it popuped with error msg "Path not found".
then i click the "add source" button which is in the right corner of the "Sources" panel. select my source file, set breakpoints.

but when i click the "debug" button, the demo bin just run, no breakpoint hit, info looks like this
image

Startup issue on MacOS

I saw your post on /r/embedded and wanted to try this out.

I'm using macOS version 12.0.1.
I saw the other open macOS issue, but mine seems different. When I run gdb-frontend with a gdb executable specified, the browser window pops open but says :

This site can’t be reached
127.0.0.1 refused to connect.

Here is the command I'm calling:
./gdbfrontend --gdb-executable=/path/to/my/arm-none-eabi-gdb-py

in the terminal, it responds with this:

GDBFrontend v0.8.0-terminal_sharer
Listening on 127.0.0.1: http://127.0.0.1:5550/
Open this address in web browser: http://127.0.0.1:5550/terminal/

A new tab opens up in my browser with this address, but it just says it can't connect (default browser error message).

If I run tmux a -t gdb-frontend, it connects me to the gdb session, and I can type gdb commands and debug as I normally would in command-line gdb. Everything seems to work correctly in this terminal gdb session. So I know gdb is working, and my path to the executable is correct.

I'm able to use another gdb webserver/wrapper called gdbgui: This works similarly and I can connect to 127.0.0.1:5550 (I can set the port to anything).

Also, I can run just gdbfrontend without any arguments. This opens a browser tab with the gdb-frontend UI (looks nice, BTW I hope I can get this working to really play with it!) But I need to use arm-none-eabi-gdb for embedded projects.

Here's what I've tried. Nothing changes when I do any of these:

  • Installing with python/pip.
  • Cloning the macos-compatibility branch and running ./gdbfrontend in the root dir of the repo.
  • Different ports: by appending --port=5678 or other numbers to the gdbfrontend command
  • --verbose and -V: no change in output
  • using arm-none-eabi-gdb instead of the -py version.
  • Checking there is no firewall turned on my mistake, restarting computer also.
  • Trying http://localhost:5550 instead of 127.0.0.1
  • Setting arguments with -G "ARGS". I tried both CLI arguments to gdb (-G path/to/main.elf) and also gdb arguments (-G target extended-remote localhost:2331)

Any ideas?

Alert!: Unable to connect to remote host.

Using HEAD of master - 09831e2
Python 3.9
Ubuntu 18.04
Tmux 2.6-3

I'm trying to run gdb-frontend on my remote machine and open browser window on my local computer.

$ ./gdb-frontend -l 0.0.0.0
Error loading http://127.0.0.1:5550/terminal/:
Connection refused

And when I open the link (with the actual IP of remote server) I get this message with an OK button, which just pops up the same message each time I click it.

Connection is closed to GDBFrontend server!

For comparison, I tried the same thing with gdbgui and that works fine for me.

$ gdbgui -r
View gdbgui at http://127.0.1.1:5000
View gdbgui dashboard at http://127.0.1.1:5000/dashboard
exit gdbgui by pressing CTRL+C

I tried several older tagged versions of gdb-frontend, but none of them works for me. Even without passing the -l param I get the same error.

There's also this Alert! message from the issue's title, when the gdb-frontend tries to render the page on my remote machine using lynx.

tmux.conf invalid settings problem

DeepinScreenshot_select-area_20200217085638

Not sure what the issue is really. I tried seeing if for some reason turning off firewalld and disabling all my adblockers and other extensions. Failing that, I tried opening it in Chromium, with the same result.

Firefox gives a similar error "Firefox can’t establish a connection to the server at ws://127.0.0.1:5552/." with the issue again being in the main .js file on line 509. , so it's clearly browser agnostic and other local services like Netdata run fine.

Debugging with QEMU

Context: I'm trying to run this frontend with a cross compiled gdb:

$ /home/z/opt/cross/bin/i686-elf-gdb --version
GNU gdb (GDB) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I installed gdb with:

https://github.com/AlanFoster/os_concepts/blob/d1c34e5009f459b57afa25df06535251c2bbaa09/install_crosscompiler.sh#L55-L72

After cloning and running ./gdbfrontend with the cross compiled gdb:

 ./gdbfrontend --gdb-executable=/home/z/opt/cross/bin/i686-elf-gdb --verbose
Listening on 127.0.0.1: http://127.0.0.1:5551/
|---------------------------------------------------------------------|
| Open this address in web browser: http://127.0.0.1:5551/terminal/   |
|---------------------------------------------------------------------|
2020/02/17 15:45:41 Loading config file at: gotty.conf
2020/02/17 15:45:41 GoTTY is starting with command: tmux a -t gdb-frontend
2020/02/17 15:45:41 Permitting clients to write input to the PTY.
2020/02/17 15:45:41 HTTP server is listening at: http://127.0.0.1:5550/

Visiting http://127.0.0.1:5551/terminal/ within the browser:

image

Visiting http://127.0.0.1:5550 within the browser:

image

I've confirmed that running ./gdbfrontend and using the "native" gdb works fine. The version details for that are:

$ gdb --version
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

I'm thinking the error is python2/3 related? I can see if I can rebuild gdb with the appropriate python version - let me know your thoughts 👍

FeatReq: Close windows in right sidebar

The right sidebar has a number of windows, however my screen is a little small on my laptop.

When I step through my program I want to keep an eye on the variables, but I can't see those without scrolling the sidebar down a bit.

Then I step, and the sidebar window is reset again to the top. Again, I can't see my variables anymore.

Fixes:

  • Allow me to close windows I don't need, e.g. Disassembly
  • Keep the windows position where it is when stepping

Ideally both these changes are put in. Thanks in advance.

gdbinit support

How to config GDB when gdb-frontend start ?
It seems not read .gdbinit file when i have start with -w option?

Method of opening UI is awkard

I'd rather gdbfrontend open it's own window with the webpage embedded in it instead of manually opening a web tab, even with the control & click of the terminal it is still awkward, for instance what if I want to run gdbfrontend from Geany's terminal? I won't be able to click the link there I expect, much easier if it just auto opens a window with the URL already loaded, also makes it easier to end the debug session if it just ends with the window, otherwise the UI seems like a good substitute for gede which is currently not downloading from AUR for me

Python 3.7 is not supported

The documentation says Python >= 3.2 is supported, but python 3.7 crashes on -

from typing import final

from typing import final

might be a good idea to add lint prevent newer python features in the repo if you plan to support older python versions

Suggestion: clicking the "run" icon (the bug that will start the debugging) should show up a dialog to prompt me for command line arguments with "Run", "Cancel" buttons instead of running directly

I discovered that clicking the "Run" icon (the bug that will start the debugging) just starts the program directly. However, I am debugging a compiler, so I need to submit arguments to it so it'll actually compile the test file instead of just quit instantly. I think the most natural way to do that would be if clicking that "Run" icon just prompted me with a popup dialog with run options like command line arguments, environment vars, etc with "Run", "Cancel" buttons to confirm and actually run and cancel out, respectively.

Alternatively, adding a "Launch Options" entry to the top-right hamburger menu icon would also be a good way where people could find & edit this, if you really don't want the "Run" icon to require one additional click to confirm to actually fully run it. (Which I suppose would be an understandable objection)

Or you could prompt for this when using "Load File" to open an executable initially, although then there should probably still be a "Launch Options" entry accessible from somewhere to easily modify it later.

Debugging without debug symbols

I've tried to use GDB frontend on Ubuntu running in WSL. I can start it buf if I want to use the UI in the browser I'm getting either 'Path not found' or 'An error occured'.

Cmd to run gdbfrontend:

 gdbfrontend --verbose --workdir=/c/temp/ctf/ropemporium/task-write4

Inside gdbfrontend:

file ./write4
break main
r

After that - click on stack frame gives me this:
image

Click on any fine in the source on the left side gives this:

image

Am I doing something wrong here?

How to run with a Qt project?

I've got a Qt project that I can build and run either with qmake or cmake - how can I use it in this frontend?

I've read through the instructions, but it's not clear on how to get started.

Update archlinux aur PKGBUILD and fix argument passthrough

A reminder that the aur PKGBUILD needs an update :)

Also currently the way the PKGBUILD file is set up it installs a script into /usr/bin that calls gdbfrontend without passing through arguments, leading to many confusing --helps that just started the server :p

This is my modified PKGBUILD that I used to install 0.5.0, that fixes the issues I mentioned

# Maintainer:  Dimitris Kiziridis <ragouel at outlook dot com>

pkgname=gdb-frontend-bin
pkgver=0.5.0.beta
_pkgver=0.5.0-beta
pkgrel=1
pkgdesc="An easy, flexible and extensionable GUI debugger"
arch=('x86_64')
url='https://oguzhaneroglu.com/projects/gdb-frontend'
license=('GPL3')
provides=('gdb-frontend' 'gdbfrontend')
depends=('gdb' 'python' 'tmux')
source=("${pkgname}-${_pkgver}.tar.gz::https://github.com/rohanrhu/gdb-frontend/archive/v${_pkgver}.tar.gz")
sha256sums=('4efcfde256f0e40ceb1603e2222033e240c5438b81b6b13054a428825ce38d9c')

package() {
  install -d "${pkgdir}/opt/" "${pkgdir}/usr/bin/"
  cp -aR ${pkgname%-bin}-${_pkgver} "${pkgdir}/opt/gdbfrontend"

  cat <<- '  EOF' | sed 's/^\s*//' > gdbfrontend.sh
    #!/usr/bin/env sh
    cd /opt/gdbfrontend/
    ./gdbfrontend "$@"
  EOF
  install -Dm755 gdbfrontend.sh "${pkgdir}/usr/bin/gdbfrontend"
}

EDIT: forgot to mention that the package in the README's aur install command is incorrect, the package is called 'gdb-frontend-bin' not 'gdbfrontend' and so should be updated to yay -S gdb-frontend-bin

Update Ace editor

Ace editor recently got support for http://odin-lang.org/ in versions > 1.22 and I would like to use this frontend to debug Odin.
Is it easy to update to a newer version?
I looked at the code but I am not sure which version you currently got or how you packaged it into the frontend.

pip install-able

If this is pure python, could we not make this pip-installable by adding a setup.py file. It will make adoption and use very easy across all platforms since pip is a part of the python ecosystem itself.

Can't scroll up the terminal

I'm trying out gdbfontend for the first time (newest version v0.9.6-beta), debugging an executable whose source files do not sit on the machine that runs gdb (and thus the executable).
I can't scroll up the terminal, yet it's the only place where I can see the program's output - and also the only place where I can add breakpoints.

There aren't any tmux settings for the user running gdbserver, by the way.
This is what it looks like:
image

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.