[Lldb-commits] [PATCH] D40311: elf-core: Split up parsing code into os-specific functions
labath added inline comments. Comment at: source/Plugins/Process/elf-core/ProcessElfCore.cpp:735 /// (see ELFNote structure) /// 3) A Thread Context in a core file usually described by 3 NOTE entries. ///a) NT_PRSTATUS - Register context krytarowski wrote: > Can we label it as SVR4-style (Linux, FreeBSD, Solaris)? Alternatively move > it to other place in order to describe Linux and FreeBSD separately (NetBSD > an OpenBSD can be skipped now). Yeah, I was wondering what to do with that comment -- it is so vague it is nearly useless. I agree we should move the core file description to the individual OS's parsing functions. I've written a description of the linux notes. Freebsd ones seem pretty similar, but don't know enough about them to say if the description applies to them as well. https://reviews.llvm.org/D40311 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40311: elf-core: Split up parsing code into os-specific functions
labath updated this revision to Diff 123898. labath added a comment. Update comments. https://reviews.llvm.org/D40311 Files: source/Plugins/Process/elf-core/ProcessElfCore.cpp source/Plugins/Process/elf-core/ProcessElfCore.h source/Plugins/Process/elf-core/ThreadElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.h source/Plugins/Process/elf-core/elf-core-enums.h Index: source/Plugins/Process/elf-core/elf-core-enums.h === --- source/Plugins/Process/elf-core/elf-core-enums.h +++ source/Plugins/Process/elf-core/elf-core-enums.h @@ -10,6 +10,10 @@ #ifndef LLDB_ELF_CORE_ENUMS_H #define LLDB_ELF_CORE_ENUMS_H +#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" +#include "lldb/Utility/DataExtractor.h" + +namespace lldb_private { /// Core files PT_NOTE segment descriptor types namespace FREEBSD { @@ -52,4 +56,11 @@ }; } +struct CoreNote { + ELFNote info; + DataExtractor data; +}; + +} // namespace lldb_private + #endif // #ifndef LLDB_ELF_CORE_ENUMS_H Index: source/Plugins/Process/elf-core/ThreadElfCore.h === --- source/Plugins/Process/elf-core/ThreadElfCore.h +++ source/Plugins/Process/elf-core/ThreadElfCore.h @@ -58,15 +58,15 @@ ELFLinuxPrStatus(); - lldb_private::Status Parse(lldb_private::DataExtractor &data, - lldb_private::ArchSpec &arch); + lldb_private::Status Parse(const lldb_private::DataExtractor &data, + const lldb_private::ArchSpec &arch); // Return the bytesize of the structure // 64 bit - just sizeof // 32 bit - hardcoded because we are reusing the struct, but some of the // members are smaller - // so the layout is not the same - static size_t GetSize(lldb_private::ArchSpec &arch); + static size_t GetSize(const lldb_private::ArchSpec &arch); }; static_assert(sizeof(ELFLinuxPrStatus) == 112, @@ -79,7 +79,7 @@ ELFLinuxSigInfo(); - lldb_private::Status Parse(lldb_private::DataExtractor &data, + lldb_private::Status Parse(const lldb_private::DataExtractor &data, const lldb_private::ArchSpec &arch); // Return the bytesize of the structure @@ -114,15 +114,15 @@ ELFLinuxPrPsInfo(); - lldb_private::Status Parse(lldb_private::DataExtractor &data, - lldb_private::ArchSpec &arch); + lldb_private::Status Parse(const lldb_private::DataExtractor &data, + const lldb_private::ArchSpec &arch); // Return the bytesize of the structure // 64 bit - just sizeof // 32 bit - hardcoded because we are reusing the struct, but some of the // members are smaller - // so the layout is not the same - static size_t GetSize(lldb_private::ArchSpec &arch); + static size_t GetSize(const lldb_private::ArchSpec &arch); }; static_assert(sizeof(ELFLinuxPrPsInfo) == 136, Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp === --- source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -259,7 +259,7 @@ memset(this, 0, sizeof(ELFLinuxPrStatus)); } -size_t ELFLinuxPrStatus::GetSize(lldb_private::ArchSpec &arch) { +size_t ELFLinuxPrStatus::GetSize(const lldb_private::ArchSpec &arch) { constexpr size_t mips_linux_pr_status_size_o32 = 96; constexpr size_t mips_linux_pr_status_size_n32 = 72; if (arch.IsMIPS()) { @@ -285,7 +285,8 @@ } } -Status ELFLinuxPrStatus::Parse(DataExtractor &data, ArchSpec &arch) { +Status ELFLinuxPrStatus::Parse(const DataExtractor &data, + const ArchSpec &arch) { Status error; if (GetSize(arch) > data.GetByteSize()) { error.SetErrorStringWithFormat( @@ -334,7 +335,7 @@ memset(this, 0, sizeof(ELFLinuxPrPsInfo)); } -size_t ELFLinuxPrPsInfo::GetSize(lldb_private::ArchSpec &arch) { +size_t ELFLinuxPrPsInfo::GetSize(const lldb_private::ArchSpec &arch) { constexpr size_t mips_linux_pr_psinfo_size_o32_n32 = 128; if (arch.IsMIPS()) { uint8_t address_byte_size = arch.GetAddressByteSize(); @@ -355,7 +356,8 @@ } } -Status ELFLinuxPrPsInfo::Parse(DataExtractor &data, ArchSpec &arch) { +Status ELFLinuxPrPsInfo::Parse(const DataExtractor &data, + const ArchSpec &arch) { Status error; ByteOrder byteorder = data.GetByteOrder(); if (GetSize(arch) > data.GetByteSize()) { @@ -424,7 +426,7 @@ } } -Status ELFLinuxSigInfo::Parse(DataExtractor &data, const ArchSpec &arch) { +Status ELFLinuxSigInfo::Parse(const DataExtractor &data, const ArchSpec &arch) { Status error; if (GetSize(arch) > data.GetByteSize()) { error.SetErrorStringWithFormat( Index: source/Plugins/Process/elf-core/ProcessElfCore.h === --- source/Plugins/Process/elf-core/ProcessElfCor
[Lldb-commits] [PATCH] D40311: elf-core: Split up parsing code into os-specific functions
kettenis added a comment. Looks like a good improvement to me. https://reviews.llvm.org/D40311 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40022: Remove extra minuses from command option
tatyana-krasnukha updated this revision to Diff 123942. tatyana-krasnukha retitled this revision from "Corrected two typos and removed unused variable" to "Remove extra minuses from command option". tatyana-krasnukha edited the summary of this revision. tatyana-krasnukha added a comment. Things that didn't require review was committed separately. Repository: rL LLVM https://reviews.llvm.org/D40022 Files: CommandObjectTarget.cpp Index: CommandObjectTarget.cpp === --- CommandObjectTarget.cpp +++ CommandObjectTarget.cpp @@ -2586,7 +2586,7 @@ "Fullpath or basename for module to load.", ""), m_load_option(LLDB_OPT_SET_1, false, "load", 'l', "Write file contents to the memory.", false, true), -m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p', +m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p', "Set PC to the entry point." " Only applicable with '--load' option.", false, true), Index: CommandObjectTarget.cpp === --- CommandObjectTarget.cpp +++ CommandObjectTarget.cpp @@ -2586,7 +2586,7 @@ "Fullpath or basename for module to load.", ""), m_load_option(LLDB_OPT_SET_1, false, "load", 'l', "Write file contents to the memory.", false, true), -m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p', +m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p', "Set PC to the entry point." " Only applicable with '--load' option.", false, true), ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40022: Remove extra minuses from command option
tatyana-krasnukha updated this revision to Diff 123953. tatyana-krasnukha added a comment. Made diff with full paths (studying to use arcanist)... Repository: rL LLVM https://reviews.llvm.org/D40022 Files: source/Commands/CommandObjectTarget.cpp Index: source/Commands/CommandObjectTarget.cpp === --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -2586,7 +2586,7 @@ "Fullpath or basename for module to load.", ""), m_load_option(LLDB_OPT_SET_1, false, "load", 'l', "Write file contents to the memory.", false, true), -m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p', +m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p', "Set PC to the entry point." " Only applicable with '--load' option.", false, true), Index: source/Commands/CommandObjectTarget.cpp === --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -2586,7 +2586,7 @@ "Fullpath or basename for module to load.", ""), m_load_option(LLDB_OPT_SET_1, false, "load", 'l', "Write file contents to the memory.", false, true), -m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p', +m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p', "Set PC to the entry point." " Only applicable with '--load' option.", false, true), ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
nelhage updated this revision to Diff 124018. nelhage added a comment. Add a test case. Verified that it passes on my machine and fails with this patch reverted. https://reviews.llvm.org/D40283 Files: include/lldb/Symbol/ClangASTContext.h packages/Python/lldbsuite/test/expression_command/issue_35310/ packages/Python/lldbsuite/test/expression_command/issue_35310/Makefile packages/Python/lldbsuite/test/expression_command/issue_35310/TestExprsBug35310.py packages/Python/lldbsuite/test/expression_command/issue_35310/flycheck_main.plist packages/Python/lldbsuite/test/expression_command/issue_35310/main.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -7960,7 +7960,7 @@ } clang::CXXMethodDecl *ClangASTContext::AddMethodToCXXRecordType( -lldb::opaque_compiler_type_t type, const char *name, +lldb::opaque_compiler_type_t type, const char *name, const char *mangled_name, const CompilerType &method_clang_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, bool is_attr_used, bool is_artificial) { @@ -8080,6 +8080,11 @@ if (is_attr_used) cxx_method_decl->addAttr(clang::UsedAttr::CreateImplicit(*getASTContext())); + if (mangled_name != NULL) { +cxx_method_decl->addAttr( +clang::AsmLabelAttr::CreateImplicit(*getASTContext(), mangled_name)); + } + // Populate the method decl with parameter decls llvm::SmallVector params; Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -220,6 +220,7 @@ bool is_forward_declaration = false; DWARFAttributes attributes; const char *type_name_cstr = NULL; + const char *mangled_name_cstr = NULL; ConstString type_name_const_str; Type::ResolveState resolve_state = Type::eResolveStateUnresolved; uint64_t byte_size = 0; @@ -1135,9 +1136,8 @@ case DW_AT_linkage_name: case DW_AT_MIPS_linkage_name: -break; // mangled = - // form_value.AsCString(&dwarf->get_debug_str_data()); - // break; +mangled_name_cstr = form_value.AsCString(); +break; case DW_AT_type: type_die_form = form_value; break; @@ -1498,9 +1498,10 @@ clang::CXXMethodDecl *cxx_method_decl = m_ast.AddMethodToCXXRecordType( class_opaque_type.GetOpaqueQualType(), - type_name_cstr, clang_type, accessibility, - is_virtual, is_static, is_inline, is_explicit, - is_attr_used, is_artificial); + type_name_cstr, mangled_name_cstr, clang_type, + accessibility, is_virtual, is_static, + is_inline, is_explicit, is_attr_used, + is_artificial); type_handled = cxx_method_decl != NULL; Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp === --- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -2165,7 +2165,7 @@ CXXMethodDecl *method_decl = ClangASTContext::GetASTContext(m_ast_context) ->AddMethodToCXXRecordType( -copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", +copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", NULL, method_type, lldb::eAccessPublic, is_virtual, is_static, is_inline, is_explicit, is_attr_used, is_artificial); Index: packages/Python/lldbsuite/test/expression_command/issue_35310/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/issue_35310/main.cpp @@ -0,0 +1,19 @@ +#include + +class A { +public: + int __attribute__((abi_tag("cxx11"))) test_abi_tag() { + return 1; + } + int test_asm_name() asm("A_test_asm") { + return 2; + } +}; + +int main(int argc, char **argv) { + A a; + // Break here + a.test_abi_tag(); + a.test_asm_name(); + return 0; +} Index: packages/Python/lldbsuite/test/expression_command/issue_35310/flycheck_main.plist
[Lldb-commits] [lldb] r318886 - Run clang-format on source/Host/common/Symbols.cpp
Author: sas Date: Wed Nov 22 15:56:32 2017 New Revision: 318886 URL: http://llvm.org/viewvc/llvm-project?rev=318886&view=rev Log: Run clang-format on source/Host/common/Symbols.cpp I saw a bunch of style errors so this fixes them. Modified: lldb/trunk/source/Host/common/Symbols.cpp Modified: lldb/trunk/source/Host/common/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=318886&r1=318885&r2=318886&view=diff == --- lldb/trunk/source/Host/common/Symbols.cpp (original) +++ lldb/trunk/source/Host/common/Symbols.cpp Wed Nov 22 15:56:32 2017 @@ -109,25 +109,25 @@ static bool LocateDSYMInVincinityOfExecu // Remove the binary name from the FileSpec parent_dirs.RemoveLastPathComponent(); - // Add a ".dSYM" name to each directory component of the path, stripping - // off components. e.g. we may have a binary like + // Add a ".dSYM" name to each directory component of the path, + // stripping off components. e.g. we may have a binary like // /S/L/F/Foundation.framework/Versions/A/Foundation // and // /S/L/F/Foundation.framework.dSYM // // so we'll need to start with /S/L/F/Foundation.framework/Versions/A, // add the .dSYM part to the "A", and if that doesn't exist, strip off - // the "A" and try it again with "Versions", etc., until we find a dSYM - // bundle or we've stripped off enough path components that there's no - // need to continue. + // the "A" and try it again with "Versions", etc., until we find a + // dSYM bundle or we've stripped off enough path components that + // there's no need to continue. for (int i = 0; i < 4; i++) { -// Does this part of the path have a "." character - could it be a bundle's -// top level directory? +// Does this part of the path have a "." character - could it be a +// bundle's top level directory? const char *fn = parent_dirs.GetFilename().AsCString(); if (fn == nullptr) -break; -if (::strchr (fn, '.') != nullptr) { + break; +if (::strchr(fn, '.') != nullptr) { dsym_fspec = parent_dirs; dsym_fspec.RemoveLastPathComponent(); @@ -140,16 +140,17 @@ static bool LocateDSYMInVincinityOfExecu dsym_fspec.AppendPathComponent("Contents"); dsym_fspec.AppendPathComponent("Resources"); dsym_fspec.AppendPathComponent("DWARF"); - dsym_fspec.AppendPathComponent(exec_fspec->GetFilename().AsCString()); + dsym_fspec.AppendPathComponent( + exec_fspec->GetFilename().AsCString()); if (dsym_fspec.Exists() && - FileAtPathContainsArchAndUUID( - dsym_fspec, module_spec.GetArchitecturePtr(), - module_spec.GetUUIDPtr())) { -if (log) { - log->Printf("dSYM with matching UUID & arch found at %s", - dsym_fspec.GetPath().c_str()); -} -return true; + FileAtPathContainsArchAndUUID( + dsym_fspec, module_spec.GetArchitecturePtr(), + module_spec.GetUUIDPtr())) { +if (log) { + log->Printf("dSYM with matching UUID & arch found at %s", + dsym_fspec.GetPath().c_str()); +} +return true; } } parent_dirs.RemoveLastPathComponent(); @@ -231,7 +232,8 @@ FileSpec Symbols::LocateExecutableSymbol #ifndef LLVM_ON_WIN32 #if defined(__NetBSD__) // Add /usr/libdata/debug directory. -debug_file_search_paths.AppendIfUnique(FileSpec("/usr/libdata/debug", true)); +debug_file_search_paths.AppendIfUnique( +FileSpec("/usr/libdata/debug", true)); #else // Add /usr/lib/debug directory. debug_file_search_paths.AppendIfUnique(FileSpec("/usr/lib/debug", true)); @@ -289,8 +291,7 @@ FileSpec Symbols::LocateExecutableSymbol // For example, this happens for *.dwp files since // at the moment llvm-dwp doesn't output build ids, // nor does binutils dwp. - if (!module_uuid.IsValid() || - module_uuid == mspec.GetUUID()) + if (!module_uuid.IsValid() || module_uuid == mspec.GetUUID()) return file_spec; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
nelhage updated this revision to Diff 124019. nelhage added a comment. Remove accidentally-added flycheck file. https://reviews.llvm.org/D40283 Files: include/lldb/Symbol/ClangASTContext.h packages/Python/lldbsuite/test/expression_command/issue_35310/ packages/Python/lldbsuite/test/expression_command/issue_35310/Makefile packages/Python/lldbsuite/test/expression_command/issue_35310/TestExprsBug35310.py packages/Python/lldbsuite/test/expression_command/issue_35310/main.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -7960,7 +7960,7 @@ } clang::CXXMethodDecl *ClangASTContext::AddMethodToCXXRecordType( -lldb::opaque_compiler_type_t type, const char *name, +lldb::opaque_compiler_type_t type, const char *name, const char *mangled_name, const CompilerType &method_clang_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, bool is_attr_used, bool is_artificial) { @@ -8080,6 +8080,11 @@ if (is_attr_used) cxx_method_decl->addAttr(clang::UsedAttr::CreateImplicit(*getASTContext())); + if (mangled_name != NULL) { +cxx_method_decl->addAttr( +clang::AsmLabelAttr::CreateImplicit(*getASTContext(), mangled_name)); + } + // Populate the method decl with parameter decls llvm::SmallVector params; Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -220,6 +220,7 @@ bool is_forward_declaration = false; DWARFAttributes attributes; const char *type_name_cstr = NULL; + const char *mangled_name_cstr = NULL; ConstString type_name_const_str; Type::ResolveState resolve_state = Type::eResolveStateUnresolved; uint64_t byte_size = 0; @@ -1135,9 +1136,8 @@ case DW_AT_linkage_name: case DW_AT_MIPS_linkage_name: -break; // mangled = - // form_value.AsCString(&dwarf->get_debug_str_data()); - // break; +mangled_name_cstr = form_value.AsCString(); +break; case DW_AT_type: type_die_form = form_value; break; @@ -1498,9 +1498,10 @@ clang::CXXMethodDecl *cxx_method_decl = m_ast.AddMethodToCXXRecordType( class_opaque_type.GetOpaqueQualType(), - type_name_cstr, clang_type, accessibility, - is_virtual, is_static, is_inline, is_explicit, - is_attr_used, is_artificial); + type_name_cstr, mangled_name_cstr, clang_type, + accessibility, is_virtual, is_static, + is_inline, is_explicit, is_attr_used, + is_artificial); type_handled = cxx_method_decl != NULL; Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp === --- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -2165,7 +2165,7 @@ CXXMethodDecl *method_decl = ClangASTContext::GetASTContext(m_ast_context) ->AddMethodToCXXRecordType( -copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", +copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", NULL, method_type, lldb::eAccessPublic, is_virtual, is_static, is_inline, is_explicit, is_attr_used, is_artificial); Index: packages/Python/lldbsuite/test/expression_command/issue_35310/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/issue_35310/main.cpp @@ -0,0 +1,19 @@ +#include + +class A { +public: + int __attribute__((abi_tag("cxx11"))) test_abi_tag() { + return 1; + } + int test_asm_name() asm("A_test_asm") { + return 2; + } +}; + +int main(int argc, char **argv) { + A a; + // Break here + a.test_abi_tag(); + a.test_asm_name(); + return 0; +} Index: packages/Python/lldbsuite/test/expression_command/issue_35310/TestExprsBug35310.py === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/issue_35310/TestExprsBug35310.py @@ -0,0 +1