mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-04 21:55:16 +01:00
Added riscv and riscv64 support for Linux
Change-Id: I62cd157d00a87720db001072662a81d8eb9112b0 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3873291 Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
e059dad5ea
commit
28cf16bc34
37 changed files with 4901 additions and 48 deletions
|
|
@ -53,14 +53,16 @@ class DumpContext : public DumpObject {
|
|||
|
||||
// Returns raw CPU-specific context data for the named CPU type. If the
|
||||
// context data does not match the CPU type or does not exist, returns NULL.
|
||||
const MDRawContextAMD64* GetContextAMD64() const;
|
||||
const MDRawContextARM* GetContextARM() const;
|
||||
const MDRawContextARM64* GetContextARM64() const;
|
||||
const MDRawContextMIPS* GetContextMIPS() const;
|
||||
const MDRawContextPPC* GetContextPPC() const;
|
||||
const MDRawContextPPC64* GetContextPPC64() const;
|
||||
const MDRawContextSPARC* GetContextSPARC() const;
|
||||
const MDRawContextX86* GetContextX86() const;
|
||||
const MDRawContextAMD64* GetContextAMD64() const;
|
||||
const MDRawContextARM* GetContextARM() const;
|
||||
const MDRawContextARM64* GetContextARM64() const;
|
||||
const MDRawContextMIPS* GetContextMIPS() const;
|
||||
const MDRawContextPPC* GetContextPPC() const;
|
||||
const MDRawContextPPC64* GetContextPPC64() const;
|
||||
const MDRawContextSPARC* GetContextSPARC() const;
|
||||
const MDRawContextX86* GetContextX86() const;
|
||||
const MDRawContextRISCV* GetContextRISCV() const;
|
||||
const MDRawContextRISCV64* GetContextRISCV64() const;
|
||||
|
||||
// A convenience method to get the instruction pointer out of the
|
||||
// MDRawContext, since it varies per-CPU architecture.
|
||||
|
|
@ -86,6 +88,8 @@ class DumpContext : public DumpObject {
|
|||
void SetContextARM(MDRawContextARM* arm);
|
||||
void SetContextARM64(MDRawContextARM64* arm64);
|
||||
void SetContextMIPS(MDRawContextMIPS* ctx_mips);
|
||||
void SetContextRISCV(MDRawContextRISCV* riscv);
|
||||
void SetContextRISCV64(MDRawContextRISCV64* riscv64);
|
||||
|
||||
// Free the CPU-specific context structure.
|
||||
void FreeContext();
|
||||
|
|
@ -93,17 +97,19 @@ class DumpContext : public DumpObject {
|
|||
private:
|
||||
// The CPU-specific context structure.
|
||||
union {
|
||||
MDRawContextBase* base;
|
||||
MDRawContextX86* x86;
|
||||
MDRawContextPPC* ppc;
|
||||
MDRawContextPPC64* ppc64;
|
||||
MDRawContextAMD64* amd64;
|
||||
MDRawContextBase* base;
|
||||
MDRawContextX86* x86;
|
||||
MDRawContextPPC* ppc;
|
||||
MDRawContextPPC64* ppc64;
|
||||
MDRawContextAMD64* amd64;
|
||||
// on Solaris SPARC, sparc is defined as a numeric constant,
|
||||
// so variables can NOT be named as sparc
|
||||
MDRawContextSPARC* ctx_sparc;
|
||||
MDRawContextARM* arm;
|
||||
MDRawContextARM64* arm64;
|
||||
MDRawContextMIPS* ctx_mips;
|
||||
MDRawContextSPARC* ctx_sparc;
|
||||
MDRawContextARM* arm;
|
||||
MDRawContextARM64* arm64;
|
||||
MDRawContextMIPS* ctx_mips;
|
||||
MDRawContextRISCV* riscv;
|
||||
MDRawContextRISCV64* riscv64;
|
||||
} context_;
|
||||
|
||||
// Store this separately because of the weirdo AMD64 context
|
||||
|
|
|
|||
|
|
@ -402,6 +402,118 @@ struct StackFrameMIPS : public StackFrame {
|
|||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameRISCV : public StackFrame {
|
||||
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_PC = 1 << 0,
|
||||
CONTEXT_VALID_RA = 1 << 1,
|
||||
CONTEXT_VALID_SP = 1 << 2,
|
||||
CONTEXT_VALID_GP = 1 << 3,
|
||||
CONTEXT_VALID_TP = 1 << 4,
|
||||
CONTEXT_VALID_T0 = 1 << 5,
|
||||
CONTEXT_VALID_T1 = 1 << 6,
|
||||
CONTEXT_VALID_T2 = 1 << 7,
|
||||
CONTEXT_VALID_S0 = 1 << 8,
|
||||
CONTEXT_VALID_S1 = 1 << 9,
|
||||
CONTEXT_VALID_A0 = 1 << 10,
|
||||
CONTEXT_VALID_A1 = 1 << 11,
|
||||
CONTEXT_VALID_A2 = 1 << 12,
|
||||
CONTEXT_VALID_A3 = 1 << 13,
|
||||
CONTEXT_VALID_A4 = 1 << 14,
|
||||
CONTEXT_VALID_A5 = 1 << 15,
|
||||
CONTEXT_VALID_A6 = 1 << 16,
|
||||
CONTEXT_VALID_A7 = 1 << 17,
|
||||
CONTEXT_VALID_S2 = 1 << 18,
|
||||
CONTEXT_VALID_S3 = 1 << 19,
|
||||
CONTEXT_VALID_S4 = 1 << 20,
|
||||
CONTEXT_VALID_S5 = 1 << 21,
|
||||
CONTEXT_VALID_S6 = 1 << 22,
|
||||
CONTEXT_VALID_S7 = 1 << 23,
|
||||
CONTEXT_VALID_S8 = 1 << 24,
|
||||
CONTEXT_VALID_S9 = 1 << 25,
|
||||
CONTEXT_VALID_S10 = 1 << 26,
|
||||
CONTEXT_VALID_S11 = 1 << 27,
|
||||
CONTEXT_VALID_T3 = 1 << 28,
|
||||
CONTEXT_VALID_T4 = 1 << 29,
|
||||
CONTEXT_VALID_T5 = 1 << 30,
|
||||
CONTEXT_VALID_T6 = 1 << 31,
|
||||
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
|
||||
};
|
||||
|
||||
StackFrameRISCV() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, which registers are present depends on what
|
||||
// debugging information were available. Refer to 'context_validity' below.
|
||||
MDRawContextRISCV context;
|
||||
|
||||
// For each register in context whose value has been recovered,
|
||||
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// type int is used instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameRISCV64 : public StackFrame {
|
||||
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_PC = 1 << 0,
|
||||
CONTEXT_VALID_RA = 1 << 1,
|
||||
CONTEXT_VALID_SP = 1 << 2,
|
||||
CONTEXT_VALID_GP = 1 << 3,
|
||||
CONTEXT_VALID_TP = 1 << 4,
|
||||
CONTEXT_VALID_T0 = 1 << 5,
|
||||
CONTEXT_VALID_T1 = 1 << 6,
|
||||
CONTEXT_VALID_T2 = 1 << 7,
|
||||
CONTEXT_VALID_S0 = 1 << 8,
|
||||
CONTEXT_VALID_S1 = 1 << 9,
|
||||
CONTEXT_VALID_A0 = 1 << 10,
|
||||
CONTEXT_VALID_A1 = 1 << 11,
|
||||
CONTEXT_VALID_A2 = 1 << 12,
|
||||
CONTEXT_VALID_A3 = 1 << 13,
|
||||
CONTEXT_VALID_A4 = 1 << 14,
|
||||
CONTEXT_VALID_A5 = 1 << 15,
|
||||
CONTEXT_VALID_A6 = 1 << 16,
|
||||
CONTEXT_VALID_A7 = 1 << 17,
|
||||
CONTEXT_VALID_S2 = 1 << 18,
|
||||
CONTEXT_VALID_S3 = 1 << 19,
|
||||
CONTEXT_VALID_S4 = 1 << 20,
|
||||
CONTEXT_VALID_S5 = 1 << 21,
|
||||
CONTEXT_VALID_S6 = 1 << 22,
|
||||
CONTEXT_VALID_S7 = 1 << 23,
|
||||
CONTEXT_VALID_S8 = 1 << 24,
|
||||
CONTEXT_VALID_S9 = 1 << 25,
|
||||
CONTEXT_VALID_S10 = 1 << 26,
|
||||
CONTEXT_VALID_S11 = 1 << 27,
|
||||
CONTEXT_VALID_T3 = 1 << 28,
|
||||
CONTEXT_VALID_T4 = 1 << 29,
|
||||
CONTEXT_VALID_T5 = 1 << 30,
|
||||
CONTEXT_VALID_T6 = 1 << 31,
|
||||
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
|
||||
};
|
||||
|
||||
StackFrameRISCV64() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, which registers are present depends on what
|
||||
// debugging information were available. Refer to 'context_validity' below.
|
||||
MDRawContextRISCV64 context;
|
||||
|
||||
// For each register in context whose value has been recovered,
|
||||
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// type int is used instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue