linux_dumper.h revision 4fa638a7ecb6ab042664300767614308dbc147bb
13665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org// Copyright (c) 2010, Google Inc.
2b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// All rights reserved.
3b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid//
4b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// Redistribution and use in source and binary forms, with or without
5b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// modification, are permitted provided that the following conditions are
6b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// met:
7b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid//
8b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid//     * Redistributions of source code must retain the above copyright
9b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// notice, this list of conditions and the following disclaimer.
10b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid//     * Redistributions in binary form must reproduce the above
11b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// copyright notice, this list of conditions and the following disclaimer
12b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// in the documentation and/or other materials provided with the
13b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// distribution.
14b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid//     * Neither the name of Google Inc. nor the names of its
15b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// contributors may be used to endorse or promote products derived from
16b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// this software without specific prior written permission.
17b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid//
18b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
304fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org// linux_dumper.h: Define the google_breakpad::LinuxDumper class, which
314fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org// is a base class for extracting information of a crashed process. It
324fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org// was originally a complete implementation using the ptrace API, but
334fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org// has been refactored to allow derived implementations supporting both
344fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org// ptrace and core dump. A portion of the original implementation is now
354fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org// in google_breakpad::LinuxPtraceDumper (see linux_ptrace_dumper.h for
364fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org// details).
374fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org
38b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#ifndef CLIENT_LINUX_MINIDUMP_WRITER_LINUX_DUMPER_H_
39b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#define CLIENT_LINUX_MINIDUMP_WRITER_LINUX_DUMPER_H_
40b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
41b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#include <elf.h>
42096992fac73756cfa0974a94754329f30fd4e786nealsid#include <linux/limits.h>
43b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#include <stdint.h>
44096992fac73756cfa0974a94754329f30fd4e786nealsid#include <sys/types.h>
45cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#if !defined(__ANDROID__)
46b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#include <sys/user.h>
47cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#endif
48b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
494621ee06914b2ebe963c93ea78fabf982cf670dfted.mielczarek#include "common/memory.h"
500a5fc5d663054eb836eafc258cc2f6792358e2c9ted.mielczarek#include "google_breakpad/common/minidump_format.h"
51b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
52b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidnamespace google_breakpad {
53b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
54cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#if defined(__i386) || defined(__x86_64)
55b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidtypedef typeof(((struct user*) 0)->u_debugreg[0]) debugreg_t;
56cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#endif
57b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
58b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// Typedef for our parsing of the auxv variables in /proc/pid/auxv.
59de545c09d0363e6964822ec92529a80feaca152dnealsid#if defined(__i386) || defined(__ARM_EABI__)
60cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#if !defined(__ANDROID__)
61b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidtypedef Elf32_auxv_t elf_aux_entry;
62cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#else
63cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek// Android is missing this structure definition
64cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarektypedef struct
65cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek{
66cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek  uint32_t a_type;              /* Entry type */
67cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek  union
68cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek    {
69cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek      uint32_t a_val;           /* Integer value */
70cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek    } a_un;
71cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek} elf_aux_entry;
72cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek
73cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#if !defined(AT_SYSINFO_EHDR)
74cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#define AT_SYSINFO_EHDR 33
75cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#endif
76cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#endif  // __ANDROID__
77e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org#elif defined(__x86_64)
78b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidtypedef Elf64_auxv_t elf_aux_entry;
79b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#endif
80b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// When we find the VDSO mapping in the process's address space, this
81b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// is the name we use for it when writing it to the minidump.
82b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// This should always be less than NAME_MAX!
83b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidconst char kLinuxGateLibraryName[] = "linux-gate.so";
84b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
85b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// We produce one of these structures for each thread in the crashed process.
86b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidstruct ThreadInfo {
87b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  pid_t tgid;   // thread group id
88b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  pid_t ppid;   // parent process
89b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
90b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // Even on platforms where the stack grows down, the following will point to
91b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // the smallest address in the stack.
92b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  const void* stack;  // pointer to the stack area
93b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  size_t stack_len;  // length of the stack to copy
94b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
95de545c09d0363e6964822ec92529a80feaca152dnealsid
96de545c09d0363e6964822ec92529a80feaca152dnealsid#if defined(__i386) || defined(__x86_64)
97b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  user_regs_struct regs;
98b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  user_fpregs_struct fpregs;
99de545c09d0363e6964822ec92529a80feaca152dnealsid  static const unsigned kNumDebugRegisters = 8;
100de545c09d0363e6964822ec92529a80feaca152dnealsid  debugreg_t dregs[8];
101096992fac73756cfa0974a94754329f30fd4e786nealsid#if defined(__i386)
102b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  user_fpxregs_struct fpxregs;
103de545c09d0363e6964822ec92529a80feaca152dnealsid#endif  // defined(__i386)
104b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
105de545c09d0363e6964822ec92529a80feaca152dnealsid#elif defined(__ARM_EABI__)
106de545c09d0363e6964822ec92529a80feaca152dnealsid  // Mimicking how strace does this(see syscall.c, search for GETREGS)
107cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#if defined(__ANDROID__)
108cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek  struct pt_regs regs;
109cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#else
110de545c09d0363e6964822ec92529a80feaca152dnealsid  struct user_regs regs;
111de545c09d0363e6964822ec92529a80feaca152dnealsid  struct user_fpregs fpregs;
112cfc8628092e17069d8d6c7068d4f21d9baabe077ted.mielczarek#endif  // __ANDROID__
113b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#endif
114b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid};
115b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
116b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// One of these is produced for each mapping in the process (i.e. line in
117b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid// /proc/$x/maps).
118b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidstruct MappingInfo {
119b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  uintptr_t start_addr;
120b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  size_t size;
121b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  size_t offset;  // offset into the backed file.
122b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  char name[NAME_MAX];
123b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid};
124b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
125b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsidclass LinuxDumper {
126b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid public:
127b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  explicit LinuxDumper(pid_t pid);
128b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
129e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  virtual ~LinuxDumper();
130e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
131b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // Parse the data for |threads| and |mappings|.
1324fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool Init();
1334fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org
1344fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  // Return true if the dumper performs a post-mortem dump.
1354fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool IsPostMortem() const = 0;
136b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
137b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // Suspend/resume all threads in the given process.
1384fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool ThreadsSuspend() = 0;
1394fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool ThreadsResume() = 0;
140b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
141e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  // Read information about the |index|-th thread of |threads_|.
142e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  // Returns true on success. One must have called |ThreadsSuspend| first.
1434fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool GetThreadInfoByIndex(size_t index, ThreadInfo* info) = 0;
144b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
145b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // These are only valid after a call to |Init|.
146b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  const wasteful_vector<pid_t> &threads() { return threads_; }
147b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  const wasteful_vector<MappingInfo*> &mappings() { return mappings_; }
148b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  const MappingInfo* FindMapping(const void* address) const;
149b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
150b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // Find a block of memory to take as the stack given the top of stack pointer.
151b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  //   stack: (output) the lowest address in the memory area
152b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  //   stack_len: (output) the length of the memory area
153b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  //   stack_top: the current top of the stack
154b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  bool GetStackInfo(const void** stack, size_t* stack_len, uintptr_t stack_top);
155b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
156b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  PageAllocator* allocator() { return &allocator_; }
157b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
158e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  // Copy content of |length| bytes from a given process |child|,
159e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  // starting from |src|, into |dest|.
1604fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual void CopyFromProcess(void* dest, pid_t child, const void* src,
1614fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org                               size_t length) = 0;
162b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
1634fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  // Builds a proc path for a certain pid for a node (/proc/<pid>/<node>).
1644fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  // |path| is a character array of at least NAME_MAX bytes to return the
1654fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  // result.|node| is the final node without any slashes. Returns true on
1664fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  // success.
1674fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool BuildProcPath(char* path, pid_t pid, const char* node) const = 0;
168b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
169ef7262d4775bf6de750bc2a26dbf98368d7ec0c3ted.mielczarek  // Generate a File ID from the .text section of a mapped entry.
17023c82999a8a8a6761133a7a8e88b5349bcff211ajessicag.feedback@gmail.com  // If not a member, mapping_id is ignored.
171ef7262d4775bf6de750bc2a26dbf98368d7ec0c3ted.mielczarek  bool ElfFileIdentifierForMapping(const MappingInfo& mapping,
17223c82999a8a8a6761133a7a8e88b5349bcff211ajessicag.feedback@gmail.com                                   bool member,
17323c82999a8a8a6761133a7a8e88b5349bcff211ajessicag.feedback@gmail.com                                   unsigned int mapping_id,
1740a5fc5d663054eb836eafc258cc2f6792358e2c9ted.mielczarek                                   uint8_t identifier[sizeof(MDGUID)]);
1750a5fc5d663054eb836eafc258cc2f6792358e2c9ted.mielczarek
176b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // Utility method to find the location of where the kernel has
177b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // mapped linux-gate.so in memory(shows up in /proc/pid/maps as
178b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // [vdso], but we can't guarantee that it's the only virtual dynamic
179b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // shared object.  Parsing the auxilary vector for AT_SYSINFO_EHDR
180b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  // is the safest way to go.)
181b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  void* FindBeginningOfLinuxGateSharedLibrary(const pid_t pid) const;
182e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
183e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  uintptr_t crash_address() const { return crash_address_; }
184e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  void set_crash_address(uintptr_t crash_address) {
185e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org    crash_address_ = crash_address;
186e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  }
187e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
188e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  int crash_signal() const { return crash_signal_; }
189e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  void set_crash_signal(int crash_signal) { crash_signal_ = crash_signal; }
190e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
191e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  pid_t crash_thread() const { return crash_thread_; }
192e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  void set_crash_thread(pid_t crash_thread) { crash_thread_ = crash_thread; }
193e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
1944fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org protected:
1954fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool EnumerateMappings();
1964fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org
1974fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  virtual bool EnumerateThreads() = 0;
198b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
1993665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // For the case where a running program has been deleted, it'll show up in
2003665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // /proc/pid/maps as "/path/to/program (deleted)". If this is the case, then
2013665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // see if '/path/to/program (deleted)' matches /proc/pid/exe and return
2023665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // /proc/pid/exe in |path| so ELF identifier generation works correctly. This
2033665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // also checks to see if '/path/to/program (deleted)' exists, so it does not
2043665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // get fooled by a poorly named binary.
2053665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // For programs that don't end with ' (deleted)', this is a no-op.
2063665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // This assumes |path| is a buffer with length NAME_MAX.
2073665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org  // Returns true if |path| is modified.
208ef7262d4775bf6de750bc2a26dbf98368d7ec0c3ted.mielczarek  bool HandleDeletedFileInMapping(char* path) const;
2093665a7d09bb32ab3939635daec398618dd1ef955thestig@chromium.org
210e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org   // ID of the crashed process.
211b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  const pid_t pid_;
212b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
213e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  // Virtual address at which the process crashed.
214e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  uintptr_t crash_address_;
215e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
216e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  // Signal that terminated the crashed process.
217e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  int crash_signal_;
218e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
219e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  // ID of the crashed thread.
220e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org  pid_t crash_thread_;
221e8bbceddb1bef18462c3504d10c60a7936a2f530benchan@chromium.org
222b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid  mutable PageAllocator allocator_;
223b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
2244fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  // IDs of all the threads.
2254fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  wasteful_vector<pid_t> threads_;
2264fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org
2274fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  // Info from /proc/<pid>/maps.
2284fa638a7ecb6ab042664300767614308dbc147bbbenchan@chromium.org  wasteful_vector<MappingInfo*> mappings_;
229b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid};
230b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
231b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid}  // namespace google_breakpad
232b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid
233b0baafc4da1f3ffb84e267dd19d176db3de1c14enealsid#endif  // CLIENT_LINUX_HANDLER_LINUX_DUMPER_H_
234