diff options
Diffstat (limited to 'src/google_breakpad')
43 files changed, 796 insertions, 242 deletions
diff --git a/src/google_breakpad/common/breakpad_types.h b/src/google_breakpad/common/breakpad_types.h index d8828043..efd94e9d 100644 --- a/src/google_breakpad/common/breakpad_types.h +++ b/src/google_breakpad/common/breakpad_types.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_amd64.h b/src/google_breakpad/common/minidump_cpu_amd64.h index 4256706d..308f21ec 100644 --- a/src/google_breakpad/common/minidump_cpu_amd64.h +++ b/src/google_breakpad/common/minidump_cpu_amd64.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_arm.h b/src/google_breakpad/common/minidump_cpu_arm.h index 6a711383..2ac0623e 100644 --- a/src/google_breakpad/common/minidump_cpu_arm.h +++ b/src/google_breakpad/common/minidump_cpu_arm.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2009, Google Inc. - * All rights reserved. +/* Copyright 2009 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_arm64.h b/src/google_breakpad/common/minidump_cpu_arm64.h index 0411bebb..96f26332 100644 --- a/src/google_breakpad/common/minidump_cpu_arm64.h +++ b/src/google_breakpad/common/minidump_cpu_arm64.h @@ -1,5 +1,4 @@ -/* Copyright 2013 Google Inc. - * All rights reserved. +/* Copyright 2013 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_mips.h b/src/google_breakpad/common/minidump_cpu_mips.h index f4e2b589..91b700af 100644 --- a/src/google_breakpad/common/minidump_cpu_mips.h +++ b/src/google_breakpad/common/minidump_cpu_mips.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2013, Google Inc. - * All rights reserved. +/* Copyright 2013 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_ppc.h b/src/google_breakpad/common/minidump_cpu_ppc.h index b24cc424..17a71af7 100644 --- a/src/google_breakpad/common/minidump_cpu_ppc.h +++ b/src/google_breakpad/common/minidump_cpu_ppc.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_ppc64.h b/src/google_breakpad/common/minidump_cpu_ppc64.h index 61f41938..75638b5d 100644 --- a/src/google_breakpad/common/minidump_cpu_ppc64.h +++ b/src/google_breakpad/common/minidump_cpu_ppc64.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2008, Google Inc. - * All rights reserved. +/* Copyright 2008 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_riscv.h b/src/google_breakpad/common/minidump_cpu_riscv.h new file mode 100644 index 00000000..94d06117 --- /dev/null +++ b/src/google_breakpad/common/minidump_cpu_riscv.h @@ -0,0 +1,168 @@ +/* minidump_format.h: A cross-platform reimplementation of minidump-related + * portions of DbgHelp.h from the Windows Platform SDK. + * + * (This is C99 source, please don't corrupt it with C++.) + * + * This file contains the necessary definitions to read minidump files + * produced on RISCV and RISCV64. These files may be read on any platform + * provided that the alignments of these structures on the processing system + * are identical to the alignments of these structures on the producing + * system. For this reason, precise-sized types are used. The structures + * defined by this file have been laid out to minimize alignment problems by + * ensuring that all members are aligned on their natural boundaries. + * In some cases, tail-padding may be significant when different ABIs specify + * different tail-padding behaviors. To avoid problems when reading or + * writing affected structures, MD_*_SIZE macros are provided where needed, + * containing the useful size of the structures without padding. + * + * Structures that are defined by Microsoft to contain a zero-length array + * are instead defined here to contain an array with one element, as + * zero-length arrays are forbidden by standard C and C++. In these cases, + * *_minsize constants are provided to be used in place of sizeof. For a + * cleaner interface to these sizes when using C++, see minidump_size.h. + * + * These structures are also sufficient to populate minidump files. + * + * Because precise data type sizes are crucial for this implementation to + * function properly and portably, a set of primitive types with known sizes + * are used as the basis of each structure defined by this file. + * + * Author: Iacopo Colonnelli + */ + +/* + * RISCV and RISCV64 support + */ + +#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV_H__ +#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV_H__ + +#include "google_breakpad/common/breakpad_types.h" + +#define MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT 32 +#if defined(__riscv) +# if __riscv_flen == 32 +typedef uint32_t riscv_fpr_size; +# elif __riscv_flen == 64 +typedef uint64_t riscv_fpr_size; +# elif __riscv_flen == 128 +typedef uint128_struct riscv_fpr_size; +# else +# error "Unexpected __riscv_flen" +# endif +#else +typedef uint32_t riscv_fpr_size; +#endif + +#define MD_CONTEXT_RISCV_GPR_COUNT 32 + +typedef struct { + /* 32 floating point registers, f0 .. f31. */ + riscv_fpr_size regs[MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT]; + uint32_t fpcsr; +} MDFloatingSaveAreaRISCV; + +enum MDRISCVRegisterNumbers { + MD_CONTEXT_RISCV_REG_PC = 0, + MD_CONTEXT_RISCV_REG_RA = 1, + MD_CONTEXT_RISCV_REG_SP = 2, +}; + +/* For (MDRawContextRISCV).context_flags. These values indicate the type of + * context stored in the structure. */ +#define MD_CONTEXT_RISCV 0x00800000 +#define MD_CONTEXT_RISCV_INTEGER (MD_CONTEXT_RISCV | 0x00000001) +#define MD_CONTEXT_RISCV_FLOATING_POINT (MD_CONTEXT_RISCV | 0x00000004) +#define MD_CONTEXT_RISCV_FULL (MD_CONTEXT_RISCV_INTEGER | \ + MD_CONTEXT_RISCV_FLOATING_POINT) + +typedef struct { + /* Determines which fields of this struct are populated */ + uint32_t context_flags; + + uint32_t pc; + uint32_t ra; + uint32_t sp; + uint32_t gp; + uint32_t tp; + uint32_t t0; + uint32_t t1; + uint32_t t2; + uint32_t s0; + uint32_t s1; + uint32_t a0; + uint32_t a1; + uint32_t a2; + uint32_t a3; + uint32_t a4; + uint32_t a5; + uint32_t a6; + uint32_t a7; + uint32_t s2; + uint32_t s3; + uint32_t s4; + uint32_t s5; + uint32_t s6; + uint32_t s7; + uint32_t s8; + uint32_t s9; + uint32_t s10; + uint32_t s11; + uint32_t t3; + uint32_t t4; + uint32_t t5; + uint32_t t6; + + MDFloatingSaveAreaRISCV float_save; +} MDRawContextRISCV; + +/* For (MDRawContextRISCV64).context_flags. These values indicate the type of + * context stored in the structure. */ +#define MD_CONTEXT_RISCV64 0x08000000 +#define MD_CONTEXT_RISCV64_INTEGER (MD_CONTEXT_RISCV64 | 0x00000001) +#define MD_CONTEXT_RISCV64_FLOATING_POINT (MD_CONTEXT_RISCV64 | 0x00000004) +#define MD_CONTEXT_RISCV64_FULL (MD_CONTEXT_RISCV64_INTEGER | \ + MD_CONTEXT_RISCV64_FLOATING_POINT) + +typedef struct { + /* Determines which fields of this struct are populated */ + uint32_t context_flags; + + uint64_t pc; + uint64_t ra; + uint64_t sp; + uint64_t gp; + uint64_t tp; + uint64_t t0; + uint64_t t1; + uint64_t t2; + uint64_t s0; + uint64_t s1; + uint64_t a0; + uint64_t a1; + uint64_t a2; + uint64_t a3; + uint64_t a4; + uint64_t a5; + uint64_t a6; + uint64_t a7; + uint64_t s2; + uint64_t s3; + uint64_t s4; + uint64_t s5; + uint64_t s6; + uint64_t s7; + uint64_t s8; + uint64_t s9; + uint64_t s10; + uint64_t s11; + uint64_t t3; + uint64_t t4; + uint64_t t5; + uint64_t t6; + + MDFloatingSaveAreaRISCV float_save; +} MDRawContextRISCV64; + + +#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV_H__ */ diff --git a/src/google_breakpad/common/minidump_cpu_sparc.h b/src/google_breakpad/common/minidump_cpu_sparc.h index 95c08b17..6452588a 100644 --- a/src/google_breakpad/common/minidump_cpu_sparc.h +++ b/src/google_breakpad/common/minidump_cpu_sparc.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_cpu_x86.h b/src/google_breakpad/common/minidump_cpu_x86.h index e09cb7cb..add1e225 100644 --- a/src/google_breakpad/common/minidump_cpu_x86.h +++ b/src/google_breakpad/common/minidump_cpu_x86.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_exception_fuchsia.h b/src/google_breakpad/common/minidump_exception_fuchsia.h index f26a8a2a..169094b2 100644 --- a/src/google_breakpad/common/minidump_exception_fuchsia.h +++ b/src/google_breakpad/common/minidump_exception_fuchsia.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2019, Google Inc. - * All rights reserved. +/* Copyright 2019 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_exception_linux.h b/src/google_breakpad/common/minidump_exception_linux.h index 6138d5d7..354cdd6b 100644 --- a/src/google_breakpad/common/minidump_exception_linux.h +++ b/src/google_breakpad/common/minidump_exception_linux.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_exception_mac.h b/src/google_breakpad/common/minidump_exception_mac.h index fadbf4ef..acfafaa0 100644 --- a/src/google_breakpad/common/minidump_exception_mac.h +++ b/src/google_breakpad/common/minidump_exception_mac.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * @@ -66,9 +65,15 @@ typedef enum { MD_EXCEPTION_MAC_MACH_SYSCALL = 8, /* EXC_MACH_SYSCALL */ MD_EXCEPTION_MAC_RPC_ALERT = 9, + /* EXC_RESOURCE */ + MD_EXCEPTION_MAC_RESOURCE = 11, + /* EXC_GUARD */ + MD_EXCEPTION_MAC_GUARD = 12, /* EXC_RPC_ALERT */ - MD_EXCEPTION_MAC_SIMULATED = 0x43507378 + MD_EXCEPTION_MAC_SIMULATED = 0x43507378, /* Fake exception code used by Crashpad's SimulateCrash ('CPsx'). */ + MD_NS_EXCEPTION_SIMULATED = 0x43506E78 + /* Fake exception code used by Crashpad's uncaught exceptions ('CPnx'). */ } MDExceptionMac; /* For (MDException).exception_flags. Breakpad minidump extension for Mac OS X diff --git a/src/google_breakpad/common/minidump_exception_ps3.h b/src/google_breakpad/common/minidump_exception_ps3.h index adff5a6b..dd87d7a7 100644 --- a/src/google_breakpad/common/minidump_exception_ps3.h +++ b/src/google_breakpad/common/minidump_exception_ps3.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2013, Google Inc. - * All rights reserved. +/* Copyright 2013 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_exception_solaris.h b/src/google_breakpad/common/minidump_exception_solaris.h index f18ddf42..16641919 100644 --- a/src/google_breakpad/common/minidump_exception_solaris.h +++ b/src/google_breakpad/common/minidump_exception_solaris.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/google_breakpad/common/minidump_exception_win32.h b/src/google_breakpad/common/minidump_exception_win32.h index 4b5d57c8..0431a3fa 100644 --- a/src/google_breakpad/common/minidump_exception_win32.h +++ b/src/google_breakpad/common/minidump_exception_win32.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * @@ -2266,4 +2265,77 @@ typedef enum { MD_IN_PAGE_ERROR_WIN_EXEC = 8 } MDInPageErrorTypeWin; +// These constants are defined in winnt.h and are used with the +// STATUS_STACK_BUFFER_OVERRUN exception as exception subcodes. +typedef enum { + MD_FAST_FAIL_LEGACY_GS_VIOLATION = 0, + MD_FAST_FAIL_VTGUARD_CHECK_FAILURE = 1, + MD_FAST_FAIL_STACK_COOKIE_CHECK_FAILURE = 2, + MD_FAST_FAIL_CORRUPT_LIST_ENTRY = 3, + MD_FAST_FAIL_INCORRECT_STACK = 4, + MD_FAST_FAIL_INVALID_ARG = 5, + MD_FAST_FAIL_GS_COOKIE_INIT = 6, + MD_FAST_FAIL_FATAL_APP_EXIT = 7, + MD_FAST_FAIL_RANGE_CHECK_FAILURE = 8, + MD_FAST_FAIL_UNSAFE_REGISTRY_ACCESS = 9, + MD_FAST_FAIL_GUARD_ICALL_CHECK_FAILURE = 10, + MD_FAST_FAIL_GUARD_WRITE_CHECK_FAILURE = 11, + MD_FAST_FAIL_INVALID_FIBER_SWITCH = 12, + MD_FAST_FAIL_INVALID_SET_OF_CONTEXT = 13, + MD_FAST_FAIL_INVALID_REFERENCE_COUNT = 14, + MD_FAST_FAIL_INVALID_JUMP_BUFFER = 18, + MD_FAST_FAIL_MRDATA_MODIFIED = 19, + MD_FAST_FAIL_CERTIFICATION_FAILURE = 20, + MD_FAST_FAIL_INVALID_EXCEPTION_CHAIN = 21, + MD_FAST_FAIL_CRYPTO_LIBRARY = 22, + MD_FAST_FAIL_INVALID_CALL_IN_DLL_CALLOUT = 23, + MD_FAST_FAIL_INVALID_IMAGE_BASE = 24, + MD_FAST_FAIL_DLOAD_PROTECTION_FAILURE = 25, + MD_FAST_FAIL_UNSAFE_EXTENSION_CALL = 26, + MD_FAST_FAIL_DEPRECATED_SERVICE_INVOKED = 27, + MD_FAST_FAIL_INVALID_BUFFER_ACCESS = 28, + MD_FAST_FAIL_INVALID_BALANCED_TREE = 29, + MD_FAST_FAIL_INVALID_NEXT_THREAD = 30, + MD_FAST_FAIL_GUARD_ICALL_CHECK_SUPPRESSED = 31, + MD_FAST_FAIL_APCS_DISABLED = 32, + MD_FAST_FAIL_INVALID_IDLE_STATE = 33, + MD_FAST_FAIL_MRDATA_PROTECTION_FAILURE = 34, + MD_FAST_FAIL_UNEXPECTED_HEAP_EXCEPTION = 35, + MD_FAST_FAIL_INVALID_LOCK_STATE = 36, + MD_FAST_FAIL_GUARD_JUMPTABLE = 37, + MD_FAST_FAIL_INVALID_LONGJUMP_TARGET = 38, + MD_FAST_FAIL_INVALID_DISPATCH_CONTEXT = 39, + MD_FAST_FAIL_INVALID_THREAD = 40, + MD_FAST_FAIL_INVALID_SYSCALL_NUMBER = 41, + MD_FAST_FAIL_INVALID_FILE_OPERATION = 42, + MD_FAST_FAIL_LPAC_ACCESS_DENIED = 43, + MD_FAST_FAIL_GUARD_SS_FAILURE = 44, + MD_FAST_FAIL_LOADER_CONTINUITY_FAILURE = 45, + MD_FAST_FAIL_GUARD_EXPORT_SUPPRESSION_FAILURE = 46, + MD_FAST_FAIL_INVALID_CONTROL_STACK = 47, + MD_FAST_FAIL_SET_CONTEXT_DENIED = 48, + MD_FAST_FAIL_INVALID_IAT = 49, + MD_FAST_FAIL_HEAP_METADATA_CORRUPTION = 50, + MD_FAST_FAIL_PAYLOAD_RESTRICTION_VIOLATION = 51, + MD_FAST_FAIL_LOW_LABEL_ACCESS_DENIED = 52, + MD_FAST_FAIL_ENCLAVE_CALL_FAILURE = 53, + MD_FAST_FAIL_UNHANDLED_LSS_EXCEPTON = 54, + MD_FAST_FAIL_ADMINLESS_ACCESS_DENIED = 55, + MD_FAST_FAIL_UNEXPECTED_CALL = 56, + MD_FAST_FAIL_CONTROL_INVALID_RETURN_ADDRESS = 57, + MD_FAST_FAIL_UNEXPECTED_HOST_BEHAVIOR = 58, + MD_FAST_FAIL_FLAGS_CORRUPTION = 59, + MD_FAST_FAIL_VEH_CORRUPTION = 60, + MD_FAST_FAIL_ETW_CORRUPTION = 61, + MD_FAST_FAIL_RIO_ABORT = 62, + MD_FAST_FAIL_INVALID_PFN = 63, + MD_FAST_FAIL_GUARD_ICALL_CHECK_FAILURE_XFG = 64, + MD_FAST_FAIL_CAST_GUARD = 65, + MD_FAST_FAIL_HOST_VISIBILITY_CHANGE = 66, + MD_FAST_FAIL_KERNEL_CET_SHADOW_STACK_ASSIST = 67, + MD_FAST_FAIL_PATCH_CALLBACK_FAILED = 68, + MD_FAST_FAIL_NTDLL_PATCH_FAILED = 69, + MD_FAST_FAIL_INVALID_FLS_DATA = 70 +} MDFastFailSubcodeTypeWin; + #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_WIN32_H__ */ diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h index 6eceddbb..1526afce 100644 --- a/src/google_breakpad/common/minidump_format.h +++ b/src/google_breakpad/common/minidump_format.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2006, Google Inc. - * All rights reserved. +/* Copyright 2006 Google LLC * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * @@ -118,6 +117,7 @@ typedef struct { #include "minidump_cpu_mips.h" #include "minidump_cpu_ppc.h" #include "minidump_cpu_ppc64.h" +#include "minidump_cpu_riscv.h" #include "minidump_cpu_sparc.h" #include "minidump_cpu_x86.h" @@ -239,6 +239,15 @@ typedef struct { MDRVA rva; } MDLocationDescriptor; /* MINIDUMP_LOCATION_DESCRIPTOR */ +/* An MDRVA64 is an 64-bit offset into the minidump file. The beginning of the + * MDRawHeader is at offset 0. */ +typedef uint64_t MDRVA64; /* RVA64 */ + +typedef struct { + uint64_t data_size; + MDRVA64 rva; +} MDLocationDescriptor64; /* MINIDUMP_LOCATION_DESCRIPTOR64 */ + typedef struct { /* The base address of the memory range on the host that produced the @@ -332,6 +341,7 @@ typedef enum { MD_JAVASCRIPT_DATA_STREAM = 20, MD_SYSTEM_MEMORY_INFO_STREAM = 21, MD_PROCESS_VM_COUNTERS_STREAM = 22, + MD_THREAD_NAME_LIST_STREAM = 24, /* MDRawThreadNameList */ MD_LAST_RESERVED_STREAM = 0x0000ffff, /* Breakpad extension types. 0x4767 = "Gg" */ @@ -382,6 +392,20 @@ typedef struct { static const size_t MDRawThreadList_minsize = offsetof(MDRawThreadList, threads[0]); +#pragma pack(push, 4) +typedef struct { + uint32_t thread_id; + MDRVA64 thread_name_rva; /* MDString */ +} MDRawThreadName; /* MINIDUMP_THREAD_NAME */ + +typedef struct { + uint32_t number_of_thread_names; + MDRawThreadName thread_names[1]; +} MDRawThreadNameList; /* MINIDUMP_THREAD_NAME_LIST */ +#pragma pack(pop) + +static const size_t MDRawThreadNameList_minsize = + offsetof(MDRawThreadNameList, thread_names[0]); typedef struct { uint64_t base_of_image; @@ -529,7 +553,7 @@ static const size_t MDRawMemoryList_minsize = offsetof(MDRawMemoryList, memory_ranges[0]); -#define MD_EXCEPTION_MAXIMUM_PARAMETERS 15 +#define MD_EXCEPTION_MAXIMUM_PARAMETERS 15u typedef struct { uint32_t exception_code; /* Windows: MDExceptionCodeWin, @@ -660,6 +684,8 @@ typedef enum { MD_CPU_ARCHITECTURE_PPC64 = 0x8002, /* Breakpad-defined value for PPC64 */ MD_CPU_ARCHITECTURE_ARM64_OLD = 0x8003, /* Breakpad-defined value for ARM64 */ MD_CPU_ARCHITECTURE_MIPS64 = 0x8004, /* Breakpad-defined value for MIPS64 */ + MD_CPU_ARCHITECTURE_RISCV = 0x8005, /* Breakpad-defined value for RISCV */ + MD_CPU_ARCHITECTURE_RISCV64 = 0x8006, /* Breakpad-defined value for RISCV64 */ MD_CPU_ARCHITECTURE_UNKNOWN = 0xffff /* PROCESSOR_ARCHITECTURE_UNKNOWN */ } MDCPUArchitecture; @@ -1071,9 +1097,22 @@ typedef struct { } MDRawSimpleStringDictionary; typedef struct { + MDRVA name; + uint16_t type; + uint16_t reserved; + MDRVA value; +} MDRawCrashpadAnnotation; + +typedef struct { + uint32_t count; + MDLocationDescriptor objects[0]; /* MDRawCrashpadAnnotation */ +} MDRawCrashpadAnnotationList; + +typedef struct { uint32_t version; MDLocationDescriptor list_annotations; MDLocationDescriptor simple_annotations; /* MDRawSimpleStringDictionary */ + MDLocationDescriptor annotation_objects; /* MDRawCrashpadAnnotationList */ } MDRawModuleCrashpadInfo; typedef struct { @@ -1092,6 +1131,8 @@ typedef struct { MDGUID client_id; MDLocationDescriptor simple_annotations; /* MDRawSimpleStringDictionary */ MDLocationDescriptor module_list; /* MDRawModuleCrashpadInfoList */ + uint32_t reserved; + uint64_t address_mask; } MDRawCrashpadInfo; #if defined(_MSC_VER) diff --git a/src/google_breakpad/common/minidump_size.h b/src/google_breakpad/common/minidump_size.h index fae57923..f9abdc36 100644 --- a/src/google_breakpad/common/minidump_size.h +++ b/src/google_breakpad/common/minidump_size.h @@ -1,5 +1,4 @@ -// Copyright (c) 2007, Google Inc. -// All rights reserved. +// Copyright 2007 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/basic_source_line_resolver.h b/src/google_breakpad/processor/basic_source_line_resolver.h index 91fb7841..e86b28d2 100644 --- a/src/google_breakpad/processor/basic_source_line_resolver.h +++ b/src/google_breakpad/processor/basic_source_line_resolver.h @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -40,6 +39,7 @@ #include <map> #include <string> +#include <vector> #include "common/using_std_string.h" #include "google_breakpad/processor/source_line_resolver_base.h" @@ -84,15 +84,50 @@ class BasicSourceLineResolver : public SourceLineResolverBase { // Helper class, containing useful methods for parsing of Breakpad symbol files. class SymbolParseHelper { public: + using MemAddr = SourceLineResolverInterface::MemAddr; + // Parses a |file_line| declaration. Returns true on success. // Format: FILE <id> <filename>. // Notice, that this method modifies the input |file_line| which is why it // can't be const. On success, <id>, and <filename> are stored in |*index|, // and |*filename|. No allocation is done, |*filename| simply points inside // |file_line|. - static bool ParseFile(char *file_line, // in - long *index, // out - char **filename); // out + static bool ParseFile(char* file_line, // in + long* index, // out + char** filename); // out + + // Parses a |inline_origin_line| declaration. Returns true on success. + // Old Format: INLINE_ORIGIN <origin_id> <file_id> <name>. + // New Format: INLINE_ORIGIN <origin_id> <name>. + // Notice, that this method modifies the input |inline_origin_line| which is + // why it can't be const. On success, <has_file_id>, <origin_id>, <file_id> + // and <name> are stored in |*has_file_id*|, |*origin_id|, |*file_id|, and + // |*name|. No allocation is done, |*name| simply points inside + // |inline_origin_line|. + static bool ParseInlineOrigin(char* inline_origin_line, // in + bool* has_file_id, // out + long* origin_id, // out + long* file_id, // out + char** name); // out + + // Parses a |inline| declaration. Returns true on success. + // Old Format: INLINE <inline_nest_level> <call_site_line> <origin_id> + // [<address> <size>]+ + // New Format: INLINE <inline_nest_level> <call_site_line> <call_site_file_id> + // <origin_id> [<address> <size>]+ + // Notice, that this method modifies the input |inline| + // which is why it can't be const. On success, <has_call_site_file_id>, + // <inline_nest_level>, <call_site_line> and <origin_id> are stored in + // |*has_call_site_file_id*|, |*inline_nest_level|, |*call_site_line|, and + // |*origin_id|, and all pairs of (<address>, <size>) are added into ranges. + static bool ParseInline( + char* inline_line, // in + bool* has_call_site_file_id, // out + long* inline_nest_level, // out + long* call_site_line, // out + long* call_site_file_id, // out + long* origin_id, // out + std::vector<std::pair<MemAddr, MemAddr>>* ranges); // out // Parses a |function_line| declaration. Returns true on success. // Format: FUNC [<multiple>] <address> <size> <stack_param_size> <name>. @@ -101,12 +136,12 @@ class SymbolParseHelper { // <stack_param_size>, and <name> are stored in |*is_multiple|, |*address|, // |*size|, |*stack_param_size|, and |*name|. No allocation is done, |*name| // simply points inside |function_line|. - static bool ParseFunction(char *function_line, // in - bool *is_multiple, // out - uint64_t *address, // out - uint64_t *size, // out - long *stack_param_size, // out - char **name); // out + static bool ParseFunction(char* function_line, // in + bool* is_multiple, // out + uint64_t* address, // out + uint64_t* size, // out + long* stack_param_size, // out + char** name); // out // Parses a |line| declaration. Returns true on success. // Format: <address> <size> <line number> <source file id> @@ -114,11 +149,11 @@ class SymbolParseHelper { // it can't be const. On success, <address>, <size>, <line number>, and // <source file id> are stored in |*address|, |*size|, |*line_number|, and // |*source_file|. - static bool ParseLine(char *line_line, // in - uint64_t *address, // out - uint64_t *size, // out - long *line_number, // out - long *source_file); // out + static bool ParseLine(char* line_line, // in + uint64_t* address, // out + uint64_t* size, // out + long* line_number, // out + long* source_file); // out // Parses a |public_line| declaration. Returns true on success. // Format: PUBLIC [<multiple>] <address> <stack_param_size> <name> @@ -127,15 +162,15 @@ class SymbolParseHelper { // <stack_param_size>, <name> are stored in |*is_multiple|, |*address|, // |*stack_param_size|, and |*name|. No allocation is done, |*name| simply // points inside |public_line|. - static bool ParsePublicSymbol(char *public_line, // in - bool *is_multiple, // out - uint64_t *address, // out - long *stack_param_size, // out - char **name); // out + static bool ParsePublicSymbol(char* public_line, // in + bool* is_multiple, // out + uint64_t* address, // out + long* stack_param_size, // out + char** name); // out private: // Used for success checks after strtoull and strtol. - static bool IsValidAfterNumber(char *after_number); + static bool IsValidAfterNumber(char* after_number); // Only allow static methods. SymbolParseHelper(); diff --git a/src/google_breakpad/processor/call_stack.h b/src/google_breakpad/processor/call_stack.h index c5914231..9bf062f8 100644 --- a/src/google_breakpad/processor/call_stack.h +++ b/src/google_breakpad/processor/call_stack.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/code_module.h b/src/google_breakpad/processor/code_module.h index 29b8d9c9..76bbfab8 100644 --- a/src/google_breakpad/processor/code_module.h +++ b/src/google_breakpad/processor/code_module.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/code_modules.h b/src/google_breakpad/processor/code_modules.h index 74f113c1..7538328b 100644 --- a/src/google_breakpad/processor/code_modules.h +++ b/src/google_breakpad/processor/code_modules.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/dump_context.h b/src/google_breakpad/processor/dump_context.h index df80bf7e..7a1c643e 100644 --- a/src/google_breakpad/processor/dump_context.h +++ b/src/google_breakpad/processor/dump_context.h @@ -1,5 +1,4 @@ -// Copyright (c) 2014 Google Inc. -// All rights reserved. +// Copyright 2014 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -54,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. @@ -87,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(); @@ -94,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 diff --git a/src/google_breakpad/processor/dump_object.h b/src/google_breakpad/processor/dump_object.h index 112f687f..0b1f4884 100644 --- a/src/google_breakpad/processor/dump_object.h +++ b/src/google_breakpad/processor/dump_object.h @@ -1,5 +1,4 @@ -// Copyright (c) 2014 Google Inc. -// All rights reserved. +// Copyright 2014 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/exception_record.h b/src/google_breakpad/processor/exception_record.h index eac6c90a..aa2b0de3 100644 --- a/src/google_breakpad/processor/exception_record.h +++ b/src/google_breakpad/processor/exception_record.h @@ -1,5 +1,4 @@ -// Copyright (c) 2019 Google Inc. -// All rights reserved. +// Copyright 2019 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/exploitability.h b/src/google_breakpad/processor/exploitability.h index 014413c9..0b51ba13 100644 --- a/src/google_breakpad/processor/exploitability.h +++ b/src/google_breakpad/processor/exploitability.h @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/fast_source_line_resolver.h b/src/google_breakpad/processor/fast_source_line_resolver.h index fdf91077..11cec75e 100644 --- a/src/google_breakpad/processor/fast_source_line_resolver.h +++ b/src/google_breakpad/processor/fast_source_line_resolver.h @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -79,6 +78,8 @@ class FastSourceLineResolver : public SourceLineResolverBase { // SourceLineResolverBase. struct Line; struct Function; + struct Inline; + struct InlineOrigin; struct PublicSymbol; class Module; diff --git a/src/google_breakpad/processor/memory_region.h b/src/google_breakpad/processor/memory_region.h index 30f88df4..378fcc39 100644 --- a/src/google_breakpad/processor/memory_region.h +++ b/src/google_breakpad/processor/memory_region.h @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/microdump.h b/src/google_breakpad/processor/microdump.h index 02ebdcd7..7c2f3e66 100644 --- a/src/google_breakpad/processor/microdump.h +++ b/src/google_breakpad/processor/microdump.h @@ -1,5 +1,4 @@ -// Copyright (c) 2014 Google Inc. -// All rights reserved. +// Copyright 2014 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/microdump_processor.h b/src/google_breakpad/processor/microdump_processor.h index 60d14a54..abf468f4 100644 --- a/src/google_breakpad/processor/microdump_processor.h +++ b/src/google_breakpad/processor/microdump_processor.h @@ -1,5 +1,4 @@ -// Copyright (c) 2014, Google Inc. -// All rights reserved. +// Copyright 2014 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h index d712cb66..934a0e3e 100644 --- a/src/google_breakpad/processor/minidump.h +++ b/src/google_breakpad/processor/minidump.h @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -291,7 +290,7 @@ class MinidumpThread : public MinidumpObject { // so a special getter is provided to retrieve this data from the // MDRawThread structure. Returns false if the thread ID cannot be // determined. - virtual bool GetThreadID(uint32_t *thread_id) const; + virtual bool GetThreadID(uint32_t* thread_id) const; // Print a human-readable representation of the object to stdout. void Print(); @@ -370,6 +369,86 @@ class MinidumpThreadList : public MinidumpStream { DISALLOW_COPY_AND_ASSIGN(MinidumpThreadList); }; +// MinidumpThreadName contains the name of a thread. +class MinidumpThreadName : public MinidumpObject { + public: + virtual ~MinidumpThreadName(); + + const MDRawThreadName* thread_name() const { + return valid_ ? &thread_name_ : NULL; + } + + // Gets the thread ID. + virtual bool GetThreadID(uint32_t* thread_id) const; + + // Print a human-readable representation of the object to stdout. + void Print(); + + // Returns the name of the thread. + virtual std::string GetThreadName() const; + + protected: + explicit MinidumpThreadName(Minidump* minidump); + + private: + // These objects are managed by MinidumpThreadNameList. + friend class MinidumpThreadNameList; + + // This works like MinidumpStream::Read, but is driven by + // MinidumpThreadNameList. No size checking is done, because + // MinidumpThreadNameList handles that directly. + bool Read(); + + // Reads indirectly-referenced data, including the thread name. + bool ReadAuxiliaryData(); + + // True after a successful Read. This is different from valid_, which is not + // set true until ReadAuxiliaryData also completes successfully. + // thread_name_valid_ is only used by ReadAuxiliaryData and the functions it + // calls to determine whether the object is ready for auxiliary data to be + // read. + bool thread_name_valid_; + + MDRawThreadName thread_name_; + + // Cached thread name. + const string* name_; +}; + +// MinidumpThreadNameList contains all of the names of the threads (as +// MinidumpThreadNames) in a process. +class MinidumpThreadNameList : public MinidumpStream { + public: + virtual ~MinidumpThreadNameList(); + + virtual unsigned int thread_name_count() const { + return valid_ ? thread_name_count_ : 0; + } + + // Sequential access to thread names. + virtual MinidumpThreadName* GetThreadNameAtIndex(unsigned int index) const; + + // Print a human-readable representation of the object to stdout. + void Print(); + + protected: + explicit MinidumpThreadNameList(Minidump* aMinidump); + + private: + friend class Minidump; + + typedef vector<MinidumpThreadName> MinidumpThreadNames; + + static const uint32_t kStreamType = MD_THREAD_NAME_LIST_STREAM; + + bool Read(uint32_t aExpectedSize) override; + + // The list of thread names. + MinidumpThreadNames* thread_names_; + uint32_t thread_name_count_; + + DISALLOW_COPY_AND_ASSIGN(MinidumpThreadNameList); +}; // MinidumpModule wraps MDRawModule, which contains information about loaded // code modules. Access is provided to various data referenced indirectly @@ -549,9 +628,9 @@ class MinidumpModuleList : public MinidumpStream, static uint32_t max_modules_; // Access to modules using addresses as the key. - RangeMap<uint64_t, unsigned int> *range_map_; + RangeMap<uint64_t, unsigned int>* range_map_; - MinidumpModules *modules_; + MinidumpModules* modules_; uint32_t module_count_; DISALLOW_COPY_AND_ASSIGN(MinidumpModuleList); @@ -606,16 +685,16 @@ class MinidumpMemoryList : public MinidumpStream { static uint32_t max_regions_; // Access to memory regions using addresses as the key. - RangeMap<uint64_t, unsigned int> *range_map_; + RangeMap<uint64_t, unsigned int>* range_map_; // The list of descriptors. This is maintained separately from the list // of regions, because MemoryRegion doesn't own its MemoryDescriptor, it // maintains a pointer to it. descriptors_ provides the storage for this // purpose. - MemoryDescriptors *descriptors_; + MemoryDescriptors* descriptors_; // The list of regions. - MemoryRegions *regions_; + MemoryRegions* regions_; uint32_t region_count_; DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryList); @@ -640,7 +719,7 @@ class MinidumpException : public MinidumpStream { // so a special getter is provided to retrieve this data from the // MDRawExceptionStream structure. Returns false if the thread ID cannot // be determined. - bool GetThreadID(uint32_t *thread_id) const; + bool GetThreadID(uint32_t* thread_id) const; MinidumpContext* GetContext(); @@ -862,9 +941,9 @@ class MinidumpUnloadedModuleList : public MinidumpStream, static uint32_t max_modules_; // Access to module indices using addresses as the key. - RangeMap<uint64_t, unsigned int> *range_map_; + RangeMap<uint64_t, unsigned int>* range_map_; - MinidumpUnloadedModules *unloaded_modules_; + MinidumpUnloadedModules* unloaded_modules_; uint32_t module_count_; DISALLOW_COPY_AND_ASSIGN(MinidumpUnloadedModuleList); @@ -919,8 +998,8 @@ class MinidumpBreakpadInfo : public MinidumpStream { // treatment, so special getters are provided to retrieve this data from // the MDRawBreakpadInfo structure. The getters return false if the thread // IDs cannot be determined. - bool GetDumpThreadID(uint32_t *thread_id) const; - bool GetRequestingThreadID(uint32_t *thread_id) const; + bool GetDumpThreadID(uint32_t* thread_id) const; + bool GetRequestingThreadID(uint32_t* thread_id) const; // Print a human-readable representation of the object to stdout. void Print(); @@ -1003,7 +1082,7 @@ class MinidumpMemoryInfoList : public MinidumpStream { bool Read(uint32_t expected_size) override; // Access to memory info using addresses as the key. - RangeMap<uint64_t, unsigned int> *range_map_; + RangeMap<uint64_t, unsigned int>* range_map_; MinidumpMemoryInfos* infos_; uint32_t info_count_; @@ -1056,7 +1135,7 @@ class MinidumpLinuxMaps : public MinidumpObject { friend class MinidumpLinuxMapsList; // This caller owns the pointer. - explicit MinidumpLinuxMaps(Minidump *minidump); + explicit MinidumpLinuxMaps(Minidump* minidump); // The memory region struct that this class wraps. MappedMemoryRegion region_; @@ -1075,9 +1154,9 @@ class MinidumpLinuxMapsList : public MinidumpStream { unsigned int get_maps_count() const { return valid_ ? maps_count_ : 0; } // Get mapping at the given memory address. The caller owns the pointer. - const MinidumpLinuxMaps *GetLinuxMapsForAddress(uint64_t address) const; + const MinidumpLinuxMaps* GetLinuxMapsForAddress(uint64_t address) const; // Get mapping at the given index. The caller owns the pointer. - const MinidumpLinuxMaps *GetLinuxMapsAtIndex(unsigned int index) const; + const MinidumpLinuxMaps* GetLinuxMapsAtIndex(unsigned int index) const; // Print the contents of /proc/self/maps to stdout. void Print() const; @@ -1085,12 +1164,12 @@ class MinidumpLinuxMapsList : public MinidumpStream { private: friend class Minidump; - typedef vector<MinidumpLinuxMaps *> MinidumpLinuxMappings; + typedef vector<MinidumpLinuxMaps*> MinidumpLinuxMappings; static const uint32_t kStreamType = MD_LINUX_MAPS; // The caller owns the pointer. - explicit MinidumpLinuxMapsList(Minidump *minidump); + explicit MinidumpLinuxMapsList(Minidump* minidump); // Read and load the contents of the process mapping data. // The stream should have data in the form of /proc/self/maps. @@ -1098,7 +1177,7 @@ class MinidumpLinuxMapsList : public MinidumpStream { bool Read(uint32_t expected_size) override; // The list of individual mappings. - MinidumpLinuxMappings *maps_; + MinidumpLinuxMappings* maps_; // The number of mappings. uint32_t maps_count_; @@ -1110,10 +1189,21 @@ class MinidumpLinuxMapsList : public MinidumpStream { // at the time the minidump was generated. class MinidumpCrashpadInfo : public MinidumpStream { public: + struct AnnotationObject { + uint16_t type; + std::string name; + std::vector<uint8_t> value; + }; + const MDRawCrashpadInfo* crashpad_info() const { return valid_ ? &crashpad_info_ : NULL; } + const std::vector<std::vector<AnnotationObject>>* + GetModuleCrashpadInfoAnnotationObjects() const { + return valid_ ? &module_crashpad_info_annotation_objects_ : NULL; + } + // Print a human-readable representation of the object to stdout. void Print(); @@ -1132,6 +1222,9 @@ class MinidumpCrashpadInfo : public MinidumpStream { std::vector<std::vector<std::string>> module_crashpad_info_list_annotations_; std::vector<std::map<std::string, std::string>> module_crashpad_info_simple_annotations_; + std::vector<std::vector<AnnotationObject>> + module_crashpad_info_annotation_objects_; + std::map<std::string, std::string> simple_annotations_; }; @@ -1188,6 +1281,7 @@ class Minidump { // to avoid exposing an ugly API (GetStream needs to accept a garbage // parameter). virtual MinidumpThreadList* GetThreadList(); + virtual MinidumpThreadNameList* GetThreadNameList(); virtual MinidumpModuleList* GetModuleList(); virtual MinidumpMemoryList* GetMemoryList(); virtual MinidumpException* GetException(); @@ -1200,7 +1294,7 @@ class Minidump { MinidumpCrashpadInfo* GetCrashpadInfo(); // The next method also calls GetStream, but is exclusive for Linux dumps. - virtual MinidumpLinuxMapsList *GetLinuxMapsList(); + virtual MinidumpLinuxMapsList* GetLinuxMapsList(); // The next set of methods are provided for users who wish to access // data in minidump files directly, while leveraging the rest of @@ -1240,6 +1334,10 @@ class Minidump { off_t offset, std::map<std::string, std::string>* simple_string_dictionary); + bool ReadCrashpadAnnotationsList( + off_t offset, + std::vector<MinidumpCrashpadInfo::AnnotationObject>* annotations_list); + // SeekToStreamType positions the file at the beginning of a stream // identified by stream_type, and informs the caller of the stream's // length by setting *stream_length. Because stream_map maps each stream diff --git a/src/google_breakpad/processor/minidump_processor.h b/src/google_breakpad/processor/minidump_processor.h index 387115ef..137ef444 100644 --- a/src/google_breakpad/processor/minidump_processor.h +++ b/src/google_breakpad/processor/minidump_processor.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -70,7 +69,7 @@ class MinidumpProcessor { ~MinidumpProcessor(); // Processes the minidump file and fills process_state with the result. - ProcessResult Process(const string &minidump_file, + ProcessResult Process(const string& minidump_file, ProcessState* process_state); // Processes the minidump structure and fills process_state with the @@ -102,8 +101,10 @@ class MinidumpProcessor { // exception, if this information is available. This will be a code // address when the crash was caused by problems such as illegal // instructions or divisions by zero, or a data address when the crash - // was caused by a memory access violation. - static string GetCrashReason(Minidump* dump, uint64_t* address); + // was caused by a memory access violation. If enable_objdump is set, this + // may use disassembly to compute the faulting address. + static string GetCrashReason(Minidump* dump, uint64_t* address, + bool enable_objdump); // This function returns true if the passed-in error code is // something unrecoverable(i.e. retry should not happen). For diff --git a/src/google_breakpad/processor/proc_maps_linux.h b/src/google_breakpad/processor/proc_maps_linux.h index 3045daa5..b99414c3 100644 --- a/src/google_breakpad/processor/proc_maps_linux.h +++ b/src/google_breakpad/processor/proc_maps_linux.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 Google LLC // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/src/google_breakpad/processor/process_result.h b/src/google_breakpad/processor/process_result.h index 15c7213e..780060d9 100644 --- a/src/google_breakpad/processor/process_result.h +++ b/src/google_breakpad/processor/process_result.h @@ -1,5 +1,4 @@ -// Copyright (c) 2014, Google Inc. -// All rights reserved. +// Copyright 2014 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -56,9 +55,13 @@ enum ProcessResult { PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS, // There was more than one // requesting thread. - PROCESS_SYMBOL_SUPPLIER_INTERRUPTED // The dump processing was + PROCESS_SYMBOL_SUPPLIER_INTERRUPTED, // The dump processing was // interrupted by the // SymbolSupplier(not fatal). + + PROCESS_ERROR_GETTING_THREAD_NAME, // There was an error getting one + // thread's name from the dump. + }; } // namespace google_breakpad diff --git a/src/google_breakpad/processor/process_state.h b/src/google_breakpad/processor/process_state.h index 9bc44c45..3fe6a5c2 100644 --- a/src/google_breakpad/processor/process_state.h +++ b/src/google_breakpad/processor/process_state.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -111,6 +110,7 @@ class ProcessState { const vector<MemoryRegion*>* thread_memory_regions() const { return &thread_memory_regions_; } + const vector<string>* thread_names() const { return &thread_names_; } const SystemInfo* system_info() const { return &system_info_; } const CodeModules* modules() const { return modules_; } const CodeModules* unloaded_modules() const { return unloaded_modules_; } @@ -176,6 +176,12 @@ class ProcessState { vector<CallStack*> threads_; vector<MemoryRegion*> thread_memory_regions_; + // Names of each thread at the time of the crash, one for each entry in + // threads_. Note that a thread's name might be empty if there was no + // corresponding ThreadNamesStream in the minidump, or if a particular thread + // ID was not present in the THREAD_NAME_LIST. + vector<string> thread_names_; + // OS and CPU information. SystemInfo system_info_; diff --git a/src/google_breakpad/processor/source_line_resolver_base.h b/src/google_breakpad/processor/source_line_resolver_base.h index c720b0c3..4c64bfc9 100644 --- a/src/google_breakpad/processor/source_line_resolver_base.h +++ b/src/google_breakpad/processor/source_line_resolver_base.h @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -41,6 +40,7 @@ #ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__ #define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__ +#include <deque> #include <map> #include <set> #include <string> @@ -64,36 +64,40 @@ class SourceLineResolverBase : public SourceLineResolverInterface { // LoadMap() method. // Place dynamically allocated heap buffer in symbol_data. Caller has the // ownership of the buffer, and should call delete [] to free the buffer. - static bool ReadSymbolFile(const string &file_name, - char **symbol_data, - size_t *symbol_data_size); + static bool ReadSymbolFile(const string& file_name, + char** symbol_data, + size_t* symbol_data_size); protected: // Users are not allowed create SourceLineResolverBase instance directly. - SourceLineResolverBase(ModuleFactory *module_factory); + SourceLineResolverBase(ModuleFactory* module_factory); virtual ~SourceLineResolverBase(); // Virtual methods inherited from SourceLineResolverInterface. - virtual bool LoadModule(const CodeModule *module, const string &map_file); - virtual bool LoadModuleUsingMapBuffer(const CodeModule *module, - const string &map_buffer); - virtual bool LoadModuleUsingMemoryBuffer(const CodeModule *module, - char *memory_buffer, + virtual bool LoadModule(const CodeModule* module, const string& map_file); + virtual bool LoadModuleUsingMapBuffer(const CodeModule* module, + const string& map_buffer); + virtual bool LoadModuleUsingMemoryBuffer(const CodeModule* module, + char* memory_buffer, size_t memory_buffer_size); virtual bool ShouldDeleteMemoryBufferAfterLoadModule(); - virtual void UnloadModule(const CodeModule *module); - virtual bool HasModule(const CodeModule *module); - virtual bool IsModuleCorrupt(const CodeModule *module); - virtual void FillSourceLineInfo(StackFrame *frame); - virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame); - virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame); + virtual void UnloadModule(const CodeModule* module); + virtual bool HasModule(const CodeModule* module); + virtual bool IsModuleCorrupt(const CodeModule* module); + virtual void FillSourceLineInfo( + StackFrame* frame, + std::deque<std::unique_ptr<StackFrame>>* inlined_frames); + virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame); + virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame); // Nested structs and classes. + struct InlineOrigin; + struct Inline; struct Line; struct Function; struct PublicSymbol; struct CompareString { - bool operator()(const string &s1, const string &s2) const; + bool operator()(const string& s1, const string& s2) const; }; // Module is an interface for an in-memory symbol file. class Module; @@ -101,18 +105,18 @@ class SourceLineResolverBase : public SourceLineResolverInterface { // All of the modules that are loaded. typedef map<string, Module*, CompareString> ModuleMap; - ModuleMap *modules_; + ModuleMap* modules_; // The loaded modules that were detecting to be corrupt during load. typedef set<string, CompareString> ModuleSet; - ModuleSet *corrupt_modules_; + ModuleSet* corrupt_modules_; // All of heap-allocated buffers that are owned locally by resolver. typedef std::map<string, char*, CompareString> MemoryMap; - MemoryMap *memory_buffers_; + MemoryMap* memory_buffers_; // Creates a concrete module at run-time. - ModuleFactory *module_factory_; + ModuleFactory* module_factory_; private: // ModuleFactory needs to have access to protected type Module. diff --git a/src/google_breakpad/processor/source_line_resolver_interface.h b/src/google_breakpad/processor/source_line_resolver_interface.h index a694bf2e..9f1f50c9 100644 --- a/src/google_breakpad/processor/source_line_resolver_interface.h +++ b/src/google_breakpad/processor/source_line_resolver_interface.h @@ -1,7 +1,6 @@ // -*- mode: C++ -*- -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -13,7 +12,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -34,7 +33,10 @@ #ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__ #define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__ +#include <deque> +#include <memory> #include <string> +#include <vector> #include "common/using_std_string.h" #include "google_breakpad/common/breakpad_types.h" @@ -58,11 +60,11 @@ class SourceLineResolverInterface { // and debug_identifier members populated. // // map_file should contain line/address mappings for this module. - virtual bool LoadModule(const CodeModule *module, - const string &map_file) = 0; + virtual bool LoadModule(const CodeModule* module, + const string& map_file) = 0; // Same as above, but takes the contents of a pre-read map buffer - virtual bool LoadModuleUsingMapBuffer(const CodeModule *module, - const string &map_buffer) = 0; + virtual bool LoadModuleUsingMapBuffer(const CodeModule* module, + const string& map_buffer) = 0; // Add an interface to load symbol using C-String data instead of string. // This is useful in the optimization design for avoiding unnecessary copying @@ -70,8 +72,8 @@ class SourceLineResolverInterface { // LoadModuleUsingMemoryBuffer() does NOT take ownership of memory_buffer. // LoadModuleUsingMemoryBuffer() null terminates the passed in buffer, if // the last character is not a null terminator. - virtual bool LoadModuleUsingMemoryBuffer(const CodeModule *module, - char *memory_buffer, + virtual bool LoadModuleUsingMemoryBuffer(const CodeModule* module, + char* memory_buffer, size_t memory_buffer_size) = 0; // Return true if the memory buffer should be deleted immediately after @@ -81,31 +83,35 @@ class SourceLineResolverInterface { // Request that the specified module be unloaded from this resolver. // A resolver may choose to ignore such a request. - virtual void UnloadModule(const CodeModule *module) = 0; + virtual void UnloadModule(const CodeModule* module) = 0; // Returns true if the module has been loaded. - virtual bool HasModule(const CodeModule *module) = 0; + virtual bool HasModule(const CodeModule* module) = 0; // Returns true if the module has been loaded and it is corrupt. - virtual bool IsModuleCorrupt(const CodeModule *module) = 0; + virtual bool IsModuleCorrupt(const CodeModule* module) = 0; // Fills in the function_base, function_name, source_file_name, // and source_line fields of the StackFrame. The instruction and - // module_name fields must already be filled in. - virtual void FillSourceLineInfo(StackFrame *frame) = 0; + // module_name fields must already be filled in. If inlined_frames is not + // nullptr, it will try to construct inlined frames by adding them into + // inlined_frames in an order from outermost frame to inner most frame. + virtual void FillSourceLineInfo( + StackFrame* frame, + std::deque<std::unique_ptr<StackFrame>>* inlined_frames) = 0; // If Windows stack walking information is available covering // FRAME's instruction address, return a WindowsFrameInfo structure // describing it. If the information is not available, returns NULL. // A NULL return value does not indicate an error. The caller takes // ownership of any returned WindowsFrameInfo object. - virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) = 0; + virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame) = 0; // If CFI stack walking information is available covering ADDRESS, // return a CFIFrameInfo structure describing it. If the information // is not available, return NULL. The caller takes ownership of any // returned CFIFrameInfo object. - virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) = 0; + virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame) = 0; protected: // SourceLineResolverInterface cannot be instantiated except by subclasses diff --git a/src/google_breakpad/processor/stack_frame.h b/src/google_breakpad/processor/stack_frame.h index 1491d788..eebe06e6 100644 --- a/src/google_breakpad/processor/stack_frame.h +++ b/src/google_breakpad/processor/stack_frame.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -50,8 +49,12 @@ struct StackFrame { FRAME_TRUST_CFI_SCAN, // Found while scanning stack using call frame info FRAME_TRUST_FP, // Derived from frame pointer FRAME_TRUST_CFI, // Derived from call frame info - FRAME_TRUST_PREWALKED, // Explicitly provided by some external stack walker. - FRAME_TRUST_CONTEXT // Given as instruction pointer in a context + // Explicitly provided by some external stack walker. + FRAME_TRUST_PREWALKED, + FRAME_TRUST_CONTEXT, // Given as instruction pointer in a context + FRAME_TRUST_INLINE, // Found by inline records in symbol files. + // Derived from leaf function by simulating a return. + FRAME_TRUST_LEAF, }; StackFrame() @@ -60,9 +63,10 @@ struct StackFrame { function_name(), function_base(), source_file_name(), - source_line(), + source_line(0), source_line_base(), - trust(FRAME_TRUST_NONE) {} + trust(FRAME_TRUST_NONE), + is_multiple(false) {} virtual ~StackFrame() {} // Return a string describing how this stack frame was found @@ -81,7 +85,11 @@ struct StackFrame { return "previous frame's frame pointer"; case StackFrame::FRAME_TRUST_SCAN: return "stack scanning"; - default: + case StackFrame::FRAME_TRUST_INLINE: + return "inline record"; + case StackFrame::FRAME_TRUST_LEAF: + return "simulating a return from leaf function"; + default: return "unknown"; } } @@ -137,6 +145,12 @@ struct StackFrame { // Amount of trust the stack walker has in the instruction pointer // of this frame. FrameTrust trust; + + // True if the frame corresponds to multiple functions, for example as the + // result of identical code folding by the linker. In that case the function + // name, filename, etc. information above represents the state of an arbitrary + // one of these functions. + bool is_multiple; }; } // namespace google_breakpad diff --git a/src/google_breakpad/processor/stack_frame_cpu.h b/src/google_breakpad/processor/stack_frame_cpu.h index dc5d8ae6..91f1d0cb 100644 --- a/src/google_breakpad/processor/stack_frame_cpu.h +++ b/src/google_breakpad/processor/stack_frame_cpu.h @@ -1,7 +1,6 @@ // -*- mode: c++ -*- -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -13,7 +12,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -251,7 +250,10 @@ struct StackFrameARM : public StackFrame { // Return the ContextValidity flag for register rN. static ContextValidity RegisterValidFlag(int n) { - return ContextValidity(1 << n); + if (0 <= n && n <= 15) { + return ContextValidity(1 << n); + } + return CONTEXT_VALID_NONE; } // Register state. This is only fully valid for the topmost frame in a @@ -400,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__ diff --git a/src/google_breakpad/processor/stack_frame_symbolizer.h b/src/google_breakpad/processor/stack_frame_symbolizer.h index 0bbaae0a..ed342ce6 100644 --- a/src/google_breakpad/processor/stack_frame_symbolizer.h +++ b/src/google_breakpad/processor/stack_frame_symbolizer.h @@ -1,7 +1,6 @@ // -*- mode: C++ -*- -// Copyright (c) 2012 Google Inc. -// All rights reserved. +// Copyright 2012 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -13,7 +12,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -35,8 +34,11 @@ #ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__ #define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__ +#include <deque> +#include <memory> #include <set> #include <string> +#include <vector> #include "common/using_std_string.h" #include "google_breakpad/common/breakpad_types.h" @@ -79,7 +81,8 @@ class StackFrameSymbolizer { const CodeModules* modules, const CodeModules* unloaded_modules, const SystemInfo* system_info, - StackFrame* stack_frame); + StackFrame* stack_frame, + std::deque<std::unique_ptr<StackFrame>>* inlined_frames); virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame); diff --git a/src/google_breakpad/processor/stackwalker.h b/src/google_breakpad/processor/stackwalker.h index 0c458d50..e5d88c80 100644 --- a/src/google_breakpad/processor/stackwalker.h +++ b/src/google_breakpad/processor/stackwalker.h @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -176,8 +175,12 @@ class Stackwalker { if (!memory_->GetMemoryAtAddress(location, &ip)) break; - if (modules_ && modules_->GetModuleForAddress(ip) && - InstructionAddressSeemsValid(ip)) { + // The return address points to the instruction after a call. If the + // caller was a no return function, this might point past the end of the + // function. Subtract one from the instruction pointer so it points into + // the call instruction instead. + if (modules_ && modules_->GetModuleForAddress(ip - 1) && + InstructionAddressSeemsValid(ip - 1)) { *ip_found = ip; *location_found = location; return true; diff --git a/src/google_breakpad/processor/symbol_supplier.h b/src/google_breakpad/processor/symbol_supplier.h index a042081f..b1c23535 100644 --- a/src/google_breakpad/processor/symbol_supplier.h +++ b/src/google_breakpad/processor/symbol_supplier.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -63,35 +62,35 @@ class SymbolSupplier { // to help locate the symbol file. system_info may be NULL or its // fields may be empty if these values are unknown. symbol_file // must be a pointer to a valid string - virtual SymbolResult GetSymbolFile(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file) = 0; + virtual SymbolResult GetSymbolFile(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file) = 0; // Same as above, except also places symbol data into symbol_data. // If symbol_data is NULL, the data is not returned. // TODO(nealsid) Once we have symbol data caching behavior implemented // investigate making all symbol suppliers implement all methods, // and make this pure virtual - virtual SymbolResult GetSymbolFile(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - string *symbol_data) = 0; + virtual SymbolResult GetSymbolFile(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + string* symbol_data) = 0; // Same as above, except allocates data buffer on heap and then places the // symbol data into the buffer as C-string. // SymbolSupplier is responsible for deleting the data buffer. After the call // to GetCStringSymbolData(), the caller should call FreeSymbolData(const - // Module *module) once the data buffer is no longer needed. + // Module* module) once the data buffer is no longer needed. // If symbol_data is not NULL, symbol supplier won't return FOUND unless it // returns a valid buffer in symbol_data, e.g., returns INTERRUPT on memory // allocation failure. - virtual SymbolResult GetCStringSymbolData(const CodeModule *module, - const SystemInfo *system_info, - string *symbol_file, - char **symbol_data, - size_t *symbol_data_size) = 0; + virtual SymbolResult GetCStringSymbolData(const CodeModule* module, + const SystemInfo* system_info, + string* symbol_file, + char** symbol_data, + size_t* symbol_data_size) = 0; // Frees the data buffer allocated for the module in GetCStringSymbolData. - virtual void FreeSymbolData(const CodeModule *module) = 0; + virtual void FreeSymbolData(const CodeModule* module) = 0; }; } // namespace google_breakpad diff --git a/src/google_breakpad/processor/system_info.h b/src/google_breakpad/processor/system_info.h index 8d2f60be..01c48182 100644 --- a/src/google_breakpad/processor/system_info.h +++ b/src/google_breakpad/processor/system_info.h @@ -1,5 +1,4 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. +// Copyright 2006 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // |