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

Unified Diff: syzygy/agent/common/stack_walker.h

Issue 2194383007: Port some more code to x64 (Closed) Base URL: git@github.com:google/syzygy.git@master
Patch Set: Rename the stack_walker unittest and fix the x86-64 implementation of stack_walker Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « syzygy/agent/common/stack_capture.cc ('k') | syzygy/agent/common/stack_walker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: syzygy/agent/common/stack_walker.h
diff --git a/syzygy/agent/common/stack_walker_x86.h b/syzygy/agent/common/stack_walker.h
similarity index 88%
rename from syzygy/agent/common/stack_walker_x86.h
rename to syzygy/agent/common/stack_walker.h
index 72acd06e34837c76905b37a79dbb13c661bd0033..f0f5ea4523c2afdcdae5af0b3451df26877a7475 100644
--- a/syzygy/agent/common/stack_walker_x86.h
+++ b/syzygy/agent/common/stack_walker.h
@@ -1,4 +1,4 @@
-// Copyright 2015 Google Inc. All Rights Reserved.
+// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -11,7 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
+
+#ifndef SYZYGY_AGENT_COMMON_STACK_WALKER_H_
+#define SYZYGY_AGENT_COMMON_STACK_WALKER_H_
+#include "syzygy/common/asan_parameters.h"
+
// Defines an X86 stack walker for standard frames that contain a saved EBP
// value at the top, generated by the common preamble:
//
@@ -58,11 +62,11 @@
// hold true, saving the value of the return pointer for each valid frame
// encountered. Note that it can quickly derail if frame pointer optimization
// is enabled, or at any frame that uses a non-standard layout.
+//
+// All the information above is valid for X86. As for Win64, the only major
+// difference is the register names and sizes, all the other principles
+// still apply.
-#ifndef SYZYGY_AGENT_COMMON_STACK_WALKER_X86_H_
-#define SYZYGY_AGENT_COMMON_STACK_WALKER_X86_H_
-
-#include "syzygy/common/asan_parameters.h"
namespace agent {
namespace common {
@@ -81,11 +85,12 @@ using StackId = ::common::AsanStackId;
// @param absolute_stack_id Pointer to the stack ID that will be calculated as
// we are walking the stack.
// @returns the number of frames successfully walked and stored in @p frames.
-size_t WalkStack(size_t bottom_frames_to_skip,
- size_t max_frame_count,
+size_t WalkStack(uint32_t bottom_frames_to_skip,
+ uint32_t max_frame_count,
void** frames,
StackId* absolute_stack_id);
+#ifndef _WIN64
// Implementation of WalkStack, with explicitly provided @p current_ebp,
// @p stack_bottom and @p stack_top. Exposed for much easier unittesting.
// @param current_ebp The current stack frame base to start walking from.
@@ -103,12 +108,13 @@ size_t WalkStack(size_t bottom_frames_to_skip,
size_t WalkStackImpl(const void* current_ebp,
const void* stack_bottom,
const void* stack_top,
- size_t bottom_frames_to_skip,
- size_t max_frame_count,
+ uint32_t bottom_frames_to_skip,
+ uint32_t max_frame_count,
void** frames,
StackId* absolute_stack_id);
+#endif // !defined _WIN64
} // namespace common
} // namespace agent
-#endif // SYZYGY_AGENT_COMMON_STACK_WALKER_X86_H_
+#endif // SYZYGY_AGENT_COMMON_STACK_WALKER_H_
« no previous file with comments | « syzygy/agent/common/stack_capture.cc ('k') | syzygy/agent/common/stack_walker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698