rust-lang / lldb Goto Github PK
View Code? Open in Web Editor NEWThis project forked from llvm-mirror/lldb
No longer used, use https://github.com/rust-lang/llvm-project instead
License: Other
This project forked from llvm-mirror/lldb
No longer used, use https://github.com/rust-lang/llvm-project instead
License: Other
2018 edition is adding raw identifiers: https://rust-lang-nursery.github.io/edition-guide/2018/transitioning/raw-identifiers.html
The lldb lexer should implement this as well.
src/test/debuginfo/union-smoke.rs
fails when run against rust-lldb:
print u
(union_smoke::U) u = { a = { = 2 = 2 } b = 514 }
print union_smoke::SU
error: could not find decl "SU"
Set up CI for this repository.
Maybe Mangled::GuessLanguage
should have a Rust case. See source/Core/Mangled.cpp
.
Alternatively maybe the existing Rust patch in there is not necessary and should be backed out.
In some cases rustc will emit DW_TAG_template_type_param
, but currently DWARFASTParserRust
ignores these.
rustc uses a small DWARF extension to inform debuggers about the type associated with a trait object's vtable. In particular, DWARF is emitted for the vtable, and this DIE has a DW_AT_containing_type
attribute which has a ref to the concrete type for which this vtable was emitted.
So, change lldb to:
gdb can do this; there the syntax for users is just print *trait_object
.
LLVM is going to merge all its repos to a single one, it would be easier to rebase the Rust branch on top of it:
[lldb-dev] LLVM git monorepo mirror published
https://lists.llvm.org/pipermail/lldb-dev/2019-January/014591.html
At least one name test fails:
File "/home/tromey/gdb/LLDB/llvm/tools/lldb/packages/Python/lldbsuite/test/lang/rust/names/TestRustNames.py", line 88, in check_names
self.assertEqual(v.GetValueAsSigned(), value, 'checking ' + name)
AssertionError: 0 != 212 : checking ::m2::m2_1::m2_1_2::VALUE
I think this worked at one point.
Create program.rs:
// program.rs
struct Struct{
a: Vec<u32>,
}
fn main() {
let s = Struct {
a: vec![],
};
println!("---");
}
Compile and run it under rust-lldb:
rustc -g program.rs
rust-lldb program
Execute these commands:
break set -f program.rs -l 10 # on println!
run
script ty1 = lldb.frame.FindVariable("s").GetType()
script [f.GetName() for f in ty1.fields]
Result: ['a']
script ty2 = filter(lambda t: t.IsValid(), [m.FindFirstType('Struct') for m in lldb.target.modules])[0]
script [f.GetName() for f in ty2.fields]
Result: ['a', 'a']
The expected result is, of course, ['a']
, same as in the first case.
I am currently on:
rustc 1.30.0-nightly (3edb355b7 2018-08-03)
llvm: 40868d437198d20a353ce4f4fb114b4d33efe5aa (upstream master)
clang: 074cccc152df061007c8500515698b57a5af7103 (upstream master)
lldb: 3dbe998969d457c5cef245f61b48bdaed0f5c059 (rust-release-70)
Testcase (taken from #14):
// a.rs
use std::option::Option;
enum Enum {A, B}
enum Union { A(usize), B(usize) }
enum Mixed { A(usize), B }
enum Field { A { field: usize }, B { field: usize } }
fn main() {
let enum_a = Enum::A;
let enum_b = Enum::B;
let enum_some_a = Option::Some(Enum::A);
let enum_some_b = Option::Some(Enum::B);
let enum_none: Option<Enum> = Option::None;
let union_a = Union::A(42);
let union_b = Union::B(84);
let union_some_a = Option::Some(Union::A(42));
let union_some_b = Option::Some(Union::B(84));
let union_none: Option<Union> = Option::None;
let mixed_a = Mixed::A(42);
let mixed_b = Mixed::B;
let mixed_some_a = Option::Some(Mixed::A(42));
let mixed_some_b = Option::Some(Mixed::B);
let mixed_none: Option<Mixed> = Option::None;
let field_a = Field::A { field: 42 };
let field_b = Field::B { field: 84 };
let field_some_a = Option::Some(Field::A { field: 42 });
let field_some_b = Option::Some(Field::B { field: 84 });
let field_none: Option<Field> = Option::None;
let number = 42;
let number_some = Option::Some(42);
let number_none: Option<i32> = Option::None;
println!("yay");
}
Calling fr v
at the println!
triggers the segfault.
Backtrace:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fe0b6e53314 in lldb_private::CompilerType::CompilerType (
this=0x7ffc86409940, rhs=...)
at /home/cynecx/dev/llvm/tools/lldb/include/lldb/Symbol/CompilerType.h:47
47 : m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
[Current thread is 1 (Thread 0x7fe0a6c315c0 (LWP 19653))]
(gdb) bt
#0 0x00007fe0b6e53314 in lldb_private::CompilerType::CompilerType (
this=0x7ffc86409940, rhs=...)
at /home/cynecx/dev/llvm/tools/lldb/include/lldb/Symbol/CompilerType.h:47
#1 0x00007fe0b72988cf in lldb_private::RustEnum::FindEnumVariant (
this=0x55abb3d49680, discriminant=2)
at /home/cynecx/dev/llvm/tools/lldb/source/Symbol/RustASTContext.cpp:629
#2 0x00007fe0b7295469 in lldb_private::RustASTContext::FindEnumVariant (
this=0x55abb3f8a190, type=..., discriminant=2)
at /home/cynecx/dev/llvm/tools/lldb/source/Symbol/RustASTContext.cpp:2007
#3 0x00007fe0b773b26f in lldb_private::RustLanguageRuntime::GetDynamicTypeAndAddress (this=0x55abb412ac30, in_value=...,
use_dynamic=lldb::eDynamicDontRunTarget, class_type_or_name=...,
dynamic_address=...,
value_type=@0x7ffc86409a30: lldb_private::Value::eValueTypeScalar)
at /home/cynecx/dev/llvm/tools/lldb/source/Plugins/LanguageRuntime/Rust/RustLanguageRuntime.cpp:100
#4 0x00007fe0b70e73cb in lldb_private::ValueObjectDynamicValue::UpdateValue (
this=0x55abb41766b0)
at /home/cynecx/dev/llvm/tools/lldb/source/Core/ValueObjectDynamicValue.cpp:156
#5 0x00007fe0b70ccc9e in lldb_private::ValueObject::UpdateValueIfNeeded (
this=0x55abb41766b0, update_format=false)
at /home/cynecx/dev/llvm/tools/lldb/source/Core/ValueObject.cpp:200
It seems that idx = -1 (m_default)
in RustEnum::FindEnumVariant
triggers the segfault because this is basically an out-of-bounds access through FieldAt
.
(gdb) p discriminant
$15 = 2
(gdb) p m_discriminants
$16 = std::unordered_map with 2 elements = {[1] = 1, [0] = 0}
Not sure what's the cause here as I am also not familiar with the code (seems that a discriminant record is missing?).
I think types local to a function or block aren't looked up properly yet.
Following the directions at https://lldb.llvm.org/build.html#BuildingLldbOnLinux I attempted to build lldb.
llvm branch is rust-llvm-release-6-0-0 509f29ac17874394acf4d49d6bae3cd93c652aa1
clang is 2f27999df400d17b33cdd412fdd606a88208dfcc (copied from the wiki)
lldb branch is rust 832406b
Linking fails with
$ ninja lldb
[1/7] Linking CXX executable bin/lldb-server
FAILED: bin/lldb-server
: && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g -Wl,-allow-shlib-undefined -Wl,-rpath-link,/home/jeremysalwen/build_llvm/./lib tools/lldb/tools/lldb-server/CMakeFiles/lldb-server.dir/Acceptor.cpp.o tools/lldb/tools/lldb-server/CMakeFiles/lldb-server.dir/lldb-gdbserver.cpp.o tools/lldb/tools/lldb-server/CMakeFiles/lldb-server.dir/lldb-platform.cpp.o tools/lldb/tools/lldb-server/CMakeFiles/lldb-server.dir/lldb-server.cpp.o tools/lldb/tools/lldb-server/CMakeFiles/lldb-server.dir/LLDBServerUtilities.cpp.o -o bin/lldb-server -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.a -lpthread lib/liblldbBase.a lib/liblldbCore.a lib/liblldbHost.a lib/liblldbInitialization.a lib/liblldbInterpreter.a lib/liblldbPluginProcessLinux.a lib/liblldbPluginInstructionARM.a lib/liblldbPluginInstructionMIPS.a lib/liblldbPluginInstructionMIPS64.a lib/libLLVMMipsCodeGen.a lib/libLLVMAsmPrinter.a lib/libLLVMSelectionDAG.a lib/libLLVMMipsAsmParser.a lib/libLLVMMipsDesc.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMipsDisassembler.a lib/libLLVMMCDisassembler.a lib/libLLVMMipsInfo.a lib/liblldbPluginObjectContainerMachOArchive.a lib/liblldbPluginObjectFilePECOFF.a lib/liblldbPluginProcessGDBRemote.a lib/liblldbPluginPlatformMacOSX.a lib/liblldbPluginPlatformPOSIX.a lib/liblldbPluginProcessPOSIX.a lib/liblldbCore.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbBreakpoint.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbCommands.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbCore.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbBreakpoint.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbCommands.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbCore.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbBreakpoint.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbCommands.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbCore.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbBreakpoint.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbCommands.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbBase.a lib/libclangCodeGen.a lib/libLLVMCoroutines.a lib/libLLVMCoverage.a lib/libLLVMLTO.a lib/libLLVMObjCARCOpts.a lib/libLLVMPasses.a lib/libLLVMCodeGen.a lib/libclangRewriteFrontend.a lib/libclangFrontend.a lib/libclangParse.a lib/libclangDriver.a lib/libLLVMOption.a lib/libclangRewrite.a lib/libclangSerialization.a lib/libclangSema.a lib/libclangEdit.a lib/libclangAnalysis.a lib/libLLVMipo.a lib/libLLVMBitWriter.a lib/libLLVMIRReader.a lib/libLLVMAsmParser.a lib/libLLVMInstrumentation.a lib/libLLVMLinker.a lib/libLLVMScalarOpts.a lib/libLLVMInstCombine.a lib/libLLVMVectorize.a lib/libLLVMTransformUtils.a lib/libLLVMMCJIT.a lib/libLLVMExecutionEngine.a lib/libLLVMRuntimeDyld.a lib/libLLVMTarget.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a lib/libLLVMDebugInfoDWARF.a lib/libLLVMDebugInfoPDB.a lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMMCParser.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/libclangAST.a lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMMC.a lib/liblldbUtility.a lib/libLLVMBinaryFormat.a -ledit /usr/lib/x86_64-linux-gnu/libpython2.7.so /usr/lib/x86_64-linux-gnu/libxml2.so -lpthread -lcurses /usr/lib/x86_64-linux-gnu/libform.so /usr/lib/x86_64-linux-gnu/libpanel.so lib/libLLVMSupport.a -lz -lrt -lpthread -ldl -ltinfo -lm lib/libLLVMDemangle.a && :
lib/liblldbPluginSymbolFileDWARF.a(DWARFDefines.cpp.o): In function `lldb_private::DW_DSC_value_to_name(unsigned int)':
/home/jeremysalwen/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp:478: undefined reference to `llvm::dwarf::DiscriminantString(unsigned int)'
collect2: error: ld returned 1 exit status
[2/7] Linking CXX shared library lib/liblldb.so.6.0.1
FAILED: lib/liblldb.so.6.0.1
: && /usr/bin/c++ -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g -Wl,-z,defs -Wl,-z,nodelete -Wl,-rpath-link,/home/jeremysalwen/build_llvm/./lib -Wl,--version-script,/home/jeremysalwen/build_llvm/tools/lldb/source/API/liblldb.exports -shared -Wl,-soname,liblldb.so.6 -o lib/liblldb.so.6.0.1 tools/lldb/source/API/CMakeFiles/liblldb.dir/SBAddress.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBAttachInfo.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBlock.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpoint.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpointLocation.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpointName.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpointOptionCommon.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBroadcaster.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCommandInterpreter.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCommandReturnObject.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCommunication.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBCompileUnit.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBData.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBDebugger.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBDeclaration.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBError.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBEvent.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBExecutionContext.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBExpressionOptions.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFileSpec.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFileSpecList.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFrame.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBFunction.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBHostOS.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBInstruction.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBInstructionList.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLanguageRuntime.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLaunchInfo.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBLineEntry.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBListener.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBMemoryRegionInfo.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBMemoryRegionInfoList.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBModule.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBModuleSpec.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBPlatform.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBProcess.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBProcessInfo.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBQueue.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBQueueItem.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSection.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSourceManager.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBStream.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBStringList.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBStructuredData.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSymbol.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSymbolContext.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBSymbolContextList.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTarget.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBThread.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBThreadCollection.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBThreadPlan.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTrace.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTraceOptions.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBType.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeCategory.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeEnumMember.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeFilter.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeFormat.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeNameSpecifier.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeSummary.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBTypeSynthetic.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBValue.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBValueList.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBVariablesOptions.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBWatchpoint.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SBUnixSignals.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/SystemInitializerFull.cpp.o tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o -Wl,-rpath,"\$ORIGIN/../lib" lib/liblldbBase.a lib/liblldbBreakpoint.a lib/liblldbCore.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbHost.a lib/liblldbInitialization.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbUtility.a lib/liblldbPluginABISysV_arm.a lib/liblldbPluginABISysV_arm64.a lib/liblldbPluginABISysV_hexagon.a lib/liblldbPluginABISysV_ppc.a lib/liblldbPluginABISysV_ppc64.a lib/liblldbPluginABISysV_mips.a lib/liblldbPluginABISysV_mips64.a lib/liblldbPluginABISysV_s390x.a lib/liblldbPluginABISysV_i386.a lib/liblldbPluginABISysV_x86_64.a lib/liblldbPluginABIMacOSX_i386.a lib/liblldbPluginABIMacOSX_arm.a lib/liblldbPluginABIMacOSX_arm64.a lib/liblldbPluginArchitectureArm.a lib/liblldbPluginDisassemblerLLVM.a lib/liblldbPluginDynamicLoaderMacOSXDYLD.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginDynamicLoaderStatic.a lib/liblldbPluginDynamicLoaderHexagonDYLD.a lib/liblldbPluginDynamicLoaderWindowsDYLD.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginInstructionARM.a lib/liblldbPluginInstructionARM64.a lib/liblldbPluginInstructionMIPS.a lib/liblldbPluginInstructionMIPS64.a lib/liblldbPluginInstrumentationRuntimeASan.a lib/liblldbPluginInstrumentationRuntimeMainThreadChecker.a lib/liblldbPluginInstrumentationRuntimeTSan.a lib/liblldbPluginInstrumentationRuntimeUBSan.a lib/liblldbPluginJITLoaderGDB.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginGoLanguage.a lib/liblldbPluginJavaLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginObjCPlusPlusLanguage.a lib/liblldbPluginOCamlLanguage.a lib/liblldbPluginRustLanguage.a lib/liblldbPluginCXXItaniumABI.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginLanguageRuntimeGo.a lib/liblldbPluginLanguageRuntimeJava.a lib/liblldbPluginRenderScriptRuntime.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginMemoryHistoryASan.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectContainerMachOArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileMachO.a lib/liblldbPluginObjectFilePECOFF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginOSGo.a lib/liblldbPluginOSPython.a lib/liblldbPluginPlatformLinux.a lib/liblldbPluginPlatformFreeBSD.a lib/liblldbPluginPlatformNetBSD.a lib/liblldbPluginPlatformOpenBSD.a lib/liblldbPluginPlatformMacOSX.a lib/liblldbPluginPlatformWindows.a lib/liblldbPluginPlatformPOSIX.a lib/liblldbPluginPlatformGDB.a lib/liblldbPluginPlatformKalimba.a lib/liblldbPluginPlatformAndroid.a lib/liblldbPluginProcessLinux.a lib/liblldbPluginProcessPOSIX.a lib/liblldbPluginProcessGDBRemote.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginProcessMinidump.a lib/liblldbPluginScriptInterpreterNone.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginStructuredDataDarwinLog.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFileSymtab.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbPluginSystemRuntimeMacOSX.a lib/liblldbPluginSymbolVendorELF.a lib/liblldbPluginUnwindAssemblyInstEmulation.a lib/liblldbPluginUnwindAssemblyX86.a lib/libLLVMSupport.a lib/liblldbPluginScriptInterpreterNone.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginPlatformMacOSX.a lib/libLLVMAArch64CodeGen.a lib/libLLVMAArch64AsmParser.a lib/libLLVMAArch64Disassembler.a lib/libLLVMAArch64Desc.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a lib/libLLVMAMDGPUCodeGen.a lib/libLLVMAMDGPUAsmParser.a lib/libLLVMAMDGPUDisassembler.a lib/libLLVMAMDGPUDesc.a lib/libLLVMAMDGPUAsmPrinter.a lib/libLLVMAMDGPUInfo.a lib/libLLVMAMDGPUUtils.a lib/libLLVMARMCodeGen.a lib/libLLVMARMAsmParser.a lib/libLLVMARMDisassembler.a lib/libLLVMARMDesc.a lib/libLLVMARMAsmPrinter.a lib/libLLVMARMInfo.a lib/libLLVMARMUtils.a lib/libLLVMBPFCodeGen.a lib/libLLVMBPFAsmParser.a lib/libLLVMBPFDesc.a lib/libLLVMBPFAsmPrinter.a lib/libLLVMBPFDisassembler.a lib/libLLVMBPFInfo.a lib/libLLVMHexagonCodeGen.a lib/libLLVMHexagonAsmParser.a lib/libLLVMHexagonDisassembler.a lib/libLLVMHexagonDesc.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiCodeGen.a lib/libLLVMLanaiAsmParser.a lib/libLLVMLanaiDisassembler.a lib/libLLVMLanaiDesc.a lib/libLLVMLanaiAsmPrinter.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsCodeGen.a lib/libLLVMMipsAsmParser.a lib/libLLVMMipsDesc.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMipsDisassembler.a lib/libLLVMMipsInfo.a lib/libLLVMMSP430CodeGen.a lib/libLLVMMSP430Desc.a lib/libLLVMMSP430AsmPrinter.a lib/libLLVMMSP430Info.a lib/libLLVMNVPTXCodeGen.a lib/libLLVMNVPTXDesc.a lib/libLLVMNVPTXAsmPrinter.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCCodeGen.a lib/libLLVMPowerPCAsmParser.a lib/libLLVMPowerPCDesc.a lib/libLLVMPowerPCAsmPrinter.a lib/libLLVMPowerPCDisassembler.a lib/libLLVMPowerPCInfo.a lib/libLLVMSparcCodeGen.a lib/libLLVMSparcAsmParser.a lib/libLLVMSparcDesc.a lib/libLLVMSparcAsmPrinter.a lib/libLLVMSparcDisassembler.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZCodeGen.a lib/libLLVMSystemZAsmParser.a lib/libLLVMSystemZDisassembler.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZInfo.a lib/libLLVMX86CodeGen.a lib/libLLVMGlobalISel.a lib/libLLVMX86AsmParser.a lib/libLLVMX86Desc.a lib/libLLVMX86AsmPrinter.a lib/libLLVMX86Disassembler.a lib/libLLVMX86Info.a lib/libLLVMX86Utils.a lib/libLLVMXCoreCodeGen.a lib/libLLVMAsmPrinter.a lib/libLLVMSelectionDAG.a lib/libLLVMXCoreDesc.a lib/libLLVMXCoreAsmPrinter.a lib/libLLVMXCoreDisassembler.a lib/libLLVMXCoreInfo.a lib/liblldbPluginPlatformLinux.a lib/liblldbPluginPlatformPOSIX.a lib/liblldbPluginPlatformGDB.a lib/liblldbBreakpoint.a lib/liblldbCore.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbCommands.a lib/liblldbBreakpoint.a lib/liblldbCore.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbCommands.a lib/liblldbBreakpoint.a lib/liblldbCore.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbCommands.a lib/liblldbBreakpoint.a lib/liblldbCore.a lib/liblldbDataFormatters.a lib/liblldbExpression.a lib/liblldbHost.a lib/liblldbInterpreter.a lib/liblldbSymbol.a lib/liblldbTarget.a lib/liblldbPluginDynamicLoaderPosixDYLD.a lib/liblldbPluginExpressionParserClang.a lib/liblldbPluginExpressionParserGo.a lib/liblldbPluginExpressionParserRust.a lib/liblldbPluginCPlusPlusLanguage.a lib/liblldbPluginObjCLanguage.a lib/liblldbPluginAppleObjCRuntime.a lib/liblldbPluginLanguageRuntimeRust.a lib/liblldbPluginObjectContainerBSDArchive.a lib/liblldbPluginObjectFileELF.a lib/liblldbPluginObjectFileJIT.a lib/liblldbPluginProcessUtility.a lib/liblldbPluginProcessElfCore.a lib/liblldbPluginScriptInterpreterPython.a lib/liblldbPluginSymbolFileDWARF.a lib/liblldbPluginSymbolFilePDB.a lib/liblldbCommands.a lib/libclangCodeGen.a lib/libLLVMCoroutines.a lib/libLLVMCoverage.a lib/libLLVMLTO.a lib/libLLVMObjCARCOpts.a lib/libLLVMPasses.a lib/libLLVMCodeGen.a lib/libclangRewriteFrontend.a lib/libclangFrontend.a lib/libclangParse.a lib/libclangDriver.a lib/libLLVMOption.a lib/libclangRewrite.a lib/libclangSerialization.a lib/libclangSema.a lib/libclangEdit.a lib/libclangAnalysis.a lib/libLLVMipo.a lib/libLLVMIRReader.a lib/libLLVMAsmParser.a lib/libLLVMScalarOpts.a lib/libLLVMVectorize.a lib/libLLVMBitWriter.a lib/libLLVMInstCombine.a lib/libLLVMInstrumentation.a lib/libLLVMLinker.a lib/libLLVMTransformUtils.a lib/libLLVMMCJIT.a lib/libLLVMExecutionEngine.a lib/libLLVMRuntimeDyld.a lib/libLLVMTarget.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a lib/libLLVMDebugInfoDWARF.a lib/libclangAST.a lib/libclangLex.a lib/libclangBasic.a lib/libLLVMDebugInfoPDB.a lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMCore.a lib/libLLVMMCParser.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/liblldbBase.a lib/liblldbUtility.a lib/libLLVMBinaryFormat.a -ledit /usr/lib/x86_64-linux-gnu/libpython2.7.so /usr/lib/x86_64-linux-gnu/libxml2.so -lpthread -lcurses /usr/lib/x86_64-linux-gnu/libform.so /usr/lib/x86_64-linux-gnu/libpanel.so lib/libLLVMMCDisassembler.a lib/libLLVMMC.a lib/libLLVMSupport.a lib/libLLVMDemangle.a -lz -lrt -ltinfo -ldl -lpthread -lm && :
lib/liblldbPluginSymbolFileDWARF.a(DWARFDefines.cpp.o): In function `lldb_private::DW_DSC_value_to_name(unsigned int)':
/home/jeremysalwen/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp:478: undefined reference to `llvm::dwarf::DiscriminantString(unsigned int)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
I think implementing GetStringPrinterEscapingHelper
for Rust would allow for more Rust-like syntax in printed strings.
fn main() {
let foo = Foo {x: 5};
foo.print();
println!("Hello, world!");
}
struct Foo {
x :i32
}
impl Foo {
fn print(&self) {
println!("hello {}", self.x)
}
}
#[test]
fn test_foo() {
println!("Hello test");
let _foo = Foo {x: 5};
panic!();
}
$ rust-lldb target/debug/deps/exampledgb-0f6ba88c6ac57fe3
(lldb) command script import "/home/jeremysalwen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/etc/lldb_rust_formatters.py"
(lldb) type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
(lldb) type category enable Rust
(lldb) target create "target/debug/deps/exampledgb-0f6ba88c6ac57fe3"
Current executable set to 'target/debug/deps/exampledgb-0f6ba88c6ac57fe3' (x86_64).
(lldb) b main.rs:20
Breakpoint 1: where = exampledgb-0f6ba88c6ac57fe3`exampledgb::test_foo::h6982aa095a01d5c4 + 72 at main.rs:20, address = 0x0000000000011a28
(lldb) run
Process 196886 launched: '/home/jeremysalwen/fun/exampledgb/target/debug/deps/exampledgb-0f6ba88c6ac57fe3' (x86_64)
running 1 test
Process 196886 stopped
* thread #2, name = 'test_foo', stop reason = breakpoint 1.1
frame #0: exampledgb-0f6ba88c6ac57fe3`exampledgb::test_foo::h6982aa095a01d5c4 at main.rs:20
17 fn test_foo() {
18 println!("Hello test");
19 let _foo = Foo {x: 5};
-> 20 panic!();
21 }
(lldb) p _foo.print()
error: no member named 'print' in 'exampledgb::Foo'
(lldb)
Currently you can't create an instance of an enum
type in an expression.
Consider the test case from rust-lang/rust#51347:
// a.rs
use std::option::Option;
enum Enum {A, B}
enum Union { A(usize), B(usize) }
enum Mixed { A(usize), B }
enum Field { A { field: usize }, B { field: usize } }
fn main() {
let enum_a = Enum::A;
let enum_b = Enum::B;
let enum_some_a = Option::Some(Enum::A);
let enum_some_b = Option::Some(Enum::B);
let enum_none: Option<Enum> = Option::None;
let union_a = Union::A(42);
let union_b = Union::B(84);
let union_some_a = Option::Some(Union::A(42));
let union_some_b = Option::Some(Union::B(84));
let union_none: Option<Union> = Option::None;
let mixed_a = Mixed::A(42);
let mixed_b = Mixed::B;
let mixed_some_a = Option::Some(Mixed::A(42));
let mixed_some_b = Option::Some(Mixed::B);
let mixed_none: Option<Mixed> = Option::None;
let field_a = Field::A { field: 42 };
let field_b = Field::B { field: 84 };
let field_some_a = Option::Some(Field::A { field: 42 });
let field_some_b = Option::Some(Field::B { field: 84 });
let field_none: Option<Field> = Option::None;
let number = 42;
let number_some = Option::Some(42);
let number_none: Option<i32> = Option::None;
println!("yay");
}
With the compiler patch, the debuginfo here is no longer wrong, but lldb still displays some enums incorrectly:
(lldb) fr v
(a::Enum) enum_a = a::Enum::A
(a::Enum) enum_b = a::Enum::B
(core::option::Option<a::Enum>) enum_some_a = {}
(core::option::Option<a::Enum>) enum_some_b = {}
(core::option::Option<a::Enum>) enum_none = {}
(a::Union) union_a = {}
(a::Union) union_b = {}
(core::option::Option<a::Union>) union_some_a = {}
(core::option::Option<a::Union>) union_some_b = {}
(core::option::Option<a::Union>) union_none = {}
(a::Mixed) mixed_a = {}
(a::Mixed) mixed_b = {}
(core::option::Option<a::Mixed>) mixed_some_a = {}
(core::option::Option<a::Mixed>) mixed_some_b = {}
(core::option::Option<a::Mixed>) mixed_none = {}
(a::Field) field_a = {}
(a::Field) field_b = {}
(core::option::Option<a::Field>) field_some_a = {}
(core::option::Option<a::Field>) field_some_b = {}
(core::option::Option<a::Field>) field_none = {}
(i32) number = 42
(core::option::Option<i32>) number_some = {}
(core::option::Option<i32>) number_none = {}
You can't print a register using print $name
-- it's not clear to me if this is needed or not.
This will create problems for many, if not all, LLDB GUI's, because they'll probably expect distinct field names (VSCode does, for example).
Underscore-prefixed field names aren't really that bad. Dot-prefixed ones, that mimic Rust syntax, would be okay too.
The expression evaluator doesn't implement slices yet.
When using a type encoded using RUST$ENCODED$ENUM$
, the variants will have incorrect names -- they are not fully qualified. This shows up during printing, at least one test is disabled due to this.
The "sum" call test fails.
RustFunctionCaller
has a couple of hacks which should be removed:
ASTStructExtractor
hack. Maybe this could be fixed there, by having it look up the result field's size. It's not clear where this information can be found, but it seems like it must be available somewhere.FunctionCaller
only accepting scalar arguments.See the reduced test case from #16:
use std::option::Option;
enum Union { A(usize), B(usize) }
fn main() {
let union_none: Option<Union> = Option::None;
println!("yay");
}
Breaking on the println and doing:
(lldb) fr v
(core::option::Option<tt::Union>) union_none = {}
(Note that this is with the patches to use DW_TAG_variant
et al.)
Here gdb prints:
(gdb) p union_none
$1 = core::option::Option<tt::Union>::None
I think lldb should do something similar.
At my work computer we are running Cb Defense, every time I try to install rust it fails to build to to the file test-pdb.exe.
It blocks the file as "Known malware" and won't agree to unpack the source. Anyone else experience something similar and have an idea how to solve it.
The "types" test has:
let voptenum = OptimizedEnum::Null;
let voptenum2 = OptimizedEnum::NonNull(Box::new(7));
The test code says:
mytypelist.append(('main::OptimizedEnum::Null', 'voptenum', address_size, '{}'))
mytypelist.append(('main::OptimizedEnum::NonNull', 'voptenum2', address_size, None))
However with git master rustc
, voptenum2
gets just main::OptimizedEnum
here -- but voptenum
still passes. One or the other of these is incorrect.
There seems to be an issue with the nightly build since Nov 26. Not sure if this is a known issue or not.
Hi! I'd like to ask about the status of expression evaluation in rust-lldb
From what I've experienced it supports only a small amount of features (like calling regular functions or methods of the primary structure impl
s, but not methods from traits for example, and not methods from data structures like Vec
)
Are there plans for adding support for such functionality?
As of 2018-10-05, lldv-preview component for nightly-x86_64-apple-darwin does not include the debugserver
binary, which is required for debugging on OSX.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.