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: Minor work #4170

Merged
merged 11 commits into from
Nov 29, 2024
Merged

GdbServer: Minor work #4170

merged 11 commits into from
Nov 29, 2024

Conversation

Sonicadvance1
Copy link
Member

Unlike in #3592, this does some initial work towards making my life easier for improving the gdbserver.

Some very minor behaviour changes but pretty much just moving some code around and documenting the command packets so I can quickly search around in vim.

@Sonicadvance1 Sonicadvance1 force-pushed the gdbserver_work branch 2 times, most recently from 5ead116 to 26904ef Compare November 25, 2024 01:50
@Sonicadvance1 Sonicadvance1 mentioned this pull request Nov 25, 2024
@neobrain
Copy link
Member

Could you apply Draft status to this PR if you're still planning to add further patches?

@Sonicadvance1
Copy link
Member Author

Could you apply Draft status to this PR if you're still planning to add further patches?

I'm moving on to a different branch now

Copy link
Contributor

@lioncash lioncash left a comment

Choose a reason for hiding this comment

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

few minor nits for a first pass

Source/Tools/LinuxEmulation/GdbServer/Info.h Outdated Show resolved Hide resolved
Source/Tools/LinuxEmulation/GdbServer/Info.cpp Outdated Show resolved Hide resolved
Source/Tools/LinuxEmulation/LinuxSyscalls/GdbServer.cpp Outdated Show resolved Hide resolved
Source/Tools/LinuxEmulation/LinuxSyscalls/GdbServer.cpp Outdated Show resolved Hide resolved
We have supported this for a while, just wasn't passed through gdbserver
since it usually doesn't matter.
Previously this would have corrupted data in the upper 128-bits of the
YMM register.
Makes these consistent in the handling and documents the commands in a
way that is easier to parse while working on this.

NFC
This doesn't behave properly anymore now that thread management was
moved to the frontend.
When parsing `comm`, by default it will have a newline which breaks gdb
in some cases. Strip out the whitespace to fix that issue.
NFC, just making this easier to track for me.
Previous `S AA` logic is legacy for non-multithreaded applications. This
newer command gives more information about what occured and in what
thread id.
This currently happens in two locations, so split it out.

There's some behaviour here where if the TID isn't found, then it
returns the ParentThread of the process. This is working around a bug in
either FEX's gdbserver or binaryninja. Leave it currently before we
figure out what's wrong.

NFC
…ction

GDB has two ways to read the registers. One way is reading the full
GDBContextDefinition, which matches the layout in `BuildTargetXML`.

The other way is to read the individual elements out of
GDBContextDefinition.

These two code paths were independently implemented. Instead generate in
one location and use in either location.

NFC
Just breaks out the two commands we support and leaves TODOs for
implementing the remaining commands.

NFC
Sonicadvance1 added a commit to Sonicadvance1/FEX that referenced this pull request Nov 29, 2024
We were using this variable for two things, letting the frontend signal
to the backend that it wants to start executing once the thread is
created, and also for handling thread pausing. These two features are
conflated with one another and actually makes things more confusing.

- Move StartRunning/StartPaused to the frontend, because its a construct
  that only needs to exist in the frontend
- Adds a FEX::HLE::ThreadStateObject CV for handling pausing, which only
  needs to exist for gdbserver

Relies on FEX-Emu#4170 and FEX-Emu#4179 being merged first. Which is what the first
two commits are from.
Sonicadvance1 added a commit to Sonicadvance1/FEX that referenced this pull request Nov 29, 2024
We were using this variable for two things, letting the frontend signal
to the backend that it wants to start executing once the thread is
created, and also for handling thread pausing. These two features are
conflated with one another and actually makes things more confusing.

- Move StartRunning/StartPaused to the frontend, because its a construct
  that only needs to exist in the frontend
- Adds a FEX::HLE::ThreadStateObject CV for handling pausing, which only
  needs to exist for gdbserver

Relies on FEX-Emu#4170 and FEX-Emu#4179 being merged first. Which is what the first
two commits are from.
Sonicadvance1 added a commit to Sonicadvance1/FEX that referenced this pull request Nov 29, 2024
We were using this variable for two things, letting the frontend signal
to the backend that it wants to start executing once the thread is
created, and also for handling thread pausing. These two features are
conflated with one another and actually makes things more confusing.

- Move StartRunning/StartPaused to the frontend, because its a construct
  that only needs to exist in the frontend
- Adds a FEX::HLE::ThreadStateObject CV for handling pausing, which only
  needs to exist for gdbserver

Relies on FEX-Emu#4170 and FEX-Emu#4179 being merged first. Which is what the first
two commits are from.
Sonicadvance1 added a commit to Sonicadvance1/FEX that referenced this pull request Nov 29, 2024
We were using this variable for two things, letting the frontend signal
to the backend that it wants to start executing once the thread is
created, and also for handling thread pausing. These two features are
conflated with one another and actually makes things more confusing.

- Move StartRunning/StartPaused to the frontend, because its a construct
  that only needs to exist in the frontend
- Adds a FEX::HLE::ThreadStateObject CV for handling pausing, which only
  needs to exist for gdbserver

Relies on FEX-Emu#4170 and FEX-Emu#4179 being merged first. Which is what the first
two commits are from.
@lioncash lioncash merged commit b2e61c3 into FEX-Emu:main Nov 29, 2024
12 checks passed
@Sonicadvance1 Sonicadvance1 deleted the gdbserver_work branch November 29, 2024 16:59
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.

3 participants