yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

use a string view to skip allocation

Signed-off-by: arades79 <scravers@protonmail.com>
This commit is contained in:
arades79 2023-02-14 11:33:42 -05:00
parent 683019878f
commit 880b6e9795
2 changed files with 7 additions and 13 deletions

View File

@ -41,9 +41,8 @@ static void PutSIMDRegister(std::array<u32, 64>& simd_regs, size_t offset, const
// For sample XML files see the GDB source /gdb/features // For sample XML files see the GDB source /gdb/features
// This XML defines what the registers are for this specific ARM device // This XML defines what the registers are for this specific ARM device
std::string GDBStubA64::GetTargetXML() const { constexpr std::string_view GDBStubA64::GetTargetXML() const {
constexpr static const char* target_xml = return R"(<?xml version="1.0"?>
R"(<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd"> <!DOCTYPE target SYSTEM "gdb-target.dtd">
<target version="1.0"> <target version="1.0">
<architecture>aarch64</architecture> <architecture>aarch64</architecture>
@ -178,8 +177,6 @@ std::string GDBStubA64::GetTargetXML() const {
<reg name="fpcr" bitsize="32"/> <reg name="fpcr" bitsize="32"/>
</feature> </feature>
</target>)"; </target>)";
return target_xml;
} }
std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const { std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const {
@ -270,9 +267,8 @@ u32 GDBStubA64::BreakpointInstruction() const {
return 0xd4200000; return 0xd4200000;
} }
std::string GDBStubA32::GetTargetXML() const { constexpr std::string_view GDBStubA32::GetTargetXML() const {
constexpr static const char* target_xml = return R"(<?xml version="1.0"?>
R"(<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd"> <!DOCTYPE target SYSTEM "gdb-target.dtd">
<target version="1.0"> <target version="1.0">
<architecture>arm</architecture> <architecture>arm</architecture>
@ -378,8 +374,6 @@ std::string GDBStubA32::GetTargetXML() const {
<reg name="fpscr" bitsize="32" type="int" group="float" regnum="80"/> <reg name="fpscr" bitsize="32" type="int" group="float" regnum="80"/>
</feature> </feature>
</target>)"; </target>)";
return target_xml;
} }
std::string GDBStubA32::RegRead(const Kernel::KThread* thread, size_t id) const { std::string GDBStubA32::RegRead(const Kernel::KThread* thread, size_t id) const {

View File

@ -16,7 +16,7 @@ namespace Core {
class GDBStubArch { class GDBStubArch {
public: public:
virtual ~GDBStubArch() = default; virtual ~GDBStubArch() = default;
virtual std::string GetTargetXML() const = 0; virtual constexpr std::string_view GetTargetXML() const = 0;
virtual std::string RegRead(const Kernel::KThread* thread, size_t id) const = 0; virtual std::string RegRead(const Kernel::KThread* thread, size_t id) const = 0;
virtual void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const = 0; virtual void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const = 0;
virtual std::string ReadRegisters(const Kernel::KThread* thread) const = 0; virtual std::string ReadRegisters(const Kernel::KThread* thread) const = 0;
@ -27,7 +27,7 @@ public:
class GDBStubA64 final : public GDBStubArch { class GDBStubA64 final : public GDBStubArch {
public: public:
std::string GetTargetXML() const override; constexpr std::string_view GetTargetXML() const override;
std::string RegRead(const Kernel::KThread* thread, size_t id) const override; std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override; void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
std::string ReadRegisters(const Kernel::KThread* thread) const override; std::string ReadRegisters(const Kernel::KThread* thread) const override;
@ -47,7 +47,7 @@ private:
class GDBStubA32 final : public GDBStubArch { class GDBStubA32 final : public GDBStubArch {
public: public:
std::string GetTargetXML() const override; constexpr std::string_view GetTargetXML() const override;
std::string RegRead(const Kernel::KThread* thread, size_t id) const override; std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override; void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
std::string ReadRegisters(const Kernel::KThread* thread) const override; std::string ReadRegisters(const Kernel::KThread* thread) const override;