-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make StackFrame.name fall back to symbol/PC and add StackFrame.functi…
…on_name Multiple people have lamented that StackFrame.name is None for functions implemented in assembly or missing debug info for any other reason. With DWARFless debugging, this will be way more common. My original hope was that StackFrame.name would strictly be the function name from the debugging information and that callers would fall back to getting the symbol name themselves. However, the distinction isn't super meaningful to users, so let's add the fallback directly to StackFrame.name and add StackFrame.function_name with the old behavior of StackFrame.name. Signed-off-by: Omar Sandoval <[email protected]>
- Loading branch information
Showing
5 changed files
with
120 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
from drgn import Program | ||
from tests import TestCase | ||
from tests.resources import get_resource | ||
|
||
|
||
class TestLinuxUserspaceCoreDump(TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
cls.prog = Program() | ||
cls.prog.set_enabled_debug_info_finders([]) | ||
cls.prog.set_core_dump(get_resource("crashme.core")) | ||
cls.prog.load_debug_info([get_resource("crashme"), get_resource("crashme.so")]) | ||
cls.trace = cls.prog.crashed_thread().stack_trace() | ||
|
||
def test_stack_frame_name(self): | ||
self.assertEqual(self.trace[0].name, "c") | ||
self.assertEqual(self.trace[5].name, "0x7f6112ad8088") | ||
self.assertEqual(self.trace[7].name, "_start") | ||
self.assertEqual(self.trace[8].name, "???") | ||
|
||
def test_stack_frame_function_name(self): | ||
self.assertEqual(self.trace[0].function_name, "c") | ||
self.assertIsNone(self.trace[5].function_name) | ||
self.assertIsNone(self.trace[7].function_name) | ||
self.assertIsNone(self.trace[8].function_name) |