rohanrhu / gdb-frontend

☕ GDBFrontend is an easy, flexible and extensible gui debugger. Try it on https://debugme.dev
https://oguzhaneroglu.com/projects/gdb-frontend/
GNU General Public License v3.0
2.79k stars 98 forks source link

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

Closed RafaelLeeImg closed 2 years ago

RafaelLeeImg commented 2 years ago

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.

rohanrhu commented 2 years ago

Hiii @RafaelLeeImg thank youu for reporting. I'm looking.

rohanrhu commented 2 years ago

Hiii again @RafaelLeeImg

Can you provide these informations?:

rohanrhu commented 2 years ago

The working directory is "~/.local/lib/python3.7/site-packages/gdbfrontend" after I ran the command

This sounds very interesting, because with v0.11.0-beta it must be setting the working directory to current directory that you run it.

Are you sure for you are using v0.11-beta?

RafaelLeeImg commented 2 years ago

Yesterday, I installed gdbfrontend with pip, the version is: gdbfrontend 0.11.0 Operating System: Debian GNU/Linux bookworm/sid x86_64 Kernel version: 5.16.0-3-amd64

Today I also tried commit 9fba9fc - (2 weeks ago) Bump version v0.11.0-beta, the problem is partly solved but not fully. 9fba9fce I checked the code in run.py, it will change dir to the working directory, but that happens after the gdb args are parsed. Leaving the executable not found. Change directory should be done before invoke gdb.

" \"cd " + config.WORKDIR + "\"" +
rohanrhu commented 2 years ago

@RafaelLeeImg I removed changing directory to GDBFrontend directory in runner.

Can you try try this latest revision? https://github.com/rohanrhu/gdb-frontend/commit/022dd9ad29b1d2820ae8de6a4b2c95c8029d5440

rohanrhu commented 2 years ago

Fixed with Remove module main chdir for /usr/bin script

There was a missing issue with /usr/bin run script, I just found out it and fixed.

Also v0.11.2-beta is released with this fix.