[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
labath added a comment. My main question would be whether it is possible to specify all the lldb-mi commands up-front, which is kinda required for this approach. I was against this for the lldb-server tests, because there we often deal with values which are not sufficiently deterministic (for example, because they represent addresses in the inferior address space), so we needed the know the output of one command before we could specify the next one. I felt that trying to capture this statically would end up with a reinvention of a domain-specific scripting language. *However*, the situation may be better in lldb-mi, as here we are sitting on top of layers which will enable us to reason about things symbolically. In a random sample of lldb-mi tests I did not find any inter-command dependencies, *except* the "-file-exec-and-symbols", where we pass the full path of the built executable. This can probably be worked around somehow. Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
aprantl added a comment. Can you give an example of what you mean by "specifying the lldb-mi commands up-front"? it's not immediately obvious to me how that would look like. Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D32167: Add support for type units (.debug_types) to LLDB in a way that is compatible with DWARF 5
clayborg updated this revision to Diff 145969. clayborg added a comment. Broke up with patch further by submitting: [PATH] https://reviews.llvm.org/D46529: Add support to object files for accessing the .debug_types section https://reviews.llvm.org/D46529 [PATCH] https://reviews.llvm.org/D46606: General cleanup to minimize the .debug_types patch https://reviews.llvm.org/D46606 This makes this patch easier to read and focus only on the .debug_types patch https://reviews.llvm.org/D32167 Files: include/lldb/lldb-forward.h lldb.xcodeproj/project.pbxproj packages/Python/lldbsuite/test/lldbinline.py packages/Python/lldbsuite/test/lldbtest.py packages/Python/lldbsuite/test/make/Makefile.rules packages/Python/lldbsuite/test/plugins/builder_base.py packages/Python/lldbsuite/test/test_categories.py source/Plugins/SymbolFile/DWARF/CMakeLists.txt source/Plugins/SymbolFile/DWARF/DIERef.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.h source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -503,20 +503,6 @@ if (section_list == NULL) return 0; -// On non Apple platforms we might have .debug_types debug info that is -// created by using "-fdebug-types-section". LLDB currently will try to -// load this debug info, but it causes crashes during debugging when types -// are missing since it doesn't know how to parse the info in the -// .debug_types type units. This causes all complex debug info types to be -// unresolved. Because this causes LLDB to crash and since it really -// doesn't provide a solid debuggiung experience, we should disable trying -// to debug this kind of DWARF until support gets added or deprecated. -if (section_list->FindSectionByName(ConstString(".debug_types"))) { - m_obj_file->GetModule()->ReportWarning( -"lldb doesn’t support .debug_types debug info"); - return 0; -} - uint64_t debug_abbrev_file_size = 0; uint64_t debug_info_file_size = 0; uint64_t debug_line_file_size = 0; @@ -592,8 +578,24 @@ const DWARFDataExtractor & SymbolFileDWARF::GetCachedSectionData(lldb::SectionType sect_type, DWARFDataSegment &data_segment) { - llvm::call_once(data_segment.m_flag, [this, sect_type, &data_segment] { + llvm::call_once(data_segment.m_flag, [&] { this->LoadSectionData(sect_type, std::ref(data_segment.m_data)); +if (sect_type == eSectionTypeDWARFDebugTypes) { + // To add .debug_types support in DWARF 4 and earlier with minimally + // invasive changes to the current DWARF parsing code, we pretend that + // any DIEs in .debug_types start at the end of the .debug_info section. + // All info in .debug_types is relative and has no external DIE + // references unless thay are DW_AT_signature references, so the DIE + // offset for things in the .debug_types. If we do this, then we can + // just add the type units to the compile units collection and treat all + // information just as we do for all other information in the DWARF and + // everything just works. If we were to try to split this out, we would + // end up having to change a TON of code. Also DWARF 5 will have compile + // and type units in the .debug_info, so coding it this way will prepare + // use for an easy transition to DWARF 5. + uint64_t debug_info_size = get_debug_info_data().GetByteSize(); + data_segment.m_data.OffsetData(debug_info_size); +} }); return data_segment.m_data; } @@ -809,7 +811,7 @@ cu_sp.reset(new CompileUnit( module_sp, dwarf_cu, cu_file_spec, dwarf_cu->GetID(), cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo)); -if (cu_sp) { +if (dwarf_cu->GetAsCompileUnit() && cu_sp) { // If we just created a compile unit with an invalid file spec, // try and get the first entry in the supports files from the // line table as that should be the compile unit. @@ -822,16 +824,16 @@ cu_sp->GetSupportFiles().Replace(0, cu_file_spec); }
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
labath added a comment. In https://reviews.llvm.org/D46588#1093267, @aprantl wrote: > Can you give an example of what you mean by "specifying the lldb-mi commands > up-front"? it's not immediately obvious to me how that would look like. In your example `lldb-mi-demo.input` is static text, right? No command depends on the result of any previous commands. That's what I mean by "up-front". The opposite of that would be if you used the output of one command to construct the next one. Something like: result = execute("first command") value = extract_something_interesting(result) result2 = execute(create_second_command(value)) My point is that lit+FileCheck is good if all your tests look like your example, but it's not if you need to do something like the above. I haven't looked at lldb-mi in much detail, so I can't which of these two options is correct, although it seems that at least the majority of the tests could be written that way. Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r331914 - [cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple configurations
Author: stella.stamenova Date: Wed May 9 12:58:51 2018 New Revision: 331914 URL: http://llvm.org/viewvc/llvm-project?rev=331914&view=rev Log: [cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple configurations Summary: The current setup for the unit tests only works correctly when the generator does not support multiple configurations. When the generator supports multiple configurations, the inputs are not copied to the correct per-configuration directory. This change sets up the build to copy the inputs in each configuration directory. Reviewers: labath, asmith, zturner Reviewed By: labath Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D46642 Modified: lldb/trunk/unittests/CMakeLists.txt Modified: lldb/trunk/unittests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/CMakeLists.txt?rev=331914&r1=331913&r2=331914&view=diff == --- lldb/trunk/unittests/CMakeLists.txt (original) +++ lldb/trunk/unittests/CMakeLists.txt Wed May 9 12:58:51 2018 @@ -42,7 +42,7 @@ function(add_lldb_unittest test_name) add_custom_command( TARGET ${test_name} POST_BUILD -COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs) +COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs) target_link_libraries(${test_name} PRIVATE ${ARG_LINK_LIBS}) endfunction() @@ -52,7 +52,7 @@ function(add_unittest_inputs test_name i add_custom_command( TARGET ${test_name} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Inputs/${INPUT} ${CMAKE_CURRENT_BINARY_DIR}/Inputs + COMMAND "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Inputs/${INPUT} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs COMMENT "Copying ${INPUT} to binary directory.") endforeach() endfunction() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
aprantl added a comment. Got it. We certainly do have dependent checks in our current tests: # Test that -data-info-line works for address self.runCmd("-data-info-line *%#x" % addr) self.expect( "\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" % (addr, line)) # Test that -data-info-line works for file:line self.runCmd("-data-info-line main.cpp:%d" % line) self.expect( "\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" % (addr, line)) Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
aprantl added a comment. Actually, the example I posted was not a good one. I'm fairly certain that that was de facto static information or otherwise not particularly important information. Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46669: Retrieve the deployment target when retrieving an object file's triple
aprantl created this revision. aprantl added a reviewer: jasonmolenda. Herald added a subscriber: mgorny. Getting the deployment target can be significant information when rebuilding clang modules since availability information could depend on it. The unittest is cargo-culted from the ELF unit tests. rdar://problem/40039633 https://reviews.llvm.org/D46669 Files: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp unittests/ObjectFile/CMakeLists.txt unittests/ObjectFile/MachO/CMakeLists.txt unittests/ObjectFile/MachO/Inputs/lc_version_min.yaml unittests/ObjectFile/MachO/TestObjectFileMachO.cpp Index: unittests/ObjectFile/MachO/TestObjectFileMachO.cpp === --- /dev/null +++ unittests/ObjectFile/MachO/TestObjectFileMachO.cpp @@ -0,0 +1,79 @@ +//===-- TestObjectFileMachO.cpp ---*- C++ -*-===// +// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" +#include "TestingSupport/TestUtilities.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/Section.h" +#include "lldb/Host/HostInfo.h" +#include "llvm/ADT/Optional.h" +#include "llvm/Support/Compression.h" +#include "llvm/Support/FileUtilities.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/Program.h" +#include "llvm/Support/raw_ostream.h" +#include "gtest/gtest.h" + +using namespace lldb_private; +using namespace lldb; + +class ObjectFileMachOTest : public testing::Test { +public: + void SetUp() override { +HostInfo::Initialize(); +ObjectFileMachO::Initialize(); + } + + void TearDown() override { +ObjectFileMachO::Terminate(); +HostInfo::Terminate(); + } + +protected: +}; + +#define ASSERT_NO_ERROR(x) \ + if (std::error_code ASSERT_NO_ERROR_ec = x) {\ +llvm::SmallString<128> MessageStorage; \ +llvm::raw_svector_ostream Message(MessageStorage); \ +Message << #x ": did not return errc::success.\n" \ +<< "error number: " << ASSERT_NO_ERROR_ec.value() << "\n" \ +<< "error message: " << ASSERT_NO_ERROR_ec.message() << "\n"; \ +GTEST_FATAL_FAILURE_(MessageStorage.c_str()); \ + } else { \ + } + +TEST_F(ObjectFileMachOTest, LCVersionMin) { + std::string yaml = GetInputFilePath("lc_version_min.yaml"); + llvm::SmallString<128> obj; + ASSERT_NO_ERROR(llvm::sys::fs::createTemporaryFile( + "lc_version_min-%%", "obj", obj)); + + llvm::FileRemover remover(obj); + const char *args[] = {YAML2OBJ, yaml.c_str(), nullptr}; + llvm::StringRef obj_ref = obj; + const llvm::Optional redirects[] = {llvm::None, obj_ref, + llvm::None}; + ASSERT_EQ(0, llvm::sys::ExecuteAndWait(YAML2OBJ, args, nullptr, redirects)); + uint64_t size; + ASSERT_NO_ERROR(llvm::sys::fs::file_size(obj, size)); + ASSERT_GT(size, 0u); + + ModuleSpec spec{FileSpec(obj, false)}; + spec.GetSymbolFileSpec().SetFile(obj, false); + auto module_sp = std::make_shared(spec); + SectionList *list = module_sp->GetSectionList(); + ASSERT_NE(nullptr, list); + + + ArchSpec arch = module_sp->GetArchitecture(); + ASSERT_EQ(arch.GetTriple().getOSName(), "macosx10.9.0"); +} Index: unittests/ObjectFile/MachO/Inputs/lc_version_min.yaml === --- /dev/null +++ unittests/ObjectFile/MachO/Inputs/lc_version_min.yaml @@ -0,0 +1,200 @@ +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x0107 + cpusubtype: 0x8003 + filetype:0x0002 + ncmds: 14 + sizeofcmds: 728 + flags: 0x00200085 + reserved:0x +LoadCommands: + - cmd: LC_SEGMENT_64 +cmdsize: 72 +segname: __PAGEZERO +vmaddr: 0 +vmsize: 4294967296 +fileoff: 0 +filesize:0 +maxprot: 0 +initprot:0 +nsects: 0 +flags: 0 + - cmd: LC_SEGMENT_64 +cmdsize: 232 +segname: __TEXT +vmaddr: 4294967296 +vmsize: 4096 +fileoff: 0 +filesize:4096 +maxprot: 7 +initprot:5 +nsects: 2 +flags: 0 +Sections: + - sectname:__text +segname: __TEXT +addr:0x00010FB0 +size:
[Lldb-commits] [PATCH] D46576: [DWARF] Align non-accelerated function fullname searching with the apple-tables path
labath added a comment. In https://reviews.llvm.org/D46576#1091548, @clayborg wrote: > Before adding the DWARF 5 index support, we should virtualize this searching > and indexing into a base class. Then we make 1 class for manual DWARF > indexing, one for Apple indexes, and one for DWARF5. Then we can unit test > each one easily. Thoughts? Yes, that's exactly where I'm heading. I started doing that, but then I noticed that two of the existing paths were sometimes very different for no apparent reason. I'm trying to bring them closer together to make the interface of the index class saner. https://reviews.llvm.org/D46576 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46529: Add support to object files for accessing the .debug_types section
labath added a comment. Looks great. Thanks. Repository: rL LLVM https://reviews.llvm.org/D46529 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [RFC] Type lookup for template types is broken...
I think we should fix lldb to reconstruct the full name based on the information from the dwarf. Right now, it seems both clang and gcc provide enough information to do this. If we start doing that, then it should also be fairly easy to implement some kind of fancy formatting (like we spoke about in the demangler thread), where we elide some information for deeply nested templates. Who knows, maybe the removal of long lists will also save some space in the dwarf. On Tue, 8 May 2018 at 18:35, Adrian Prantl via lldb-commits < lldb-commits@lists.llvm.org> wrote: > I made a small experiment where I manually edited the DW_AT_name in the assembler output: > Baseline: > $ lldb with_params > (lldb) target create "with_params" > (lldb) b 5 > (lldb) r > Process 28369 stopped > * thread #1, name = 'with_params', stop reason = breakpoint 1.1 > frame #0: 0x004004fc with_params`main(argc=1, argv=0x7fffe578) at template.cpp:5 > 2 > 3int main(int argc, char **argv) { > 4 MyC c = {23}; > -> 5 return c.t; > 6} > Target 0: (with_params) stopped. > (lldb) p c > (MyC) $0 = (t = 23) > ^^ > Without the parameters: > $ lldb no_params > (lldb) target create "no_params" > (lldb) b 5 > * thread #1, name = 'no_params', stop reason = breakpoint 1.1 > frame #0: 0x004004fc no_params`main(argc=1, argv=0x7fffe588) at template.cpp:5 > 2 > 3int main(int argc, char **argv) { > 4 MyC c = {23}; > -> 5 return c.t; > 6} > Target 0: (no_params) stopped. > (lldb) p c > (MyC) $0 = (t = 23) > ^ > Note how lldb uses the typename to print the result type of the expression. > -- adrian > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46606: General cleanup to minimize the .debug_types patch
labath added a comment. This looks fine to me. I am not clicking accept yet, so other debug info folks can take a look at this too. Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:28 // Out of memory? - if (cu_sp.get() == NULL) + if (!cu_sp) return nullptr; This is dead code. `new` will abort the program if it cannot allocate memory for the object. https://reviews.llvm.org/D46606 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r331855 - [DWARF] Align non-accelerated function fullname searching with the apple-tables path
Author: labath Date: Wed May 9 01:21:25 2018 New Revision: 331855 URL: http://llvm.org/viewvc/llvm-project?rev=331855&view=rev Log: [DWARF] Align non-accelerated function fullname searching with the apple-tables path Summary: Before this patch the two paths were doing very different things - the apple path searched the .apple_names section, which contained mangled names, as well as basenames of all functions. It returned any name it found. - the non-accelerated path looked in the "full name" index we built ourselves, which contained mangled as well as demangled names of all functions (but no basenames). Then however, if it did not find a match it did an extra search in the basename index, with some special handling for anonymous namespaces. This aligns the two paths by changing the non-accelerated path to return the same results as in the apple-tables one. In pratice, this means we will search in both the "basename", "method" and "fullname" indexes (in the manual indexes these are separate indexes. This means the function will return some slightly inappropriate results (e.g. bar::baz::foo when one asks for a "full name" foo), but this can be handled by additional filtering, independently indexing method. I've also stopped inserting demangled names into the "fullname" index, as that is inconsistent with the apple path. Reviewers: clayborg, JDevlieghere Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D46576 Modified: lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp?rev=331855&r1=331854&r2=331855&view=diff == --- lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp (original) +++ lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp Wed May 9 01:21:25 2018 @@ -8,6 +8,8 @@ // RUN: FileCheck --check-prefix=METHOD %s // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \ // RUN: FileCheck --check-prefix=FULL %s +// RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \ +// RUN: FileCheck --check-prefix=FULL-MANGLED %s // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ // RUN: FileCheck --check-prefix=CONTEXT %s // RUN: lldb-test symbols --name=not_there --find=function %t | \ @@ -24,9 +26,17 @@ // METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" // METHOD-DAG: name = "ffbar()::sbar::foo()", mangled = "_ZZ5ffbarvEN4sbar3fooEv" -// FULL: Found 2 functions: +// FULL: Found 7 functions: // FULL-DAG: name = "foo()", mangled = "_Z3foov" // FULL-DAG: name = "foo(int)", mangled = "_Z3fooi" +// FULL-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv" +// FULL-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv" +// FULL-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv" +// FULL-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" +// FULL-DAG: name = "ffbar()::sbar::foo()", mangled = "_ZZ5ffbarvEN4sbar3fooEv" + +// FULL-MANGLED: Found 1 functions: +// FULL-DAG: name = "foo(int)", mangled = "_Z3fooi" // CONTEXT: Found 1 functions: // CONTEXT-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv" Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=331855&r1=331854&r2=331855&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Wed May 9 01:21:25 2018 @@ -897,13 +897,8 @@ void DWARFUnit::IndexPrivate( if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { -Mangled mangled(ConstString(mangled_cstr), true); -func_fullnames.Insert(mangled.GetMangledName(), +func_fullnames.Insert(ConstString(mangled_cstr), DIERef(cu_offset, die.GetOffset())); -ConstString demangled = mangled.GetDemangledName(cu_language); -if (demangled) - func_fullnames.Insert(demangled, -DIERef(cu_offset, die.GetOffset())); } } } @@ -922,13 +917,8 @@ void DWARFUnit::IndexPrivate( if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { -Mangled mangled(ConstString(mangled_cstr), true); -func_fullnames.Insert(mangled.GetMang
[Lldb-commits] [PATCH] D46576: [DWARF] Align non-accelerated function fullname searching with the apple-tables path
This revision was automatically updated to reflect the committed changes. Closed by commit rL331855: [DWARF] Align non-accelerated function fullname searching with the apple-tables… (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D46576 Files: lldb/trunk/lit/SymbolFile/DWARF/find-basic-function.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2626,44 +2626,26 @@ if (!m_indexed) Index(); +DIEArray die_offsets; if (name_type_mask & eFunctionNameTypeFull) { - FindFunctions(name, m_function_fullname_index, include_inlines, sc_list); + uint32_t num_matches = m_function_basename_index.Find(name, die_offsets); + num_matches += m_function_method_index.Find(name, die_offsets); + num_matches += m_function_fullname_index.Find(name, die_offsets); + for (uint32_t i = 0; i < num_matches; i++) { +const DIERef &die_ref = die_offsets[i]; +DWARFDIE die = info->GetDIE(die_ref); +if (die) { + if (!DIEInDeclContext(parent_decl_ctx, die)) +continue; // The containing decl contexts don't match - // FIXME Temporary workaround for global/anonymous namespace - // functions debugging FreeBSD and Linux binaries. If we didn't find any - // functions in the global namespace try looking in the basename index - // but ignore any returned functions that have a namespace but keep - // functions which have an anonymous namespace - // TODO: The arch in the object file isn't correct for MSVC - // binaries on windows, we should find a way to make it correct and - // handle those symbols as well. - if (sc_list.GetSize() == original_size) { -ArchSpec arch; -if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && -arch.GetTriple().isOSBinFormatELF()) { - SymbolContextList temp_sc_list; - FindFunctions(name, m_function_basename_index, include_inlines, -temp_sc_list); - SymbolContext sc; - for (uint32_t i = 0; i < temp_sc_list.GetSize(); i++) { -if (temp_sc_list.GetContextAtIndex(i, sc)) { - ConstString mangled_name = - sc.GetFunctionName(Mangled::ePreferMangled); - ConstString demangled_name = - sc.GetFunctionName(Mangled::ePreferDemangled); - // Mangled names on Linux and FreeBSD are of the form: - // _ZN18function_namespace13function_nameEv. - if (strncmp(mangled_name.GetCString(), "_ZN", 3) || - !strncmp(demangled_name.GetCString(), "(anonymous namespace)", - 21)) { -sc_list.Append(sc); - } -} + if (resolved_dies.find(die.GetDIE()) == resolved_dies.end()) { +if (ResolveFunction(die, include_inlines, sc_list)) + resolved_dies.insert(die.GetDIE()); } } } + die_offsets.clear(); } -DIEArray die_offsets; if (name_type_mask & eFunctionNameTypeBase) { uint32_t num_base = m_function_basename_index.Find(name, die_offsets); for (uint32_t i = 0; i < num_base; i++) { Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -897,13 +897,8 @@ if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { -Mangled mangled(ConstString(mangled_cstr), true); -func_fullnames.Insert(mangled.GetMangledName(), +func_fullnames.Insert(ConstString(mangled_cstr), DIERef(cu_offset, die.GetOffset())); -ConstString demangled = mangled.GetDemangledName(cu_language); -if (demangled) - func_fullnames.Insert(demangled, -DIERef(cu_offset, die.GetOffset())); } } } @@ -922,13 +917,8 @@ if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { -Mangled mangled(ConstString(mangled_cstr), true); -func_fullnames.Insert(mangled.GetMangledName(), +func_fullnames.Insert(ConstString(mangled_cstr), DIERef(cu_offset, die.GetOffset())); -
Re: [Lldb-commits] [RFC] Type lookup for template types is broken...
On Tue, 8 May 2018 at 18:27, via lldb-commits wrote: > Clang can control the emission of or not in the name, using the "debugger tuning" feature. It sounds like neither LLDB nor PS4 will mind losing the in the name, and it makes the indexing simpler. If the tuning is set for GDB then we can still emit the in the names. > It would make me uncomfortable to have the index and the actual DWARF be inconsistent, but given the way templates work in general (a variety of spellings all refer to the same type) it is probably better to use the un-decorated name in the index even if the DWARF itself used decorated names. This should probably be proposed as a revision for DWARF 6. > --paulr I just ran into this sort of an inconsistency issue while working on the DWARFVerifier. I hope I don't end up hijacking the thread, but I thought I'd write here as it is related to the above issue and all interested parties are following this thread already. Background: In D45323 I added code which (among other things) checks that the names in the index match the debug_info names. Because the implementation had a bug (I forgot to do a ++NumErrors), the error only surfaced when I committed D46583 (which added the missing increment). Anyway, the issue is that the PS4 targets don't emit DW_AT_linkage_name attributes in the debug info, but we are still emitting an index entry with the mangled names. This caused the verifier to complain. Two interesting questions follow from this: 1. (mainly for Paul, I guess) Should we fix the debug_names generator to not emit the linkage name index entry for PS4 targets? 2. (for everyone) Is this verifier check actually valid? This depending on the interpretation of the last (non-normative) paragraph of Section 6.1.1.1 (*). One way of reading it is that a producer is allowed to insert additional entries into the name index. Another would be that we can also insert additional names for existing entries. This is interesting here because this is exactly what the the template stripping proposal would do (add extra names to existing entries). If we don't remove that check, it will cause the verifier to complain again. regards pavel (*) The intent of the above rules is to provide the consumer with some assurance that looking up an unqualified name in the index will yield all relevant debugging information entries that provide a defining declaration at global scope for that name. A producer may choose to implement additional rules for what names are placed in the index, and may communicate those rules to a cooperating consumer via an augmentation string, described below. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
polyakov.alex updated this revision to Diff 145909. polyakov.alex retitled this revision from "[WIP][LLDB-MI] Add possibility to set breakpoints without selecting a target." to "[LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.". polyakov.alex edited the summary of this revision. polyakov.alex added a comment. Added testcase and updated revision. Repository: rL LLVM https://reviews.llvm.org/D46588 Files: packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py tools/lldb-mi/MICmdCmdBreak.cpp tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp === --- tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -871,7 +871,10 @@ // Throws: None. //-- lldb::SBTarget CMICmnLLDBDebugSessionInfo::GetTarget() const { - return GetDebugger().GetSelectedTarget(); + auto target = GetDebugger().GetSelectedTarget(); + if (target.IsValid()) +return target; + return GetDebugger().GetDummyTarget(); } //++ Index: tools/lldb-mi/MICmdCmdBreak.cpp === --- tools/lldb-mi/MICmdCmdBreak.cpp +++ tools/lldb-mi/MICmdCmdBreak.cpp @@ -148,6 +148,11 @@ CMICMDBASE_GETOPTION(pArgRestrictBrkPtToThreadId, OptionShort, m_constStrArgNamedRestrictBrkPtToThreadId); + // Ask LLDB for the target to check if we have valid or dummy one. + CMICmnLLDBDebugSessionInfo &rSessionInfo( + CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBTarget sbTarget = rSessionInfo.GetTarget(); + m_bBrkPtEnabled = !pArgDisableBrkPt->GetFound(); m_bBrkPtIsTemp = pArgTempBrkPt->GetFound(); m_bHaveArgOptionThreadGrp = pArgThreadGroup->GetFound(); @@ -157,7 +162,12 @@ nThreadGrp); m_strArgOptionThreadGrp = CMIUtilString::Format("i%d", nThreadGrp); } - m_bBrkPtIsPending = pArgPendingBrkPt->GetFound(); + + if (sbTarget == rSessionInfo.GetDebugger().GetDummyTarget()) +m_bBrkPtIsPending = true; + else +m_bBrkPtIsPending = pArgPendingBrkPt->GetFound(); + if (pArgLocation->GetFound()) m_brkName = pArgLocation->GetValue(); else if (m_bBrkPtIsPending) { @@ -225,9 +235,6 @@ // Ask LLDB to create a breakpoint bool bOk = MIstatus::success; - CMICmnLLDBDebugSessionInfo &rSessionInfo( - CMICmnLLDBDebugSessionInfo::Instance()); - lldb::SBTarget sbTarget = rSessionInfo.GetTarget(); switch (eBrkPtType) { case eBreakPoint_ByAddress: m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress); Index: packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py === --- packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -143,6 +143,32 @@ self.expect("\^running") self.expect("\*stopped,reason=\"breakpoint-hit\"") +@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows. +@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races. +@skipIfRemote # We do not currently support remote debugging via the MI. +def test_lldbmi_break_insert_without_target(self): +"""Test that 'lldb-mi --interpreter' can set breakpoints without +selecting a valid target.""" + +self.spawnLldbMi(args=None) + +# This command have to insert breakpoint to the dummy target. +self.runCmd("-break-insert main") +# FIXME function name is unknown on Darwin, fullname should be ??, line is -1 +self.expect( + "\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\"," + "addr=\"0x\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\"," + "line=\"0\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}" +) + +# Add a valid target. +self.runCmd("-file-exec-and-symbols %s" % self.myexe) +self.expect("\^done") + +self.runCmd("-exec-run") +self.expect("\^running") +self.expect("\*stopped,reason=\"breakpoint-hit\"") + @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @skipIfRemote # We do not currently support remote debugging via the MI. Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp === --- tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -871,7 +871,10 @@ // Throws: None. //-- lldb::SBTarget CMICmnLLDBDebugSessionInfo::GetTarget() const { - return GetDebugger().GetSelectedTarget(); + auto target = GetDebugger().GetSelectedTarget(); + if (target.IsValid()) +return target; + retur
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
labath added a comment. Out of curiosity, are there any plans to improve the lldb-mi test reliability situation? As it stands now, most of the lldb-mi tests are disabled one way or another due to them being flaky. Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r331880 - Modernize and clean-up the Predicate class
Author: labath Date: Wed May 9 07:29:30 2018 New Revision: 331880 URL: http://llvm.org/viewvc/llvm-project?rev=331880&view=rev Log: Modernize and clean-up the Predicate class Summary: The comments on this class were out of date with the implementation, and the implementation itself was inconsistent with our usage of the Timeout class (I started converting everything to use this class back in D27136, but I missed this one). I avoid duplicating the waiting logic by introducing a templated WaitFor function, and make other functions delegate to that. This function can be also used as a replacement for the unused WaitForBitToBeSet functions I removed, if it turns out to be necessary. As this changes the meaning of a "zero" timeout, I tracked down all the callers of these functions and updated them accordingly. Propagating the changes to all the callers of RunShellCommand was a bit too much for this patch, so I stopped there and will continue that in a follow-up patch. I also add some basic unittests for the functions I modified. Reviewers: jingham, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D46580 Added: lldb/trunk/unittests/Host/PredicateTest.cpp Modified: lldb/trunk/include/lldb/Core/Event.h lldb/trunk/include/lldb/Host/Predicate.h lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/unittests/Host/CMakeLists.txt Modified: lldb/trunk/include/lldb/Core/Event.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Event.h?rev=331880&r1=331879&r2=331880&view=diff == --- lldb/trunk/include/lldb/Core/Event.h (original) +++ lldb/trunk/include/lldb/Core/Event.h Wed May 9 07:29:30 2018 @@ -121,9 +121,8 @@ public: const ConstString &GetFlavor() const override { return GetFlavorString(); } - bool WaitForEventReceived( - const std::chrono::microseconds &abstime = std::chrono::microseconds(0)) { -return m_predicate.WaitForValueEqualTo(true, abstime); + bool WaitForEventReceived(const Timeout &timeout = llvm::None) { +return m_predicate.WaitForValueEqualTo(true, timeout); } private: Modified: lldb/trunk/include/lldb/Host/Predicate.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Predicate.h?rev=331880&r1=331879&r2=331880&view=diff == --- lldb/trunk/include/lldb/Host/Predicate.h (original) +++ lldb/trunk/include/lldb/Host/Predicate.h Wed May 9 07:29:30 2018 @@ -20,6 +20,7 @@ // Other libraries and framework includes // Project includes +#include "lldb/Utility/Timeout.h" #include "lldb/lldb-defines.h" //#define DB_PTHREAD_LOG_EVENTS @@ -118,6 +119,40 @@ public: } //-- + /// Wait for Cond(m_value) to be true. + /// + /// Waits in a thread safe way for Cond(m_value) to be true. If Cond(m_value) + /// is already true, this function will return without waiting. + /// + /// It is possible for the value to be changed between the time the value is + /// set and the time the waiting thread wakes up. If the value no longer + /// satisfies the condition when the waiting thread wakes up, it will go back + /// into a wait state. It may be necessary for the calling code to use + /// additional thread synchronization methods to detect transitory states. + /// + /// @param[in] Cond + /// The condition we want \a m_value satisfy. + /// + /// @param[in] timeout + /// How long to wait for the condition to hold. + /// + /// @return + /// @li m_value if Cond(m_value) is true. + /// @li None otherwise (timeout occurred). + //-- + template + llvm::Optional WaitFor(C Cond, const Timeout &timeout) { +std::unique_lock lock(m_mutex); +auto RealCond = [&] { return Cond(m_value); }; +if (!timeout) { + m_condition.wait(lock, RealCond); + return m_value; +} +if (m_condition.wait_for(lock, *timeout, RealCond)) + return m_value; +return llvm::None; + } + //-- /// Wait for \a m_value to be equal to \a value. /// /// Waits in a thread safe way for \a m_value to be equal to \a @@ -134,38 +169,17 @@ public: /// @param[in] value /// The value we want \a m_value to be equal to. /// - /// @param[in] abstime - /// If non-nullptr, the absolute time at whic
[Lldb-commits] [PATCH] D46580: Modernize and clean-up the Predicate class
This revision was automatically updated to reflect the committed changes. Closed by commit rL331880: Modernize and clean-up the Predicate class (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D46580?vs=145682&id=145913#toc Repository: rL LLVM https://reviews.llvm.org/D46580 Files: lldb/trunk/include/lldb/Core/Event.h lldb/trunk/include/lldb/Host/Predicate.h lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/unittests/Host/CMakeLists.txt lldb/trunk/unittests/Host/PredicateTest.cpp Index: lldb/trunk/unittests/Host/CMakeLists.txt === --- lldb/trunk/unittests/Host/CMakeLists.txt +++ lldb/trunk/unittests/Host/CMakeLists.txt @@ -3,6 +3,7 @@ HostInfoTest.cpp HostTest.cpp MainLoopTest.cpp + PredicateTest.cpp SocketAddressTest.cpp SocketTest.cpp SymbolsTest.cpp Index: lldb/trunk/unittests/Host/PredicateTest.cpp === --- lldb/trunk/unittests/Host/PredicateTest.cpp +++ lldb/trunk/unittests/Host/PredicateTest.cpp @@ -0,0 +1,34 @@ +//===-- PredicateTest.cpp ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "lldb/Host/Predicate.h" +#include "gtest/gtest.h" +#include + +using namespace lldb_private; + +TEST(Predicate, WaitForValueEqualTo) { + Predicate P(0); + EXPECT_TRUE(P.WaitForValueEqualTo(0)); + EXPECT_FALSE(P.WaitForValueEqualTo(1, std::chrono::milliseconds(10))); + + std::thread Setter([&P] { +std::this_thread::sleep_for(std::chrono::milliseconds(100)); +P.SetValue(1, eBroadcastAlways); + }); + EXPECT_TRUE(P.WaitForValueEqualTo(1)); + Setter.join(); +} + +TEST(Predicate, WaitForValueNotEqualTo) { + Predicate P(0); + EXPECT_EQ(0, P.WaitForValueNotEqualTo(1)); + EXPECT_EQ(llvm::None, +P.WaitForValueNotEqualTo(0, std::chrono::milliseconds(10))); +} Index: lldb/trunk/source/Target/Process.cpp === --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -947,21 +947,25 @@ return state; } -void Process::SyncIOHandler(uint32_t iohandler_id, uint64_t timeout_msec) { +void Process::SyncIOHandler(uint32_t iohandler_id, +const Timeout &timeout) { // don't sync (potentially context switch) in case where there is no process // IO if (!m_process_input_reader) return; - uint32_t new_iohandler_id = 0; - m_iohandler_sync.WaitForValueNotEqualTo( - iohandler_id, new_iohandler_id, std::chrono::milliseconds(timeout_msec)); + auto Result = m_iohandler_sync.WaitForValueNotEqualTo(iohandler_id, timeout); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - if (log) -log->Printf("Process::%s waited for m_iohandler_sync to change from %u, " -"new value is %u", -__FUNCTION__, iohandler_id, new_iohandler_id); + if (Result) { +LLDB_LOG( +log, +"waited from m_iohandler_sync to change from {0}. New value is {1}.", +iohandler_id, *Result); + } else { +LLDB_LOG(log, "timed out waiting for m_iohandler_sync to change from {0}.", + iohandler_id); + } } StateType Process::WaitForProcessToStop(const Timeout &timeout, Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -1133,7 +1133,7 @@ ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)GetConnection(); // Wait for 10 seconds to resolve the bound port -uint16_t port_ = connection->GetListeningPort(10); +uint16_t port_ = connection->GetListeningPort(std::chrono::seconds(10)); if (port_ > 0) { char port_cstr[32]; snprintf(port_cstr, sizeof(port_cstr), "127.0.0.1:%i", port_); Index: lldb/trunk/source/Commands/CommandObjectProcess.cpp === --- lldb/trunk/source/Commands/CommandObjectProcess.cpp +++ lldb/trunk/
[Lldb-commits] [lldb] r331882 - Fix Windows build for the Predicate.h refactor in r331880
Author: labath Date: Wed May 9 07:49:43 2018 New Revision: 331882 URL: http://llvm.org/viewvc/llvm-project?rev=331882&view=rev Log: Fix Windows build for the Predicate.h refactor in r331880 Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp?rev=331882&r1=331881&r2=331882&view=diff == --- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Wed May 9 07:49:43 2018 @@ -363,8 +363,8 @@ DebuggerThread::HandleExceptionEvent(con m_exception_pred.SetValue(result, eBroadcastNever); LLDB_LOG(log, "waiting for ExceptionPred != BreakInDebugger"); - m_exception_pred.WaitForValueNotEqualTo(ExceptionResult::BreakInDebugger, - result); + result = *m_exception_pred.WaitForValueNotEqualTo( + ExceptionResult::BreakInDebugger); LLDB_LOG(log, "got ExceptionPred = {0}", (int)m_exception_pred.GetValue()); return result; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46606: General cleanup to minimize the .debug_types patch
clayborg updated this revision to Diff 145926. clayborg added a comment. Remove check for NULL cu_sp shared pointer as Pavel noted. https://reviews.llvm.org/D46606 Files: include/lldb/lldb-forward.h source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp source/Plugins/SymbolFile/DWARF/DWARFDIE.h source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3776,7 +3776,7 @@ location_is_const_value_data = true; // The constant value will be either a block, a data value or a // string. - const DWARFDataExtractor &debug_info_data = get_debug_info_data(); + auto debug_info_data = die.GetData(); if (DWARFFormValue::IsBlockForm(form_value.Form())) { // Retrieve the value as a block expression. uint32_t block_offset = @@ -3833,13 +3833,12 @@ location_is_const_value_data = false; has_explicit_location = true; if (DWARFFormValue::IsBlockForm(form_value.Form())) { - const DWARFDataExtractor &debug_info_data = get_debug_info_data(); + auto data = die.GetData(); uint32_t block_offset = - form_value.BlockData() - debug_info_data.GetDataStart(); + form_value.BlockData() - data.GetDataStart(); uint32_t block_length = form_value.Unsigned(); - location.CopyOpcodeData(module, get_debug_info_data(), - block_offset, block_length); + location.CopyOpcodeData(module, data, block_offset, block_length); } else { const DWARFDataExtractor &debug_loc_data = get_debug_loc_data(); const dw_offset_t debug_loc_offset = form_value.Unsigned(); Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -44,28 +44,57 @@ uint32_t depth = UINT32_MAX) const; bool Verify(lldb_private::Stream *s) const; virtual void Dump(lldb_private::Stream *s) const = 0; + //-- + /// Get the data that contains the DIE information for this unit. + /// + /// This will return the correct bytes that contain the data for + /// this DWARFUnit. It could be .debug_info or .debug_types + /// depending on where the data for this unit originates. + /// + /// @return + /// The correct data for the DIE information in this unit. + //-- + virtual const lldb_private::DWARFDataExtractor &GetData() const = 0; + //-- + /// Get the size in bytes of the compile unit header. + /// + /// @return + /// Byte size of the compile unit header + //-- + virtual uint32_t GetHeaderByteSize() const = 0; // Offset of the initial length field. dw_offset_t GetOffset() const { return m_offset; } lldb::user_id_t GetID() const; - // Size in bytes of the initial length + compile unit header. - uint32_t Size() const; + //-- + /// Get the size in bytes of the length field in the header. + /// + /// In DWARF32 this is just 4 bytes, and DWARF64 it is 12 where 4 + /// are 0x followed by the actual 64 bit length. + /// + /// @return + /// Byte size of the compile unit header length field + //-- + size_t GetLengthByteSize() const { return IsDWARF64() ? 12 : 4; } + bool ContainsDIEOffset(dw_offset_t die_offset) const { return die_offset >= GetFirstDIEOffset() && die_offset < GetNextCompileUnitOffset(); } - dw_offset_t GetFirstDIEOffset() const { return m_offset + Size(); } + dw_offset_t GetFirstDIEOffset() const { +return m_offset + GetHeaderByt
[Lldb-commits] [lldb] r331886 - [lit, lldbsuite] Add a bug reference to the failing TestLinuxCore and fix an undefined property in dotest.py
Author: stella.stamenova Date: Wed May 9 08:35:19 2018 New Revision: 331886 URL: http://llvm.org/viewvc/llvm-project?rev=331886&view=rev Log: [lit, lldbsuite] Add a bug reference to the failing TestLinuxCore and fix an undefined property in dotest.py Summary: 1) In TestLinuxCore rather than skipping the tests on Windows, mark them as expected failures and add a bug reference 2) In dotest.py replace the undefined property in the exceptions with the actual property causing the exception Reviewers: asmith, labath, zturner Reviewed By: labath, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46590 Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=331886&r1=331885&r2=331886&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Wed May 9 08:35:19 2018 @@ -1208,11 +1208,11 @@ def run_suite(): configuration.lldb_platform_working_dir, 448) # 448 = 0o700 if error.Fail(): raise Exception("making remote directory '%s': %s" % ( -remote_test_dir, error)) +configuration.lldb_platform_working_dir, error)) if not lldb.remote_platform.SetWorkingDirectory( configuration.lldb_platform_working_dir): -raise Exception("failed to set working directory '%s'" % remote_test_dir) +raise Exception("failed to set working directory '%s'" % configuration.lldb_platform_working_dir) lldb.DBG.SetSelectedPlatform(lldb.remote_platform) else: lldb.remote_platform = None Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=331886&r1=331885&r2=331886&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py Wed May 9 08:35:19 2018 @@ -40,52 +40,52 @@ class LinuxCoreTestCase(TestBase): lldb.DBG.SetSelectedPlatform(self._initial_platform) super(LinuxCoreTestCase, self).tearDown() -@skipIf(oslist=['windows']) +@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) @skipIf(triple='^mips') def test_i386(self): """Test that lldb can read the process information from an i386 linux core file.""" self.do_test("linux-i386", self._i386_pid, self._i386_regions, "a.out") -@skipIf(oslist=['windows']) +@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) def test_mips_o32(self): """Test that lldb can read the process information from an MIPS O32 linux core file.""" self.do_test("linux-mipsel-gnuabio32", self._mips_o32_pid, self._mips_regions, "linux-mipsel-gn") -@skipIf(oslist=['windows']) +@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) def test_mips_n32(self): """Test that lldb can read the process information from an MIPS N32 linux core file """ self.do_test("linux-mips64el-gnuabin32", self._mips64_n32_pid, self._mips_regions, "linux-mips64el-") -@skipIf(oslist=['windows']) +@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) def test_mips_n64(self): """Test that lldb can read the process information from an MIPS N64 linux core file """ self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid, self._mips_regions, "linux-mips64el-") -@skipIf(oslist=['windows']) +@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) @skipIf(triple='^mips') def test_ppc64le(self): """Test that lldb can read the process information from an ppc64le linux core file.""" self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions, "linux-ppc64le.ou") -@skipIf(oslist=['windows']) +@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"]) @skipIf(triple='^mips') def test_x86_64(self): """Test that lldb can read the process information from an x86_64 linux core file.""" self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions, "a.out") -@skipIf(oslist=['windows']) +@expected
[Lldb-commits] [PATCH] D46606: General cleanup to minimize the .debug_types patch
aprantl accepted this revision. aprantl added a comment. This revision is now accepted and ready to land. Looks like this is bringing the interface a *little* closer to the llvm one. Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h:40 + //-- + uint32_t GetHeaderByteSize() const override { +return m_is_dwarf64 ? 23 : 11; Looking at the LLVM implementation, this is only correct fro DWARF 4. Out of curiosity, do we have any plans to ever support DWARF 5 in LLDB's DWARF parser or are we planning to get that from moving to the LLVM implementation? (I'd clearly prefer the second option). https://reviews.llvm.org/D46606 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
aprantl added a comment. In https://reviews.llvm.org/D46588#1092884, @labath wrote: > Out of curiosity, are there any plans to improve the lldb-mi test reliability > situation? As it stands now, most of the lldb-mi tests are disabled one way > or another due to them being flaky. Thanks for bringing that up. I just looked at a few lldb-mi testcases and they all seem to follow a pattern of `self.runCmd()` followed by `self.expect()`. That in itself doesn't look like a particularly bad design to me since it synchronizes commands and expected output tightly. Do we know why the tests are flakey? Do they get out of sync, or is there something else? Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D45628: [LLDB] Support GNU-style compressed debug sections (.zdebug)
alur updated this revision to Diff 145939. alur retitled this revision from "[LLDB] Support compressed debug info sections (.zdebug*)" to "[LLDB] Support GNU-style compressed debug sections (.zdebug)". alur added a comment. Updated the diff to be against head, again. https://reviews.llvm.org/D45628 Files: packages/Python/lldbsuite/test/linux/compressed-debug-info/Makefile packages/Python/lldbsuite/test/linux/compressed-debug-info/TestCompressedDebugInfo.py packages/Python/lldbsuite/test/linux/compressed-debug-info/a.c source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1757,6 +1757,63 @@ return 0; } +static SectionType getSectionType(llvm::StringRef section_name) { + if (!section_name.startswith(".")) { +return eSectionTypeOther; + } + + // MISSING? .gnu_debugdata - "mini debuginfo / MiniDebugInfo" section, + // http://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html + // MISSING? .debug-index - + // http://src.chromium.org/viewvc/chrome/trunk/src/build/gdb-add-index?pathrev=144644 + return llvm::StringSwitch(section_name.drop_front(1)) + .Case("text", eSectionTypeCode) + .Case("data", eSectionTypeData) + .Case("bss", eSectionTypeZeroFill) + .Case("tdata", eSectionTypeData) + .Case("tbss", eSectionTypeZeroFill) + // Abbreviations used in the .debug_info section + .Case("debug_abbrev", eSectionTypeDWARFDebugAbbrev) + .Case("debug_abbrev.dwo", eSectionTypeDWARFDebugAbbrev) + .Case("debug_addr", eSectionTypeDWARFDebugAddr) + // Lookup table for mapping addresses to compilation units + .Case("debug_aranges", eSectionTypeDWARFDebugAranges) + .Case("debug_cu_index", eSectionTypeDWARFDebugCuIndex) + // Call frame information + .Case("debug_frame", eSectionTypeDWARFDebugFrame) + // The core DWARF information section + .Case("debug_info", eSectionTypeDWARFDebugInfo) + .Case("debug_info.dwo", eSectionTypeDWARFDebugInfo) + // Line number information + .Case("debug_line", eSectionTypeDWARFDebugLine) + .Case("debug_line.dwo", eSectionTypeDWARFDebugLine) + // Location lists used in DW_AT_location attributes + .Case("debug_loc", eSectionTypeDWARFDebugLoc) + .Case("debug_loc.dwo", eSectionTypeDWARFDebugLoc) + // Macro information + .Case("debug_macinfo", eSectionTypeDWARFDebugMacInfo) + .Case("debug_macro", eSectionTypeDWARFDebugMacro) + .Case("debug_macro.dwo", eSectionTypeDWARFDebugMacro) + // Lookup table for mapping object and function names to compilation units + .Case("debug_pubnames", eSectionTypeDWARFDebugPubNames) + // Lookup table for mapping type names to compilation units + .Case("debug_pubtypes", eSectionTypeDWARFDebugPubTypes) + // Address ranges used in DW_AT_ranges attributes + .Case("debug_ranges", eSectionTypeDWARFDebugRanges) + // String table used in .debug_info + .Case("debug_str", eSectionTypeDWARFDebugStr) + .Case("debug_str.dwo", eSectionTypeDWARFDebugStr) + .Case("debug_str_offsets", eSectionTypeDWARFDebugStrOffsets) + .Case("debug_str_offsets.dwo", eSectionTypeDWARFDebugStrOffsets) + .Case("debug_types", eSectionTypeDWARFDebugTypes) + .Case("gnu_debugaltlink", eSectionTypeDWARFGNUDebugAltLink) + .Case("eh_frame", eSectionTypeEHFrame) + .Case("ARM.exidx", eSectionTypeARMexidx) + .Case("ARM.extab", eSectionTypeARMextab) + .Case("gosymtab", eSectionTypeGoSymtab) + .Default(eSectionTypeOther); +} + void ObjectFileELF::CreateSections(SectionList &unified_section_list) { if (!m_sections_ap.get() && ParseSectionHeaders()) { m_sections_ap.reset(new SectionList()); @@ -1771,137 +1828,14 @@ I != m_section_headers.end(); ++I) { const ELFSectionHeaderInfo &header = *I; - ConstString &name = I->section_name; + llvm::StringRef section_name = I->section_name.GetStringRef(); const uint64_t file_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size; const uint64_t vm_size = header.sh_flags & SHF_ALLOC ? header.sh_size : 0; - static ConstString g_sect_name_text(".text"); - static ConstString g_sect_name_data(".data"); - static ConstString g_sect_name_bss(".bss"); - static ConstString g_sect_name_tdata(".tdata"); - static ConstString g_sect_name_tbss(".tbss"); - static ConstString g_sect_name_dwarf_debug_abbrev(".debug_abbrev"); - static ConstString g_sect_name_dwarf_debug_addr(".debug_addr"); - static ConstString g_sect_name_dwarf_debug_aranges(".debug_aranges"); - static ConstString g_sect_name_dwarf_debug_cu_index(".debug_cu_index"); - static ConstString g_sect_name_dwarf_debug_frame(".debug_frame"); - static Con
[Lldb-commits] [PATCH] D45628: [LLDB] Support GNU-style compressed debug sections (.zdebug)
alur added a comment. Friendly ping on this again. I re-merged the patch against head. https://reviews.llvm.org/D45628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
labath added a comment. In https://reviews.llvm.org/D46588#1093054, @aprantl wrote: > In https://reviews.llvm.org/D46588#1092884, @labath wrote: > > > Out of curiosity, are there any plans to improve the lldb-mi test > > reliability situation? As it stands now, most of the lldb-mi tests are > > disabled one way or another due to them being flaky. > > > Thanks for bringing that up. I just looked at a few lldb-mi testcases and > they all seem to follow a pattern of `self.runCmd()` followed by > `self.expect()`. That in itself doesn't look like a particularly bad design > to me since it synchronizes commands and expected output tightly. Do we know > why the tests are flakey? Do they get out of sync, or is there something else? Short answer: I don't know. Noone was motived enough to get to the bottom of that. I tried looking at it once or twice, but I was put off by: - when the test fails you get a dump of the pexpect state, which is hard to comprehend - I tried enabling some logging but the log was full of useless messages because lldb-mi has a thread which does a 1 millisecond polls for events. I think it would help if instead of pexpect, we used some driver which is aware of the basics of lldb-mi protocol. This would make logging the execution of a test easier and it would solve the XFAIL issue -- right now, if lldb-mi does not produce expected output, pexpect will just hang until it times out, hoping that the right output might come eventually. And it would also make it possible to run the tests on windows. The 1ms wait also sounds like something that should be fixed regardless of whether it is causing any flakyness or not. Repository: rL LLVM https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
aprantl added a comment. Okay, that's no good. What would you think about writing tests using lit & FileCheck? The lldb-mi tests should not be in the debuginfo category anyway, since they only test the alternative driver. $ cat lldb-mi-demo.input -file-exec-and-symbols a.out -break-insert -f main ... $ cat lldb-mi-demo.test RUN: %cc test.c -g RUN: %lldb-mi https://reviews.llvm.org/D46588 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46606: General cleanup to minimize the .debug_types patch
This revision was automatically updated to reflect the committed changes. Closed by commit rL331892: General cleanup to minimize the .debug_types patch (authored by gclayton, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D46606?vs=145926&id=145946#toc Repository: rL LLVM https://reviews.llvm.org/D46606 Files: lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3758,7 +3758,7 @@ location_is_const_value_data = true; // The constant value will be either a block, a data value or a // string. - const DWARFDataExtractor &debug_info_data = get_debug_info_data(); + auto debug_info_data = die.GetData(); if (DWARFFormValue::IsBlockForm(form_value.Form())) { // Retrieve the value as a block expression. uint32_t block_offset = @@ -3815,13 +3815,12 @@ location_is_const_value_data = false; has_explicit_location = true; if (DWARFFormValue::IsBlockForm(form_value.Form())) { - const DWARFDataExtractor &debug_info_data = get_debug_info_data(); + auto data = die.GetData(); uint32_t block_offset = - form_value.BlockData() - debug_info_data.GetDataStart(); + form_value.BlockData() - data.GetDataStart(); uint32_t block_length = form_value.Unsigned(); - location.CopyOpcodeData(module, get_debug_info_data(), - block_offset, block_length); + location.CopyOpcodeData(module, data, block_offset, block_length); } else { const DWARFDataExtractor &debug_loc_data = get_debug_loc_data(); const dw_offset_t debug_loc_offset = form_value.Unsigned(); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -20,14 +20,10 @@ : DWARFUnit(dwarf2Data) {} DWARFUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data, -lldb::offset_t *offset_ptr) { + const DWARFDataExtractor &debug_info, + lldb::offset_t *offset_ptr) { // std::make_shared would require the ctor to be public. std::shared_ptr cu_sp(new DWARFCompileUnit(dwarf2Data)); - // Out of memory? - if (cu_sp.get() == NULL) -return nullptr; - - const DWARFDataExtractor &debug_info = dwarf2Data->get_debug_info_data(); cu_sp->m_offset = *offset_ptr; @@ -67,3 +63,8 @@ m_offset, m_length, m_version, GetAbbrevOffset(), m_addr_size, GetNextCompileUnitOffset()); } + + +const lldb_private::DWARFDataExtractor &DWARFCompileUnit::GetData() const { + return m_dwarf->get_debug_info_data(); +} Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h @@ -44,13 +44,6 @@ DWARFDIE GetDIEForDIEOffset(dw_offset_t die_offset); DWARFDIE GetDIE(const DIERef &die_ref); - void Dump(lldb_private::Stream *s, const uint32_t die_offset, -const uint32_t recurse_depth); - static void Parse(SymbolFileDWARF *parser, Callback callback, void *userData); - static void Verify(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data); - static void Dump(lldb_private::Stream *s, SymbolFileDWARF *dwarf2Data, - const uint32_t die_o
[Lldb-commits] [lldb] r331892 - General cleanup to minimize the .debug_types patch
Author: gclayton Date: Wed May 9 09:42:53 2018 New Revision: 331892 URL: http://llvm.org/viewvc/llvm-project?rev=331892&view=rev Log: General cleanup to minimize the .debug_types patch This cleanup is designed to make the https://reviews.llvm.org/D32167 patch smaller and easier to read. Cleanup in this patch: Allow DWARFUnit subclasses to hand out the data that should be used when decoding data for a DIE. The information might be in .debug_info or could be in .debug_types. There is a new virtual function on DWARFUnit that each subclass must override: virtual const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const; This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different data to be used when decoding the DIE information. Add a new pure virtual function to get the size of the DWARF unit header: virtual uint32_t DWARFUnit::GetHeaderByteSize() const = 0; This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different offsets where the first DIE starts when decoding DIE information from the unit. Added a new function to DWARFDataExtractor to get the size of an offset: size_t DWARFDataExtractor::GetDWARFSizeOfOffset() const; Removed dead dumping and parsing code in the DWARFDebugInfo class. Inlined a bunch of calls in DWARFUnit for accessors that were just returning integer member variables. Renamed DWARFUnit::Size() to DWARFUnit::GetHeaderByteSize() as it clearly states what it is doing and makes more sense. Differential Revision: https://reviews.llvm.org/D46606 Modified: lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/include/lldb/lldb-forward.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=331892&r1=331891&r2=331892&view=diff == --- lldb/trunk/include/lldb/lldb-forward.h (original) +++ lldb/trunk/include/lldb/lldb-forward.h Wed May 9 09:42:53 2018 @@ -76,6 +76,7 @@ class ConnectionFileDescriptor; class ConstString; class CXXSyntheticChildren; class DWARFCallFrameInfo; +class DWARFDataExtractor; class DWARFExpression; class DataBuffer; class DataEncoder; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=331892&r1=331891&r2=331892&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Wed May 9 09:42:53 2018 @@ -2868,8 +2868,7 @@ bool DWARFASTParserClang::ParseChildMemb if (form_value.BlockData()) { Value initialValue(0); Value memberOffset(0); -const DWARFDataExtractor &debug_info_data = -die.GetDWARF()->get_debug_info_data(); +const DWARFDataExtractor &debug_info_data = die.GetData(); uint32_t block_length = form_value.Unsigned(); uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); @@ -3330,8 +3329,7 @@ bool DWARFASTParserClang::ParseChildMemb if (form_value.BlockData()) { Value initialValue(0); Value memberOffset(0); -const DWARFDataExtractor &debug_info_data = -die.GetDWARF()->get_debug_info_data(); +const DWARFDataExtractor &debug_info_data = die.GetData(); uint32_t block_length = form_value.Unsigned(); uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp?rev=331892&r1=331