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

Side by Side Diff: profiler/win32_stack_frame_unwinder.h

Issue 2043183002: Update to Chromium //base at Chromium commit 01cb97b2e09618bbc3a60c7348f0a844eea20547. (Closed) Base URL: https://github.com/domokit/base.git@master
Patch Set: Created 4 years, 6 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 | « profiler/native_stack_sampler_win.cc ('k') | profiler/win32_stack_frame_unwinder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_PROFILER_WIN32_STACK_FRAME_UNWINDER_H_
6 #define BASE_PROFILER_WIN32_STACK_FRAME_UNWINDER_H_
7
8 #include <windows.h>
9
10 #include "base/base_export.h"
11 #include "base/macros.h"
12
13 namespace base {
14
15 #if !defined(_WIN64)
16 // Allows code to compile for x86. Actual support for x86 will require either
17 // refactoring these interfaces or separate architecture-specific interfaces.
18 using PRUNTIME_FUNCTION = void*;
19 #endif // !defined(_WIN64)
20
21 // Instances of this class are expected to be created and destroyed for each
22 // stack unwinding, outside of SuspendThread/ResumeThread.
23 class BASE_EXPORT Win32StackFrameUnwinder {
24 public:
25 // Interface for Win32 unwind-related functionality this class depends
26 // on. Provides a seam for testing.
27 class BASE_EXPORT UnwindFunctions {
28 public:
29 virtual ~UnwindFunctions();
30
31 virtual PRUNTIME_FUNCTION LookupFunctionEntry(DWORD64 program_counter,
32 PDWORD64 image_base) = 0;
33 virtual void VirtualUnwind(DWORD64 image_base,
34 DWORD64 program_counter,
35 PRUNTIME_FUNCTION runtime_function,
36 CONTEXT* context) = 0;
37
38 protected:
39 UnwindFunctions();
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(UnwindFunctions);
43 };
44
45 class BASE_EXPORT Win32UnwindFunctions : public UnwindFunctions {
46 public:
47 Win32UnwindFunctions();
48
49 PRUNTIME_FUNCTION LookupFunctionEntry(DWORD64 program_counter,
50 PDWORD64 image_base) override;
51
52 void VirtualUnwind(DWORD64 image_base,
53 DWORD64 program_counter,
54 PRUNTIME_FUNCTION runtime_function,
55 CONTEXT* context) override;
56
57 private:
58 DISALLOW_COPY_AND_ASSIGN(Win32UnwindFunctions);
59 };
60
61 Win32StackFrameUnwinder();
62 ~Win32StackFrameUnwinder();
63
64 bool TryUnwind(CONTEXT* context);
65
66 private:
67 // This function is for test purposes only.
68 Win32StackFrameUnwinder(UnwindFunctions* unwind_functions);
69 friend class Win32StackFrameUnwinderTest;
70
71 // State associated with each stack unwinding.
72 bool at_top_frame_;
73 bool unwind_info_present_for_all_frames_;
74 const void* pending_blacklisted_module_;
75
76 Win32UnwindFunctions win32_unwind_functions_;
77 UnwindFunctions* const unwind_functions_;
78
79 DISALLOW_COPY_AND_ASSIGN(Win32StackFrameUnwinder);
80 };
81
82 } // namespace base
83
84 #endif // BASE_PROFILER_WIN32_STACK_FRAME_UNWINDER_H_
OLDNEW
« no previous file with comments | « profiler/native_stack_sampler_win.cc ('k') | profiler/win32_stack_frame_unwinder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698