Fix NE when DumpKernelStack
Before kernel_stack_frames.pop_back(),
check whether kernel_stack_frames is empty.
Bug: 72759265
Test: manual
Change-Id: I3e52d0a38ff868a278da94b2b80d44a324514934
Signed-off-by: yuanhao <yuanhao@xiaomi.com>
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index ec94552..91dadbf 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -385,6 +385,10 @@
std::vector<std::string> kernel_stack_frames;
Split(kernel_stack, '\n', &kernel_stack_frames);
+ if (kernel_stack_frames.empty()) {
+ os << prefix << "(" << kernel_stack_filename << " is empty)\n";
+ return;
+ }
// We skip the last stack frame because it's always equivalent to "[<ffffffff>] 0xffffffff",
// which looking at the source appears to be the kernel's way of saying "that's all, folks!".
kernel_stack_frames.pop_back();