-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-commit "Introduce ObjectFileBreakpad"
This re-commits r348592, which was reverted due to a failing test on macos. The issue was that I was passing a null pointer for the "CreateMemoryInstance" callback when registering ObjectFileBreakpad, which caused crashes when attemping to load modules from memory. The correct thing to do is to pass a callback which always returns a null pointer (as breakpad files are never loaded in inferior memory). It turns out that there is only one test which exercises this code path, and it's mac-only, so I've create a new test which should run everywhere (except windows, as one cannot delete an executable which is being run). Unfortunately, this test still fails on linux for other reasons, but at least it gives us something to aim for. The original commit message was: This patch adds the scaffolding necessary for lldb to recognise symbol files generated by breakpad. These (textual) files contain just enough information to be able to produce a backtrace from a crash dump. This information includes: - UUID, architecture and name of the module - line tables - list of symbols - unwind information A minimal breakpad file could look like this: MODULE Linux x86_64 0000000024B5D199F0F766FFFFFF5DC30 a.out INFO CODE_ID 00000000B52499D1F0F766FFFFFF5DC3 FILE 0 /tmp/a.c FUNC 1010 10 0 _start 1010 4 4 0 1014 5 5 0 1019 5 6 0 101e 2 7 0 PUBLIC 1010 0 _start STACK CFI INIT 1010 10 .cfa: $rsp 8 + .ra: .cfa -8 + ^ STACK CFI 1011 $rbp: .cfa -16 + ^ .cfa: $rsp 16 + STACK CFI 1014 .cfa: $rbp 16 + Even though this data would normally be considered "symbol" information, in the current lldb infrastructure it is assumed every SymbolFile object is backed by an ObjectFile instance. So, in order to better interoperate with the rest of the code (particularly symbol vendors). In this patch I just parse the breakpad header, which is enough to populate the UUID and architecture fields of the ObjectFile interface. The rough plan for followup patches is to expose the individual parts of the breakpad file as ObjectFile "sections", which can then be used by other parts of the codebase (SymbolFileBreakpad ?) to vend the necessary information. Reviewers: clayborg, zturner, lemo, amccarth Subscribers: mgorny, fedor.sergeev, markmentovai, lldb-commits Differential Revision: https://reviews.llvm.org/D55214 llvm-svn: 348773
- Loading branch information
Showing
20 changed files
with
558 additions
and
1 deletion.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| MODULE Linux x86_64 E5894855+C35D+CCCCCCCCCCCCCCCCCCCC0 linux.out | ||
| PUBLIC 1000 0 _start |
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,2 @@ | ||
| MODULE Linux x86_64 E5894855C35DCCCCCCCCCCCCCCCCC linux.out | ||
| PUBLIC 1000 0 _start |
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,2 @@ | ||
| MODULE Linux x86_64 E58X4855C35DCCCCCCCCXCCCCCCCCCCC0 linux.out | ||
| PUBLIC 1000 0 _start |
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,6 @@ | ||
| MODULE Linux x86_64 E5894855C35DCCCCCCCCCCCCCCCCCCCC0 linux.out | ||
| INFO CODE_ID 554889E55DC3CCCCCCCCCCCCCCCCCCCC | ||
| PUBLIC 1000 0 _start | ||
| STACK CFI INIT 1000 6 .cfa: $rsp 8 + .ra: .cfa -8 + ^ | ||
| STACK CFI 1001 $rbp: .cfa -16 + ^ .cfa: $rsp 16 + | ||
| STACK CFI 1004 .cfa: $rbp 16 + |
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,6 @@ | ||
| MODULE mac x86_64 D98C0E682089AA1BEACD6A8C1F16707B0 mac.out | ||
| PUBLIC 0 0 _mh_execute_header | ||
| PUBLIC f30 0 start | ||
| STACK CFI INIT f30 6 .cfa: $rsp 8 + .ra: .cfa -8 + ^ | ||
| STACK CFI f31 $rbp: .cfa -16 + ^ .cfa: $rsp 16 + | ||
| STACK CFI f34 .cfa: $rbp 16 + |
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,4 @@ | ||
| MODULE windows x86 A0C9165780B5490981A1925EA62165C01 a.pdb | ||
| INFO CODE_ID 5C01672A4000 a.exe | ||
| FILE 1 c:\tmp\a.cpp | ||
| PUBLIC 1000 0 main |
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,32 @@ | ||
| RUN: lldb-test object-file %p/Inputs/identification-linux.syms | FileCheck %s --check-prefix=LINUX | ||
| RUN: lldb-test object-file %p/Inputs/identification-macosx.syms | FileCheck %s --check-prefix=MAC | ||
| RUN: lldb-test object-file %p/Inputs/identification-windows.syms | FileCheck %s --check-prefix=WINDOWS | ||
| RUN: not lldb-test object-file %p/Inputs/bad-module-id-1.syms 2>&1 | FileCheck %s --check-prefix=ERROR | ||
| RUN: not lldb-test object-file %p/Inputs/bad-module-id-2.syms 2>&1 | FileCheck %s --check-prefix=ERROR | ||
| RUN: not lldb-test object-file %p/Inputs/bad-module-id-3.syms 2>&1 | FileCheck %s --check-prefix=ERROR | ||
|
|
||
| LINUX: Plugin name: breakpad | ||
| LINUX: Architecture: x86_64--linux | ||
| LINUX: UUID: 554889E5-5DC3-CCCC-CCCC-CCCCCCCCCCCC | ||
| LINUX: Executable: false | ||
| LINUX: Stripped: false | ||
| LINUX: Type: debug info | ||
| LINUX: Strata: user | ||
|
|
||
| MAC: Plugin name: breakpad | ||
| MAC: Architecture: x86_64--macosx | ||
| MAC: UUID: 680E8CD9-8920-1BAA-EACD-6A8C1F16707B | ||
| MAC: Executable: false | ||
| MAC: Stripped: false | ||
| MAC: Type: debug info | ||
| MAC: Strata: user | ||
|
|
||
| WINDOWS: Plugin name: breakpad | ||
| WINDOWS: Architecture: i386--windows | ||
| WINDOWS: UUID: 5716C9A0-B580-0949-81A1-925EA62165C0-01000000 | ||
| WINDOWS: Executable: false | ||
| WINDOWS: Stripped: false | ||
| WINDOWS: Type: debug info | ||
| WINDOWS: Strata: user | ||
|
|
||
| ERROR: not recognised as an object file |
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 @@ | ||
| config.suffixes = ['.test'] |
5 changes: 5 additions & 0 deletions
5
lldb/packages/Python/lldbsuite/test/functionalities/deleted-executable/Makefile
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,5 @@ | ||
| LEVEL = ../../make | ||
|
|
||
| CXX_SOURCES := main.cpp | ||
|
|
||
| include $(LEVEL)/Makefile.rules |
31 changes: 31 additions & 0 deletions
31
...ackages/Python/lldbsuite/test/functionalities/deleted-executable/TestDeletedExecutable.py
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,31 @@ | ||
| """ | ||
| Test process attach/resume. | ||
| """ | ||
|
|
||
| from __future__ import print_function | ||
|
|
||
|
|
||
| import os | ||
| import time | ||
| import lldb | ||
| from lldbsuite.test.decorators import * | ||
| from lldbsuite.test.lldbtest import * | ||
| from lldbsuite.test import lldbutil | ||
|
|
||
| class TestDeletedExecutable(TestBase): | ||
|
|
||
| mydir = TestBase.compute_mydir(__file__) | ||
| NO_DEBUG_INFO_TESTCASE = True | ||
|
|
||
| @skipIfWindows # cannot delete a running executable | ||
| @expectedFailureAll(oslist=["linux"]) # determining the architecture of the process fails | ||
| def test(self): | ||
| self.build() | ||
| exe = self.getBuildArtifact("a.out") | ||
|
|
||
| popen = self.spawnSubprocess(exe) | ||
| self.addTearDownHook(self.cleanupSubprocesses) | ||
| os.remove(exe) | ||
|
|
||
| self.runCmd("process attach -p " + str(popen.pid)) | ||
| self.runCmd("kill") |
9 changes: 9 additions & 0 deletions
9
lldb/packages/Python/lldbsuite/test/functionalities/deleted-executable/main.cpp
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,9 @@ | ||
| #include <chrono> | ||
| #include <thread> | ||
|
|
||
| int main(int argc, char const *argv[]) | ||
| { | ||
| lldb_enable_attach(); | ||
|
|
||
| std::this_thread::sleep_for(std::chrono::seconds(30)); | ||
| } |
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,11 @@ | ||
| add_lldb_library(lldbPluginObjectFileBreakpad PLUGIN | ||
| ObjectFileBreakpad.cpp | ||
|
|
||
| LINK_LIBS | ||
| lldbCore | ||
| lldbHost | ||
| lldbSymbol | ||
| lldbUtility | ||
| LINK_COMPONENTS | ||
| Support | ||
| ) |
Oops, something went wrong.