forked from GPUOpen-Drivers/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged master:a03dc8c9fa8 into amd-gfx:5fc05c258fe
Local branch amd-gfx 5fc05c2 Merged master:2c7af6dffc0 into amd-gfx:13b4e3c2331 Remote branch master a03dc8c [lldb] Add basic -flimit-debug-info support to expression evaluator
- Loading branch information
Showing
20 changed files
with
443 additions
and
113 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
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,27 @@ | ||
CFLAGS_EXTRAS = $(LIMIT_DEBUG_INFO_FLAGS) | ||
LD_EXTRAS = -L. -lone -ltwo | ||
CXX_SOURCES = main.cpp | ||
|
||
ONE_CXXFLAGS = $(LIMIT_DEBUG_INFO_FLAGS) | ||
ifdef STRIP_ONE | ||
ONE_CXXFLAGS += -g0 | ||
endif | ||
|
||
TWO_CXXFLAGS = $(LIMIT_DEBUG_INFO_FLAGS) | ||
ifdef STRIP_TWO | ||
TWO_CXXFLAGS += -g0 | ||
endif | ||
|
||
include Makefile.rules | ||
|
||
a.out: libone libtwo | ||
|
||
libone: | ||
$(MAKE) -f $(MAKEFILE_RULES) \ | ||
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=one.cpp DYLIB_NAME=one \ | ||
CFLAGS_EXTRAS="$(ONE_CXXFLAGS)" | ||
|
||
libtwo: libone | ||
$(MAKE) -f $(MAKEFILE_RULES) \ | ||
DYLIB_ONLY=YES DYLIB_CXX_SOURCES=two.cpp DYLIB_NAME=two \ | ||
CFLAGS_EXTRAS="$(TWO_CXXFLAGS)" LD_EXTRAS="-L. -lone" |
90 changes: 90 additions & 0 deletions
90
lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.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,90 @@ | ||
""" | ||
Test completing types using information from other shared libraries. | ||
""" | ||
|
||
import os | ||
import lldb | ||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test import lldbutil | ||
|
||
|
||
class LimitDebugInfoTestCase(TestBase): | ||
|
||
mydir = TestBase.compute_mydir(__file__) | ||
|
||
def _check_type(self, target, name): | ||
exe = target.FindModule(lldb.SBFileSpec("a.out")) | ||
type_ = exe.FindFirstType(name) | ||
self.trace("type_: %s"%type_) | ||
self.assertTrue(type_) | ||
base = type_.GetDirectBaseClassAtIndex(0).GetType() | ||
self.trace("base:%s"%base) | ||
self.assertTrue(base) | ||
self.assertEquals(base.GetNumberOfFields(), 0) | ||
|
||
def _check_debug_info_is_limited(self, target): | ||
# Without other shared libraries we should only see the member declared | ||
# in the derived class. This serves as a sanity check that we are truly | ||
# building with limited debug info. | ||
self._check_type(target, "InheritsFromOne") | ||
self._check_type(target, "InheritsFromTwo") | ||
|
||
@skipIf(bugnumber="pr46284", debug_info="gmodules") | ||
def test_one_and_two_debug(self): | ||
self.build() | ||
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) | ||
|
||
self._check_debug_info_is_limited(target) | ||
|
||
self.registerSharedLibrariesWithTarget(target, ["one", "two"]) | ||
|
||
# But when other shared libraries are loaded, we should be able to see | ||
# all members. | ||
self.expect_expr("inherits_from_one.member", result_value="47") | ||
self.expect_expr("inherits_from_one.one", result_value="142") | ||
|
||
self.expect_expr("inherits_from_two.member", result_value="47") | ||
self.expect_expr("inherits_from_two.one", result_value="142") | ||
self.expect_expr("inherits_from_two.two", result_value="242") | ||
|
||
@skipIf(bugnumber="pr46284", debug_info="gmodules") | ||
def test_two_debug(self): | ||
self.build(dictionary=dict(STRIP_ONE="1")) | ||
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) | ||
|
||
self._check_debug_info_is_limited(target) | ||
|
||
self.registerSharedLibrariesWithTarget(target, ["one", "two"]) | ||
|
||
# This time, we should only see the members from the second library. | ||
self.expect_expr("inherits_from_one.member", result_value="47") | ||
self.expect("expr inherits_from_one.one", error=True, | ||
substrs=["no member named 'one' in 'InheritsFromOne'"]) | ||
|
||
self.expect_expr("inherits_from_two.member", result_value="47") | ||
self.expect("expr inherits_from_two.one", error=True, | ||
substrs=["no member named 'one' in 'InheritsFromTwo'"]) | ||
self.expect_expr("inherits_from_two.two", result_value="242") | ||
|
||
@skipIf(bugnumber="pr46284", debug_info="gmodules") | ||
def test_one_debug(self): | ||
self.build(dictionary=dict(STRIP_TWO="1")) | ||
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) | ||
|
||
self._check_debug_info_is_limited(target) | ||
|
||
self.registerSharedLibrariesWithTarget(target, ["one", "two"]) | ||
|
||
# In this case we should only see the members from the second library. | ||
# Note that we cannot see inherits_from_two.one because without debug | ||
# info for "Two", we cannot determine that it in fact inherits from | ||
# "One". | ||
self.expect_expr("inherits_from_one.member", result_value="47") | ||
self.expect_expr("inherits_from_one.one", result_value="142") | ||
|
||
self.expect_expr("inherits_from_two.member", result_value="47") | ||
self.expect("expr inherits_from_two.one", error=True, | ||
substrs=["no member named 'one' in 'InheritsFromTwo'"]) | ||
self.expect("expr inherits_from_two.two", error=True, | ||
substrs=["no member named 'two' in 'InheritsFromTwo'"]) |
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 @@ | ||
struct A { | ||
int a = 47; | ||
virtual ~A(); | ||
}; | ||
|
||
A::~A() = default; |
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,13 @@ | ||
#include "onetwo.h" | ||
|
||
struct InheritsFromOne : One { | ||
constexpr InheritsFromOne() = default; | ||
int member = 47; | ||
} inherits_from_one; | ||
|
||
struct InheritsFromTwo : Two { | ||
constexpr InheritsFromTwo() = default; | ||
int member = 47; | ||
} inherits_from_two; | ||
|
||
int main() { return 0; } |
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,3 @@ | ||
#include "onetwo.h" | ||
|
||
One::~One() = default; |
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 @@ | ||
struct One { | ||
int one = 142; | ||
constexpr One() = default; | ||
virtual ~One(); | ||
}; | ||
|
||
struct Two : One { | ||
int two = 242; | ||
constexpr Two() = default; | ||
~Two() override; | ||
}; |
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,3 @@ | ||
#include "onetwo.h" | ||
|
||
Two::~Two() = default; |
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
Oops, something went wrong.