diff options
| author | 2022-06-01 21:16:33 -0400 | |
|---|---|---|
| committer | 2022-06-01 21:16:33 -0400 | |
| commit | 114a4562edfdeed7917be1b75cb03ac59e10c0c4 (patch) | |
| tree | bdeeef0eea5ed1c7a9924677fb42ddbcd27d554c | |
| parent | Merge pull request #8402 from liamwhite/better-step (diff) | |
| parent | gdbstub: fix target descriptions (diff) | |
| download | yuzu-114a4562edfdeed7917be1b75cb03ac59e10c0c4.tar.gz yuzu-114a4562edfdeed7917be1b75cb03ac59e10c0c4.tar.xz yuzu-114a4562edfdeed7917be1b75cb03ac59e10c0c4.zip | |
Merge pull request #8409 from liamwhite/tdesc-fix
gdbstub: fix target descriptions
| -rw-r--r-- | src/core/debugger/gdbstub_arch.cpp | 93 | ||||
| -rw-r--r-- | src/core/debugger/gdbstub_arch.h | 4 |
2 files changed, 87 insertions, 10 deletions
diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp index 99e3893a9..750c353b9 100644 --- a/src/core/debugger/gdbstub_arch.cpp +++ b/src/core/debugger/gdbstub_arch.cpp | |||
| @@ -46,6 +46,7 @@ std::string GDBStubA64::GetTargetXML() const { | |||
| 46 | R"(<?xml version="1.0"?> | 46 | R"(<?xml version="1.0"?> |
| 47 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> | 47 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> |
| 48 | <target version="1.0"> | 48 | <target version="1.0"> |
| 49 | <architecture>aarch64</architecture> | ||
| 49 | <feature name="org.gnu.gdb.aarch64.core"> | 50 | <feature name="org.gnu.gdb.aarch64.core"> |
| 50 | <reg name="x0" bitsize="64"/> | 51 | <reg name="x0" bitsize="64"/> |
| 51 | <reg name="x1" bitsize="64"/> | 52 | <reg name="x1" bitsize="64"/> |
| @@ -80,7 +81,7 @@ std::string GDBStubA64::GetTargetXML() const { | |||
| 80 | <reg name="x30" bitsize="64"/> | 81 | <reg name="x30" bitsize="64"/> |
| 81 | <reg name="sp" bitsize="64" type="data_ptr"/> | 82 | <reg name="sp" bitsize="64" type="data_ptr"/> |
| 82 | <reg name="pc" bitsize="64" type="code_ptr"/> | 83 | <reg name="pc" bitsize="64" type="code_ptr"/> |
| 83 | <flags id="pstate_flags" size="4"> | 84 | <flags id="cpsr_flags" size="4"> |
| 84 | <field name="SP" start="0" end="0"/> | 85 | <field name="SP" start="0" end="0"/> |
| 85 | <field name="" start="1" end="1"/> | 86 | <field name="" start="1" end="1"/> |
| 86 | <field name="EL" start="2" end="3"/> | 87 | <field name="EL" start="2" end="3"/> |
| @@ -97,9 +98,84 @@ std::string GDBStubA64::GetTargetXML() const { | |||
| 97 | <field name="Z" start="30" end="30"/> | 98 | <field name="Z" start="30" end="30"/> |
| 98 | <field name="N" start="31" end="31"/> | 99 | <field name="N" start="31" end="31"/> |
| 99 | </flags> | 100 | </flags> |
| 100 | <reg name="pstate" bitsize="32" type="pstate_flags"/> | 101 | <reg name="cpsr" bitsize="32" type="cpsr_flags"/> |
| 101 | </feature> | 102 | </feature> |
| 102 | <feature name="org.gnu.gdb.aarch64.fpu"> | 103 | <feature name="org.gnu.gdb.aarch64.fpu"> |
| 104 | <vector id="v2d" type="ieee_double" count="2"/> | ||
| 105 | <vector id="v2u" type="uint64" count="2"/> | ||
| 106 | <vector id="v2i" type="int64" count="2"/> | ||
| 107 | <vector id="v4f" type="ieee_single" count="4"/> | ||
| 108 | <vector id="v4u" type="uint32" count="4"/> | ||
| 109 | <vector id="v4i" type="int32" count="4"/> | ||
| 110 | <vector id="v8u" type="uint16" count="8"/> | ||
| 111 | <vector id="v8i" type="int16" count="8"/> | ||
| 112 | <vector id="v16u" type="uint8" count="16"/> | ||
| 113 | <vector id="v16i" type="int8" count="16"/> | ||
| 114 | <vector id="v1u" type="uint128" count="1"/> | ||
| 115 | <vector id="v1i" type="int128" count="1"/> | ||
| 116 | <union id="vnd"> | ||
| 117 | <field name="f" type="v2d"/> | ||
| 118 | <field name="u" type="v2u"/> | ||
| 119 | <field name="s" type="v2i"/> | ||
| 120 | </union> | ||
| 121 | <union id="vns"> | ||
| 122 | <field name="f" type="v4f"/> | ||
| 123 | <field name="u" type="v4u"/> | ||
| 124 | <field name="s" type="v4i"/> | ||
| 125 | </union> | ||
| 126 | <union id="vnh"> | ||
| 127 | <field name="u" type="v8u"/> | ||
| 128 | <field name="s" type="v8i"/> | ||
| 129 | </union> | ||
| 130 | <union id="vnb"> | ||
| 131 | <field name="u" type="v16u"/> | ||
| 132 | <field name="s" type="v16i"/> | ||
| 133 | </union> | ||
| 134 | <union id="vnq"> | ||
| 135 | <field name="u" type="v1u"/> | ||
| 136 | <field name="s" type="v1i"/> | ||
| 137 | </union> | ||
| 138 | <union id="aarch64v"> | ||
| 139 | <field name="d" type="vnd"/> | ||
| 140 | <field name="s" type="vns"/> | ||
| 141 | <field name="h" type="vnh"/> | ||
| 142 | <field name="b" type="vnb"/> | ||
| 143 | <field name="q" type="vnq"/> | ||
| 144 | </union> | ||
| 145 | <reg name="v0" bitsize="128" type="aarch64v" regnum="34"/> | ||
| 146 | <reg name="v1" bitsize="128" type="aarch64v" /> | ||
| 147 | <reg name="v2" bitsize="128" type="aarch64v" /> | ||
| 148 | <reg name="v3" bitsize="128" type="aarch64v" /> | ||
| 149 | <reg name="v4" bitsize="128" type="aarch64v" /> | ||
| 150 | <reg name="v5" bitsize="128" type="aarch64v" /> | ||
| 151 | <reg name="v6" bitsize="128" type="aarch64v" /> | ||
| 152 | <reg name="v7" bitsize="128" type="aarch64v" /> | ||
| 153 | <reg name="v8" bitsize="128" type="aarch64v" /> | ||
| 154 | <reg name="v9" bitsize="128" type="aarch64v" /> | ||
| 155 | <reg name="v10" bitsize="128" type="aarch64v"/> | ||
| 156 | <reg name="v11" bitsize="128" type="aarch64v"/> | ||
| 157 | <reg name="v12" bitsize="128" type="aarch64v"/> | ||
| 158 | <reg name="v13" bitsize="128" type="aarch64v"/> | ||
| 159 | <reg name="v14" bitsize="128" type="aarch64v"/> | ||
| 160 | <reg name="v15" bitsize="128" type="aarch64v"/> | ||
| 161 | <reg name="v16" bitsize="128" type="aarch64v"/> | ||
| 162 | <reg name="v17" bitsize="128" type="aarch64v"/> | ||
| 163 | <reg name="v18" bitsize="128" type="aarch64v"/> | ||
| 164 | <reg name="v19" bitsize="128" type="aarch64v"/> | ||
| 165 | <reg name="v20" bitsize="128" type="aarch64v"/> | ||
| 166 | <reg name="v21" bitsize="128" type="aarch64v"/> | ||
| 167 | <reg name="v22" bitsize="128" type="aarch64v"/> | ||
| 168 | <reg name="v23" bitsize="128" type="aarch64v"/> | ||
| 169 | <reg name="v24" bitsize="128" type="aarch64v"/> | ||
| 170 | <reg name="v25" bitsize="128" type="aarch64v"/> | ||
| 171 | <reg name="v26" bitsize="128" type="aarch64v"/> | ||
| 172 | <reg name="v27" bitsize="128" type="aarch64v"/> | ||
| 173 | <reg name="v28" bitsize="128" type="aarch64v"/> | ||
| 174 | <reg name="v29" bitsize="128" type="aarch64v"/> | ||
| 175 | <reg name="v30" bitsize="128" type="aarch64v"/> | ||
| 176 | <reg name="v31" bitsize="128" type="aarch64v"/> | ||
| 177 | <reg name="fpsr" bitsize="32"/> | ||
| 178 | <reg name="fpcr" bitsize="32"/> | ||
| 103 | </feature> | 179 | </feature> |
| 104 | </target>)"; | 180 | </target>)"; |
| 105 | 181 | ||
| @@ -121,12 +197,12 @@ std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const | |||
| 121 | return ValueToHex(context.pc); | 197 | return ValueToHex(context.pc); |
| 122 | } else if (id == PSTATE_REGISTER) { | 198 | } else if (id == PSTATE_REGISTER) { |
| 123 | return ValueToHex(context.pstate); | 199 | return ValueToHex(context.pstate); |
| 124 | } else if (id >= Q0_REGISTER && id < FPCR_REGISTER) { | 200 | } else if (id >= Q0_REGISTER && id < FPSR_REGISTER) { |
| 125 | return ValueToHex(fprs[id - Q0_REGISTER]); | 201 | return ValueToHex(fprs[id - Q0_REGISTER]); |
| 126 | } else if (id == FPCR_REGISTER) { | ||
| 127 | return ValueToHex(context.fpcr); | ||
| 128 | } else if (id == FPSR_REGISTER) { | 202 | } else if (id == FPSR_REGISTER) { |
| 129 | return ValueToHex(context.fpsr); | 203 | return ValueToHex(context.fpsr); |
| 204 | } else if (id == FPCR_REGISTER) { | ||
| 205 | return ValueToHex(context.fpcr); | ||
| 130 | } else { | 206 | } else { |
| 131 | return ""; | 207 | return ""; |
| 132 | } | 208 | } |
| @@ -145,12 +221,12 @@ void GDBStubA64::RegWrite(Kernel::KThread* thread, size_t id, std::string_view v | |||
| 145 | context.pc = HexToValue<u64>(value); | 221 | context.pc = HexToValue<u64>(value); |
| 146 | } else if (id == PSTATE_REGISTER) { | 222 | } else if (id == PSTATE_REGISTER) { |
| 147 | context.pstate = HexToValue<u32>(value); | 223 | context.pstate = HexToValue<u32>(value); |
| 148 | } else if (id >= Q0_REGISTER && id < FPCR_REGISTER) { | 224 | } else if (id >= Q0_REGISTER && id < FPSR_REGISTER) { |
| 149 | context.vector_registers[id - Q0_REGISTER] = HexToValue<u128>(value); | 225 | context.vector_registers[id - Q0_REGISTER] = HexToValue<u128>(value); |
| 150 | } else if (id == FPCR_REGISTER) { | ||
| 151 | context.fpcr = HexToValue<u32>(value); | ||
| 152 | } else if (id == FPSR_REGISTER) { | 226 | } else if (id == FPSR_REGISTER) { |
| 153 | context.fpsr = HexToValue<u32>(value); | 227 | context.fpsr = HexToValue<u32>(value); |
| 228 | } else if (id == FPCR_REGISTER) { | ||
| 229 | context.fpcr = HexToValue<u32>(value); | ||
| 154 | } | 230 | } |
| 155 | } | 231 | } |
| 156 | 232 | ||
| @@ -195,6 +271,7 @@ std::string GDBStubA32::GetTargetXML() const { | |||
| 195 | R"(<?xml version="1.0"?> | 271 | R"(<?xml version="1.0"?> |
| 196 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> | 272 | <!DOCTYPE target SYSTEM "gdb-target.dtd"> |
| 197 | <target version="1.0"> | 273 | <target version="1.0"> |
| 274 | <architecture>arm</architecture> | ||
| 198 | <feature name="org.gnu.gdb.arm.core"> | 275 | <feature name="org.gnu.gdb.arm.core"> |
| 199 | <reg name="r0" bitsize="32" type="uint32"/> | 276 | <reg name="r0" bitsize="32" type="uint32"/> |
| 200 | <reg name="r1" bitsize="32" type="uint32"/> | 277 | <reg name="r1" bitsize="32" type="uint32"/> |
diff --git a/src/core/debugger/gdbstub_arch.h b/src/core/debugger/gdbstub_arch.h index e943848e5..4d039a9f7 100644 --- a/src/core/debugger/gdbstub_arch.h +++ b/src/core/debugger/gdbstub_arch.h | |||
| @@ -40,8 +40,8 @@ private: | |||
| 40 | static constexpr u32 PC_REGISTER = 32; | 40 | static constexpr u32 PC_REGISTER = 32; |
| 41 | static constexpr u32 PSTATE_REGISTER = 33; | 41 | static constexpr u32 PSTATE_REGISTER = 33; |
| 42 | static constexpr u32 Q0_REGISTER = 34; | 42 | static constexpr u32 Q0_REGISTER = 34; |
| 43 | static constexpr u32 FPCR_REGISTER = 66; | 43 | static constexpr u32 FPSR_REGISTER = 66; |
| 44 | static constexpr u32 FPSR_REGISTER = 67; | 44 | static constexpr u32 FPCR_REGISTER = 67; |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | class GDBStubA32 final : public GDBStubArch { | 47 | class GDBStubA32 final : public GDBStubArch { |