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

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: 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
Index: syzygy/agent/common/stack_walker.h
diff --git a/syzygy/agent/common/stack_walker.h b/syzygy/agent/common/stack_walker.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d8ccf8abd9c51bd8e006fb1355d30e4b7c3498e
--- /dev/null
+++ b/syzygy/agent/common/stack_walker.h
@@ -0,0 +1,49 @@
+// 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// 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_
+
+#ifdef _WIN64
+#include "syzygy/common/asan_parameters.h"
+
+namespace agent {
+namespace common {
+
+using StackId = ::common::AsanStackId;
+
+// Heuristically walks the current stack. Does not consider its own stack
+// frame. Frames are expected to have a standard layout with the top of the
+// frame being a saved frame pointer, and the bottom of a frame being a return
+// address.
+// @param bottom_frames_to_skip The number of frames to skip from the bottom
+// of the stack.
+// @param max_frame_count The maximum number of frames that can be written to
+// @p frames.
+// @param frames The array to be populated with the computed frames.
+// @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(uint32_t bottom_frames_to_skip,
+ uint32_t max_frame_count,
+ void** frames,
+ StackId* absolute_stack_id);
chrisha 2016/08/03 17:40:06 This definition is identical to the 32 and 64 bit
+
+} // namespace common
+} // namespace agent
+#else
+#include "syzygy/agent/common/stack_walker_x86.h"
+#endif // defined _WIN^$
+
+#endif // SYZYGY_AGENT_COMMON_STACK_WALKER_H_

Powered by Google App Engine
This is Rietveld 408576698