From 45e13b03f372230dbf780f3fa87dd88f388af605 Mon Sep 17 00:00:00 2001 From: arades79 Date: Sat, 11 Feb 2023 13:28:03 -0500 Subject: add static lifetime to constexpr values to force compile time evaluation where possible Signed-off-by: arades79 --- src/core/debugger/gdbstub_arch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/debugger/gdbstub_arch.cpp') diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp index 4bef09bd7..b13c473bb 100644 --- a/src/core/debugger/gdbstub_arch.cpp +++ b/src/core/debugger/gdbstub_arch.cpp @@ -42,7 +42,7 @@ static void PutSIMDRegister(std::array& simd_regs, size_t offset, const // For sample XML files see the GDB source /gdb/features // This XML defines what the registers are for this specific ARM device std::string GDBStubA64::GetTargetXML() const { - constexpr const char* target_xml = + constexpr static const char* target_xml = R"( @@ -271,7 +271,7 @@ u32 GDBStubA64::BreakpointInstruction() const { } std::string GDBStubA32::GetTargetXML() const { - constexpr const char* target_xml = + constexpr static const char* target_xml = R"( -- cgit v1.2.3 From 880b6e9795e2a86d8f31f437c9ac7d356e7790a5 Mon Sep 17 00:00:00 2001 From: arades79 Date: Tue, 14 Feb 2023 11:33:42 -0500 Subject: use a string view to skip allocation Signed-off-by: arades79 --- src/core/debugger/gdbstub_arch.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/core/debugger/gdbstub_arch.cpp') diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp index b13c473bb..f3dd517bd 100644 --- a/src/core/debugger/gdbstub_arch.cpp +++ b/src/core/debugger/gdbstub_arch.cpp @@ -41,9 +41,8 @@ static void PutSIMDRegister(std::array& simd_regs, size_t offset, const // For sample XML files see the GDB source /gdb/features // This XML defines what the registers are for this specific ARM device -std::string GDBStubA64::GetTargetXML() const { - constexpr static const char* target_xml = - R"( +constexpr std::string_view GDBStubA64::GetTargetXML() const { + return R"( aarch64 @@ -178,8 +177,6 @@ std::string GDBStubA64::GetTargetXML() const { )"; - - return target_xml; } std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const { @@ -270,9 +267,8 @@ u32 GDBStubA64::BreakpointInstruction() const { return 0xd4200000; } -std::string GDBStubA32::GetTargetXML() const { - constexpr static const char* target_xml = - R"( +constexpr std::string_view GDBStubA32::GetTargetXML() const { + return R"( arm @@ -378,8 +374,6 @@ std::string GDBStubA32::GetTargetXML() const { )"; - - return target_xml; } std::string GDBStubA32::RegRead(const Kernel::KThread* thread, size_t id) const { -- cgit v1.2.3 From 98631b45b6012f997081dc76c6908dcba8df729b Mon Sep 17 00:00:00 2001 From: arades79 Date: Tue, 14 Feb 2023 19:14:29 -0500 Subject: remove constexpr from virtual function Signed-off-by: arades79 --- src/core/debugger/gdbstub_arch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/debugger/gdbstub_arch.cpp') diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp index f3dd517bd..831c48513 100644 --- a/src/core/debugger/gdbstub_arch.cpp +++ b/src/core/debugger/gdbstub_arch.cpp @@ -41,7 +41,7 @@ static void PutSIMDRegister(std::array& simd_regs, size_t offset, const // For sample XML files see the GDB source /gdb/features // This XML defines what the registers are for this specific ARM device -constexpr std::string_view GDBStubA64::GetTargetXML() const { +std::string_view GDBStubA64::GetTargetXML() const { return R"( @@ -267,7 +267,7 @@ u32 GDBStubA64::BreakpointInstruction() const { return 0xd4200000; } -constexpr std::string_view GDBStubA32::GetTargetXML() const { +std::string_view GDBStubA32::GetTargetXML() const { return R"( -- cgit v1.2.3