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 that GDB HVT bug #567

Merged
merged 1 commit into from
Feb 27, 2024
Merged

Fix that GDB HVT bug #567

merged 1 commit into from
Feb 27, 2024

Conversation

greydot
Copy link
Contributor

@greydot greydot commented Feb 25, 2024

#548

Took me a while to get to this, mostly because GDB wire format is weird.

@greydot
Copy link
Contributor Author

greydot commented Feb 25, 2024

P.S. While debugging this, I also implemented KVM_GET_FPU code, but it's not really tested in the field (seems to work fine tho) and I'm not sure whether I should include it in this PR.

@dinosaure
Copy link
Collaborator

P.S. While debugging this, I also implemented KVM_GET_FPU code, but it's not really tested in the field (seems to work fine tho) and I'm not sure whether I should include it in this PR.

The best is probably to make another PR to review on it 👍. Otherwise, this PR looks fine to me.

Copy link
Collaborator

@dinosaure dinosaure left a comment

Choose a reason for hiding this comment

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

/cc @reynir who participated to debug the gdb bug

@reynir
Copy link
Contributor

reynir commented Feb 26, 2024

Hi!

It's been about a year since I last looked at this. From reading my comments in #548 it seems we should maybe support the qSupported GDB debug protocol query. If I remember correctly that way we can tell GDB the register layout(?!) but then again I remember it was very difficult to find any documentation on the protocol.

Looking at the XML file it seems this change is correct. Maybe GDB can guess the layout just from the length of the hex string?? I'm in favor of merging this as this is at least less wrong.

@greydot
Copy link
Contributor Author

greydot commented Feb 26, 2024

It's been about a year since I last looked at this. From reading my comments in #548 it seems we should maybe support the qSupported GDB debug protocol query. If I remember correctly that way we can tell GDB the register layout(?!) but then again I remember it was very difficult to find any documentation on the protocol.

I briefly looked through the feature list that qSupported operates on and it doesn't have anything with registers. I might be wrong here though.

Looking at the XML file it seems this change is correct. Maybe GDB can guess the layout just from the length of the hex string?? I'm in favor of merging this as this is at least less wrong.

Not exactly. It seems that GDB operates either on individual registers or on groups of them (again, see XML). The error in this case was due to EFLAGS being longer than GDB expected, so the following segment registers were shifted down the line. GDB thought there was partial ST0 register data sent and hence threw the error "Truncated register 24 in remote 'g' packet", with "register 24" being ST0 (haha i actually counted).

I'm not sure this GDB server implementation has ever worked correctly. Or at the very least, values for segment registers were always shown wrong in GDB on x86_64.

@greydot
Copy link
Contributor Author

greydot commented Feb 27, 2024

Sooo... I suppose, this can be merged now?
@dinosaure

@dinosaure dinosaure merged commit 3f83367 into Solo5:master Feb 27, 2024
4 checks passed
@dinosaure
Copy link
Collaborator

Thanks!

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