Update GetRegisterInfoByName() methods to support getting registers
by a generic name independently of alt_name entries in the register
context. This makes it possible to use generic names when interacting
with gdbserver (that does not supply alt_names). It also makes it
possible to remove some of the duplicated information from register
context declarations and/or use alt_names for another purpose.
Details
Diff Detail
Event Timeline
Preserve the prior (probably accidental) behavior of generic names taking precedence over later registers with the same name (e.g. generic sp alias taking precedence over 16-bit sp pseudo-register).
I'm not sure we should be preserving this behavior for the native register context. User-provided strings should not make it there, and code should really be retrieving the registers in some other way (like via the LLDB_REGNUM_GENERIC_*** constants).
It would also be nice to follow this up by actually removing the generic altnames from register definitions, for cases where they don't match architecturally defined names.
Could you rephrase this comment to indicate the requested change, if any? ;-)
It would also be nice to follow this up by actually removing the generic altnames from register definitions, for cases where they don't match architecturally defined names.
That was roughly my plan, presuming you like the idea. Should I include this in the same commit or separately for each platform?
Well.. the comment was open ended, because my thoughts on this are quite open ended as well.. :) But if I wanted to be more precise, I suppose it boils down to this:
- Is the NativeRC change there for a particular reason (like, does anything break if you leave it out)?
- Do _you_ agree with my assessment of its necessity?
If there's no reason for its presence, and you don't see it as necessary, then I'd like to remove it. If not, let's talk.
It would also be nice to follow this up by actually removing the generic altnames from register definitions, for cases where they don't match architecturally defined names.
That was roughly my plan, presuming you like the idea. Should I include this in the same commit or separately for each platform?
Sounds good. I think we should do it as a separate patch. Whether it's one or more of them depends on how large they get...
Ah, now I get what you mean. To be honest, I've done that because I wasn't sure whether there isn't any code relying on that. I guess I'll try removing it and see if any tests fail.
Ok, so I've done some testing and indeed Native* part doesn't seem necessary.
However, after removing the aliases from x86_64 target def, there are two test regressions. The two following snippets no longer seem to work:
eip = frame.FindRegister("pc") sp_value = frame0.FindValue("sp", lldb.eValueTypeRegister)
This doesn't seem to work anymore. Should I attempt to fix the API to make grabbing these registers by name work again, or should I try to modify the tests to grab these registers via generic reg nums?
These are pretty much the SB equivalents of register read, and they should keep working
Fixed SBFrame stuffs. While at it, changed ValueObjectRegister to take const RegisterInfo * instead of the index, since it's almost always what it really wants.
lldb/source/API/SBFrame.cpp | ||
---|---|---|
636–638 ↗ | (On Diff #371941) | I like this. |
lldb/source/Target/RegisterContext.cpp | ||
57–59 | This isn't just "consistent with" generic aliases taking precedence. This is actually the implementation of that precedence (at least, after we remove the aliases in the other patch. This should just state as a fact that we want the aliases to take priority. The historic trivia can go into the commit message. |
This isn't just "consistent with" generic aliases taking precedence. This is actually the implementation of that precedence (at least, after we remove the aliases in the other patch. This should just state as a fact that we want the aliases to take priority. The historic trivia can go into the commit message.