[Lldb-commits] [PATCH] D61483: [www] list command: lldb run
kkleine added a comment. @labath @jingham @teemperor I've updated the documentation in both, the new and the old places. Can you please merge this? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61483/new/ https://reviews.llvm.org/D61483 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61438: [ASTImporter] Use llvm::Expected and Error in the importer API
martong updated this revision to Diff 198618. martong added a comment. - Add braces to 'true' cases when 'false' case has braces - Simplify logging and error handling with LLDB_LOG_ERROR Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61438/new/ https://reviews.llvm.org/D61438 Files: clang/include/clang/AST/ASTImporter.h clang/lib/AST/ASTImporter.cpp clang/lib/AST/ExternalASTMerger.cpp clang/lib/CrossTU/CrossTranslationUnit.cpp clang/lib/Frontend/ASTMerge.cpp clang/unittests/AST/ASTImporterTest.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/source/Symbol/ClangASTContext.cpp lldb/source/Symbol/ClangASTImporter.cpp lldb/source/Symbol/CxxModuleHandler.cpp Index: lldb/source/Symbol/CxxModuleHandler.cpp === --- lldb/source/Symbol/CxxModuleHandler.cpp +++ lldb/source/Symbol/CxxModuleHandler.cpp @@ -9,6 +9,7 @@ #include "lldb/Symbol/CxxModuleHandler.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Utility/Log.h" #include "clang/Sema/Lookup.h" #include "llvm/Support/Error.h" @@ -214,13 +215,15 @@ // Import the foreign template arguments. llvm::SmallVector imported_args; + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + // If this logic is changed, also update templateArgsAreSupported. for (const TemplateArgument &arg : foreign_args.asArray()) { switch (arg.getKind()) { case TemplateArgument::Type: { - llvm::Expected type = m_importer->Import_New(arg.getAsType()); + llvm::Expected type = m_importer->Import(arg.getAsType()); if (!type) { -llvm::consumeError(type.takeError()); +LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}"); return {}; } imported_args.push_back(TemplateArgument(*type)); @@ -229,9 +232,9 @@ case TemplateArgument::Integral: { llvm::APSInt integral = arg.getAsIntegral(); llvm::Expected type = - m_importer->Import_New(arg.getIntegralType()); + m_importer->Import(arg.getIntegralType()); if (!type) { -llvm::consumeError(type.takeError()); +LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}"); return {}; } imported_args.push_back( Index: lldb/source/Symbol/ClangASTImporter.cpp === --- lldb/source/Symbol/ClangASTImporter.cpp +++ lldb/source/Symbol/ClangASTImporter.cpp @@ -62,8 +62,16 @@ ASTImporterDelegate::CxxModuleScope std_scope(*delegate_sp, dst_ast); - if (delegate_sp) -return delegate_sp->Import(type); + if (delegate_sp) { +if (llvm::Expected ret_or_error = delegate_sp->Import(type)) { + return *ret_or_error; +} else { + Log *log = + lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LLDB_LOG_ERROR(log, ret_or_error.takeError(), + "Couldn't import type: {0}"); +} + } return QualType(); } @@ -106,7 +114,7 @@ ASTImporterDelegate::CxxModuleScope std_scope(*delegate_sp, dst_ast); if (delegate_sp) { -clang::Decl *result = delegate_sp->Import(decl); +llvm::Expected result = delegate_sp->Import(decl); if (!result) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -127,9 +135,13 @@ "metadata 0x%" PRIx64, decl->getDeclKindName(), user_id); } + + llvm::consumeError(result.takeError()); + + return nullptr; } -return result; +return *result; } return nullptr; @@ -624,6 +636,8 @@ if (!RequireCompleteType(type)) return false; + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + if (const TagType *tag_type = type->getAs()) { TagDecl *tag_decl = tag_type->getDecl(); @@ -641,7 +655,12 @@ TagDecl *origin_tag_decl = llvm::dyn_cast(decl_origin.decl); for (Decl *origin_child_decl : origin_tag_decl->decls()) { - delegate_sp->Import(origin_child_decl); + llvm::Expected imported_or_err = + delegate_sp->Import(origin_child_decl); + if (!imported_or_err) +// FIXME return with false? +LLDB_LOG_ERROR(log, imported_or_err.takeError(), + "Couldn't import decl: {0}"); } if (RecordDecl *record_decl = dyn_cast(origin_tag_decl)) { @@ -666,7 +685,12 @@ llvm::dyn_cast(decl_origin.decl); for (Decl *origin_child_decl : origin_interface_decl->decls()) { -delegate_sp->Import(origin_child_decl); +llvm::Expected imported_or_err = +delegate_sp->Import(origin_child_decl); +if (!imported_or_err) + // FIXME return with false? + LLDB_LOG_ERROR(log, imported_or_err.takeError(), +
[Lldb-commits] [PATCH] D61438: [ASTImporter] Use llvm::Expected and Error in the importer API
martong updated this revision to Diff 198623. martong added a comment. - Use LLDB_LOG_ERROR in ImportDefinitionTo Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61438/new/ https://reviews.llvm.org/D61438 Files: clang/include/clang/AST/ASTImporter.h clang/lib/AST/ASTImporter.cpp clang/lib/AST/ExternalASTMerger.cpp clang/lib/CrossTU/CrossTranslationUnit.cpp clang/lib/Frontend/ASTMerge.cpp clang/unittests/AST/ASTImporterTest.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/source/Symbol/ClangASTContext.cpp lldb/source/Symbol/ClangASTImporter.cpp lldb/source/Symbol/CxxModuleHandler.cpp Index: lldb/source/Symbol/CxxModuleHandler.cpp === --- lldb/source/Symbol/CxxModuleHandler.cpp +++ lldb/source/Symbol/CxxModuleHandler.cpp @@ -9,6 +9,7 @@ #include "lldb/Symbol/CxxModuleHandler.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Utility/Log.h" #include "clang/Sema/Lookup.h" #include "llvm/Support/Error.h" @@ -214,13 +215,15 @@ // Import the foreign template arguments. llvm::SmallVector imported_args; + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + // If this logic is changed, also update templateArgsAreSupported. for (const TemplateArgument &arg : foreign_args.asArray()) { switch (arg.getKind()) { case TemplateArgument::Type: { - llvm::Expected type = m_importer->Import_New(arg.getAsType()); + llvm::Expected type = m_importer->Import(arg.getAsType()); if (!type) { -llvm::consumeError(type.takeError()); +LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}"); return {}; } imported_args.push_back(TemplateArgument(*type)); @@ -229,9 +232,9 @@ case TemplateArgument::Integral: { llvm::APSInt integral = arg.getAsIntegral(); llvm::Expected type = - m_importer->Import_New(arg.getIntegralType()); + m_importer->Import(arg.getIntegralType()); if (!type) { -llvm::consumeError(type.takeError()); +LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}"); return {}; } imported_args.push_back( Index: lldb/source/Symbol/ClangASTImporter.cpp === --- lldb/source/Symbol/ClangASTImporter.cpp +++ lldb/source/Symbol/ClangASTImporter.cpp @@ -62,8 +62,16 @@ ASTImporterDelegate::CxxModuleScope std_scope(*delegate_sp, dst_ast); - if (delegate_sp) -return delegate_sp->Import(type); + if (delegate_sp) { +if (llvm::Expected ret_or_error = delegate_sp->Import(type)) { + return *ret_or_error; +} else { + Log *log = + lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LLDB_LOG_ERROR(log, ret_or_error.takeError(), + "Couldn't import type: {0}"); +} + } return QualType(); } @@ -106,7 +114,7 @@ ASTImporterDelegate::CxxModuleScope std_scope(*delegate_sp, dst_ast); if (delegate_sp) { -clang::Decl *result = delegate_sp->Import(decl); +llvm::Expected result = delegate_sp->Import(decl); if (!result) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); @@ -127,9 +135,13 @@ "metadata 0x%" PRIx64, decl->getDeclKindName(), user_id); } + + llvm::consumeError(result.takeError()); + + return nullptr; } -return result; +return *result; } return nullptr; @@ -624,6 +636,8 @@ if (!RequireCompleteType(type)) return false; + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + if (const TagType *tag_type = type->getAs()) { TagDecl *tag_decl = tag_type->getDecl(); @@ -641,7 +655,12 @@ TagDecl *origin_tag_decl = llvm::dyn_cast(decl_origin.decl); for (Decl *origin_child_decl : origin_tag_decl->decls()) { - delegate_sp->Import(origin_child_decl); + llvm::Expected imported_or_err = + delegate_sp->Import(origin_child_decl); + if (!imported_or_err) +// FIXME return with false? +LLDB_LOG_ERROR(log, imported_or_err.takeError(), + "Couldn't import decl: {0}"); } if (RecordDecl *record_decl = dyn_cast(origin_tag_decl)) { @@ -666,7 +685,12 @@ llvm::dyn_cast(decl_origin.decl); for (Decl *origin_child_decl : origin_interface_decl->decls()) { -delegate_sp->Import(origin_child_decl); +llvm::Expected imported_or_err = +delegate_sp->Import(origin_child_decl); +if (!imported_or_err) + // FIXME return with false? + LLDB_LOG_ERROR(log, imported_or_err.takeError(), + "Couldn't import decl: {0}"); } r
[Lldb-commits] [lldb] r360246 - [DWARF] Centralize user_id <-> DWARFDIE conversions
Author: labath Date: Wed May 8 04:43:05 2019 New Revision: 360246 URL: http://llvm.org/viewvc/llvm-project?rev=360246&view=rev Log: [DWARF] Centralize user_id <-> DWARFDIE conversions Summary: The logic for translating a user_id into a DWARFDIE was replicated in several places. This removes that redundancy and settles on a single implementation in SymbolFileDWARF. The reason for choosing that instead of DIERef was that we were always immediately converting the returned DIERef into a DWARFDIE anyway, which meant that one had to specify the SymbolFileDWARF argument twice (once to get the DIERef, and once to get the actual DIE). Also, passing a higher-level object (SymbolFileDWARF) into a lower-level one (DIERef) seemed like a less intuitive arrangement than doing things the other way around. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: tberghammer, jankratochvil, lldb-commits Differential Revision: https://reviews.llvm.org/D61648 Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp?rev=360246&r1=360245&r2=360246&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp Wed May 8 04:43:05 2019 @@ -13,29 +13,6 @@ #include "SymbolFileDWARF.h" #include "SymbolFileDWARFDebugMap.h" -DIERef::DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf) -: cu_offset(DW_INVALID_OFFSET), die_offset(uid & 0x) { - SymbolFileDWARFDebugMap *debug_map = dwarf->GetDebugMapSymfile(); - if (debug_map) { -const uint32_t oso_idx = debug_map->GetOSOIndexFromUserID(uid); -SymbolFileDWARF *actual_dwarf = debug_map->GetSymbolFileByOSOIndex(oso_idx); -if (actual_dwarf) { - DWARFDebugInfo *debug_info = actual_dwarf->DebugInfo(); - if (debug_info) { -DWARFUnit *dwarf_cu = -debug_info->GetCompileUnitContainingDIEOffset(die_offset); -if (dwarf_cu) { - cu_offset = dwarf_cu->GetOffset(); - return; -} - } -} -die_offset = DW_INVALID_OFFSET; - } else { -cu_offset = uid >> 32; - } -} - DIERef::DIERef(const DWARFFormValue &form_value) : cu_offset(DW_INVALID_OFFSET), die_offset(DW_INVALID_OFFSET) { if (form_value.IsValid()) { @@ -49,16 +26,3 @@ DIERef::DIERef(const DWARFFormValue &for die_offset = form_value.Reference(); } } - -lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const { - // Each SymbolFileDWARF will set its ID to what is expected. - // - // SymbolFileDWARF, when used for DWARF with .o files on MacOSX, has the - // ID set to the compile unit index. - // - // SymbolFileDWARFDwo sets the ID to the compile unit offset. - if (dwarf && die_offset != DW_INVALID_OFFSET) -return dwarf->GetID() | die_offset; - else -return LLDB_INVALID_UID; -} Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h?rev=360246&r1=360245&r2=360246&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h Wed May 8 04:43:05 2019 @@ -20,20 +20,8 @@ struct DIERef { DIERef(dw_offset_t c, dw_offset_t d) : cu_offset(c), die_offset(d) {} - // In order to properly decode a lldb::user_id_t back into a DIERef we - // need the DWARF file since it knows if DWARF in .o files is being used - // (MacOSX) or if DWO files are being used. The encoding of the user ID - // differs between the two types of DWARF. - explicit DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf); - explicit DIERef(const DWARFFormValue &form_value); - // In order to properly encode a DIERef unto a lldb::user_id_t we need - // the DWARF file since it knows if DWARF in .o files is being used - // (MacOSX) or if DWO files are being used. The encoding of the user ID - // differs between the two types of DWARF. - lldb::user_id_t GetUID(SymbolFileDWARF *dwarf) const; - bool operator<(const DIERef &ref) const { return die_offset < ref.die_offset; } 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=360246&r1=360245&r2=360246&view=diff =
[Lldb-commits] [PATCH] D61648: [DWARF] Centralize user_id <-> DWARFDIE conversions
labath marked 3 inline comments as done. labath added inline comments. Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h:138-139 + DWARFDIE GetDIEFromUID(lldb::user_id_t uid); + lldb::user_id_t GetUIDFromDIE(DWARFBaseDIE die); + lldb::user_id_t GetUIDFromDIERef(DIERef ref); clayborg wrote: > Maybe just overload these?: > ``` > lldb::user_id_t GetUID(DWARFBaseDIE die); > lldb::user_id_t GetUID(DIERef ref); > ``` Sounds good. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61648/new/ https://reviews.llvm.org/D61648 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61648: [DWARF] Centralize user_id <-> DWARFDIE conversions
This revision was automatically updated to reflect the committed changes. labath marked an inline comment as done. Closed by commit rL360246: [DWARF] Centralize user_id <-> DWARFDIE conversions (authored by labath, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D61648?vs=198510&id=198625#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61648/new/ https://reviews.llvm.org/D61648 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp @@ -75,7 +75,9 @@ } lldb::user_id_t DWARFBaseDIE::GetID() const { - return GetDIERef().GetUID(GetDWARF()); + if (IsValid()) +return GetDWARF()->GetUID(*this); + return LLDB_INVALID_UID; } const char *DWARFBaseDIE::GetName() const { Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -134,11 +134,6 @@ bool assert_not_being_parsed = true, bool resolve_function_context = false); - SymbolFileDWARF *GetDWARFForUID(lldb::user_id_t uid); - - DWARFDIE - GetDIEFromUID(lldb::user_id_t uid); - lldb_private::CompilerDecl GetDeclForUID(lldb::user_id_t uid) override; lldb_private::CompilerDeclContext @@ -289,6 +284,14 @@ virtual DWARFDIE GetDIE(const DIERef &die_ref); + DWARFDIE GetDIE(lldb::user_id_t uid); + + lldb::user_id_t GetUID(const DWARFBaseDIE &die) { +return GetID() | die.GetOffset(); + } + + lldb::user_id_t GetUID(const DIERef &ref) { return GetID() | ref.die_offset; } + virtual std::unique_ptr GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die); @@ -440,6 +443,12 @@ return m_forward_decl_clang_type_to_die; } + struct DecodedUID { +SymbolFileDWARF *dwarf; +DIERef ref; + }; + DecodedUID DecodeUID(lldb::user_id_t uid); + SymbolFileDWARFDwp *GetDwpSymbolFile(); lldb::ModuleWP m_debug_map_module_wp; 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 @@ -1243,7 +1243,7 @@ ast_parser->GetDeclForUIDFromDWARF(decl); } -SymbolFileDWARF *SymbolFileDWARF::GetDWARFForUID(lldb::user_id_t uid) { +SymbolFileDWARF::DecodedUID SymbolFileDWARF::DecodeUID(lldb::user_id_t uid) { // This method can be called without going through the symbol vendor so we // need to lock the module. std::lock_guard guard(GetModuleMutex()); @@ -1254,28 +1254,25 @@ // references to other DWARF objects and we must be ready to receive a // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF // instance. - SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile(); - if (debug_map) -return debug_map->GetSymbolFileByOSOIndex( + if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile()) { +SymbolFileDWARF *dwarf = debug_map->GetSymbolFileByOSOIndex( debug_map->GetOSOIndexFromUserID(uid)); - return this; +return {dwarf, {DW_INVALID_OFFSET, dw_offset_t(uid)}}; + } + return {this, {dw_offset_t(uid >> 32), dw_offset_t(uid)}}; } DWARFDIE -SymbolFileDWARF::GetDIEFromUID(lldb::user_id_t uid) { +SymbolFileDWARF::GetDIE(lldb::user_id_t uid) { // This method can be called without going through the symbol vendor so we // need to lock the module. std::lock_guard guard(GetModuleMutex()); - // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API we - // must make sure we use the correct DWARF file when resolving things. On - // MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple - // SymbolFileDWARF classes, one for each .o file. We can often end up with - // references to other DWARF objects and we must be ready to receive a - // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF - // instance. - SymbolFileDWARF *dwarf = GetDWARFForUID(uid); - if (dwarf) -return dwarf->GetDIE(DIERef(uid, dwarf)); + + DecodedUID decoded = DecodeUID(uid); + + if (decod
[Lldb-commits] [PATCH] D61423: MinidumpYAML: add support for the ThreadList stream
labath marked 9 inline comments as done. labath added inline comments. Comment at: include/llvm/ObjectYAML/MinidumpYAML.h:58 +/// streams with similar structure. +template +struct ListStream : public Stream { jhenderson wrote: > KindV and TypeV aren't clear names to me. What does the V stand for? "variable" or "value" or something like that. :) Not a very good name, but I needed to differentiate that from the class member with the same name. However, just I've had an idea of how to organize this better and reduce the number of template parameters (by making these static members of the `EntryT` type). This also avoid the need for inventing names here. Comment at: include/llvm/ObjectYAML/MinidumpYAML.h:70-73 +/// A structure containing all data belonging to a single minidump module. On +/// disk, these are placed at various places in the minidump file and +/// cross-referenced via their offsets, but for ease of use, we group them +/// together in the logical memory view. jhenderson wrote: > I'm not sure how much sense it makes to go into the detail of the minidump > file format versus the memory view here. I also am not convinced by the > repetition of this in the comments below. I've removed the memory vs. file blurb. Comment at: test/tools/obj2yaml/basic-minidump.yaml:47-49 + - Thread Id: 0x5C5D5E5F +Priority Class: 0x60616263 +Environment Block: 0x6465666768696A6B jhenderson wrote: > It would be nice if these were padded so that they all line up. Ditto in the > Stack block below. The microsoft structure definition calls this field just "teb" (for Thread Environment Block), but I've found that too opaque, so I expanded the acronym (sans "thread", because it is obvious we are talking about threads here). I could shorten this further to "environment" (the word "block" probably doesn't add that much value) , or even to "teb" for consistency with microsoft headers. Let me know what you think. Comment at: test/tools/obj2yaml/basic-minidump.yaml:51 +Stack: + Start of Memory Range: 0x6C6D6E6F70717273 + Content: 7475767778797A7B jhenderson wrote: > I don't have a concrete suggestion, but it might be nice to have a shorter > field name than "Start of Memory Range", but that's less of a concern if > that's the actual minidump field name. That's how the field is called in the official microsoft documentation (https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-minidump_memory_descriptor), which is probably the closest thing to a "spec" for this thing. It's a bit verbose, and probably "Address" would just suffice here, but otoh it's nice for this to match the official name. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61423/new/ https://reviews.llvm.org/D61423 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61423: MinidumpYAML: add support for the ThreadList stream
labath updated this revision to Diff 198653. labath marked 2 inline comments as done. labath added a comment. Address review comments. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61423/new/ https://reviews.llvm.org/D61423 Files: include/llvm/ObjectYAML/MinidumpYAML.h lib/ObjectYAML/MinidumpYAML.cpp test/tools/obj2yaml/basic-minidump.yaml Index: test/tools/obj2yaml/basic-minidump.yaml === --- test/tools/obj2yaml/basic-minidump.yaml +++ test/tools/obj2yaml/basic-minidump.yaml @@ -42,6 +42,15 @@ Size of Image: 0x54555657 Module Name: libb.so CodeView Record: 58595A5B + - Type:ThreadList +Threads: + - Thread Id: 0x5C5D5E5F +Priority Class: 0x60616263 +Environment Block: 0x6465666768696A6B +Stack: + Start of Memory Range: 0x6C6D6E6F70717273 + Content: 7475767778797A7B +Context: 7C7D7E7F80818283 ... # CHECK: --- !minidump @@ -86,4 +95,13 @@ # CHECK-NEXT: Size of Image: 0x54555657 # CHECK-NEXT: Module Name: libb.so # CHECK-NEXT: CodeView Record: 58595A5B +# CHECK-NEXT: - Type:ThreadList +# CHECK-NEXT: Threads: +# CHECK-NEXT: - Thread Id: 0x5C5D5E5F +# CHECK-NEXT: Priority Class: 0x60616263 +# CHECK-NEXT: Environment Block: 0x6465666768696A6B +# CHECK-NEXT: Stack: +# CHECK-NEXT: Start of Memory Range: 0x6C6D6E6F70717273 +# CHECK-NEXT: Content: 7475767778797A7B +# CHECK-NEXT: Context: 7C7D7E7F80818283 # CHECK-NEXT: ... Index: lib/ObjectYAML/MinidumpYAML.cpp === --- lib/ObjectYAML/MinidumpYAML.cpp +++ lib/ObjectYAML/MinidumpYAML.cpp @@ -180,6 +180,8 @@ case StreamType::LinuxProcStat: case StreamType::LinuxProcUptime: return StreamKind::TextContent; + case StreamType::ThreadList: +return StreamKind::ThreadList; default: return StreamKind::RawContent; } @@ -196,6 +198,8 @@ return llvm::make_unique(); case StreamKind::TextContent: return llvm::make_unique(Type); + case StreamKind::ThreadList: +return llvm::make_unique(); } llvm_unreachable("Unhandled stream kind!"); } @@ -323,19 +327,19 @@ mapOptionalHex(IO, "File Date Low", Info.FileDateLow, 0); } -void yaml::MappingTraits::mapping( -IO &IO, ModuleListStream::ParsedModule &M) { - mapRequiredHex(IO, "Base of Image", M.Module.BaseOfImage); - mapRequiredHex(IO, "Size of Image", M.Module.SizeOfImage); - mapOptionalHex(IO, "Checksum", M.Module.Checksum, 0); - IO.mapOptional("Time Date Stamp", M.Module.TimeDateStamp, +void yaml::MappingTraits::mapping( +IO &IO, ModuleListStream::entry_type &M) { + mapRequiredHex(IO, "Base of Image", M.Entry.BaseOfImage); + mapRequiredHex(IO, "Size of Image", M.Entry.SizeOfImage); + mapOptionalHex(IO, "Checksum", M.Entry.Checksum, 0); + IO.mapOptional("Time Date Stamp", M.Entry.TimeDateStamp, support::ulittle32_t(0)); IO.mapRequired("Module Name", M.Name); - IO.mapOptional("Version Info", M.Module.VersionInfo, VSFixedFileInfo()); + IO.mapOptional("Version Info", M.Entry.VersionInfo, VSFixedFileInfo()); IO.mapRequired("CodeView Record", M.CvRecord); IO.mapOptional("Misc Record", M.MiscRecord, yaml::BinaryRef()); - mapOptionalHex(IO, "Reserved0", M.Module.Reserved0, 0); - mapOptionalHex(IO, "Reserved1", M.Module.Reserved1, 0); + mapOptionalHex(IO, "Reserved0", M.Entry.Reserved0, 0); + mapOptionalHex(IO, "Reserved1", M.Entry.Reserved1, 0); } static void streamMapping(yaml::IO &IO, RawContentStream &Stream) { @@ -350,7 +354,7 @@ } static void streamMapping(yaml::IO &IO, ModuleListStream &Stream) { - IO.mapRequired("Modules", Stream.Modules); + IO.mapRequired("Modules", Stream.Entries); } static void streamMapping(yaml::IO &IO, SystemInfoStream &Stream) { @@ -386,6 +390,27 @@ IO.mapOptional("Text", Stream.Text); } +void yaml::MappingContextTraits::mapping( +IO &IO, MemoryDescriptor &Memory, BinaryRef &Content) { + mapRequiredHex(IO, "Start of Memory Range", Memory.StartOfMemoryRange); + IO.mapRequired("Content", Content); +} + +void yaml::MappingTraits::mapping( +IO &IO, ThreadListStream::entry_type &T) { + mapRequiredHex(IO, "Thread Id", T.Entry.ThreadId); + mapOptionalHex(IO, "Suspend Count", T.Entry.SuspendCount, 0); + mapOptionalHex(IO, "Priority Class", T.Entry.PriorityClass, 0); + mapOptionalHex(IO, "Priority", T.Entry.Priority, 0); + mapOptionalHex(IO, "Environment Block", T.Entry.EnvironmentBlock, 0); + IO.mapRequired("Stack", T.Entry.Stack, T.Stack); + IO.mapRequired("Context", T.Context); +} + +static void streamMapping(yaml::IO &IO, ThreadListStream &Stream) { + IO.mapRequired("Threads", Stream.Entries); +} + void yaml
[Lldb-commits] [PATCH] D61686: Disable pty redirection on Windows and add a method to get the parent pid
asmith created this revision. asmith added reviewers: labath, rnk. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. More changes for lldb-server on Windows - Disable pty redirection for Windows since there is no pty support currently - Add a method to get the parent pid for a process on Windows Repository: rLLDB LLDB https://reviews.llvm.org/D61686 Files: source/Host/windows/Host.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -214,8 +214,14 @@ m_process_launch_info.GetFlags().Set(eLaunchFlagDebug); if (should_forward_stdio) { +// There is no pty support on Windows currently which means O* and I* +// notification packets will not be generated about the inferior. +// In most cases the missing notifications do not affect lldb-server +// so we are temporarily relaxing the following for Windows. +#if !defined(_WIN32) if (llvm::Error Err = m_process_launch_info.SetUpPtyRedirection()) return Status(std::move(Err)); +#endif } { Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -1185,12 +1185,17 @@ void GDBRemoteCommunicationServerCommon:: CreateProcessInfoResponse_DebugServerStyle( const ProcessInstanceInfo &proc_info, StreamString &response) { +#if defined(_WIN32) + response.Printf("pid:%" PRIx64 ";parent-pid:%" PRIx64 ";", + proc_info.GetProcessID(), proc_info.GetParentProcessID()); +#else response.Printf("pid:%" PRIx64 ";parent-pid:%" PRIx64 ";real-uid:%x;real-gid:%x;effective-uid:%x;effective-gid:%x;", proc_info.GetProcessID(), proc_info.GetParentProcessID(), proc_info.GetUserID(), proc_info.GetGroupID(), proc_info.GetEffectiveUserID(), proc_info.GetEffectiveGroupID()); +#endif const ArchSpec &proc_arch = proc_info.GetArchitecture(); if (proc_arch.IsValid()) { Index: source/Host/windows/Host.cpp === --- source/Host/windows/Host.cpp +++ source/Host/windows/Host.cpp @@ -169,7 +169,23 @@ GetProcessExecutableAndTriple(handle, process_info); // Need to read the PEB to get parent process and command line arguments. - return true; + + AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); + if (!snapshot.IsValid()) +return false; + + PROCESSENTRY32W pe; + pe.dwSize = sizeof(PROCESSENTRY32W); + if (Process32FirstW(snapshot.get(), &pe)) { +do { + if (pe.th32ProcessID == pid) { +process_info.SetParentProcessID(pe.th32ParentProcessID); +return true; + } +} while (Process32NextW(snapshot.get(), &pe)); + } + + return false; } HostThread Host::StartMonitoringChildProcess( Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -214,8 +214,14 @@ m_process_launch_info.GetFlags().Set(eLaunchFlagDebug); if (should_forward_stdio) { +// There is no pty support on Windows currently which means O* and I* +// notification packets will not be generated about the inferior. +// In most cases the missing notifications do not affect lldb-server +// so we are temporarily relaxing the following for Windows. +#if !defined(_WIN32) if (llvm::Error Err = m_process_launch_info.SetUpPtyRedirection()) return Status(std::move(Err)); +#endif } { Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -1185,12 +1185,17 @@ void GDBRemoteCommunicationServerCommon:: CreateProcessInfoResponse_DebugServerStyle( const ProcessInstanceInfo &proc_info, StreamString &response) { +#if defined(_WIN32) + response.Printf("pid:%" PRIx64 ";parent-pid:%" PRIx64 ";", + proc_info.GetProcessID(), proc_info.GetParentProcessID()); +#else response.Printf("pid:%" PRIx64 ";parent-pid:%" PRIx64 ";re
[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src
martong added a comment. Ping @shafik @teemperor Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61333/new/ https://reviews.llvm.org/D61333 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61687: Update Python tests for lldb-server on Windows
asmith created this revision. asmith added reviewers: labath, rnk. Herald added a reviewer: jfb. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Repository: rLLDB LLDB https://reviews.llvm.org/D61687 Files: packages/Python/lldbsuite/test/dotest.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py Index: packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py === --- packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py +++ packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py @@ -29,6 +29,7 @@ kv_dict = self.parse_key_val_dict(context.get("key_vals_text")) self.assertEqual(expected_name, kv_dict.get("name")) +@skipIfWindows # the test is not updated for Windows. @llgs_test def test(self): """ Make sure lldb-server can retrieve inferior thread name""" Index: packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py === --- packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py +++ packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py @@ -81,6 +81,7 @@ self.ignore_signals(signals_to_ignore) self.expect_exit_code(len(signals_to_ignore)) +@skipIfWindows # no signal support @llgs_test def test_default_signals_behavior(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py === --- packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py +++ packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py @@ -926,6 +926,12 @@ # Convert text pids to ints process_ids = [int(text_pid) for text_pid in text_process_ids if text_pid != ''] +elif platform.system() == 'Windows': +output = subprocess.check_output( +"for /f \"tokens=2 delims=,\" %F in ('tasklist /nh /fi \"PID ne 0\" /fo csv') do @echo %~F", shell=True).decode("utf-8") +text_process_ids = output.split('\n')[1:] +process_ids = [int(text_pid) + for text_pid in text_process_ids if text_pid != ''] # elif {your_platform_here}: # fill in process_ids as a list of int type process IDs running on # the local system. Index: packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py === --- packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py +++ packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py @@ -37,6 +37,7 @@ self.build() self.inferior_abort_received() +@skipIfWindows # For now the signo in T* packet is always 0. @llgs_test # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836 @expectedFailureAndroid(api_levels=list(range(16 + 1))) Index: packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py === --- packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -235,6 +235,10 @@ # Remote platforms don't support named pipe based port negotiation use_named_pipe = False +triple = self.dbg.GetSelectedPlatform().GetTriple() +if re.match(".*-.*-windows", triple): +self.skipTest
[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows
asmith updated this revision to Diff 198675. asmith retitled this revision from "Disable pty redirection on Windows and add a method to get the parent pid" to "Enable lldb-server on Windows". asmith edited the summary of this revision. Herald added subscribers: mgorny, srhines. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61686/new/ https://reviews.llvm.org/D61686 Files: cmake/modules/LLDBConfig.cmake include/lldb/Host/windows/PosixApi.h source/Host/windows/Host.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp tools/lldb-server/lldb-gdbserver.cpp tools/lldb-server/lldb-platform.cpp Index: tools/lldb-server/lldb-platform.cpp === --- tools/lldb-server/lldb-platform.cpp +++ tools/lldb-server/lldb-platform.cpp @@ -15,8 +15,9 @@ #include #include #include +#if !defined(_WIN32) #include - +#endif #include #include "llvm/Support/FileSystem.h" @@ -69,6 +70,7 @@ // Watch for signals static void signal_handler(int signo) { +#if !defined(_WIN32) switch (signo) { case SIGHUP: // Use SIGINT first, if that does not work, use SIGHUP as a last resort. @@ -80,6 +82,7 @@ abort(); break; } +#endif } static void display_usage(const char *progname, const char *subcommand) { @@ -131,8 +134,10 @@ const char *subcommand = argv[1]; argc--; argv++; +#if !defined(_WIN32) signal(SIGPIPE, SIG_IGN); signal(SIGHUP, signal_handler); +#endif int long_option_index = 0; Status error; std::string listen_host_port; Index: tools/lldb-server/lldb-gdbserver.cpp === --- tools/lldb-server/lldb-gdbserver.cpp +++ tools/lldb-server/lldb-gdbserver.cpp @@ -515,7 +515,7 @@ handle_launch(gdb_server, argc, argv); // Print version info. - printf("%s-%s", LLGS_PROGRAM_NAME, LLGS_VERSION_STR); + printf("%s-%s\n", LLGS_PROGRAM_NAME, LLGS_VERSION_STR); ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port, progname, subcommand, named_pipe_path.c_str(), Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -214,8 +214,14 @@ m_process_launch_info.GetFlags().Set(eLaunchFlagDebug); if (should_forward_stdio) { +// There is no pty support on Windows currently which means O* and I* +// notification packets will not be generated about the inferior. +// In most cases the missing notifications do not affect lldb-server +// so we are temporarily relaxing the following for Windows. +#if !defined(_WIN32) if (llvm::Error Err = m_process_launch_info.SetUpPtyRedirection()) return Status(std::move(Err)); +#endif } { Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -1185,12 +1185,17 @@ void GDBRemoteCommunicationServerCommon:: CreateProcessInfoResponse_DebugServerStyle( const ProcessInstanceInfo &proc_info, StreamString &response) { +#if defined(_WIN32) + response.Printf("pid:%" PRIx64 ";parent-pid:%" PRIx64 ";", + proc_info.GetProcessID(), proc_info.GetParentProcessID()); +#else response.Printf("pid:%" PRIx64 ";parent-pid:%" PRIx64 ";real-uid:%x;real-gid:%x;effective-uid:%x;effective-gid:%x;", proc_info.GetProcessID(), proc_info.GetParentProcessID(), proc_info.GetUserID(), proc_info.GetGroupID(), proc_info.GetEffectiveUserID(), proc_info.GetEffectiveGroupID()); +#endif const ArchSpec &proc_arch = proc_info.GetArchitecture(); if (proc_arch.IsValid()) { Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -38,6 +38,8 @@ #if defined(__APPLE__) #define DEBUGSERVER_BASENAME "debugserver" +#elif defined(_WIN32) +#define DEBUGSERVER_BASENAME "lldb-server.exe" #else #define DEBUGSERVER_BASENAME "lldb-server" #endif Index: source/Host/windows/Host.cpp === --- source/Host/windows/Host.cpp +++ source/Host/windows/Host.cpp @@ -169,7 +169,23 @@ GetProcessExecutableAndTriple(handle, process_info); //
[Lldb-commits] [PATCH] D61438: [ASTImporter] Use llvm::Expected and Error in the importer API
aprantl added inline comments. Comment at: clang/lib/AST/ASTImporter.cpp:5039 + if (!ToOrErr) +// FIXME: return the error? +consumeError(ToOrErr.takeError()); We don't typically commit FIXME's into LLVM code. Why not just deal with the error properly from the start? Comment at: lldb/source/Symbol/ClangASTImporter.cpp:65 - if (delegate_sp) -return delegate_sp->Import(type); + if (delegate_sp) { +if (llvm::Expected ret_or_error = delegate_sp->Import(type)) { ``` if (!delegate_sp) return {}; ``` Comment at: lldb/source/Symbol/ClangASTImporter.cpp:68 + return *ret_or_error; +} else { + Log *log = The `else` is redundant. Comment at: lldb/source/Symbol/ClangASTImporter.cpp:139 + + llvm::consumeError(result.takeError()); + Can you convert this to an early return instead? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61438/new/ https://reviews.llvm.org/D61438 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r360269 - [Docs] list command: lldb run
Author: jdevlieghere Date: Wed May 8 09:31:47 2019 New Revision: 360269 URL: http://llvm.org/viewvc/llvm-project?rev=360269&view=rev Log: [Docs] list command: lldb run The run command is only an abbreviation for the more verbose process launch -- but it works just as with GDB and therefore should be mentioned in the GDB to LLDB command map. For educational purposes I've not listed it as the first option on the LLDB side so that new LLDB user can, if they want, also know what the "native" way is for LLDB. Here's the help documentation for the run command in lldb which gives proof: > (lldb) help run > Launch the executable in the debugger. > > Syntax: run [] > > Command Options Usage: > run [] > > 'run' is an abbreviation for 'process launch -c /bin/sh --' Patch by: Konrad Kleine Differential revision: https://reviews.llvm.org/D61483 Modified: lldb/trunk/docs/use/map.rst Modified: lldb/trunk/docs/use/map.rst URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/use/map.rst?rev=360269&r1=360268&r2=360269&view=diff == --- lldb/trunk/docs/use/map.rst (original) +++ lldb/trunk/docs/use/map.rst Wed May 8 09:31:47 2019 @@ -51,6 +51,8 @@ Execution Commands (lldb) process launch --+ (lldb) run + (lldb) r ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61483: [www] list command: lldb run
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB360269: [Docs] list command: lldb run(authored by JDevlieghere, committed by ). Changed prior to commit: https://reviews.llvm.org/D61483?vs=198223&id=198686#toc Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61483/new/ https://reviews.llvm.org/D61483 Files: docs/use/map.rst Index: docs/use/map.rst === --- docs/use/map.rst +++ docs/use/map.rst @@ -51,6 +51,8 @@ (lldb) process launch -- + (lldb) run + (lldb) r Index: docs/use/map.rst === --- docs/use/map.rst +++ docs/use/map.rst @@ -51,6 +51,8 @@ (lldb) process launch -- + (lldb) run + (lldb) r ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61611: [JITLoaderGDB] Set eTypeJIT for objects read from JIT descriptors
sgraenitz updated this revision to Diff 198692. sgraenitz added a comment. Herald added a reviewer: alexshap. Add lit test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61611/new/ https://reviews.llvm.org/D61611 Files: lldb/lit/Breakpoint/Inputs/jitbp.cpp lldb/lit/Breakpoint/jitbp_elf.test lldb/lit/helper/toolchain.py lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1865,7 +1865,7 @@ return; m_sections_up = llvm::make_unique(); - VMAddressProvider address_provider(CalculateType()); + VMAddressProvider address_provider(GetType()); size_t LoadID = 0; for (const auto &EnumPHdr : llvm::enumerate(ProgramHeaders())) { Index: lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp === --- lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -327,6 +327,10 @@ FileSpec(jit_name), symbolfile_addr, symbolfile_size); if (module_sp && module_sp->GetObjectFile()) { +// Object formats (like ELF) have no representation for a JIT type. +// We will get it wrong, if we deduce it from the header. +module_sp->GetObjectFile()->SetType(ObjectFile::eTypeJIT); + // load the symbol table right away module_sp->GetObjectFile()->GetSymtab(); Index: lldb/lit/helper/toolchain.py === --- lldb/lit/helper/toolchain.py +++ lldb/lit/helper/toolchain.py @@ -129,6 +129,6 @@ support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil', 'llvm-mc', 'llvm-readobj', 'llvm-objdump', - 'llvm-objcopy'] + 'llvm-objcopy', 'lli'] additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs) Index: lldb/lit/Breakpoint/jitbp_elf.test === --- /dev/null +++ lldb/lit/Breakpoint/jitbp_elf.test @@ -0,0 +1,13 @@ +# REQUIRES: target-x86_64, system-linux, native + +# RUN: %clang -g -S -emit-llvm -o %t.ll %p/Inputs/jitbp.cpp +# RUN: %lldb -b -o 'b jitbp' -o 'run -jit-kind=mcjit %t.ll' lli | FileCheck %s + +# CHECK: (lldb) target create "{{.*}}/lli" +# CHECK: (lldb) b jitbp +# CHECK: Breakpoint 1: no locations (pending). +# CHECK: (lldb) run -jit-kind=mcjit {{.*}}/jitbp_elf.test.tmp.ll +# CHECK: 1 location added to breakpoint 1 +# CHECK: Process {{.*}} stopped +# CHECK: JIT(0x{{.*}})`jitbp: +# CHECK: Process {{.*}} launched: {{.*}} Index: lldb/lit/Breakpoint/Inputs/jitbp.cpp === --- /dev/null +++ lldb/lit/Breakpoint/Inputs/jitbp.cpp @@ -0,0 +1,2 @@ +int jitbp() { return 0; } +int main() { return jitbp(); } Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1865,7 +1865,7 @@ return; m_sections_up = llvm::make_unique(); - VMAddressProvider address_provider(CalculateType()); + VMAddressProvider address_provider(GetType()); size_t LoadID = 0; for (const auto &EnumPHdr : llvm::enumerate(ProgramHeaders())) { Index: lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp === --- lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -327,6 +327,10 @@ FileSpec(jit_name), symbolfile_addr, symbolfile_size); if (module_sp && module_sp->GetObjectFile()) { +// Object formats (like ELF) have no representation for a JIT type. +// We will get it wrong, if we deduce it from the header. +module_sp->GetObjectFile()->SetType(ObjectFile::eTypeJIT); + // load the symbol table right away module_sp->GetObjectFile()->GetSymtab(); Index: lldb/lit/helper/toolchain.py === --- lldb/lit/helper/toolchain.py +++ lldb/lit/helper/toolchain.py @@ -129,6 +129,6 @@ support_tools = ['yaml2obj', 'obj2yaml', 'llvm-pdbutil', 'llvm-mc', 'llvm-readobj', 'llvm-objdump', - 'llvm-objcopy'] + 'llvm-objcopy', 'lli'] additional_tool_dirs += [config.lldb_tools_dir, config.llvm_tools_dir] llvm_config.add_tool_substitutions(support_tools, additional_tool_dirs) Index: lldb/lit/Breakpoint/jitbp_elf.
[Lldb-commits] [PATCH] D61611: [JITLoaderGDB] Set eTypeJIT for objects read from JIT descriptors
sgraenitz marked 3 inline comments as done. sgraenitz added a comment. Thanks for your reply and thoughts about that. > I'd strongly encourage you to try to come up with a testing strategy here. Yes, I just added a simple lit test. What do you think? I ran it in isolation on macOS (`UNSUPPORTED`) and on Ubuntu 18.04 (`PASS`) using: $ cd path/to/llvm-build $ ninja FileCheck llvm-config lli clang lldb $ python bin/llvm-lit -v /path/to/llvm-project/lldb/lit/Breakpoint/jitbp_elf.test Comment at: lldb/lit/Breakpoint/Inputs/jitbp.cpp:2 +int jitbp() { return 0; } +int main() { return jitbp(); } lli already has a `main()` and so we have `jitbp()` here to set the breakpoint on. Comment at: lldb/lit/Breakpoint/jitbp_elf.test:1 +# REQUIRES: target-x86_64, system-linux, native + The test only works with ELF on Linux. Is the `REQUIRES` sufficient? Comment at: lldb/lit/Breakpoint/jitbp_elf.test:3 + +# RUN: %clang -g -S -emit-llvm -o %t.ll %p/Inputs/jitbp.cpp +# RUN: %lldb -b -o 'b jitbp' -o 'run -jit-kind=mcjit %t.ll' lli | FileCheck %s With these args, clang shouldn't optimize away `jitbp()` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61611/new/ https://reviews.llvm.org/D61611 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61438: [ASTImporter] Use llvm::Expected and Error in the importer API
sgraenitz added inline comments. Comment at: lldb/source/Symbol/ClangASTImporter.cpp:68 + return *ret_or_error; +} else { + Log *log = aprantl wrote: > The `else` is redundant. Here it's necessary for the scope of `ret_or_error`. That's a bit unfortunate. Maybe invert the condition? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61438/new/ https://reviews.llvm.org/D61438 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows
amccarth added inline comments. Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:220 +// In most cases the missing notifications do not affect lldb-server +// so we are temporarily relaxing the following for Windows. +#if !defined(_WIN32) What's the scope of "temporarily"? Is there some specific feature or change that will cause this workaround to be removed? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61686/new/ https://reviews.llvm.org/D61686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC
thakis added a comment. Hello, in a bit of a https://xkcd.com/1172/ moment this breaks the chromium/android build. We have a list of "resources" (strings, bitmaps, etc) that we list in an XML file which then generates a header with lots of "IDR_foo" constants. As it turns out, now all of these resources are used on all platforms, so we use the following technique to only keep the ones actually used on android: - Have an empty template function `template Whitelist() {}` - Have the resource header expand IDR_foo to `(Whitelist(), unique_id_per_resource)` where `unique_id_per_resource` is something like 123 (and different for every resource) - For every IDR_foo referenced in a cc file, this generates debug info for the function call `Whitelist()` We then look at `'readelf', '-p', '.debug_str'` and grep for `WhitelistedResource<` and keep all resources whose ID is referenced from debug info. Before this change, this worked great. Now, resources that are referenced from functions that make it into the final binary get stripped. From the patch description, it sounds like maybe that shouldn't happen (can you confirm?), but in practice it does. If this only stripped debug info for functions that don't make it into the final binary, this would be a great change for us though! Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54747/new/ https://reviews.llvm.org/D54747 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows
Hui added inline comments. Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:220 +// In most cases the missing notifications do not affect lldb-server +// so we are temporarily relaxing the following for Windows. +#if !defined(_WIN32) amccarth wrote: > What's the scope of "temporarily"? Is there some specific feature or change > that will cause this workaround to be removed? Currently the absence of pty support is treated as a fatal error that will block the overall usage of lldb-server.exe for windows. In my opinion, the redirection of std -i/o/e are mainly intended to generate I* and O* packets to notify the lldb about the llgs's inferior (shown on lldb console). Without such support, some of the lldb-server functionalities, like launch/attach process and most of the remote packets etc. still can be tested or say be experimented (see the python tests under tools/lldb-server). Temporarily relax the mentioned codes and wait for the pty support on windows. No concrete idea how to add that support now. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61686/new/ https://reviews.llvm.org/D61686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC
thakis added a comment. That problem only seems to happen when (thin) lto is enabled. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54747/new/ https://reviews.llvm.org/D54747 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows
amccarth marked an inline comment as done. amccarth added inline comments. Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:220 +// In most cases the missing notifications do not affect lldb-server +// so we are temporarily relaxing the following for Windows. +#if !defined(_WIN32) Hui wrote: > amccarth wrote: > > What's the scope of "temporarily"? Is there some specific feature or > > change that will cause this workaround to be removed? > Currently the absence of pty support is treated as a fatal error that will > block the overall usage of lldb-server.exe for windows. In my opinion, the > redirection of std -i/o/e are mainly intended to generate I* and O* packets > to notify the lldb about the llgs's inferior (shown on lldb console). Without > such support, some of the lldb-server functionalities, like launch/attach > process and most of the remote packets etc. still can be tested or say be > experimented (see the python tests under tools/lldb-server). > > Temporarily relax the mentioned codes and wait for the pty support on > windows. No concrete idea how to add that support now. Got it. I misunderstood the original comment and thought the "temporarily" applied to the code change itself. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61686/new/ https://reviews.llvm.org/D61686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows
compnerd added inline comments. Comment at: include/lldb/Host/windows/PosixApi.h:108 + // To be implemented. + return pid_t(-1); +} This should be out-of-lined. Furthermore, is there any place where the use requires process group handling? Otherwise, can't we just replace this with: ``` pid_t waitpid(pid_t pid, int *status, int options) { assert(pid > 0 && "only support waiting for a particular child"); assert(options ^ ~WNOHANG == 0 && "only WNOHANG is supported'); HANDLE hProcess; DWORD dwResult; hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); if (hProcess == NULL) return pid_t(-1); // TODO(compnerd) better error handling dwResult = WaitForSingleObject(hProcess, options & WNOHANG ? 0 : INFINITE); CloseHandle(hProcess); if (dwResult == WAIT_OBJECT_0 || dwResult == WAIT_TIMEOUT) return pid; return pid_t(-1); } ``` Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:220 +// In most cases the missing notifications do not affect lldb-server +// so we are temporarily relaxing the following for Windows. +#if !defined(_WIN32) amccarth wrote: > Hui wrote: > > amccarth wrote: > > > What's the scope of "temporarily"? Is there some specific feature or > > > change that will cause this workaround to be removed? > > Currently the absence of pty support is treated as a fatal error that will > > block the overall usage of lldb-server.exe for windows. In my opinion, the > > redirection of std -i/o/e are mainly intended to generate I* and O* packets > > to notify the lldb about the llgs's inferior (shown on lldb console). > > Without such support, some of the lldb-server functionalities, like > > launch/attach process and most of the remote packets etc. still can be > > tested or say be experimented (see the python tests under > > tools/lldb-server). > > > > Temporarily relax the mentioned codes and wait for the pty support on > > windows. No concrete idea how to add that support now. > Got it. I misunderstood the original comment and thought the "temporarily" > applied to the code change itself. PTY support is available as of 2019H1. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61686/new/ https://reviews.llvm.org/D61686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC
Tagging in Teresa as well for the thinlto parts. On Wed, May 8, 2019 at 12:43 PM Nico Weber via Phabricator wrote: > > thakis added a comment. > > That problem only seems to happen when (thin) lto is enabled. > > > Repository: > rL LLVM > > CHANGES SINCE LAST ACTION > https://reviews.llvm.org/D54747/new/ > > https://reviews.llvm.org/D54747 > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r360285 - [Reproducers] Fix unitialized pointer
Author: jdevlieghere Date: Wed May 8 14:07:15 2019 New Revision: 360285 URL: http://llvm.org/viewvc/llvm-project?rev=360285&view=rev Log: [Reproducers] Fix unitialized pointer The FileCollector pointer in the FileSystem class wasn't initialized to nullptr during replay. Modified: lldb/trunk/include/lldb/Host/FileSystem.h Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=360285&r1=360284&r2=360285&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Wed May 8 14:07:15 2019 @@ -39,7 +39,7 @@ public: m_mapped(false) {} FileSystem(llvm::IntrusiveRefCntPtr fs, bool mapped = false) - : m_fs(fs), m_mapped(mapped) {} + : m_fs(fs), m_collector(nullptr), m_mapped(mapped) {} FileSystem(const FileSystem &fs) = delete; FileSystem &operator=(const FileSystem &fs) = delete; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r360286 - [Reproducers] Flush files to disk periodically
Author: jdevlieghere Date: Wed May 8 14:07:19 2019 New Revision: 360286 URL: http://llvm.org/viewvc/llvm-project?rev=360286&view=rev Log: [Reproducers] Flush files to disk periodically Periodically flush some of the data to disk. Although not perfect, this helps when the debugger crashes. Modified: lldb/trunk/include/lldb/Utility/Reproducer.h lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Modified: lldb/trunk/include/lldb/Utility/Reproducer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=360286&r1=360285&r2=360286&view=diff == --- lldb/trunk/include/lldb/Utility/Reproducer.h (original) +++ lldb/trunk/include/lldb/Utility/Reproducer.h Wed May 8 14:07:19 2019 @@ -126,6 +126,7 @@ public: m_os << t; if (newline) m_os << '\n'; +m_os.flush(); } const FileSpec &GetFilename() { return m_filename; } Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=360286&r1=360285&r2=360286&view=diff == --- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original) +++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Wed May 8 14:07:19 2019 @@ -542,7 +542,9 @@ public: SerializeAll(tail...); } - void SerializeAll() {} + void SerializeAll() { +m_stream.flush(); + } private: /// Serialize pointers. We need to differentiate between pointers to ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D60153: Re-enable most lldb-vscode tests on Linux.
stella.stamenova added a comment. A couple of the tests from TestVSCode_attach.py (test_by_pid and test_by_name) are failing for us on Ubuntu because they are failing to attach: `AssertionError: False is not True : attach failed (Operation not permitted)`. It looks like attaching by pid or by name requires elevation - if I rerun the same tests with sudo, they pass reliably. How did you run the tests when they passed for you? Incidentally, AFAIK there is no Ubuntu lldb bot... Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60153/new/ https://reviews.llvm.org/D60153 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61659: Fix bug in ArchSpec::MergeFrom
This revision was automatically updated to reflect the committed changes. Closed by commit rL360292: Fix bug in ArchSpec::MergeFrom (authored by gclayton, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D61659?vs=198538&id=198734#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61659/new/ https://reviews.llvm.org/D61659 Files: lldb/trunk/source/Utility/ArchSpec.cpp lldb/trunk/unittests/Utility/ArchSpecTest.cpp Index: lldb/trunk/unittests/Utility/ArchSpecTest.cpp === --- lldb/trunk/unittests/Utility/ArchSpecTest.cpp +++ lldb/trunk/unittests/Utility/ArchSpecTest.cpp @@ -10,6 +10,7 @@ #include "lldb/Utility/ArchSpec.h" #include "llvm/BinaryFormat/MachO.h" +#include "llvm/BinaryFormat/ELF.h" using namespace lldb; using namespace lldb_private; @@ -174,6 +175,31 @@ EXPECT_EQ(llvm::Triple::EnvironmentType::Android, A.GetTriple().getEnvironment()); } + { +ArchSpec A, B; +A.SetArchitecture(eArchTypeELF, llvm::ELF::EM_ARM, + LLDB_INVALID_CPUTYPE, llvm::ELF::ELFOSABI_NONE); +B.SetArchitecture(eArchTypeELF, llvm::ELF::EM_ARM, + LLDB_INVALID_CPUTYPE, llvm::ELF::ELFOSABI_LINUX); + +EXPECT_TRUE(A.IsValid()); +EXPECT_TRUE(B.IsValid()); + +EXPECT_EQ(llvm::Triple::ArchType::arm, B.GetTriple().getArch()); +EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor, + B.GetTriple().getVendor()); +EXPECT_EQ(llvm::Triple::OSType::Linux, B.GetTriple().getOS()); +EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment, + B.GetTriple().getEnvironment()); + +A.MergeFrom(B); +EXPECT_EQ(llvm::Triple::ArchType::arm, A.GetTriple().getArch()); +EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor, + A.GetTriple().getVendor()); +EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS()); +EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment, + A.GetTriple().getEnvironment()); + } } TEST(ArchSpecTest, MergeFromMachOUnknown) { Index: lldb/trunk/source/Utility/ArchSpec.cpp === --- lldb/trunk/source/Utility/ArchSpec.cpp +++ lldb/trunk/source/Utility/ArchSpec.cpp @@ -859,7 +859,7 @@ void ArchSpec::MergeFrom(const ArchSpec &other) { if (!TripleVendorWasSpecified() && other.TripleVendorWasSpecified()) GetTriple().setVendor(other.GetTriple().getVendor()); - if (!TripleOSWasSpecified() && other.TripleVendorWasSpecified()) + if (!TripleOSWasSpecified() && other.TripleOSWasSpecified()) GetTriple().setOS(other.GetTriple().getOS()); if (GetTriple().getArch() == llvm::Triple::UnknownArch) { GetTriple().setArch(other.GetTriple().getArch()); Index: lldb/trunk/unittests/Utility/ArchSpecTest.cpp === --- lldb/trunk/unittests/Utility/ArchSpecTest.cpp +++ lldb/trunk/unittests/Utility/ArchSpecTest.cpp @@ -10,6 +10,7 @@ #include "lldb/Utility/ArchSpec.h" #include "llvm/BinaryFormat/MachO.h" +#include "llvm/BinaryFormat/ELF.h" using namespace lldb; using namespace lldb_private; @@ -174,6 +175,31 @@ EXPECT_EQ(llvm::Triple::EnvironmentType::Android, A.GetTriple().getEnvironment()); } + { +ArchSpec A, B; +A.SetArchitecture(eArchTypeELF, llvm::ELF::EM_ARM, + LLDB_INVALID_CPUTYPE, llvm::ELF::ELFOSABI_NONE); +B.SetArchitecture(eArchTypeELF, llvm::ELF::EM_ARM, + LLDB_INVALID_CPUTYPE, llvm::ELF::ELFOSABI_LINUX); + +EXPECT_TRUE(A.IsValid()); +EXPECT_TRUE(B.IsValid()); + +EXPECT_EQ(llvm::Triple::ArchType::arm, B.GetTriple().getArch()); +EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor, + B.GetTriple().getVendor()); +EXPECT_EQ(llvm::Triple::OSType::Linux, B.GetTriple().getOS()); +EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment, + B.GetTriple().getEnvironment()); + +A.MergeFrom(B); +EXPECT_EQ(llvm::Triple::ArchType::arm, A.GetTriple().getArch()); +EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor, + A.GetTriple().getVendor()); +EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS()); +EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment, + A.GetTriple().getEnvironment()); + } } TEST(ArchSpecTest, MergeFromMachOUnknown) { Index: lldb/trunk/source/Utility/ArchSpec.cpp === --- lldb/trunk/source/Utility/ArchSpec.cpp +++ lldb/trunk/source/Utility/ArchSpec.cpp @@ -859,7 +859,7 @@ void ArchSpec::MergeFrom(const ArchSpec &other) { if (!TripleVendorWasSpecified() && other.TripleVendorWasSpecified()) GetTriple().setVendor(other.GetTriple().getVendor()); -
[Lldb-commits] [lldb] r360292 - Fix bug in ArchSpec::MergeFrom
Author: gclayton Date: Wed May 8 15:03:22 2019 New Revision: 360292 URL: http://llvm.org/viewvc/llvm-project?rev=360292&view=rev Log: Fix bug in ArchSpec::MergeFrom Previous ArchSpec tests didn't catch this bug since we never tested just the OS being out of date. Fixed the bug and covered this with a test that would catch this. This was found when trying to load a core file where the core file was an ELF file with just the e_machine for architeture and where the ELF header had no OS set in the OSABI field of the e_ident. It wasn't merging the architecture with the target architecture correctly. Differential Revision: https://reviews.llvm.org/D61659 Modified: lldb/trunk/source/Utility/ArchSpec.cpp lldb/trunk/unittests/Utility/ArchSpecTest.cpp Modified: lldb/trunk/source/Utility/ArchSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ArchSpec.cpp?rev=360292&r1=360291&r2=360292&view=diff == --- lldb/trunk/source/Utility/ArchSpec.cpp (original) +++ lldb/trunk/source/Utility/ArchSpec.cpp Wed May 8 15:03:22 2019 @@ -859,7 +859,7 @@ bool ArchSpec::ContainsOnlyArch(const ll void ArchSpec::MergeFrom(const ArchSpec &other) { if (!TripleVendorWasSpecified() && other.TripleVendorWasSpecified()) GetTriple().setVendor(other.GetTriple().getVendor()); - if (!TripleOSWasSpecified() && other.TripleVendorWasSpecified()) + if (!TripleOSWasSpecified() && other.TripleOSWasSpecified()) GetTriple().setOS(other.GetTriple().getOS()); if (GetTriple().getArch() == llvm::Triple::UnknownArch) { GetTriple().setArch(other.GetTriple().getArch()); Modified: lldb/trunk/unittests/Utility/ArchSpecTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ArchSpecTest.cpp?rev=360292&r1=360291&r2=360292&view=diff == --- lldb/trunk/unittests/Utility/ArchSpecTest.cpp (original) +++ lldb/trunk/unittests/Utility/ArchSpecTest.cpp Wed May 8 15:03:22 2019 @@ -10,6 +10,7 @@ #include "lldb/Utility/ArchSpec.h" #include "llvm/BinaryFormat/MachO.h" +#include "llvm/BinaryFormat/ELF.h" using namespace lldb; using namespace lldb_private; @@ -174,6 +175,31 @@ TEST(ArchSpecTest, MergeFrom) { EXPECT_EQ(llvm::Triple::EnvironmentType::Android, A.GetTriple().getEnvironment()); } + { +ArchSpec A, B; +A.SetArchitecture(eArchTypeELF, llvm::ELF::EM_ARM, + LLDB_INVALID_CPUTYPE, llvm::ELF::ELFOSABI_NONE); +B.SetArchitecture(eArchTypeELF, llvm::ELF::EM_ARM, + LLDB_INVALID_CPUTYPE, llvm::ELF::ELFOSABI_LINUX); + +EXPECT_TRUE(A.IsValid()); +EXPECT_TRUE(B.IsValid()); + +EXPECT_EQ(llvm::Triple::ArchType::arm, B.GetTriple().getArch()); +EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor, + B.GetTriple().getVendor()); +EXPECT_EQ(llvm::Triple::OSType::Linux, B.GetTriple().getOS()); +EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment, + B.GetTriple().getEnvironment()); + +A.MergeFrom(B); +EXPECT_EQ(llvm::Triple::ArchType::arm, A.GetTriple().getArch()); +EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor, + A.GetTriple().getVendor()); +EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS()); +EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment, + A.GetTriple().getEnvironment()); + } } TEST(ArchSpecTest, MergeFromMachOUnknown) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r360298 - [Reproducers] Fix reproducer unittest
Author: jdevlieghere Date: Wed May 8 15:59:35 2019 New Revision: 360298 URL: http://llvm.org/viewvc/llvm-project?rev=360298&view=rev Log: [Reproducers] Fix reproducer unittest I think the recent change to flush the SB API recording uncovered a real issue on the Windows bot. Although I couldn't make much sense of the error message "unknown file: error: SEH exception with code 0x3221225477 thrown in the test body.", it prompted me to look at the test. In the unit test we were recording during replay, which is obviously not correct. I think we didn't see this issue before because we flushed once after the recording was done. This patch unsets the recording logic during the replay part of the test. Hopefully this fixed the Windows bot. Modified: lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp Modified: lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp?rev=360298&r1=360297&r2=360298&view=diff == --- lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp (original) +++ lldb/trunk/unittests/Utility/ReproducerInstrumentationTest.cpp Wed May 8 15:59:35 2019 @@ -54,7 +54,7 @@ static llvm::Optional g_seri static llvm::Optional g_registry; #define LLDB_GET_INSTRUMENTATION_DATA() \ - InstrumentationData(*g_serializer, *g_registry) + g_serializer ? InstrumentationData(*g_serializer, *g_registry) : InstrumentationData() class InstrumentedFoo { public: @@ -109,6 +109,8 @@ static std::vector g_ static std::vector g_bars; void ClearObjects() { + g_registry.reset(); + g_serializer.reset(); g_foos.clear(); g_bars.clear(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r360304 - Fix the output file dependency for Options.inc.
Author: jingham Date: Wed May 8 18:43:27 2019 New Revision: 360304 URL: http://llvm.org/viewvc/llvm-project?rev=360304&view=rev Log: Fix the output file dependency for Options.inc. The script phase to do Options.td -> Options.inc was wrong (missing the "include" directory) so the rule didn't get run when Options.td changed. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=360304&r1=360303&r2=360304&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed May 8 18:43:27 2019 @@ -7695,7 +7695,7 @@ outputFileListPaths = ( ); outputPaths = ( - $BUILT_PRODUCTS_DIR/Options.inc, + $BUILT_PRODUCTS_DIR/include/Options.inc, ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D61713: [lldb] build.py: fix behavior when passing --compiler=/path/to/compiler
jgorbe created this revision. jgorbe added reviewers: labath, zturner. Herald added a subscriber: teemperor. Herald added a project: LLDB. All the other paths in the find_toolchain function return a tuple (detected_toolchain_type, compiler_path), but when the parameter to `--compiler` is not one of the predefined names it only returns the detected toolchain type, which causes an error when trying to unpack the result. This patch changes it to return also the compiler path passed as a parameter. Repository: rLLDB LLDB https://reviews.llvm.org/D61713 Files: lldb/lit/helper/build.py Index: lldb/lit/helper/build.py === --- lldb/lit/helper/build.py +++ lldb/lit/helper/build.py @@ -207,16 +207,16 @@ file = os.path.basename(compiler) name, ext = os.path.splitext(file) if file.lower() == 'cl.exe': -return 'msvc' +return ('msvc', compiler) if name == 'clang-cl': -return 'clang-cl' +return ('clang-cl', compiler) if name.startswith('clang'): -return 'clang' +return ('clang', compiler) if name.startswith('gcc') or name.startswith('g++'): -return 'gcc' +return ('gcc', compiler) if name == 'cc' or name == 'c++': -return 'generic' -return 'unknown' +return ('generic', compiler) +return ('unknown', compiler) class Builder(object): def __init__(self, toolchain_type, args, obj_ext): Index: lldb/lit/helper/build.py === --- lldb/lit/helper/build.py +++ lldb/lit/helper/build.py @@ -207,16 +207,16 @@ file = os.path.basename(compiler) name, ext = os.path.splitext(file) if file.lower() == 'cl.exe': -return 'msvc' +return ('msvc', compiler) if name == 'clang-cl': -return 'clang-cl' +return ('clang-cl', compiler) if name.startswith('clang'): -return 'clang' +return ('clang', compiler) if name.startswith('gcc') or name.startswith('g++'): -return 'gcc' +return ('gcc', compiler) if name == 'cc' or name == 'c++': -return 'generic' -return 'unknown' +return ('generic', compiler) +return ('unknown', compiler) class Builder(object): def __init__(self, toolchain_type, args, obj_ext): ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r360312 - Fix up lldb after clang r360311.
Author: rsmith Date: Wed May 8 21:40:57 2019 New Revision: 360312 URL: http://llvm.org/viewvc/llvm-project?rev=360312&view=rev Log: Fix up lldb after clang r360311. Patch by Tyker! Differential Revision: https://reviews.llvm.org/D60934 Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=360312&r1=360311&r2=360312&view=diff == --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed May 8 21:40:57 2019 @@ -8173,6 +8173,10 @@ clang::CXXMethodDecl *ClangASTContext::A if (is_artificial) return nullptr; // skip everything artificial + const clang::ExplicitSpecifier explicit_spec( + nullptr /*expr*/, is_explicit +? clang::ExplicitSpecKind::ResolvedTrue +: clang::ExplicitSpecKind::ResolvedFalse); if (name[0] == '~') { cxx_dtor_decl = clang::CXXDestructorDecl::Create( *getASTContext(), cxx_record_decl, clang::SourceLocation(), @@ -8191,7 +8195,7 @@ clang::CXXMethodDecl *ClangASTContext::A clang::SourceLocation()), method_qual_type, nullptr, // TypeSourceInfo * -is_explicit, is_inline, is_artificial, false /*is_constexpr*/); +explicit_spec, is_inline, is_artificial, false /*is_constexpr*/); cxx_method_decl = cxx_ctor_decl; } else { clang::StorageClass SC = is_static ? clang::SC_Static : clang::SC_None; @@ -8226,7 +8230,7 @@ clang::CXXMethodDecl *ClangASTContext::A clang::SourceLocation()), method_qual_type, nullptr, // TypeSourceInfo * -is_inline, is_explicit, false /*is_constexpr*/, +is_inline, explicit_spec, false /*is_constexpr*/, clang::SourceLocation()); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits