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

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

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_walker.h ('k') | syzygy/agent/common/stack_walker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: syzygy/agent/common/stack_walker.cc
diff --git a/syzygy/agent/common/stack_walker_x86.cc b/syzygy/agent/common/stack_walker.cc
similarity index 87%
rename from syzygy/agent/common/stack_walker_x86.cc
rename to syzygy/agent/common/stack_walker.cc
index 2a63172ac70f359e72a512e79f3f793398b09541..7516ac9f6b81967dab4bafd9c670a536e2a2115a 100644
--- a/syzygy/agent/common/stack_walker_x86.cc
+++ b/syzygy/agent/common/stack_walker.cc
@@ -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.
@@ -12,18 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "syzygy/agent/common/stack_walker_x86.h"
+#include "syzygy/agent/common/stack_walker.h"
#include <windows.h>
-#include <winnt.h>
+#ifndef _WIN64
#include "base/logging.h"
#include "syzygy/agent/common/stack_capture.h"
#include "syzygy/common/align.h"
+#endif
namespace agent {
namespace common {
+#ifndef _WIN64
+
namespace {
static size_t kPointerSize = sizeof(void*);
@@ -96,8 +99,8 @@ __forceinline bool CanAdvanceFrame(const StackFrame* frame) {
} // namespace
-size_t __declspec(noinline) WalkStack(size_t bottom_frames_to_skip,
- size_t max_frame_count,
+size_t __declspec(noinline) WalkStack(uint32_t bottom_frames_to_skip,
+ uint32_t max_frame_count,
void** frames,
StackId* absolute_stack_id) {
// Get the stack extents.
@@ -182,5 +185,20 @@ size_t WalkStackImpl(const void* current_ebp,
return num_frames;
}
+#else
+
+size_t __declspec(noinline) WalkStack(uint32_t bottom_frames_to_skip,
+ uint32_t max_frame_count,
+ void** frames,
+ StackId* absolute_stack_id) {
+ // Skip one more frame for call of this function
+ return CaptureStackBackTrace(bottom_frames_to_skip + 1,
+ max_frame_count,
+ frames,
+ reinterpret_cast<PDWORD>(absolute_stack_id));
+}
+
+#endif // !defined _WIN64
+
} // namespace common
} // namespace agent
« no previous file with comments | « syzygy/agent/common/stack_walker.h ('k') | syzygy/agent/common/stack_walker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698