diff options
author | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-03-29 18:27:11 +0000 |
---|---|---|
committer | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-03-29 18:27:11 +0000 |
commit | f3319839c4c6416e060c301b55aa5847486aaec5 (patch) | |
tree | dd0de9cf9fb6f983313673e70f2cc40990e5e271 /src/client | |
parent | Breakpad Linux client: Simplify VerifyStackReadWithMultipleThreads unit test. (diff) | |
download | breakpad-f3319839c4c6416e060c301b55aa5847486aaec5.tar.xz |
[ Mistakenly committed older version of patch. This is the right one. ]
Breakpad Linux client: Simplify VerifyStackReadWithMultipleThreads unit test.
As written, the VerifyStackReadWithMultipleThreads unit test makes
assumptions about the layout of thread_function's stack frame. As a result,
the test will fail when compiled with some compilers, or built with certain
optimization levels.
As an extension to C++, the GNU compilers allow you to request that a
variable be placed in a specific register. Using this, we can have
thread_function put the thread id in place where the test can find it
reliably.
a=jimblandy, r=nealsid
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@559 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc index 388a6580..e91e9767 100644 --- a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +++ b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc @@ -48,10 +48,10 @@ #endif void *thread_function(void *data) { - pid_t thread_id = syscall(SYS_gettid); - register pid_t *thread_id_ptr asm(TID_PTR_REGISTER) = &thread_id; + volatile pid_t thread_id = syscall(SYS_gettid); + register volatile pid_t *thread_id_ptr asm(TID_PTR_REGISTER) = &thread_id; while (true) - asm("" : : "r" (thread_id_ptr)); + asm volatile ("" : : "r" (thread_id_ptr)); return NULL; } |