30 Commits

Author SHA1 Message Date
Mark Mentovai
6278690abe Update copyright boilerplate, 2022 edition (Crashpad)
sed -i '' -E -e 's/Copyright (.+) The Crashpad Authors\. All rights reserved\.$/Copyright \1 The Crashpad Authors/' $(git grep -El 'Copyright (.+) The Crashpad Authors\. All rights reserved\.$')

Bug: chromium:1098010
Change-Id: I8d6138469ddbe3d281a5d83f64cf918ec2491611
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3878262
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-09-06 23:54:07 +00:00
Ben Hamilton
6d0d1a4be6 [minidump] Add support for THREAD_NAME_LIST stream
The minidump stream type MINIDUMP_THREAD_NAME_LIST represents
thread names as a list in the form [(thread_id, thread name), ...].

This introduces a new MinidumpThreadNameListWriter class which
allows OS-specific snapshot writers to write thread names using
this new stream type.

Bug: crashpad:327
Change-Id: Ief45df5dbbf44c0e1254786bfbe6720112ceef38
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3671775
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2022-06-06 19:39:09 +00:00
Ben Hamilton
a903f7541f [minidump] Add support for RVA64 / MINIDUMP_LOCATION_DESCRIPTOR64
Newer minidump stream types, like MINIDUMP_THREAD_NAME_LIST, use
64-bit RVAs (which have 64-bit location descriptors) instead of 32-bit
RVAs and location descriptors.

This adds support to MinidumpWritable for the new 64-bit RVA64 and
MINIDUMP_LOCATION_DESCRIPTOR64 types.

Bug: crashpad:327
Change-Id: Icd67bca600756a68ef9ba7d5a429f935eebf726f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3673776
Commit-Queue: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-06-01 19:13:07 +00:00
Alex Gough
9e0051aba6 Write compacted xsave contexts in minidumps
Adds new structures and offsets for minidump extended contexts. This
information will be captured from threads in a later CL so this CL
does not yet write different dumps, except in testing.

Minidump format for extended compacted contexts has been determined by
experiment. Offsets for where to write various parts of the context
are hardcoded to 0x550 as this matches values seen in Windows. Offsets
for misc_info_5 match those seen in working minidumps that can be opened
in windbg. Our hope is that while these could change in future, CPU
and OS vendors are unlikely to change them.

See doc[0] for a discussion of these fields and offsets in the minidump.

See "MANAGING STATE USING THE XSAVE FEATURE SET" Chapter 13 in the
Intel SDM[1]. Many of the offsets and sizes of the extended features
are provided by cpu specific values. We can access these in Windows
using the SDK, and transfer these to the saved extended context
which in turn is understandable by windbg.

Further information is available from AMD Ch. 18 "Shadow Stacks"[2].

    [0] https://docs.google.com/document/d/1Dn8n97r5B7kxYouvujNnPIYd_7QeVHpahSRmB92Qn6g/edit#heading=h.hivqj2jg39y
    [1] https://software.intel.com/content/www/us/en/develop/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4.html.
    [2] https://www.amd.com/system/files/TechDocs/24593.pdf

Bug: 1250098
Change-Id: Ia9041acc379c6d38329ee99737a2a0a77f7a1ee0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3536964
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
2022-05-17 01:45:56 +00:00
Jan Wilken Dörrie
2872c0ea4e [LSC] Remove base::char16 and base::string16 aliases
This change removes usages of the base::char16 and base::string16 type
aliases in favor of using char16_t and std::u16string directly.

Bug: chromium:1184339
Change-Id: Ieb790cbe2ce98d91865cd21d98616195a57b3903
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2742482
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-03-08 21:08:44 +00:00
Jinke Fan
e1b3bd11cd Add support for Hygon Dhyana CPU
This patch is used to add support Hygon Dhyana x86
vendor id (HygonGenuine).

More details can be found on:
http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn

Change-Id: I53445a8a63421811401b6a6a40e664d2600a3ec8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1640959
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-03 18:12:33 +00:00
Mark Mentovai
20e5aba1af URL cleanups: switch to HTTPS, fix dead ones, use canonical ones
Change-Id: I4b247d7fae1a212350f8ffcf2bf5ba1fa730f5c1
Reviewed-on: https://chromium-review.googlesource.com/780339
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-20 22:23:39 +00:00
Mark Mentovai
f53f2c84cc Fix comments identifying the source of module TimeDateStamp information
Change-Id: I164f0208db103410c3133a67a994a4f603ce1b27
Reviewed-on: https://chromium-review.googlesource.com/494827
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-05-03 21:13:05 +00:00
Mark Mentovai
f848952e05 Support MINIDUMP_MISC_INFO_5 defined in Windows 10
MINIDUMP_MISC_INFO_5 can carry information about extended XSTATE state
components and the process cookie value.

I made some informed guesses about the precise meanings of some of the
attributes of the XSTATE stuff.

I don’t know what “process cookie” refers to yet. My guess is that it’s
the stack canary value, or something similar. But since this isn’t an
informed guess, I haven’t written it into the documentation.

Crashpad does not yet use either of these features.

BUG=crashpad:58

Change-Id: I614568287a01fec99d6cd60e378a6d6e20b4f48c
Reviewed-on: https://chromium-review.googlesource.com/409630
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-03-02 19:27:21 +00:00
Mark Mentovai
dd4859965f Update compat version of winnt.h to 10.0.14393.0 SDK (Windows 10 1607)
This defines PROCESSOR_ARCHITECTURE_ARM64 and
PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64, usable in
MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.

This also defines four new PF_* flags usable in
CPU_INFORMATION::OtherCpuInfo::ProcessorFeatures.

Definitions are provided in compat/non_win, and #ifdef-guarded
definitions in compat/win for compatibility with Windows SDKs older than
Chrome’s minimum requirement.

PROCESSOR_ARCHITECTURE_ARM64 means the same thing that Breakpad used the
value 0x8003 for. At this point, Crashpad aims to use the
officially-defined constant. In the minidump_extensions.h
MinidumpCPUArchitecture enum, 0x8003 remains present and documented as
deprecated to discourage reuse of that constant for another purpose.

BUG=

Change-Id: Ic4b5fb9de31c5f00f3698f112633ece2a036b889
Reviewed-on: https://chromium-review.googlesource.com/409098
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-11-09 17:43:27 +00:00
Mark Mentovai
acabe35928 doc: Fix all Doxygen warnings, cleaning up some generated documentation
This makes Doxygen’s output more actionable by setting QUIET = YES to
suppress verbose progress spew, and WARN_IF_UNDOCUMENTED = NO to prevent
warnings for undocumented classes and members from being generated. The
latter is too noisy, producing 721 warnings in the current codebase.

The remaining warnings produced by Doxygen were useful and actionable.
They fell into two categories: abuses of Doxygen’s markup syntax, and
missing (or misspelled) parameter documentation. In a small number of
cases, pass-through parameters had intentionally been left undocumented.
In these cases, they are now given blank \param descriptions. This is
not optimal, but there doesn’t appear to be any other way to tell
Doxygen to allow a single parameter to be undocumented.

Some tricky Doxygen errors were resolved by asking it to not enter
directiores that we do not provide documentation in (such as the
“on-platform” compat directories, compat/mac and compat/win, as well as
compat/non_cxx11_lib) while allowing it to enter the
“off-platform” directories that we do document (compat/non_mac and
compat/non_win).

A Doxygen run (doc/support/generate_doxygen.sh) now produces no output
at all. It would produce warnings if any were triggered.

Not directly related, but still relevant to documentation,
doc/support/generate.sh is updated to remove temporary removals of
now-extinct files and directories. doc/appengine/README is updated so
that a consistent path to “goapp” is used throughout the file.

Change-Id: I300730c04de4d3340551ea3086ca70cc5ff862d1
Reviewed-on: https://chromium-review.googlesource.com/408812
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 19:24:05 +00:00
Mark Mentovai
952f787f4a doc: Standardize on “macOS” in comments
Use “macOS” as the generic unversioned name of the operating system in
comments. For version-specific references, use Mac OS X through 10.6, OS
X from 10.7 through 10.11, and macOS for 10.12.

Change-Id: I1ebee64fbf79200bc799d4a351725dd73257b54d
Reviewed-on: https://chromium-review.googlesource.com/408269
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 19:21:44 +00:00
Scott Graham
c307f94f19 Support custom streams in the minidump
BUG=crashpad:95

Change-Id: Iee956906651dfd56e0ae3d2bcec82daabdc97067
Reviewed-on: https://chromium-review.googlesource.com/329733
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-03-02 17:39:34 +00:00
Scott Graham
badfacccee win: Add support for capturing unloaded modules
R=mark@chromium.org
BUG=crashpad:89

Change-Id: Ib6a67147e538811168d68f14a457fdceab30c02e
Reviewed-on: https://chromium-review.googlesource.com/327231
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-02-18 00:55:38 +00:00
Mark Mentovai
6d2d31d2d1 Use base/macros.h instead of base/basictypes.h
This was done in Chromium’s local copy of Crashpad in 562827afb599. This
change is similar to that one, except more care was taken to avoid
including headers from a .cc or _test.cc when already included by the
associated .h. Rather than using <stddef.h> for size_t, Crashpad has
always used <sys/types.h>, so that’s used here as well.

This updates mini_chromium to 8a2363f486e3a0dc562a68884832d06d28d38dcc,
which removes base/basictypes.h.

e128dcf10122 Remove base/move.h; use std::move() instead of Pass()
8a2363f486e3 Move basictypes.h to macros.h

R=avi@chromium.org

Review URL: https://codereview.chromium.org/1566713002 .
2016-01-06 12:22:50 -05:00
Mark Mentovai
04d97ca86e win: Add a note about /Z7 obsolescence regarding CodeView debug info
BUG=crashpad:47
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1414323003 .
2015-11-02 12:20:25 -05:00
Scott Graham
3261edd997 Write MINIDUMP_HANDLE_DATA_STREAM to minidump
R=mark@chromium.org
BUG=crashpad:21, crashpad:52

Review URL: https://codereview.chromium.org/1419623003 .
2015-10-21 10:43:42 -07:00
Scott Graham
4600643a78 Some plumbing for the beginning of getting handles into snapshot/minidump
Follows https://codereview.chromium.org/1400413002/.

R=mark@chromium.org
BUG=crashpad:21, crashpad:46, crashpad:52

Review URL: https://codereview.chromium.org/1407643004 .
2015-10-16 15:58:40 -07:00
Scott Graham
019a0cec8b win: Write memory map info as MINIDUMP_MEMORY_INFO[_LIST]
Makes !vprot work in windbg, e.g.

0:000> !vprot 0x970000
BaseAddress:       00970000
AllocationBase:    00970000
AllocationProtect: 00000004  PAGE_READWRITE
RegionSize:        00001000
State:             00001000  MEM_COMMIT
Protect:           00000001  PAGE_NOACCESS
Type:              00020000  MEM_PRIVATE

...

0:000> !vprot 0x97a000
BaseAddress:       0097a000
AllocationBase:    00970000
AllocationProtect: 00000004  PAGE_READWRITE
RegionSize:        00001000
State:             00001000  MEM_COMMIT
Protect:           00000140  PAGE_EXECUTE_READWRITE + PAGE_GUARD
Type:              00020000  MEM_PRIVATE

Follows https://codereview.chromium.org/1377133006.

R=mark@chromium.org
BUG=crashpad:20, crashpad:46

Review URL: https://codereview.chromium.org/1379873005 .
2015-10-13 13:15:44 -07:00
Scott Graham
937d3d710c Mostly-boilerplate to add MemoryMapSnapshot
Follows https://codereview.chromium.org/1375313005.

Adds MINIDUMP_MEMORY_INFO for non-win in dbghelp.h.

R=mark@chromium.org
BUG=crashpad:20, crashpad:46

Review URL: https://codereview.chromium.org/1377133006 .
2015-10-13 12:37:44 -07:00
Scott Graham
3ef04d14f2 Implement ModuleSnapshotWin::UUID
Reads CodeView PDB GUID from Debug Directory of PE header.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1311003003 .
2015-09-01 09:32:09 -07:00
Scott Graham
a691448ffb win: Implement exception snapshot
Refactor some of the NT internals helpers and cpu_context to share
between the thread and exception snapshot code.

Add test that runs crashing child and validates the exception in the
snapshot.

R=mark@chromium.org, cpu@chromium.org, rsesek@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1126413008 .
2015-08-18 12:25:19 -07:00
Mark Mentovai
e1347a740c Handle EXC_RESOURCE and EXC_GUARD exceptions properly.
These two exception types use all 64 bits of the code[0] field.  The
ExceptionSnapshot was unprepared to stuff this into a 32-bit field.  To
resolve the discrepancy, the more-significant data is taken from the
high 32 bits of code[0]. No information is lost because the full code[0]
is made available as part of the Codes() vector.

BUG=crashpad:34
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1050313003
2015-04-02 15:49:51 -04:00
Scott Graham
429a3368d4 win: Work towards getting 'minidump' to compile
- dbghelp.h requires windows.h to be included before it (ick!).
  Add a stub one for non_win to make this work.
- convert __attribute__ -> macro that can work work with MSVC;
- a handful of narrowing casts.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/883773005
2015-02-04 17:30:03 -08:00
Scott Graham
af07f4022b Move string16 and char16 in to base::
Needs to include roll with https://codereview.chromium.org/803593002/ included.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/804593002
2014-12-12 11:06:09 -08:00
Mark Mentovai
7f30a9ebef Fix a few documentation problems.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/688643002
2014-10-29 11:33:34 -04:00
Mark Mentovai
c73a97d4e3 Add MinidumpMiscInfoWriter and its test.
TEST=minidump_test MinidumpMiscInfoWriter
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/454073002
2014-08-11 11:42:12 -07:00
Mark Mentovai
aa3adf2c5b Add MinidumpSystemInfoWriter and its test.
TEST=minidump_test MinidumpSystemInfoWriter
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/435243002
2014-08-07 14:58:26 -04:00
Mark Mentovai
5ba343ccf1 Add minidump_extensions.h, which defines Crashpad/Breakpad extensions to
the standard minidump format defined in dbghelp.h.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/435013002
2014-08-01 14:37:20 -04:00
Mark Mentovai
dfe81014f7 Add compat to Crashpad.
compat includes headers providing definitions normally provided by the
system, in cases where the system SDK does not always provide the
correct or up-to-date definitions, and cases where code on different
platforms needs to access definitions normally only available on one
platform.

To provide definitions on a single platform, where the system SDK may
not provide the definitions correctly, use subdirectories named for the
platform, such as “mac”.

To provide definitions normally available on only one platform to
others, use subdirectories that identify that they are to be used on
platforms other than the one that originated their definitions, such as
“non_win”.

In all cases, headers should be named as they are natively in their
respective SDKs, so that it’s possible to #include them according to
their usual names.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/432843002
2014-07-31 13:45:51 -04:00