diff --git a/Kernel/Arch/x86/RegisterState.h b/Kernel/Arch/x86/RegisterState.h index b69315c547d..65e6b059a47 100644 --- a/Kernel/Arch/x86/RegisterState.h +++ b/Kernel/Arch/x86/RegisterState.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include diff --git a/Kernel/ThreadTracer.h b/Kernel/ThreadTracer.h index 29b1ef1e601..892cda90461 100644 --- a/Kernel/ThreadTracer.h +++ b/Kernel/ThreadTracer.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace Kernel { diff --git a/Ports/gdb/patches/0002-serenity-Add-basic-ptrace-based-native-target-for-Se.patch b/Ports/gdb/patches/0002-serenity-Add-basic-ptrace-based-native-target-for-Se.patch index 129319d8dfb..abe6a9112bf 100644 --- a/Ports/gdb/patches/0002-serenity-Add-basic-ptrace-based-native-target-for-Se.patch +++ b/Ports/gdb/patches/0002-serenity-Add-basic-ptrace-based-native-target-for-Se.patch @@ -129,7 +129,7 @@ index 0000000..034252a +#include "regset.h" +#include "target.h" + -+#include ++#include +#include + +#include "i386-tdep.h" diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index eab199ca953..1eba7028ad2 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h index 43df6afbb05..7090d28f09f 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace Debug { diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h index d881cf0166e..11759c649d0 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace HackStudio { diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h index fdd8e3b03b6..67cbeb4c94a 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace Debug { diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h index 9f32350e66e..d695e600c63 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace HackStudio { diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h index f8749f4c476..3004feada85 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h @@ -9,7 +9,7 @@ #include #include -#include +#include namespace HackStudio { diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h index 5ab55a4d823..6350e99b8eb 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace HackStudio { diff --git a/Userland/Libraries/LibC/sys/arch/x86_64/regs.h b/Userland/Libraries/LibC/sys/arch/x86_64/regs.h index b41fd676178..849a29624aa 100644 --- a/Userland/Libraries/LibC/sys/arch/x86_64/regs.h +++ b/Userland/Libraries/LibC/sys/arch/x86_64/regs.h @@ -6,118 +6,41 @@ #pragma once -#include +#include -#define RREGISTER(num) \ - union { \ - u64 r##num; \ - struct { \ - u32 _unused##num; \ - union { \ - u32 r##num##d; \ - struct { \ - u16 __unused##num; \ - union { \ - u16 r##num##w; \ - struct { \ - u8 ___unused##num; \ - u8 r##num##b; \ - }; \ - }; \ - }; \ - }; \ - }; \ +#if defined(__cplusplus) && defined(__cpp_concepts) +# include +#else +# include +#endif + +#include + +#ifdef __cplusplus +struct [[gnu::packed]] PtraceRegisters : public __mcontext { +#if defined(__cplusplus) && defined(__cpp_concepts) + FlatPtr ip() const + { + return rip; } -#define GPREGISTER(letter) \ - union { \ - u64 r##letter##x; \ - struct \ - { \ - u32 _unused##letter; \ - union { \ - u32 e##letter##x; \ - struct \ - { \ - u16 __unused##letter; \ - union { \ - u16 letter##x; \ - struct { \ - u8 letter##h; \ - u8 letter##l; \ - }; \ - }; \ - }; \ - }; \ - }; \ + void set_ip(FlatPtr ip) + { + rip = ip; } -#define SPREGISTER(name) \ - union { \ - u64 r##name; \ - struct \ - { \ - u32 _unused##name; \ - union { \ - u32 e##name; \ - struct \ - { \ - u16 __unused##name; \ - union { \ - u16 name; \ - struct { \ - u8 ___unused##name; \ - u8 name##l; \ - }; \ - }; \ - }; \ - }; \ - }; \ + FlatPtr bp() const + { + return rbp; } -struct [[gnu::packed]] PtraceRegisters { - GPREGISTER(a); - GPREGISTER(b); - GPREGISTER(c); - GPREGISTER(d); - - SPREGISTER(sp); - SPREGISTER(bp); - SPREGISTER(si); - SPREGISTER(di); - SPREGISTER(ip); // technically there is no ipl, but what ever - - RREGISTER(8); - RREGISTER(9); - RREGISTER(10); - RREGISTER(11); - RREGISTER(12); - RREGISTER(13); - RREGISTER(14); - RREGISTER(15); - // flags - union { - u64 rflags; - struct { - u32 _; - union { - u32 eflags; - struct { - u16 __; - u16 flags; - }; - }; - }; - }; - - // These may not be used, unless we go back into compatibility mode - u32 cs; - u32 ss; - u32 ds; - u32 es; - u32 fs; - u32 gs; - - // FIXME: Add FPU registers and Flags - // FIXME: Add Ymm Xmm etc. + void set_bp(FlatPtr bp) + { + rbp = bp; + } +#endif }; + +#else +typedef struct __mcontext PthreadRegisters; +#endif diff --git a/Userland/Libraries/LibDebug/DebugInfo.h b/Userland/Libraries/LibDebug/DebugInfo.h index 3f7f2042294..b73c272ca95 100644 --- a/Userland/Libraries/LibDebug/DebugInfo.h +++ b/Userland/Libraries/LibDebug/DebugInfo.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace Debug { diff --git a/Userland/Libraries/LibDebug/DebugSession.h b/Userland/Libraries/LibDebug/DebugSession.h index 6084f730997..87fea886bcd 100644 --- a/Userland/Libraries/LibDebug/DebugSession.h +++ b/Userland/Libraries/LibDebug/DebugSession.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp index 6d6a5af72c2..08dda504e50 100644 --- a/Userland/Libraries/LibDebug/Dwarf/Expression.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/Expression.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include namespace Debug::Dwarf::Expression { diff --git a/Userland/Libraries/LibDebug/ProcessInspector.h b/Userland/Libraries/LibDebug/ProcessInspector.h index ac3968fb7c4..d72aac6b657 100644 --- a/Userland/Libraries/LibDebug/ProcessInspector.h +++ b/Userland/Libraries/LibDebug/ProcessInspector.h @@ -9,7 +9,7 @@ #include "LoadedLibrary.h" #include -#include +#include namespace Debug { diff --git a/Userland/Libraries/LibELF/Core.h b/Userland/Libraries/LibELF/Core.h index ca9a36db77c..ae977b462a7 100644 --- a/Userland/Libraries/LibELF/Core.h +++ b/Userland/Libraries/LibELF/Core.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #ifndef KERNEL # include diff --git a/Userland/Utilities/functrace.cpp b/Userland/Utilities/functrace.cpp index c61787d6566..3bcf652dce3 100644 --- a/Userland/Utilities/functrace.cpp +++ b/Userland/Utilities/functrace.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Userland/Utilities/strace.cpp b/Userland/Utilities/strace.cpp index a7f5ae5f8a6..fbe3f0722c2 100644 --- a/Userland/Utilities/strace.cpp +++ b/Userland/Utilities/strace.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include