Fully remove DumpKernelStack.
As explained in the previous commit touching this code, these days only
root can get the kernel stack trace anyway.
Test: treehugger
Change-Id: I9924951afa1f8511720c479598c3bd74f5a55c66
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index b360f86..0c9e726 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -411,45 +411,6 @@
}
}
-void DumpKernelStack(std::ostream& os, pid_t tid, const char* prefix, bool include_count) {
- if (tid == GetTid()) {
- // There's no point showing that we're reading our stack out of /proc!
- return;
- }
-
- std::string kernel_stack_filename(StringPrintf("/proc/self/task/%d/stack", tid));
- std::string kernel_stack;
- if (!android::base::ReadFileToString(kernel_stack_filename, &kernel_stack)) {
- // Not being able to read is actually the normal case on Android, so just
- // silently ignore the failure.
- return;
- }
-
- 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();
- for (size_t i = 0; i < kernel_stack_frames.size(); ++i) {
- // Turn "[<ffffffff8109156d>] futex_wait_queue_me+0xcd/0x110"
- // into "futex_wait_queue_me+0xcd/0x110".
- const char* text = kernel_stack_frames[i].c_str();
- const char* close_bracket = strchr(text, ']');
- if (close_bracket != nullptr) {
- text = close_bracket + 2;
- }
- os << prefix;
- if (include_count) {
- os << StringPrintf("#%02zd ", i);
- }
- os << text << std::endl;
- }
-}
-
#elif defined(__APPLE__)
void DumpNativeStack(std::ostream& os ATTRIBUTE_UNUSED,
@@ -461,12 +422,6 @@
bool skip_frames ATTRIBUTE_UNUSED) {
}
-void DumpKernelStack(std::ostream& os ATTRIBUTE_UNUSED,
- pid_t tid ATTRIBUTE_UNUSED,
- const char* prefix ATTRIBUTE_UNUSED,
- bool include_count ATTRIBUTE_UNUSED) {
-}
-
#else
#error "Unsupported architecture for native stack dumps."
#endif
diff --git a/runtime/native_stack_dump.h b/runtime/native_stack_dump.h
index ad4bfab..4d4b36b 100644
--- a/runtime/native_stack_dump.h
+++ b/runtime/native_stack_dump.h
@@ -39,12 +39,6 @@
bool skip_frames = true)
NO_THREAD_SAFETY_ANALYSIS;
-// Dumps the kernel stack for thread 'tid' to 'os'. Note that this is only available on linux-x86.
-void DumpKernelStack(std::ostream& os,
- pid_t tid,
- const char* prefix = "",
- bool include_count = true);
-
} // namespace art
#endif // ART_RUNTIME_NATIVE_STACK_DUMP_H_
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index b651851..766782d 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -521,7 +521,6 @@
if (self == nullptr) {
os << "(Aborting thread was not attached to runtime!)\n";
- DumpKernelStack(os, GetTid(), " kernel: ", false);
DumpNativeStack(os, GetTid(), nullptr, " native: ", nullptr);
} else {
os << "Aborting thread:\n";
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 820bcb5..7adcb11 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2173,7 +2173,6 @@
if (safe_to_dump || force_dump_stack) {
// If we're currently in native code, dump that stack before dumping the managed stack.
if (dump_native_stack && (dump_for_abort || force_dump_stack || ShouldShowNativeStack(this))) {
- DumpKernelStack(os, GetTid(), " kernel: ", false);
ArtMethod* method =
GetCurrentMethod(nullptr,
/*check_suspended=*/ !force_dump_stack,
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 2fe239a..28bc184 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -162,7 +162,6 @@
// TODO: No thread safety analysis as DumpState with a null thread won't access fields, should
// refactor DumpState to avoid skipping analysis.
Thread::DumpState(os, nullptr, tid);
- DumpKernelStack(os, tid, " kernel: ", false);
if (dump_native_stack) {
DumpNativeStack(os, tid, nullptr, " native: ");
}