Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@ -0,0 +1,5 @@
LEVEL = ../../make
CXX_SOURCES := main.cpp
include $(LEVEL)/Makefile.rules

View File

@ -0,0 +1,72 @@
"""
Test some lldb command abbreviations.
"""
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 DisassemblyTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(
oslist=["windows"],
bugnumber="function names print fully demangled instead of name-only")
def test(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
patterns=["Current executable set to .*a.out.*"])
match_object = lldbutil.run_break_set_command(self, "br s -n sum")
lldbutil.check_breakpoint_result(
self,
match_object,
symbol_name='sum',
symbol_match_exact=False,
num_locations=1)
self.expect("run",
patterns=["Process .* launched: "])
self.runCmd("dis -f")
disassembly = self.res.GetOutput()
# ARCH, if not specified, defaults to x86_64.
arch = self.getArchitecture()
if arch in ["", 'x86_64', 'i386', 'i686']:
breakpoint_opcodes = ["int3"]
instructions = [' mov', ' addl ', 'ret']
elif arch in ["arm", "aarch64", "arm64", "armv7", "armv7k"]:
breakpoint_opcodes = ["brk", "udf"]
instructions = [' add ', ' ldr ', ' str ']
elif re.match("mips", arch):
breakpoint_opcodes = ["break"]
instructions = ['lw', 'sw']
elif arch in ["s390x"]:
breakpoint_opcodes = [".long"]
instructions = [' l ', ' a ', ' st ']
else:
# TODO please add your arch here
self.fail(
'unimplemented for arch = "{arch}"'.format(
arch=self.getArchitecture()))
# make sure that the software breakpoint has been removed
for op in breakpoint_opcodes:
self.assertFalse(op in disassembly)
# make sure a few reasonable assembly instructions are here
self.expect(
disassembly,
exe=False,
startstr="a.out`sum",
substrs=instructions)

View File

@ -0,0 +1,68 @@
"""
Test to ensure SBFrame::Disassemble produces SOME output
"""
from __future__ import print_function
import os
import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
class FrameDisassembleTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
def test_frame_disassemble(self):
"""Sample test to ensure SBFrame::Disassemble produces SOME output."""
self.build()
self.frame_disassemble_test()
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
def frame_disassemble_test(self):
"""Sample test to ensure SBFrame::Disassemble produces SOME output"""
exe = os.path.join(os.getcwd(), "a.out")
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint in main.c at the source matching
# "Set a breakpoint here"
breakpoint = target.BreakpointCreateBySourceRegex(
"Set a breakpoint here", lldb.SBFileSpec("main.cpp"))
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() >= 1,
VALID_BREAKPOINT)
error = lldb.SBError()
# This is the launch info. If you want to launch with arguments or
# environment variables, add them using SetArguments or
# SetEnvironmentEntries
launch_info = lldb.SBLaunchInfo(None)
process = target.Launch(launch_info, error)
self.assertTrue(process, PROCESS_IS_VALID)
# Did we hit our breakpoint?
from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
threads = get_threads_stopped_at_breakpoint(process, breakpoint)
self.assertTrue(
len(threads) == 1,
"There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
frame = threads[0].GetFrameAtIndex(0)
disassembly = frame.Disassemble()
self.assertTrue(len(disassembly) != 0, "Disassembly was empty.")

View File

@ -0,0 +1,28 @@
//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int
sum (int a, int b)
{
int result = a + b;
return result;
}
int
main(int argc, char const *argv[])
{
int array[3];
array[0] = sum (1238, 78392); // Set a breakpoint here
array[1] = sum (379265, 23674);
array[2] = sum (872934, 234);
return 0;
}