Skip to content

Commit ea480cc

Browse files
authored
[lldb] support ieee_single and ieee_double gdbtypes for registers (#150268)
Some gdb remote servers send target.xml that contains ``` <reg name='ft0' bitsize='32' type='ieee_single' dwarf_regnum='32'/> <reg name='ft1' bitsize='32' type='ieee_single' dwarf_regnum='33'/> <reg name='ft2' bitsize='32' type='ieee_single' dwarf_regnum='34'/> <reg name='ft3' bitsize='32' type='ieee_single' dwarf_regnum='35'/> <reg name='ft4' bitsize='32' type='ieee_single' dwarf_regnum='36'/> <reg name='ft5' bitsize='32' type='ieee_single' dwarf_regnum='37'/> <reg name='ft6' bitsize='32' type='ieee_single' dwarf_regnum='38'/> <reg name='ft7' bitsize='32' type='ieee_single' dwarf_regnum='39'/> ``` it seems like a valid and supported type in gdb. from gdb16.3/gdb/target_descriptions.c (could not find a way to link it). ``` case TDESC_TYPE_IEEE_SINGLE: m_type = init_float_type (alloc, -1, "builtin_type_ieee_single", floatformats_ieee_single); return; case TDESC_TYPE_IEEE_DOUBLE: m_type = init_float_type (alloc, -1, "builtin_type_ieee_double", floatformats_ieee_double); return; ``` ### Testplan updated unittest to test this. Reviewers: @clayborg , @jeffreytan81 , @Jlalond
1 parent 88389cc commit ea480cc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4783,7 +4783,8 @@ bool ParseRegisters(
47834783
} else if (gdb_type == "data_ptr" || gdb_type == "code_ptr") {
47844784
reg_info.format = eFormatAddressInfo;
47854785
reg_info.encoding = eEncodingUint;
4786-
} else if (gdb_type == "float") {
4786+
} else if (gdb_type == "float" || gdb_type == "ieee_single" ||
4787+
gdb_type == "ieee_double") {
47874788
reg_info.format = eFormatFloat;
47884789
reg_info.encoding = eEncodingIEEE754;
47894790
} else if (gdb_type == "aarch64v" ||

lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,9 @@ class MyResponder(MockGDBServerResponder):
692692
"0102030405060708" # t4
693693
"0102030405060708" # t5
694694
"0102030405060708" # t6
695+
"6162636465666768" # pc
696+
"0000C03F" # ft0
697+
"e07a6147a8a40940" # ft1
695698
)
696699

697700
def qXferRead(self, obj, annex, offset, length):
@@ -737,6 +740,10 @@ def qXferRead(self, obj, annex, offset, length):
737740
<reg name="t6" bitsize="64" type="int"/>
738741
<reg name="pc" bitsize="64" type="code_ptr"/>
739742
</feature>
743+
<feature name='org.gnu.gdb.riscv.fpu'>
744+
<reg name='ft0' bitsize='32' type='ieee_single'/>
745+
<reg name='ft1' bitsize='64' type='ieee_double'/>
746+
</feature>
740747
</target>""",
741748
False,
742749
)
@@ -799,6 +806,10 @@ def haltReason(self):
799806
self.match("register read x29", ["t4 = 0x0807060504030201"])
800807
self.match("register read x30", ["t5 = 0x0807060504030201"])
801808
self.match("register read x31", ["t6 = 0x0807060504030201"])
809+
self.match("register read pc", ["pc = 0x6867666564636261"])
810+
# test FPU registers
811+
self.match("register read ft0", ["ft0 = 1.5"])
812+
self.match("register read ft1", ["ft1 = 3.2053990913985757"])
802813

803814
@skipIfXmlSupportMissing
804815
@skipIfRemote

0 commit comments

Comments
 (0)