fuchsia: clarify stack capture in case of stack overflow
Bug: fuchsia:74897
Change-Id: If3ba11aa2eacf0e139d89eb7b47fc0c961bcb2b9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2895346
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
GitOrigin-RevId: e841b92e18e85f0d943441f949062b74b2a544b6
diff --git a/snapshot/fuchsia/process_reader_fuchsia.cc b/snapshot/fuchsia/process_reader_fuchsia.cc
index 4522e51..1c037d7 100644
--- a/snapshot/fuchsia/process_reader_fuchsia.cc
+++ b/snapshot/fuchsia/process_reader_fuchsia.cc
@@ -46,6 +46,12 @@
#error Port
#endif
+ // TODO(fxbug.dev/74897): make this work for stack overflows, e.g., by looking
+ // up using the initial stack pointer (sp) when the thread was created. Right
+ // now, it gets the stack by getting the mapping that contains the current sp.
+ // But in the case of stack overflows, the current sp is by definition outside
+ // of the stack so the mapping returned is not the stack and fails the type
+ // check, at least on arm64.
zx_info_maps_t range_with_sp;
if (!memory_map.FindMappingForAddress(sp, &range_with_sp)) {
LOG(ERROR) << "stack pointer not found in mapping";
@@ -54,7 +60,7 @@
if (range_with_sp.type != ZX_INFO_MAPS_TYPE_MAPPING) {
LOG(ERROR) << "stack range has unexpected type " << range_with_sp.type
- << ", aborting";
+ << ", stack overflow? Aborting";
return;
}