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

GdbServer: Fixes crash on gdb detach #3319

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

Sonicadvance1
Copy link
Member

GdbServer object was getting deleted before the socket thread was shutdown which was causing a crash on detach.

Now on destructor it will wait for the thread to thread to exit.

GdbServer object was getting deleted before the socket thread was
shutdown which was causing a crash on detach.

Now on destructor it will wait for the thread to thread to exit.
@@ -127,8 +127,12 @@ void GdbServer::WaitForThreadWakeup() {
}

GdbServer::~GdbServer() {
CloseListenSocket();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since OpenListenSocket is running at the start of the GDB server thread, is there potential for a race condition for short-lived FEX processes here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not currently since gdbserver always forces processes to wait for gdb attach currently.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it? I see GDBServer::GDBServer() ending in a call to StartThread, so the caller can immediately close it after. Is there external logic that does this waiting?

Copy link
Member Author

@Sonicadvance1 Sonicadvance1 Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, thanks for clarifying!

@Sonicadvance1 Sonicadvance1 merged commit a1cf14f into FEX-Emu:main Dec 11, 2023
10 checks passed
@Sonicadvance1 Sonicadvance1 deleted the fix_gdbserver_crash branch December 11, 2023 14:19
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.

2 participants