Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI Soft lock when trying to switch from an already tracing process #275

Open
AMAIOLAMO opened this issue Dec 27, 2024 · 6 comments
Open
Labels

Comments

@AMAIOLAMO
Copy link

AMAIOLAMO commented Dec 27, 2024

I was trying to trace multiple different programs on Arch Linux

Description

Normally attaching processes the first time works flawlessly, but whenever I try to switch to another process(which is after I already attached a process), the Console showed some kind of GDB fatal error:

Last command: c&
^running
*running,thread-id="all"
0.0009875297546386719
Exiting state_observe_thread
Detached from the process with PID:24462
Last command: set logging enabled off
^done
0.0011920928955078125
Last command: set logging file /tmp/PINCE/-1/gdb_log.txt
=cmd-param-changed,param="logging file",value="/tmp/PINCE/-1/gdb_log.txt"
^done
0.0008037090301513672
Last command: set $GDBINIT_AA_PATH="/home/cxredix/.config/PINCE/gdbinit_after_attach"
^done
0.001062154769897461
Last command: set $PINCE_PATH="/tmp/.mount_pince-Yzse8s/opt/PINCE"
^done
0.0008051395416259766
Last command: source gdb_python_scripts/gdbextensions.py

EOF exception caught within pexpect, here's the contents of child.before:
&"\n\n"
&"Fatal signal: "
&"Segmentation fault"
&"\n"
&"----- Backtrace -----\n"
&"Backtrace unavailable\n"
&"---------------------\n"
&"A fatal error internal to GDB has been detected, further\ndebugging is not possible.  GDB will now terminate.\n\n"
&"This is a bug, please report it."
&"  For instructions, see:\n"
&"<https://www.gnu.org/software/gdb/bugs/>"
&"."
&"\n\n"

Exiting state_observe_thread

Steps To Reproduce

  1. Open Pince, and any two programs(A & B)
  2. Attach pince with the first program(A)
  3. Then after doing that, attach again the second program(B)

Notes

I noticed that PINCE's GUI seems to be soft locked due to some GDB issues. but pince itself can still receive inputs (such as like Ctrl + C that seems to tell PINCE to cancel the previous GDB command).

This seems to happen with any program, not necessarily just a specific one.

I am not sure if this is PINCE's issue, or GDB's issue, please let me know.

@brkzlr
Copy link
Collaborator

brkzlr commented Dec 27, 2024

I can't repro this on the dev install but it does seem to happen on AppImage (which is what you use according to the log).

"A fatal error internal to GDB has been detected, further\ndebugging is not possible.

I don't have this error when it happens on AppImage though, it's something different so I'm not sure why that happens to you.

Just to confirm, can you try to repro this on the dev install? Follow the instructions here and it should work directly as you're on Arch.

@brkzlr brkzlr added the Bug label Dec 27, 2024
@AMAIOLAMO
Copy link
Author

AMAIOLAMO commented Dec 28, 2024

I have installed the local dev, and it seems to work fine. Though something of note during my installation, there are a few errors that I have to resolve, I believe it's because I am using both outdated packages of python, qt and GDB. everything breaks when python 3.13 was not installed, which is expected. After fixing those, everything works fine.

Though when I switched back and tried the AppImage again, it seems it be having errors with python this time, I'm assuming this is because my installation of python was broken.(although I am unsure what is causing the exact problem)

EOF exception caught within pexpect, here's the contents of child.before:
Python Exception <class 'ModuleNotFoundError'>: No module named 'encodings'
Python not initialized

Here is the terminal output after trying it again with app image.

Traceback (most recent call last):
  File "/tmp/.mount_pince-wFkiTV/opt/PINCE/PINCE.py", line 2085, in pushButton_Open_clicked
    if self.parent().attach_to_pid(pid):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_pince-wFkiTV/opt/PINCE/PINCE.py", line 1662, in attach_to_pid
    attach_result = debugcore.attach(pid, settings.gdb_path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_pince-wFkiTV/opt/PINCE/libpince/debugcore.py", line 574, in attach
    send_command("attach " + str(pid))
  File "/tmp/.mount_pince-wFkiTV/opt/PINCE/libpince/debugcore.py", line 178, in send_command
    raise typedefs.GDBInitializeException
libpince.typedefs.GDBInitializeException: GDB not initialized

In short, Dev install works fine, but AppImage this time isn't GUI soft locking(thats one step forward), but complaining that GDB is not initialized due to 'enncodings' python modules not found. and I believe it might be just because I have either out-of-date packages or installed python incorrectly.

@brkzlr
Copy link
Collaborator

brkzlr commented Dec 28, 2024

That's the same error I'm having so we're in the same page now.

Dev install does everything in a venv, so anything you have in your distro is "mostly" irrelevant.

AppImage also has nothing to do with your local python or gdb, it uses everything that's bundled inside.

We'll look into why it's not working for AppImage.

@AMAIOLAMO
Copy link
Author

That's the same error I'm having so we're in the same page now.

Dev install does everything in a venv, so anything you have in your distro is "mostly" irrelevant.

AppImage also has nothing to do with your local python or gdb, it uses everything that's bundled inside.

I see, Im not a python person so I didnt know about that!

I do prefer using AppImage over installation due to it's portability. though I will be using the dev install for now. Thanks a lot for helping!

@korcankaraokcu
Copy link
Owner

@AMAIOLAMO I'm able to reproduce the bug, thanks for reporting. However, the error I got is different:

&"Error occurred in Python: No module named 'capstone'\n"
^error,msg="/dev/shm/PINCE_IPC/-1/gdb_command.txt:1: Error in sourced command file:\nError occurred in Python: No module named 'capstone'"

For some reason, gdb cannot find the capstone module after detaching from the first process. To produce less logs, I've tested it by switching between two different bash processes

@brkzlr
Copy link
Collaborator

brkzlr commented Dec 30, 2024

My error is the same as his. Basically after detaching (only in AppImage) our bundled GDB loses the PYTHONHOME env var and can't find the bundled deps.

Looked into it a bit more and can't figure out why it loses it. Will check out more later when I have more time, but feel free to tackle it if you want Korcan (or anybody else that wants to do a PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants