aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/tests/crash_generator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/linux/tests/crash_generator.h')
-rw-r--r--src/common/linux/tests/crash_generator.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/common/linux/tests/crash_generator.h b/src/common/linux/tests/crash_generator.h
index 874b15cd..d05ce73d 100644
--- a/src/common/linux/tests/crash_generator.h
+++ b/src/common/linux/tests/crash_generator.h
@@ -58,13 +58,12 @@ class CrashGenerator {
// if /proc/sys/kernel/core_pattern has the default value 'core'.
bool HasDefaultCorePattern() const;
- // Sets the maximum size of core dump file (both the soft and hard limit)
- // to |limit| bytes. Returns true on success.
- bool SetCoreFileSizeLimit(rlim_t limit) const;
-
// Returns the expected path of the core dump file.
std::string GetCoreFilePath() const;
+ // Returns the directory of a copy of proc files of the child process.
+ std::string GetDirectoryOfProcFilesCopy() const;
+
// Creates a crash (and a core dump file) by creating a child process with
// |num_threads| threads, and the terminating the child process by sending
// a signal with number |crash_signal| to the |crash_thread|-th thread.
@@ -72,14 +71,23 @@ class CrashGenerator {
bool CreateChildCrash(unsigned num_threads, unsigned crash_thread,
int crash_signal, pid_t* child_pid);
- // Creates |num_threads| threads in the child process.
- void CreateThreadsInChildProcess(unsigned num_threads);
-
// Returns the thread ID of the |index|-th thread in the child process.
// This method does not validate |index|.
pid_t GetThreadId(unsigned index) const;
private:
+ // Copies the following proc files of the process with |pid| to the directory
+ // at |path|: auxv, cmdline, environ, maps, status
+ // The directory must have been created. Returns true on success.
+ bool CopyProcFiles(pid_t pid, const char* path) const;
+
+ // Creates |num_threads| threads in the child process.
+ void CreateThreadsInChildProcess(unsigned num_threads);
+
+ // Sets the maximum size of core dump file (both the soft and hard limit)
+ // to |limit| bytes. Returns true on success.
+ bool SetCoreFileSizeLimit(rlim_t limit) const;
+
// Creates a shared memory of |memory_size| bytes for communicating thread
// IDs between the parent and child process. Returns true on success.
bool MapSharedMemory(size_t memory_size);