Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Side by Side Diff: snapshot/win/process_reader_win_test.cc

Issue 1133203002: win: Retrieve thread context for x64 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fix current thread Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/process_reader_win.cc ('k') | snapshot/win/thread_snapshot_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 25 matching lines...) Expand all
36 36
37 const char kTestMemory[] = "Some test memory"; 37 const char kTestMemory[] = "Some test memory";
38 char buffer[arraysize(kTestMemory)]; 38 char buffer[arraysize(kTestMemory)];
39 ASSERT_TRUE( 39 ASSERT_TRUE(
40 process_reader.ReadMemory(reinterpret_cast<uintptr_t>(kTestMemory), 40 process_reader.ReadMemory(reinterpret_cast<uintptr_t>(kTestMemory),
41 sizeof(kTestMemory), 41 sizeof(kTestMemory),
42 &buffer)); 42 &buffer));
43 EXPECT_STREQ(kTestMemory, buffer); 43 EXPECT_STREQ(kTestMemory, buffer);
44 } 44 }
45 45
46 TEST(ProcessReaderWin, SelfOneThread) {
47 ProcessReaderWin process_reader;
48 ASSERT_TRUE(process_reader.Initialize(GetCurrentProcess()));
49
50 const std::vector<ProcessReaderWin::Thread>& threads =
51 process_reader.Threads();
52
53 // If other tests ran in this process previously, threads may have been
54 // created and may still be running. This check must look for at least one
55 // thread, not exactly one thread.
56 ASSERT_GE(threads.size(), 1u);
57
58 EXPECT_EQ(GetThreadId(GetCurrentThread()), threads[0].id);
59 #if defined(ARCH_CPU_64_BITS)
60 EXPECT_NE(0, threads[0].context.Rip);
61 #else
62 EXPECT_NE(0, threads[0].context.Eip);
63 #endif
64
65 EXPECT_EQ(0, threads[0].suspend_count);
66 }
67
46 } // namespace 68 } // namespace
47 } // namespace test 69 } // namespace test
48 } // namespace crashpad 70 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/win/process_reader_win.cc ('k') | snapshot/win/thread_snapshot_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698