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

Fix gdb.attach not working properly in x-terminal-emulator #2363

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

cnitlrt
Copy link

@cnitlrt cnitlrt commented Mar 3, 2024

fix: #2362

@peace-maker
Copy link
Member

Hey, was the issue solved externally?

@cnitlrt
Copy link
Author

cnitlrt commented Mar 14, 2024

nop...
Perhaps my proposed solution may not be the most efficient or elegant. Should I close the pull request and issue, or would it be advisable to consider reopening them?

@peace-maker
Copy link
Member

I'm afraid of race conditions when just adding one. Can we get the new pid more deterministically? We can at least check the proc.children() of the parent terminal somehow?

@cnitlrt
Copy link
Author

cnitlrt commented Mar 22, 2024

I'm afraid of race conditions when just adding one. Can we get the new pid more deterministically? We can at least check the proc.children() of the parent terminal somehow?

Hello, I've made some modifications to the code. Now, it can address my issue without impacting #1922

@peace-maker
Copy link
Member

Can you explain your reasoning behind this change please?

@cnitlrt
Copy link
Author

cnitlrt commented Mar 28, 2024

Can you explain your reasoning behind this change please?

Certainly, when debugging, I found that unlike tmux, gnome-terminal does not provide a method to directly retrieve the window pid (gdb_pid) such as through '-F' '#{pane_pid}', '-P'. When initialized using subprocess, gnome-terminal immediately pops up the window which has already been launched by the time wait_for_debugger is invoked. Consequently, at this juncture, the gdb_pid that we obtain through the p.pid method is actually the pid of the window, which is already operational. Henceforth, all we need to do is to ensure a successful trace to the process pid without disrupting the execution logic of tmux #1922 To achieve this, I switched 'break' to 'continue'. The system will subsequently keep invoking trace(pid) until it's not None, indicating that the process has been correctly traced.

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

Successfully merging this pull request may close these issues.

x-terminal-emulator gdb.attach not working properly
2 participants