[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
labath added a comment. I am not sure what do you mean by "translating paths" in the VFS. If you mean something like "return a `FILE *` for `/whatever/my_reproducer/vfs/bin/ls` when I ask for `/bin/ls`", then I think that's a good idea, as it's most likely to work with all of our existing code (e.g. mmapping). Although, in this case, i am not sure how much benefit will the llvm VFS bring to the game, as most of the operations could then be implemented by plainly prepending some prefix to a given path. Getting rid of `FILE *` is not going to be easy, as it is used for some of our external dependencies (libedit). It's possible to create a fake FILE* on posix systems (`fopencookie, fmemopen`), but I don't think it's possible to do something like that on windows (which is why I stopped when I was looking at this some time ago). Also, be aware that there are some places where we open `raw_ostream`s directly (`Debugger::EnableLog` comes to mind). I guess those will need to go through the `FileSystem` too... Comment at: source/Host/common/FileSystem.cpp:253 +static int GetOpenFlags(uint32_t options) { + const bool read = options & File::OpenOptions::eOpenOptionRead; + const bool write = options & File::OpenOptions::eOpenOptionWrite; `File::eOpenOptionRead` should be sufficient, no? Comment at: source/Host/posix/FileSystem.cpp:74-79 +FILE *FileSystem::Fopen(const char *path, const char *mode) const { return ::fopen(path, mode); } -int FileSystem::Open(const char *path, int flags, int mode) { +int FileSystem::Open(const char *path, int flags, int mode) const { return ::open(path, flags, mode); Why are these two `const`? It seems that at least with `eOpenOptionCanCreate`, one can create a new file, which is definitely not a "const" operation. Comment at: source/Utility/FileSpec.cpp:321-322 +bool FileSpec::Empty() const { return m_directory && m_filename; } + //-- We already have `operator bool` for this. Repository: rLLDB LLDB https://reviews.llvm.org/D54020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53915: [FileSystem] Move resolve logic out of FileSpec
aleksandr.urakov added a comment. This commit breaks the Windows build. Repository: rL LLVM https://reviews.llvm.org/D53915 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345956 - [Windows] Fix Windows build after be053dd5a384a03da5a77552686900ddc7bfc178
Author: aleksandr.urakov Date: Fri Nov 2 01:47:33 2018 New Revision: 345956 URL: http://llvm.org/viewvc/llvm-project?rev=345956&view=rev Log: [Windows] Fix Windows build after be053dd5a384a03da5a77552686900ddc7bfc178 Modified: lldb/trunk/source/Host/windows/FileSystem.cpp lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp lldb/trunk/source/Host/windows/HostProcessWindows.cpp lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Modified: lldb/trunk/source/Host/windows/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/FileSystem.cpp?rev=345956&r1=345955&r2=345956&view=diff == --- lldb/trunk/source/Host/windows/FileSystem.cpp (original) +++ lldb/trunk/source/Host/windows/FileSystem.cpp Fri Nov 2 01:47:33 2018 @@ -75,7 +75,7 @@ Status FileSystem::Readlink(const FileSp else if (!llvm::convertWideToUTF8(buf.data(), path)) error.SetErrorString(PATH_CONVERSION_ERROR); else -dst.SetFile(path, false, FileSpec::Style::native); +dst.SetFile(path, FileSpec::Style::native); ::CloseHandle(h); return error; Modified: lldb/trunk/source/Host/windows/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=345956&r1=345955&r2=345956&view=diff == --- lldb/trunk/source/Host/windows/Host.cpp (original) +++ lldb/trunk/source/Host/windows/Host.cpp Fri Nov 2 01:47:33 2018 @@ -84,7 +84,7 @@ void GetProcessExecutableAndTriple(const triple.setOS(llvm::Triple::Win32); triple.setArch(llvm::Triple::UnknownArch); if (GetExecutableForProcess(handle, executable)) { -FileSpec executableFile(executable.c_str(), false); +FileSpec executableFile(executable.c_str()); process.SetExecutableFile(executableFile, true); GetTripleForProcess(executableFile, triple); } @@ -123,7 +123,7 @@ FileSpec Host::GetModuleFileSpecForHostA std::string path; if (!llvm::convertWideToUTF8(buffer.data(), path)) return module_filespec; - module_filespec.SetFile(path, false, FileSpec::Style::native); + module_filespec.SetFile(path, FileSpec::Style::native); return module_filespec; } @@ -146,7 +146,7 @@ uint32_t Host::FindProcesses(const Proce ProcessInstanceInfo process; std::string exeFile; llvm::convertWideToUTF8(pe.szExeFile, exeFile); - process.SetExecutableFile(FileSpec(exeFile, false), true); + process.SetExecutableFile(FileSpec(exeFile), true); process.SetProcessID(pe.th32ProcessID); process.SetParentProcessID(pe.th32ParentProcessID); GetProcessExecutableAndTriple(handle, process); Modified: lldb/trunk/source/Host/windows/HostInfoWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostInfoWindows.cpp?rev=345956&r1=345955&r2=345956&view=diff == --- lldb/trunk/source/Host/windows/HostInfoWindows.cpp (original) +++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp Fri Nov 2 01:47:33 2018 @@ -92,7 +92,7 @@ FileSpec HostInfoWindows::GetProgramFile ::GetModuleFileNameW(NULL, buffer.data(), buffer.size()); std::string path; llvm::convertWideToUTF8(buffer.data(), path); -m_program_filespec.SetFile(path, false, FileSpec::Style::native); +m_program_filespec.SetFile(path, FileSpec::Style::native); }); return m_program_filespec; } @@ -103,9 +103,9 @@ FileSpec HostInfoWindows::GetDefaultShel std::string shell; if (GetEnvironmentVar("ComSpec", shell)) -return FileSpec(shell, false); +return FileSpec(shell); - return FileSpec("C:\\Windows\\system32\\cmd.exe", false); + return FileSpec("C:\\Windows\\system32\\cmd.exe"); } bool HostInfoWindows::GetEnvironmentVar(const std::string &var_name, Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=345956&r1=345955&r2=345956&view=diff == --- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original) +++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Fri Nov 2 01:47:33 2018 @@ -57,7 +57,7 @@ Status HostProcessWindows::GetMainModule if (::GetProcessImageFileNameW(m_process, wpath.data(), wpath.size())) { std::string path; if (llvm::convertWideToUTF8(wpath.data(), path)) - file_spec.SetFile(path, false, FileSpec::Style::native); + file_spec.SetFile(path, FileSpec::Style::native); else error.SetErrorString("Error converting path to UTF-8"); } else Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp URL: http://l
[Lldb-commits] [PATCH] D53915: [FileSystem] Move resolve logic out of FileSpec
aleksandr.urakov added a comment. It's ok, I was able to fix it myself. Here is the commit: r345956 Repository: rL LLVM https://reviews.llvm.org/D53915 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
aleksandr.urakov added a comment. Thank you! https://reviews.llvm.org/D53368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345957 - [Symbol] Search symbols with name and type in a symbol file
Author: aleksandr.urakov Date: Fri Nov 2 01:54:35 2018 New Revision: 345957 URL: http://llvm.org/viewvc/llvm-project?rev=345957&view=rev Log: [Symbol] Search symbols with name and type in a symbol file Summary: This patch adds possibility of searching a public symbol with name and type in a symbol file. It is helpful when working with PE, because PE's symtabs contain only imported / exported symbols only. Such a search is required for e.g. evaluation of an expression that calls some function of the debuggee. Reviewers: zturner, asmith, labath, clayborg, espindola Reviewed By: clayborg Subscribers: emaste, arichardson, aleksandr.urakov, jingham, lldb-commits, stella.stamenova Tags: #lldb Differential Revision: https://reviews.llvm.org/D53368 Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h lldb/trunk/include/lldb/Symbol/SymbolVendor.h lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h lldb/trunk/source/Symbol/SymbolVendor.cpp lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=345957&r1=345956&r2=345957&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Fri Nov 2 01:54:35 2018 @@ -214,6 +214,8 @@ public: return {}; } + virtual void AddSymbols(Symtab &symtab) {} + //-- /// Notify the SymbolFile that the file addresses in the Sections /// for this module have been changed. Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=345957&r1=345956&r2=345957&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Fri Nov 2 01:54:35 2018 @@ -165,6 +165,8 @@ protected: // file) std::unique_ptr m_sym_file_ap; // A single symbol file. Subclasses // can add more of these if needed. + Symtab *m_symtab; // Save a symtab once to not pass it through `AddSymbols` of +// the symbol file each time when it is needed private: //-- Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=345957&r1=345956&r2=345957&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri Nov 2 01:54:35 2018 @@ -2876,8 +2876,6 @@ Symtab *ObjectFileELF::GetSymtab() { // do the section lookup next time. if (m_symtab_ap == nullptr) m_symtab_ap.reset(new Symtab(this)); - -m_symtab_ap->CalculateSymbolSizes(); } return m_symtab_ap.get(); Modified: lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp?rev=345957&r1=345956&r2=345957&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp Fri Nov 2 01:54:35 2018 @@ -124,7 +124,6 @@ Symtab *ObjectFileJIT::GetSymtab() { if (delegate_sp) delegate_sp->PopulateSymtab(this, *m_symtab_ap); // TODO: get symbols from delegate - m_symtab_ap->Finalize(); } } return m_symtab_ap.get(); Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=345957&r1=345956&r2=345957&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Nov 2 01:54:35 2018 @@ -1315,7 +1315,6 @@ Symtab *ObjectFileMachO::GetSymtab() { std::lock_guard symtab_guard( m_symtab_ap->GetMutex()); ParseSymtab(); - m_symtab_ap->Finalize(); } }
[Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB345957: [Symbol] Search symbols with name and type in a symbol file (authored by aleksandr.urakov, committed by ). Repository: rLLDB LLDB https://reviews.llvm.org/D53368 Files: include/lldb/Symbol/SymbolFile.h include/lldb/Symbol/SymbolVendor.h source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp source/Plugins/SymbolFile/PDB/SymbolFilePDB.h source/Symbol/SymbolVendor.cpp unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Index: include/lldb/Symbol/SymbolVendor.h === --- include/lldb/Symbol/SymbolVendor.h +++ include/lldb/Symbol/SymbolVendor.h @@ -165,6 +165,8 @@ // file) std::unique_ptr m_sym_file_ap; // A single symbol file. Subclasses // can add more of these if needed. + Symtab *m_symtab; // Save a symtab once to not pass it through `AddSymbols` of +// the symbol file each time when it is needed private: //-- Index: include/lldb/Symbol/SymbolFile.h === --- include/lldb/Symbol/SymbolFile.h +++ include/lldb/Symbol/SymbolFile.h @@ -214,6 +214,8 @@ return {}; } + virtual void AddSymbols(Symtab &symtab) {} + //-- /// Notify the SymbolFile that the file addresses in the Sections /// for this module have been changed. Index: unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp === --- unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp +++ unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp @@ -621,3 +621,20 @@ EXPECT_EQ(0u, num_results); EXPECT_EQ(0u, results.GetSize()); } + +TEST_F(SymbolFilePDBTests, TestFindSymbolsWithNameAndType) { + FileSpec fspec(m_pdb_test_exe.c_str(), false); + ArchSpec aspec("i686-pc-windows"); + lldb::ModuleSP module = std::make_shared(fspec, aspec); + + SymbolContextList sc_list; + EXPECT_EQ(1u, +module->FindSymbolsWithNameAndType(ConstString("?foo@@YAHH@Z"), + lldb::eSymbolTypeAny, sc_list)); + EXPECT_EQ(1u, sc_list.GetSize()); + + SymbolContext sc; + EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc)); + EXPECT_STREQ("int foo(int)", + sc.GetFunctionName(Mangled::ePreferDemangled).AsCString()); +} Index: source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp === --- source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -124,7 +124,6 @@ if (delegate_sp) delegate_sp->PopulateSymtab(this, *m_symtab_ap); // TODO: get symbols from delegate - m_symtab_ap->Finalize(); } } return m_symtab_ap.get(); Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2876,8 +2876,6 @@ // do the section lookup next time. if (m_symtab_ap == nullptr) m_symtab_ap.reset(new Symtab(this)); - -m_symtab_ap->CalculateSymbolSizes(); } return m_symtab_ap.get(); Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp === --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1315,7 +1315,6 @@ std::lock_guard symtab_guard( m_symtab_ap->GetMutex()); ParseSymtab(); - m_symtab_ap->Finalize(); } } return m_symtab_ap.get(); @@ -4807,16 +4806,6 @@ } } -//StreamFile s(stdout, false); -//s.Printf ("Symbol table before CalculateSymbolSizes():\n"); -//symtab->Dump(&s, NULL, eSortOrderNone); -// Set symbol byte sizes correctly since mach-o nlist entries don't have -// sizes -symtab->CalculateSymbolSizes(); - -//s.Printf ("Symbol table after CalculateSymbolSizes():\n"); -//symtab->Dump(&s, NULL, eSortOrderNone); - return symtab->GetNumSymbols(); } return 0; Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp === --- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -651,7 +651,6 @@ symbols[i].SetDebug(true); } } - m_symtab_ap->Cal
[Lldb-commits] [lldb] r345958 - [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.
Author: grimar Date: Fri Nov 2 02:03:25 2018 New Revision: 345958 URL: http://llvm.org/viewvc/llvm-project?rev=345958&view=rev Log: [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries. This adds support for DW_RLE_base_addressx, DW_RLE_startx_endx, DW_RLE_startx_length, DW_FORM_rnglistx. Differential revision: https://reviews.llvm.org/D53929 Added: lldb/trunk/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml lldb/trunk/lit/Breakpoint/debug_rnglistx_rlex.test Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Added: lldb/trunk/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml?rev=345958&view=auto == --- lldb/trunk/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml (added) +++ lldb/trunk/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml Fri Nov 2 02:03:25 2018 @@ -0,0 +1,57 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machine: EM_X86_64 + Entry: 0x00201000 +Sections: + - Name:.text +Type:SHT_PROGBITS +Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +Address: 0x00201000 +AddressAlign:0x0010 +Content: 31ED4989D15E4889E24883E4F0505449C7C08011200048C7C11011200048C7C700112000E89701F455B810202000483D102020004889E57417B84885C0740D5DBF10202000FFE00F1F445DC3660F1F44BE10202000554881EE102020004889E548C1FE034889F048C1E83F4801C648D1FE7415B84885C0740B5DBF10202000FFE00F1F005DC3660F1F44803D592F007517554889E5E87EFFC605472F015DC30F1F44F3C30F1F4000662E0F1F8400554889E55DEB89CCC3CCC3CC31C0C3CC415741564189FF415541544C8D25E61E55488D2DE61E534989F64989D54C29E54883EC0848C1FD03E843004885ED742031DB0F1F84004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F8400F3C3 + - Name:.debug_str_offsets +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: 28000500300067002800760024006F0074002200 + - Name:.debug_str +Type:SHT_PROGBITS +Flags: [ SHF_MERGE, SHF_STRINGS ] +AddressAlign:0x0001 +Content: 2F686F6D652F756D622F74657374735F323031382F3131345F726E676C69737473007900696E74005F5A336261726900636C616E672076657273696F6E20382E302E3020287472756E6B203334353639392920286C6C766D2F7472756E6B203334353530362900746573742E6363006D61696E00780062617200 + - Name:.debug_loclists +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: '15000500080003000301005503020101005000' + - Name:.debug_abbrev +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: 011101252513050325721710171B2573171101552374178C0117022E0B120640187A196E2503253A0B3B0B49133F19030500021703253A0B3B0B4913042E0B120640187A1903253A0B3B0B49133F190534001C0D03253A0B3B0B491306240003253E0B0B0B00 + - Name:.debug_info +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: 6600050001080100040001080002080C000C00020004000157030401036500030C000701036504010600015706010765000501080108650605050400 + - Name:.debug_rnglists +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: '1300050008000100040003000403010600' + - Name:.debug_macinfo +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: '00' + - Name:.debug_addr +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: 1C0005000800E0102000F0102000E3102000 + - Name:.debug_line +Type:SHT_PROGBITS +AddressAlign:0x0001 +Content: 8200050008004C00010101FB0E0D000101010100010101011F0103011F020F051E0222FC42F1EAF1396417A8FBE442FBADC70322FC42F1EAF1396417A8FBE442FBADC703000902E010200014050B0A130504063C0201000101000902F01020001805030A140206000101 + - Name:.debug_line_st
[Lldb-commits] [PATCH] D53929: [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.
This revision was automatically updated to reflect the committed changes. Closed by commit rL345958: [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries. (authored by grimar, committed by ). Changed prior to commit: https://reviews.llvm.org/D53929?vs=172121&id=172323#toc Repository: rL LLVM https://reviews.llvm.org/D53929 Files: lldb/trunk/lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml lldb/trunk/lit/Breakpoint/debug_rnglistx_rlex.test lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp @@ -128,6 +128,11 @@ return false; } +uint64_t DWARFDebugRanges::GetOffset(size_t Index) const { + lldbassert(false && "DW_FORM_rnglistx is not present before DWARF5"); + return 0; +} + bool DWARFDebugRngLists::ExtractRangeList( const DWARFDataExtractor &data, uint8_t addrSize, lldb::offset_t *offset_ptr, std::vector &rangeList) { @@ -166,17 +171,44 @@ break; } +case DW_RLE_base_addressx: { + dw_addr_t base = data.GetULEB128(offset_ptr); + rangeList.push_back({DW_RLE_base_addressx, base, 0}); + break; +} + +case DW_RLE_startx_endx: { + dw_addr_t start = data.GetULEB128(offset_ptr); + dw_addr_t end = data.GetULEB128(offset_ptr); + rangeList.push_back({DW_RLE_startx_endx, start, end}); + break; +} + +case DW_RLE_startx_length: { + dw_addr_t start = data.GetULEB128(offset_ptr); + dw_addr_t length = data.GetULEB128(offset_ptr); + rangeList.push_back({DW_RLE_startx_length, start, length}); + break; +} + default: - // Next encodings are not yet supported: - // DW_RLE_base_addressx, DW_RLE_startx_endx, DW_RLE_startx_length. lldbassert(0 && "unknown range list entry encoding"); error = true; } } return false; } +static uint64_t ReadAddressFromDebugAddrSection(const DWARFUnit *cu, +uint32_t index) { + uint32_t index_size = cu->GetAddressByteSize(); + dw_offset_t addr_base = cu->GetAddrBase(); + lldb::offset_t offset = addr_base + index * index_size; + return cu->GetSymbolFileDWARF()->get_debug_addr_data().GetMaxU64(&offset, + index_size); +} + bool DWARFDebugRngLists::FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset, DWARFRangeList &range_list) const { @@ -200,6 +232,21 @@ range_list.Append( DWARFRangeList::Entry(BaseAddr + E.value0, E.value1 - E.value0)); break; + case DW_RLE_base_addressx: { +BaseAddr = ReadAddressFromDebugAddrSection(cu, E.value0); +break; + } + case DW_RLE_startx_endx: { +dw_addr_t start = ReadAddressFromDebugAddrSection(cu, E.value0); +dw_addr_t end = ReadAddressFromDebugAddrSection(cu, E.value1); +range_list.Append(DWARFRangeList::Entry(start, end - start)); +break; + } + case DW_RLE_startx_length: { +dw_addr_t start = ReadAddressFromDebugAddrSection(cu, E.value0); +range_list.Append(DWARFRangeList::Entry(start, E.value1)); +break; + } default: llvm_unreachable("unexpected encoding"); } @@ -214,7 +261,8 @@ lldb::offset_t offset = 0; uint64_t length = data.GetU32(&offset); - if (length == 0x) + bool isDwarf64 = (length == 0x); + if (isDwarf64) length = data.GetU64(&offset); lldb::offset_t end = offset + length; @@ -232,12 +280,16 @@ uint32_t offsetsAmount = data.GetU32(&offset); for (uint32_t i = 0; i < offsetsAmount; ++i) -Offsets.push_back(data.GetPointer(&offset)); +Offsets.push_back(data.GetMaxU64(&offset, isDwarf64 ? 8 : 4)); lldb::offset_t listOffset = offset; std::vector rangeList; while (offset < end && ExtractRangeList(data, addrSize, &offset, rangeList)) { m_range_map[listOffset] = rangeList; listOffset = offset; } } + +uint64_t DWARFDebugRngLists::GetOffset(size_t Index) const { + return Offsets[Index]; +} Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -157,6 +157,7 @@ // signed or unsigned LEB 1
[Lldb-commits] [PATCH] D54031: [NativePDB] Make tests work on x86 too
aleksandr.urakov created this revision. aleksandr.urakov added reviewers: zturner, stella.stamenova. aleksandr.urakov added a project: LLDB. Herald added subscribers: lldb-commits, teemperor. This patch fixes the NativePDB tests to make them work from x86 command line too. Repository: rLLDB LLDB https://reviews.llvm.org/D54031 Files: lit/SymbolFile/NativePDB/disassembly.cpp lit/SymbolFile/NativePDB/simple-breakpoints.cpp lit/SymbolFile/NativePDB/tag-types.cpp Index: lit/SymbolFile/NativePDB/tag-types.cpp === --- lit/SymbolFile/NativePDB/tag-types.cpp +++ lit/SymbolFile/NativePDB/tag-types.cpp @@ -141,7 +141,7 @@ } // CHECK: (lldb) target create "{{.*}}tag-types.cpp.tmp.exe" -// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' (x86_64). +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' // CHECK-NEXT: (lldb) command source -s 0 '{{.*}}tag-types.lldbinit' // CHECK-NEXT: Executing commands in '{{.*}}tag-types.lldbinit'. // CHECK-NEXT: (lldb) type lookup -- Struct Index: lit/SymbolFile/NativePDB/simple-breakpoints.cpp === --- lit/SymbolFile/NativePDB/simple-breakpoints.cpp +++ lit/SymbolFile/NativePDB/simple-breakpoints.cpp @@ -35,30 +35,30 @@ // CHECK: (lldb) target create "{{.*}}simple-breakpoints.cpp.tmp.exe" -// CHECK: Current executable set to '{{.*}}simple-breakpoints.cpp.tmp.exe' (x86_64). +// CHECK: Current executable set to '{{.*}}simple-breakpoints.cpp.tmp.exe' // CHECK: (lldb) break set -n main -// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main + 21 +// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main + {{[0-9]+}} // CHECK-SAME: at simple-breakpoints.cpp:31 // CHECK: (lldb) break set -n OvlGlobalFn // CHECK: Breakpoint 2: 3 locations. // CHECK: (lldb) break set -n StaticFn -// CHECK: Breakpoint 3: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5 +// CHECK: Breakpoint 3: where = simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}} // CHECK-SAME: at simple-breakpoints.cpp:24 // CHECK: (lldb) break set -n DoesntExist // CHECK: Breakpoint 4: no locations (pending). // CHECK: (lldb) break list // CHECK: Current breakpoints: // CHECK: 1: name = 'main', locations = 1 -// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + 21 +// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:31 // CHECK: 2: name = 'OvlGlobalFn', locations = 3 -// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 5 +// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:13 // CHECK:2.2: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn // CHECK-SAME:at simple-breakpoints.cpp:16 -// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 17 +// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:20 // CHECK: 3: name = 'StaticFn', locations = 1 -// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5 +// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:24 // CHECK: 4: name = 'DoesntExist', locations = 0 (pending) Index: lit/SymbolFile/NativePDB/disassembly.cpp === --- lit/SymbolFile/NativePDB/disassembly.cpp +++ lit/SymbolFile/NativePDB/disassembly.cpp @@ -2,7 +2,7 @@ // REQUIRES: lld // Test that we can show disassembly and source. -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: clang-cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s Index: lit/SymbolFile/NativePDB/tag-types.cpp === --- lit/SymbolFile/NativePDB/tag-types.cpp +++ lit/SymbolFile/NativePDB/tag-types.cpp @@ -141,7 +141,7 @@ } // CHECK: (lldb) target create "{{.*}}tag-types.cpp.tmp.exe" -// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' (x86_64). +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' // CHECK-NEXT: (lldb) command source -s 0 '{{.*}}tag-types.lldbinit' // CHECK-NEXT: Executing commands in '{{.*}}tag-types.lldbinit'. // CHECK-NEXT: (lldb) type lookup -- Struct Index: lit/SymbolFile/NativePDB/simple-breakpoints.cpp
[Lldb-commits] [PATCH] D54031: [NativePDB] Make tests work on x86 too
zturner added a subscriber: aleksandr.urakov. zturner added a comment. Lgtm Repository: rLLDB LLDB https://reviews.llvm.org/D54031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D54031: [NativePDB] Make tests work on x86 too
Lgtm On Fri, Nov 2, 2018 at 3:03 AM Aleksandr Urakov via Phabricator < revi...@reviews.llvm.org> wrote: > aleksandr.urakov created this revision. > aleksandr.urakov added reviewers: zturner, stella.stamenova. > aleksandr.urakov added a project: LLDB. > Herald added subscribers: lldb-commits, teemperor. > > This patch fixes the NativePDB tests to make them work from x86 command > line too. > > > Repository: > rLLDB LLDB > > https://reviews.llvm.org/D54031 > > Files: > lit/SymbolFile/NativePDB/disassembly.cpp > lit/SymbolFile/NativePDB/simple-breakpoints.cpp > lit/SymbolFile/NativePDB/tag-types.cpp > > > Index: lit/SymbolFile/NativePDB/tag-types.cpp > === > --- lit/SymbolFile/NativePDB/tag-types.cpp > +++ lit/SymbolFile/NativePDB/tag-types.cpp > @@ -141,7 +141,7 @@ > } > > // CHECK: (lldb) target create "{{.*}}tag-types.cpp.tmp.exe" > -// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' > (x86_64). > +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' > // CHECK-NEXT: (lldb) command source -s 0 '{{.*}}tag-types.lldbinit' > // CHECK-NEXT: Executing commands in '{{.*}}tag-types.lldbinit'. > // CHECK-NEXT: (lldb) type lookup -- Struct > Index: lit/SymbolFile/NativePDB/simple-breakpoints.cpp > === > --- lit/SymbolFile/NativePDB/simple-breakpoints.cpp > +++ lit/SymbolFile/NativePDB/simple-breakpoints.cpp > @@ -35,30 +35,30 @@ > > > // CHECK: (lldb) target create "{{.*}}simple-breakpoints.cpp.tmp.exe" > -// CHECK: Current executable set to > '{{.*}}simple-breakpoints.cpp.tmp.exe' (x86_64). > +// CHECK: Current executable set to > '{{.*}}simple-breakpoints.cpp.tmp.exe' > // CHECK: (lldb) break set -n main > -// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main > + 21 > +// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main > + {{[0-9]+}} > // CHECK-SAME: at simple-breakpoints.cpp:31 > // CHECK: (lldb) break set -n OvlGlobalFn > // CHECK: Breakpoint 2: 3 locations. > // CHECK: (lldb) break set -n StaticFn > -// CHECK: Breakpoint 3: where = > simple-breakpoints.cpp.tmp.exe`StaticFn + 5 > +// CHECK: Breakpoint 3: where = > simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}} > // CHECK-SAME: at simple-breakpoints.cpp:24 > // CHECK: (lldb) break set -n DoesntExist > // CHECK: Breakpoint 4: no locations (pending). > // CHECK: (lldb) break list > // CHECK: Current breakpoints: > // CHECK: 1: name = 'main', locations = 1 > -// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + 21 > +// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + > {{[0-9]+}} > // CHECK-SAME:at simple-breakpoints.cpp:31 > // CHECK: 2: name = 'OvlGlobalFn', locations = 3 > -// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn > + 5 > +// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn > + {{[0-9]+}} > // CHECK-SAME:at simple-breakpoints.cpp:13 > // CHECK:2.2: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn > // CHECK-SAME:at simple-breakpoints.cpp:16 > -// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn > + 17 > +// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn > + {{[0-9]+}} > // CHECK-SAME:at simple-breakpoints.cpp:20 > // CHECK: 3: name = 'StaticFn', locations = 1 > -// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5 > +// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + > {{[0-9]+}} > // CHECK-SAME:at simple-breakpoints.cpp:24 > // CHECK: 4: name = 'DoesntExist', locations = 0 (pending) > Index: lit/SymbolFile/NativePDB/disassembly.cpp > === > --- lit/SymbolFile/NativePDB/disassembly.cpp > +++ lit/SymbolFile/NativePDB/disassembly.cpp > @@ -2,7 +2,7 @@ > // REQUIRES: lld > > // Test that we can show disassembly and source. > -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s > +// RUN: clang-cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s > // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb > -- %t.obj > // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ > // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54031: [NativePDB] Make tests work on x86 too
aleksandr.urakov added a comment. Thanks! Repository: rLLDB LLDB https://reviews.llvm.org/D54031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345974 - [NativePDB] Make tests work on x86 too
Author: aleksandr.urakov Date: Fri Nov 2 07:15:29 2018 New Revision: 345974 URL: http://llvm.org/viewvc/llvm-project?rev=345974&view=rev Log: [NativePDB] Make tests work on x86 too Summary: This patch fixes the NativePDB tests to make them work from x86 command line too Reviewers: zturner, stella.stamenova Subscribers: aleksandr.urakov, teemperor, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D54031 Modified: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp Modified: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp?rev=345974&r1=345973&r2=345974&view=diff == --- lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp (original) +++ lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp Fri Nov 2 07:15:29 2018 @@ -2,7 +2,7 @@ // REQUIRES: lld // Test that we can show disassembly and source. -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: clang-cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s Modified: lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp?rev=345974&r1=345973&r2=345974&view=diff == --- lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp (original) +++ lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp Fri Nov 2 07:15:29 2018 @@ -35,30 +35,30 @@ int main(int argc, char **argv) { // CHECK: (lldb) target create "{{.*}}simple-breakpoints.cpp.tmp.exe" -// CHECK: Current executable set to '{{.*}}simple-breakpoints.cpp.tmp.exe' (x86_64). +// CHECK: Current executable set to '{{.*}}simple-breakpoints.cpp.tmp.exe' // CHECK: (lldb) break set -n main -// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main + 21 +// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main + {{[0-9]+}} // CHECK-SAME: at simple-breakpoints.cpp:31 // CHECK: (lldb) break set -n OvlGlobalFn // CHECK: Breakpoint 2: 3 locations. // CHECK: (lldb) break set -n StaticFn -// CHECK: Breakpoint 3: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5 +// CHECK: Breakpoint 3: where = simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}} // CHECK-SAME: at simple-breakpoints.cpp:24 // CHECK: (lldb) break set -n DoesntExist // CHECK: Breakpoint 4: no locations (pending). // CHECK: (lldb) break list // CHECK: Current breakpoints: // CHECK: 1: name = 'main', locations = 1 -// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + 21 +// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:31 // CHECK: 2: name = 'OvlGlobalFn', locations = 3 -// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 5 +// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:13 // CHECK:2.2: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn // CHECK-SAME:at simple-breakpoints.cpp:16 -// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 17 +// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:20 // CHECK: 3: name = 'StaticFn', locations = 1 -// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5 +// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:24 // CHECK: 4: name = 'DoesntExist', locations = 0 (pending) Modified: lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp?rev=345974&r1=345973&r2=345974&view=diff == --- lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp (original) +++ lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp Fri Nov 2 07:15:29 2018 @@ -141,7 +141,7 @@ int main(int argc, char **argv) { } // CHECK: (lldb) target create "{{.*}}tag-types.cpp.tmp.exe" -// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' (x86_64). +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' // CHECK-NEXT: (lldb) command source -s 0 '{
[Lldb-commits] [PATCH] D54031: [NativePDB] Make tests work on x86 too
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL345974: [NativePDB] Make tests work on x86 too (authored by aleksandr.urakov, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D54031?vs=172328&id=172352#toc Repository: rL LLVM https://reviews.llvm.org/D54031 Files: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp Index: lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp === --- lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp +++ lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp @@ -141,7 +141,7 @@ } // CHECK: (lldb) target create "{{.*}}tag-types.cpp.tmp.exe" -// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' (x86_64). +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' // CHECK-NEXT: (lldb) command source -s 0 '{{.*}}tag-types.lldbinit' // CHECK-NEXT: Executing commands in '{{.*}}tag-types.lldbinit'. // CHECK-NEXT: (lldb) type lookup -- Struct Index: lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp === --- lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp +++ lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp @@ -35,30 +35,30 @@ // CHECK: (lldb) target create "{{.*}}simple-breakpoints.cpp.tmp.exe" -// CHECK: Current executable set to '{{.*}}simple-breakpoints.cpp.tmp.exe' (x86_64). +// CHECK: Current executable set to '{{.*}}simple-breakpoints.cpp.tmp.exe' // CHECK: (lldb) break set -n main -// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main + 21 +// CHECK: Breakpoint 1: where = simple-breakpoints.cpp.tmp.exe`main + {{[0-9]+}} // CHECK-SAME: at simple-breakpoints.cpp:31 // CHECK: (lldb) break set -n OvlGlobalFn // CHECK: Breakpoint 2: 3 locations. // CHECK: (lldb) break set -n StaticFn -// CHECK: Breakpoint 3: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5 +// CHECK: Breakpoint 3: where = simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}} // CHECK-SAME: at simple-breakpoints.cpp:24 // CHECK: (lldb) break set -n DoesntExist // CHECK: Breakpoint 4: no locations (pending). // CHECK: (lldb) break list // CHECK: Current breakpoints: // CHECK: 1: name = 'main', locations = 1 -// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + 21 +// CHECK:1.1: where = simple-breakpoints.cpp.tmp.exe`main + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:31 // CHECK: 2: name = 'OvlGlobalFn', locations = 3 -// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 5 +// CHECK:2.1: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:13 // CHECK:2.2: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn // CHECK-SAME:at simple-breakpoints.cpp:16 -// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + 17 +// CHECK:2.3: where = simple-breakpoints.cpp.tmp.exe`OvlGlobalFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:20 // CHECK: 3: name = 'StaticFn', locations = 1 -// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + 5 +// CHECK:3.1: where = simple-breakpoints.cpp.tmp.exe`StaticFn + {{[0-9]+}} // CHECK-SAME:at simple-breakpoints.cpp:24 // CHECK: 4: name = 'DoesntExist', locations = 0 (pending) Index: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp === --- lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp +++ lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp @@ -2,7 +2,7 @@ // REQUIRES: lld // Test that we can show disassembly and source. -// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s +// RUN: clang-cl -m64 /Z7 /GS- /GR- /c /Fo%t.obj -- %s // RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s Index: lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp === --- lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp +++ lldb/trunk/lit/SymbolFile/NativePDB/tag-types.cpp @@ -141,7 +141,7 @@ } // CHECK: (lldb) target create "{{.*}}tag-types.cpp.tmp.exe" -// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' (x86_64). +// CHECK-NEXT: Current executable set to '{{.*}}tag-types.cpp.tmp.exe' // CHE
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
JDevlieghere added a comment. In https://reviews.llvm.org/D54020#1285201, @labath wrote: > I am not sure what do you mean by "translating paths" in the VFS. If you mean > something like "return a `FILE *` for `/whatever/my_reproducer/vfs/bin/ls` > when I ask for `/bin/ls`", then I think that's a good idea, as it's most > likely to work with all of our existing code (e.g. mmapping). Although, in > this case, i am not sure how much benefit will the llvm VFS bring to the > game, as most of the operations could then be implemented by plainly > prepending some prefix to a given path. Let me try to explain this better. This is mostly a question about what kind of API the VFS (which lives in LLVM) provides to deal with files in lldb (i.e. through `FILE*` and file descriptors). The first possibility is providing a method in the VFS that takes a "virtual" path and returns the "underlying" path. Something like `Optional vfs::getUnderlyingPath(path)`. This doesn't just have to be a prefix thing but you are right that it's mostly going to be just that. The problem is that this method wouldn't work for virtual file systems that don't have files on disk. Hence the lack of generality. The second possibility is providing a method in the VFS that returns `FILE*`. When I was writing this I was still hoping that there was something like the fake `FILE*` you mentioned below. If that were the case it could support virtual file systems that have files that strictly live in memory. But if this doesn't work for Windows it's not really any better than the first alternative. > Getting rid of `FILE *` is not going to be easy, as it is used for some of > our external dependencies (libedit). It's possible to create a fake FILE* on > posix systems (`fopencookie, fmemopen`), but I don't think it's possible to > do something like that on windows (which is why I stopped when I was looking > at this some time ago). Yup, this is not something I'm proposing. > Also, be aware that there are some places where we open `raw_ostream`s > directly (`Debugger::EnableLog` comes to mind). I guess those will need to go > through the `FileSystem` too... Yup, we need to audit all file access. This particular example actually goes through file so it should be covered by this change. Repository: rLLDB LLDB https://reviews.llvm.org/D54020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
JDevlieghere added inline comments. Comment at: source/Host/common/FileSystem.cpp:253 +static int GetOpenFlags(uint32_t options) { + const bool read = options & File::OpenOptions::eOpenOptionRead; + const bool write = options & File::OpenOptions::eOpenOptionWrite; labath wrote: > `File::eOpenOptionRead` should be sufficient, no? Sorry, I don't know what you mean? Comment at: source/Host/posix/FileSystem.cpp:74-79 +FILE *FileSystem::Fopen(const char *path, const char *mode) const { return ::fopen(path, mode); } -int FileSystem::Open(const char *path, int flags, int mode) { +int FileSystem::Open(const char *path, int flags, int mode) const { return ::open(path, flags, mode); labath wrote: > Why are these two `const`? It seems that at least with > `eOpenOptionCanCreate`, one can create a new file, which is definitely not a > "const" operation. Depends on what you consider const, the real filesystem or the class. But yeah, the `const` doesn't add much so I can un-const this. Repository: rLLDB LLDB https://reviews.llvm.org/D54020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
JDevlieghere updated this revision to Diff 172382. JDevlieghere marked 3 inline comments as done. JDevlieghere added a comment. Address Pavel's feedback: - Un-const open functions. - Remove `::Empty()` again as it was redundant with `operator bool()`. - Rename `OpenFile` to just `Open`. We might need more `Open` methods in the future. https://reviews.llvm.org/D54020 Files: include/lldb/Host/File.h include/lldb/Host/FileSystem.h source/API/SBStream.cpp source/Commands/CommandObjectBugreport.cpp source/Commands/CommandObjectMemory.cpp source/Core/StreamFile.cpp source/Expression/REPL.cpp source/Host/common/File.cpp source/Host/common/FileCache.cpp source/Host/common/FileSystem.cpp source/Interpreter/CommandInterpreter.cpp source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp source/Target/ModuleCache.cpp source/Target/Platform.cpp Index: source/Target/Platform.cpp === --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -1280,8 +1280,9 @@ if (fs::is_symlink_file(source.GetPath())) source_open_options |= File::eOpenOptionDontFollowSymlinks; - File source_file(source, source_open_options, lldb::eFilePermissionsUserRW); - Status error; + File source_file; + Status error = FileSystem::Instance().Open( + source_file, source, source_open_options, lldb::eFilePermissionsUserRW); uint32_t permissions = source_file.GetPermissions(error); if (permissions == 0) permissions = lldb::eFilePermissionsFileDefault; Index: source/Target/ModuleCache.cpp === --- source/Target/ModuleCache.cpp +++ source/Target/ModuleCache.cpp @@ -159,9 +159,10 @@ return; m_file_spec = JoinPath(lock_dir_spec, uuid.GetAsString().c_str()); - m_file.Open(m_file_spec.GetCString(), File::eOpenOptionWrite | -File::eOpenOptionCanCreate | -File::eOpenOptionCloseOnExec); + FileSystem::Instance().Open(m_file, m_file_spec, + File::eOpenOptionWrite | + File::eOpenOptionCanCreate | + File::eOpenOptionCloseOnExec); if (!m_file) { error.SetErrorToErrno(); return; Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -829,11 +829,15 @@ error_file_sp); } else { input_file_sp.reset(new StreamFile()); - input_file_sp->GetFile().Open(FileSystem::DEV_NULL, -File::eOpenOptionRead); + FileSystem::Instance().Open(input_file_sp->GetFile(), + FileSpec(FileSystem::DEV_NULL), + File::eOpenOptionRead); + output_file_sp.reset(new StreamFile()); - output_file_sp->GetFile().Open(FileSystem::DEV_NULL, - File::eOpenOptionWrite); + FileSystem::Instance().Open(output_file_sp->GetFile(), + FileSpec(FileSystem::DEV_NULL), + File::eOpenOptionWrite); + error_file_sp = output_file_sp; } Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp === --- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -939,7 +939,8 @@ PythonFile::PythonFile(File &file, const char *mode) { Reset(file, mode); } PythonFile::PythonFile(const char *path, const char *mode) { - lldb_private::File file(path, GetOptionsFromMode(mode)); + lldb_private::File file; + FileSystem::Instance().Open(file, FileSpec(path), GetOptionsFromMode(mode)); Reset(file, mode); } Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -101,8 +101,9 @@ // and get the packet history dumped to a file. void DumpProcessGDBRemotePacketHistory(void *p, const char *path) { StreamFile strm; - Status error(strm.GetFile().Open(path, File::eOpenOptionWrite | - File::eOpenOptionCanCreate)); + Status error = FileSystem::Instanc
[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types
aprantl updated this revision to Diff 172388. aprantl added a comment. Herald added subscribers: kbarton, nemanjai. Version that only overrides GetNumChildren to avoid creating dynamic clang types. https://reviews.llvm.org/D53530 Files: include/lldb/Symbol/ClangASTContext.h include/lldb/Symbol/CompilerType.h include/lldb/Symbol/GoASTContext.h include/lldb/Symbol/JavaASTContext.h include/lldb/Symbol/OCamlASTContext.h include/lldb/Symbol/SymbolFile.h include/lldb/Symbol/TypeSystem.h packages/Python/lldbsuite/test/lang/c/vla/Makefile packages/Python/lldbsuite/test/lang/c/vla/TestVLA.py packages/Python/lldbsuite/test/lang/c/vla/main.c source/Core/ValueObjectCast.cpp source/Core/ValueObjectChild.cpp source/Core/ValueObjectConstResult.cpp source/Core/ValueObjectDynamicValue.cpp source/Core/ValueObjectMemory.cpp source/Core/ValueObjectRegister.cpp source/Core/ValueObjectVariable.cpp source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp source/Plugins/Language/CPlusPlus/BlockPointer.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParser.h source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp source/Plugins/SymbolFile/PDB/SymbolFilePDB.h source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h source/Symbol/ClangASTContext.cpp source/Symbol/CompilerType.cpp source/Symbol/GoASTContext.cpp source/Symbol/JavaASTContext.cpp source/Symbol/OCamlASTContext.cpp source/Symbol/Type.cpp source/Symbol/Variable.cpp Index: source/Symbol/Variable.cpp === --- source/Symbol/Variable.cpp +++ source/Symbol/Variable.cpp @@ -603,7 +603,7 @@ case eTypeClassObjCObjectPointer: case eTypeClassPointer: { bool omit_empty_base_classes = true; -if (compiler_type.GetNumChildren(omit_empty_base_classes) > 0) +if (compiler_type.GetNumChildren(omit_empty_base_classes, nullptr) > 0) matches.AppendString((prefix_path + "->").str()); else { matches.AppendString(prefix_path.str()); Index: source/Symbol/Type.cpp === --- source/Symbol/Type.cpp +++ source/Symbol/Type.cpp @@ -342,7 +342,7 @@ } uint32_t Type::GetNumChildren(bool omit_empty_base_classes) { - return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes); + return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes, nullptr); } bool Type::IsAggregateType() { Index: source/Symbol/OCamlASTContext.cpp === --- source/Symbol/OCamlASTContext.cpp +++ source/Symbol/OCamlASTContext.cpp @@ -509,7 +509,8 @@ } uint32_t OCamlASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, - bool omit_empty_base_classes) { + bool omit_empty_base_classes, + const ExecutionContext *exe_ctx) { if (!type || !GetCompleteType(type)) return 0; Index: source/Symbol/JavaASTContext.cpp === --- source/Symbol/JavaASTContext.cpp +++ source/Symbol/JavaASTContext.cpp @@ -915,12 +915,14 @@ } uint32_t JavaASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, -bool omit_empty_base_classes) { +bool omit_empty_base_classes, +const ExecutionContext *exe_ctx) { GetCompleteType(type); if (JavaReferenceType *ref = llvm::dyn_cast(static_cast(type))) -return ref->GetPointeeType().GetNumChildren(omit_empty_base_classes); +return ref->GetPointeeType().GetNumChildren(omit_empty_base_classes, +exe_ctx); if (llvm::isa(static_cast(type))) return GetNumFields(type) + GetNumDirectBaseClasses(type); Index: source/Symbol/GoASTContext.cpp === --- source/Symbol/GoASTContext.cpp +++ source/Symbol/GoASTContext.cpp @@ -864,19 +864,20 @@ } uint32_t GoASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, - bool omit_empty_base_classes) { + bool omit_empty_base_classes, + const ExecutionContext *exe_ctx) { if (!type
[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types
aprantl added a comment. Fair point. So here's a version that only overrides GetNumChildren(). I'll leave the type summary for a follow-up patch. https://reviews.llvm.org/D53530 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types
aprantl updated this revision to Diff 172390. aprantl added a comment. Fix a bug in the testcase. https://reviews.llvm.org/D53530 Files: include/lldb/Symbol/ClangASTContext.h include/lldb/Symbol/CompilerType.h include/lldb/Symbol/GoASTContext.h include/lldb/Symbol/JavaASTContext.h include/lldb/Symbol/OCamlASTContext.h include/lldb/Symbol/SymbolFile.h include/lldb/Symbol/TypeSystem.h packages/Python/lldbsuite/test/lang/c/vla/Makefile packages/Python/lldbsuite/test/lang/c/vla/TestVLA.py packages/Python/lldbsuite/test/lang/c/vla/main.c source/Core/ValueObjectCast.cpp source/Core/ValueObjectChild.cpp source/Core/ValueObjectConstResult.cpp source/Core/ValueObjectDynamicValue.cpp source/Core/ValueObjectMemory.cpp source/Core/ValueObjectRegister.cpp source/Core/ValueObjectVariable.cpp source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp source/Plugins/Language/CPlusPlus/BlockPointer.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParser.h source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp source/Plugins/SymbolFile/PDB/SymbolFilePDB.h source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h source/Symbol/ClangASTContext.cpp source/Symbol/CompilerType.cpp source/Symbol/GoASTContext.cpp source/Symbol/JavaASTContext.cpp source/Symbol/OCamlASTContext.cpp source/Symbol/Type.cpp source/Symbol/Variable.cpp Index: source/Symbol/Variable.cpp === --- source/Symbol/Variable.cpp +++ source/Symbol/Variable.cpp @@ -603,7 +603,7 @@ case eTypeClassObjCObjectPointer: case eTypeClassPointer: { bool omit_empty_base_classes = true; -if (compiler_type.GetNumChildren(omit_empty_base_classes) > 0) +if (compiler_type.GetNumChildren(omit_empty_base_classes, nullptr) > 0) matches.AppendString((prefix_path + "->").str()); else { matches.AppendString(prefix_path.str()); Index: source/Symbol/Type.cpp === --- source/Symbol/Type.cpp +++ source/Symbol/Type.cpp @@ -342,7 +342,7 @@ } uint32_t Type::GetNumChildren(bool omit_empty_base_classes) { - return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes); + return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes, nullptr); } bool Type::IsAggregateType() { Index: source/Symbol/OCamlASTContext.cpp === --- source/Symbol/OCamlASTContext.cpp +++ source/Symbol/OCamlASTContext.cpp @@ -509,7 +509,8 @@ } uint32_t OCamlASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, - bool omit_empty_base_classes) { + bool omit_empty_base_classes, + const ExecutionContext *exe_ctx) { if (!type || !GetCompleteType(type)) return 0; Index: source/Symbol/JavaASTContext.cpp === --- source/Symbol/JavaASTContext.cpp +++ source/Symbol/JavaASTContext.cpp @@ -915,12 +915,14 @@ } uint32_t JavaASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, -bool omit_empty_base_classes) { +bool omit_empty_base_classes, +const ExecutionContext *exe_ctx) { GetCompleteType(type); if (JavaReferenceType *ref = llvm::dyn_cast(static_cast(type))) -return ref->GetPointeeType().GetNumChildren(omit_empty_base_classes); +return ref->GetPointeeType().GetNumChildren(omit_empty_base_classes, +exe_ctx); if (llvm::isa(static_cast(type))) return GetNumFields(type) + GetNumDirectBaseClasses(type); Index: source/Symbol/GoASTContext.cpp === --- source/Symbol/GoASTContext.cpp +++ source/Symbol/GoASTContext.cpp @@ -864,19 +864,20 @@ } uint32_t GoASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, - bool omit_empty_base_classes) { + bool omit_empty_base_classes, + const ExecutionContext *exe_ctx) { if (!type || !GetCompleteType(type)) return 0; GoType *t = static_cast(type); if (t->GetGoKind() ==
[Lldb-commits] [lldb] r346002 - [FileSystme] Move ::open abstraction into FileSystem.
Author: jdevlieghere Date: Fri Nov 2 10:34:16 2018 New Revision: 346002 URL: http://llvm.org/viewvc/llvm-project?rev=346002&view=rev Log: [FileSystme] Move ::open abstraction into FileSystem. This moves the abstraction around ::open into the FileSystem, as is already the case for ::fopen. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/posix/FileSystem.cpp lldb/trunk/source/Host/windows/FileSystem.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Fri Nov 2 10:34:16 2018 @@ -43,10 +43,12 @@ public: Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); - /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be - /// manipulated and closed with the normal ::fread, ::fclose, etc. functions. + /// Wraps ::fopen in a platform-independent way. FILE *Fopen(const char *path, const char *mode); + /// Wraps ::open in a platform-independent way. + int Open(const char *path, int flags, int mode); + /// Returns the modification time of the given file. /// @{ llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const; Modified: lldb/trunk/source/Host/common/File.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/source/Host/common/File.cpp (original) +++ lldb/trunk/source/Host/common/File.cpp Fri Nov 2 10:34:16 2018 @@ -30,6 +30,7 @@ #include "llvm/Support/Process.h" // for llvm::sys::Process::FileDescriptorHasColors() #include "lldb/Host/Config.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" @@ -160,16 +161,7 @@ void File::SetStream(FILE *fh, bool tran } static int DoOpen(const char *path, int flags, int mode) { -#ifdef _MSC_VER - std::wstring wpath; - if (!llvm::ConvertUTF8toWide(path, wpath)) -return -1; - int result; - ::_wsopen_s(&result, wpath.c_str(), flags, _SH_DENYNO, mode); - return result; -#else - return ::open(path, flags, mode); -#endif + return FileSystem::Instance().Open(path, flags, mode); } Status File::Open(const char *path, uint32_t options, uint32_t permissions) { Modified: lldb/trunk/source/Host/posix/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/FileSystem.cpp?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/source/Host/posix/FileSystem.cpp (original) +++ lldb/trunk/source/Host/posix/FileSystem.cpp Fri Nov 2 10:34:16 2018 @@ -11,6 +11,7 @@ // C includes #include +#include #include #include #include @@ -73,3 +74,7 @@ Status FileSystem::ResolveSymbolicLink(c FILE *FileSystem::Fopen(const char *path, const char *mode) { return ::fopen(path, mode); } + +int FileSystem::Open(const char *path, int flags, int mode) { + return ::open(path, flags, mode); +} Modified: lldb/trunk/source/Host/windows/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/FileSystem.cpp?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/source/Host/windows/FileSystem.cpp (original) +++ lldb/trunk/source/Host/windows/FileSystem.cpp Fri Nov 2 10:34:16 2018 @@ -96,3 +96,12 @@ FILE *FileSystem::Fopen(const char *path return nullptr; return file; } + +int FileSystem::Open(const char *path, int flags, int mode) { + std::wstring wpath; + if (!llvm::ConvertUTF8toWide(path, wpath)) +return -1; + int result; + ::_wsopen_s(&result, wpath.c_str(), flags, _SH_DENYNO, mode); + return result; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346003 - [FileSystem] Remove `SetFileSystem` method.
Author: jdevlieghere Date: Fri Nov 2 10:34:17 2018 New Revision: 346003 URL: http://llvm.org/viewvc/llvm-project?rev=346003&view=rev Log: [FileSystem] Remove `SetFileSystem` method. This is no longer relevant with the new way we initialize the FileSystem. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/FileSystem.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346003&r1=346002&r2=346003&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Fri Nov 2 10:34:17 2018 @@ -124,9 +124,6 @@ public: std::error_code GetRealPath(const llvm::Twine &path, llvm::SmallVectorImpl &output) const; -protected: - void SetFileSystem(llvm::IntrusiveRefCntPtr fs); - private: static llvm::Optional &InstanceImpl(); llvm::IntrusiveRefCntPtr m_fs; Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=346003&r1=346002&r2=346003&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Fri Nov 2 10:34:17 2018 @@ -47,10 +47,6 @@ Optional &FileSystem::Instan return g_fs; } -void FileSystem::SetFileSystem(IntrusiveRefCntPtr fs) { - m_fs = fs; -} - sys::TimePoint<> FileSystem::GetModificationTime(const FileSpec &file_spec) const { return GetModificationTime(file_spec.GetPath()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346008 - Refactor the lit configuration files
Author: zturner Date: Fri Nov 2 10:49:01 2018 New Revision: 346008 URL: http://llvm.org/viewvc/llvm-project?rev=346008&view=rev Log: Refactor the lit configuration files A year or so ago, I re-wrote most of the lit infrastructure in LLVM so that it wasn't so boilerplate-y. I added lots of common helper type stuff, simplifed usage patterns, and made the code more elegant and maintainable. We migrated to this in LLVM, clang, and lld's lit files, but not in LLDBs. This started to bite me recently, as the 4 most recent times I tried to run the lit test suite in LLDB on a fresh checkout the first thing that would happen is that python would just start crashing with unhelpful backtraces and I would have to spend time investigating. You can reproduce this today by doing a fresh cmake generation, doing ninja lldb and then python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile at which point you'll get a segfault that tells you nothing about what your problem is. I started trying to fix the issues with bandaids, but it became clear that the proper solution was to just bring in the work I did in the rest of the projects. The side benefit of this is that the lit configuration files become much cleaner and more understandable as a result. Differential Revision: https://reviews.llvm.org/D54009 Added: lldb/trunk/lit/Unit/lit.cfg.py lldb/trunk/lit/Unit/lit.site.cfg.py.in lldb/trunk/lit/lit.cfg.py lldb/trunk/lit/lit.site.cfg.py.in Removed: lldb/trunk/lit/Breakpoint/lit.local.cfg lldb/trunk/lit/Expr/lit.local.cfg lldb/trunk/lit/Quit/lit.local.cfg lldb/trunk/lit/Settings/lit.local.cfg lldb/trunk/lit/SymbolFile/NativePDB/lit.local.cfg lldb/trunk/lit/SymbolFile/PDB/lit.local.cfg lldb/trunk/lit/Unit/lit.cfg lldb/trunk/lit/Unit/lit.site.cfg.in lldb/trunk/lit/lit.cfg lldb/trunk/lit/lit.site.cfg.in Modified: lldb/trunk/lit/Breakpoint/case-insensitive.test lldb/trunk/lit/CMakeLists.txt lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test lldb/trunk/lit/SymbolFile/PDB/ast-restore.test lldb/trunk/lit/SymbolFile/PDB/calling-conventions.test lldb/trunk/lit/SymbolFile/PDB/class-layout.test lldb/trunk/lit/SymbolFile/PDB/compilands.test lldb/trunk/lit/SymbolFile/PDB/enums-layout.test lldb/trunk/lit/SymbolFile/PDB/func-symbols.test lldb/trunk/lit/SymbolFile/PDB/function-level-linking.test lldb/trunk/lit/SymbolFile/PDB/function-nested-block.test lldb/trunk/lit/SymbolFile/PDB/pointers.test lldb/trunk/lit/SymbolFile/PDB/type-quals.test lldb/trunk/lit/SymbolFile/PDB/typedefs.test lldb/trunk/lit/SymbolFile/PDB/udt-layout.test lldb/trunk/lit/SymbolFile/PDB/variables-locations.test lldb/trunk/lit/SymbolFile/PDB/variables.test lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test lldb/trunk/lit/tools/lldb-mi/data/data-info-line.test lldb/trunk/lit/tools/lldb-mi/exec/exec-continue.test lldb/trunk/lit/tools/lldb-mi/exec/exec-finish.test lldb/trunk/lit/tools/lldb-mi/exec/exec-interrupt.test lldb/trunk/lit/tools/lldb-mi/exec/exec-next-instruction.test lldb/trunk/lit/tools/lldb-mi/exec/exec-next.test lldb/trunk/lit/tools/lldb-mi/exec/exec-step-instruction.test lldb/trunk/lit/tools/lldb-mi/exec/exec-step.test lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Modified: lldb/trunk/lit/Breakpoint/case-insensitive.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/case-insensitive.test?rev=346008&r1=346007&r2=346008&view=diff == --- lldb/trunk/lit/Breakpoint/case-insensitive.test (original) +++ lldb/trunk/lit/Breakpoint/case-insensitive.test Fri Nov 2 10:49:01 2018 @@ -1,5 +1,5 @@ -# REQUIRES: windows -# XFAIL: windows +# REQUIRES: system-windows +# XFAIL: system-windows # -> llvm.org/pr24528 # # RUN: %cc %p/Inputs/case-sensitive.c -g -o %t Removed: lldb/trunk/lit/Breakpoint/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/lit.local.cfg?rev=346007&view=auto == --- lldb/trunk/lit/Breakpoint/lit.local.cfg (original) +++ lldb/trunk/lit/Breakpoint/lit.local.cfg (removed) @@ -1 +0,0 @@ -config.suffixes = ['.test'] Modified: lldb/trunk/lit/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=346008&r1=346007&r2=346008&view=diff == --- lldb/trunk/lit/CMakeLists.txt (original) +++ lldb/trunk/lit/CMakeLists.txt Fri Nov 2 10:49:01 2018 @@ -51,11 +51,13 @@ llvm_canonicalize_cmake_booleans( LLVM_ENABLE_ZLIB) configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in + ${CMAKE_CURRENT_BIN
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB346008: Refactor the lit configuration files (authored by zturner, committed by ). Herald added subscribers: teemperor, abidh. Changed prior to commit: https://reviews.llvm.org/D54009?vs=172254&id=172399#toc Repository: rLLDB LLDB https://reviews.llvm.org/D54009 Files: lit/Breakpoint/case-insensitive.test lit/Breakpoint/lit.local.cfg lit/CMakeLists.txt lit/Expr/TestIRMemoryMapWindows.test lit/Expr/lit.local.cfg lit/Quit/lit.local.cfg lit/Settings/lit.local.cfg lit/SymbolFile/NativePDB/lit.local.cfg lit/SymbolFile/PDB/ast-restore.test lit/SymbolFile/PDB/calling-conventions.test lit/SymbolFile/PDB/class-layout.test lit/SymbolFile/PDB/compilands.test lit/SymbolFile/PDB/enums-layout.test lit/SymbolFile/PDB/func-symbols.test lit/SymbolFile/PDB/function-level-linking.test lit/SymbolFile/PDB/function-nested-block.test lit/SymbolFile/PDB/lit.local.cfg lit/SymbolFile/PDB/pointers.test lit/SymbolFile/PDB/type-quals.test lit/SymbolFile/PDB/typedefs.test lit/SymbolFile/PDB/udt-layout.test lit/SymbolFile/PDB/variables-locations.test lit/SymbolFile/PDB/variables.test lit/Unit/lit.cfg lit/Unit/lit.cfg.py lit/Unit/lit.site.cfg.in lit/Unit/lit.site.cfg.py.in lit/lit.cfg lit/lit.cfg.py lit/lit.site.cfg.in lit/lit.site.cfg.py.in lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test lit/tools/lldb-mi/breakpoint/break-insert.test lit/tools/lldb-mi/data/data-info-line.test lit/tools/lldb-mi/exec/exec-continue.test lit/tools/lldb-mi/exec/exec-finish.test lit/tools/lldb-mi/exec/exec-interrupt.test lit/tools/lldb-mi/exec/exec-next-instruction.test lit/tools/lldb-mi/exec/exec-next.test lit/tools/lldb-mi/exec/exec-step-instruction.test lit/tools/lldb-mi/exec/exec-step.test lit/tools/lldb-mi/symbol/symbol-list-lines.test Index: lit/tools/lldb-mi/breakpoint/break-insert.test === --- lit/tools/lldb-mi/breakpoint/break-insert.test +++ lit/tools/lldb-mi/breakpoint/break-insert.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o a.exe %p/inputs/break-insert.c -g Index: lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test === --- lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test +++ lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/break-insert-pending.c -g Index: lit/tools/lldb-mi/data/data-info-line.test === --- lit/tools/lldb-mi/data/data-info-line.test +++ lit/tools/lldb-mi/data/data-info-line.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/data-info-line.c -g Index: lit/tools/lldb-mi/symbol/symbol-list-lines.test === --- lit/tools/lldb-mi/symbol/symbol-list-lines.test +++ lit/tools/lldb-mi/symbol/symbol-list-lines.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g Index: lit/tools/lldb-mi/exec/exec-finish.test === --- lit/tools/lldb-mi/exec/exec-finish.test +++ lit/tools/lldb-mi/exec/exec-finish.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-next.test === --- lit/tools/lldb-mi/exec/exec-next.test +++ lit/tools/lldb-mi/exec/exec-next.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-next-instruction.test === --- lit/tools/lldb-mi/exec/exec-next-instruction.test +++ lit/tools/lldb-mi/exec/exec-next-instruction.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-interrupt.test === --- lit/tools/lldb-mi/exec/exec-interrupt.test +++ lit/tools/lldb-mi/exec/exec-interrupt.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-step.test === --- lit/tools/lldb-mi/exec/exec-step.test +++ lit/tools/lldb-mi/exec/exec-step.test @@ -1,4 +1,4 @@ -# XFAI
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. In https://reviews.llvm.org/D54020#1285539, @JDevlieghere wrote: > In https://reviews.llvm.org/D54020#1285201, @labath wrote: > > > I am not sure what do you mean by "translating paths" in the VFS. If you > > mean something like "return a `FILE *` for > > `/whatever/my_reproducer/vfs/bin/ls` when I ask for `/bin/ls`", then I > > think that's a good idea, as it's most likely to work with all of our > > existing code (e.g. mmapping). Although, in this case, i am not sure how > > much benefit will the llvm VFS bring to the game, as most of the operations > > could then be implemented by plainly prepending some prefix to a given > > path. > > > Let me try to explain this better. This is mostly a question about what kind > of API the VFS (which lives in LLVM) provides to deal with files in lldb > (i.e. through `FILE*` and file descriptors). > > The first possibility is providing a method in the VFS that takes a "virtual" > path and returns the "underlying" path. Something like `Optional > vfs::getUnderlyingPath(path)`. This doesn't just have to be a prefix thing > but you are right that it's mostly going to be just that. The problem is that > this method wouldn't work for virtual file systems that don't have files on > disk. Hence the lack of generality. Ok, I think we're on the same page here. What I was wondering is that given this lack of generality (this operation would only be supported on `DiskBackedFilesystem`, and not all other kinds of file systems), whether it is not better to just do a custom solution instead of going through the VFS layer (thereby removing one layer, since now we have `lldb_private::FileSystem` sitting on top of `llvm::VirtualFileSystem`, sitting on top of the real thing). E.g., if we know we can restrict ourselves to the case where the on disk layout matches the real system, then all filesystem operations can be implemented very trivially via something like: auto virtual_op(const Twine &Path, ...) { return real_op(Prefix+Path, ...); } I am not sure whether this is a good idea (there's definitely a case to be made for reusing existing infrastructure), but it is something to think about. >> Also, be aware that there are some places where we open `raw_ostream`s >> directly (`Debugger::EnableLog` comes to mind). I guess those will need to >> go through the `FileSystem` too... > > Yup, we need to audit all file access. This particular example actually goes > through file so it should be covered by this change. You're right, I should have looked at this more closely. It should be fine (assuming we can have real fds for the virtual files). Comment at: source/Host/common/FileSystem.cpp:253 +static int GetOpenFlags(uint32_t options) { + const bool read = options & File::OpenOptions::eOpenOptionRead; + const bool write = options & File::OpenOptions::eOpenOptionWrite; JDevlieghere wrote: > labath wrote: > > `File::eOpenOptionRead` should be sufficient, no? > Sorry, I don't know what you mean? I meant to remove the superfluous `OpenOptions` qualification, As this is a non-class enum, it is not necessary, and it doesn't help clarity, since the enum value already contains the type name. None of the existing code uses this kind of qualification. https://reviews.llvm.org/D54020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346035 - Fix a bug in the lit test suite generation.
Author: zturner Date: Fri Nov 2 12:55:15 2018 New Revision: 346035 URL: http://llvm.org/viewvc/llvm-project?rev=346035&view=rev Log: Fix a bug in the lit test suite generation. I'm not sure why this has to be CMAKE_CURRENT_SOURCE_DIR, but it causes all kinds of strange cmake generation errors when it's the binary dir. Modified: lldb/trunk/lit/CMakeLists.txt Modified: lldb/trunk/lit/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=346035&r1=346034&r2=346035&view=diff == --- lldb/trunk/lit/CMakeLists.txt (original) +++ lldb/trunk/lit/CMakeLists.txt Fri Nov 2 12:55:15 2018 @@ -83,6 +83,6 @@ if (TARGET clang) endif() add_lit_testsuites(LLDB - ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${LLDB_TEST_DEPS} ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
JDevlieghere added a comment. In https://reviews.llvm.org/D54020#1285799, @labath wrote: > Ok, I think we're on the same page here. What I was wondering is that given > this lack of generality (this operation would only be supported on > `DiskBackedFilesystem`, and not all other kinds of file systems), whether it > is not better to just do a custom solution instead of going through the VFS > layer (thereby removing one layer, since now we have > `lldb_private::FileSystem` sitting on top of `llvm::VirtualFileSystem`, > sitting on top of the real thing). E.g., if we know we can restrict ourselves > to the case where the on disk layout matches the real system, then all > filesystem operations can be implemented very trivially via something like: > > auto virtual_op(const Twine &Path, ...) { return real_op(Prefix+Path, ...); > } > > > I am not sure whether this is a good idea (there's definitely a case to be > made for reusing existing infrastructure), but it is something to think about. Thanks Pavel, I really appreciate you thinking this through with me! I understand what you're saying but I still think the VFS is worthwhile: - The lack of generality I brought up only applies to in-memory file systems. Every VFS implementation that's backed by disk would still work. - The only reason hard-coding the vfs implementation (because that's essentially what the prefix thing is) is the coincidence that no prefix equals the real file system. - We could have a prefix VFS implementation that's really simple and self-contained without cluttering the LLDB `FileSystem` class with details. In the end I believe the indirection is more of a feature than a bug. I'm worried that, if we do our own thing, we'll end up in this situation where we have something in LLDB that looks really similar to something in LLVM but isn't quite the same. As soon as we want to do more complex than just prepending a prefix we'll need an abstraction anyway, so it might as well be the thing from LLVM. Comment at: source/Host/common/FileSystem.cpp:253 +static int GetOpenFlags(uint32_t options) { + const bool read = options & File::OpenOptions::eOpenOptionRead; + const bool write = options & File::OpenOptions::eOpenOptionWrite; labath wrote: > JDevlieghere wrote: > > labath wrote: > > > `File::eOpenOptionRead` should be sufficient, no? > > Sorry, I don't know what you mean? > I meant to remove the superfluous `OpenOptions` qualification, As this is a > non-class enum, it is not necessary, and it doesn't help clarity, since the > enum value already contains the type name. None of the existing code uses > this kind of qualification. Got it, thanks! https://reviews.llvm.org/D54020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54003: Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter
teemperor added a comment. This looks nice, just added some minor comments below. Otherwise LGTM after Davide's point is addressed. Comment at: include/lldb/Symbol/ClangASTContext.h:909 clang::EnumConstantDecl *AddEnumerationValueToEnumerationType( - lldb::opaque_compiler_type_t type, - const CompilerType &enumerator_qual_type, const Declaration &decl, - const char *name, int64_t enum_value, uint32_t enum_value_bit_size); + const CompilerType enum_type, const Declaration &decl, const char *name, + int64_t enum_value, uint32_t enum_value_bit_size); Can we pass `enum_type` as const ref? Comment at: source/Symbol/ClangASTContext.cpp:8851 clang::EnumConstantDecl *ClangASTContext::AddEnumerationValueToEnumerationType( -lldb::opaque_compiler_type_t type, -const CompilerType &enumerator_clang_type, const Declaration &decl, -const char *name, int64_t enum_value, uint32_t enum_value_bit_size) { - if (type && enumerator_clang_type.IsValid() && name && name[0]) { -clang::QualType enum_qual_type(GetCanonicalQualType(type)); - -bool is_signed = false; -enumerator_clang_type.IsIntegerType(is_signed); -const clang::Type *clang_type = enum_qual_type.getTypePtr(); -if (clang_type) { - const clang::EnumType *enutype = - llvm::dyn_cast(clang_type); - - if (enutype) { -llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed); -enum_llvm_apsint = enum_value; -clang::EnumConstantDecl *enumerator_decl = -clang::EnumConstantDecl::Create( -*getASTContext(), enutype->getDecl(), clang::SourceLocation(), -name ? &getASTContext()->Idents.get(name) - : nullptr, // Identifier -ClangUtil::GetQualType(enumerator_clang_type), -nullptr, enum_llvm_apsint); - -if (enumerator_decl) { - enutype->getDecl()->addDecl(enumerator_decl); +const CompilerType enum_type, const Declaration &decl, const char *name, +int64_t enum_value, uint32_t enum_value_bit_size) { (Same as above) Can we have `enum_type` as a const ref? https://reviews.llvm.org/D54003 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54003: Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter
zturner added a comment. This function is called in `SymbolFile/NativePDB` as well. https://reviews.llvm.org/D54003 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
JDevlieghere added a comment. Hi Zachary, looks like this broke GreenDragon: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12087/console Can you have a look please? Repository: rLLDB LLDB https://reviews.llvm.org/D54009 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
davide added a comment. This broke MacOS. I'm going to revert this. To reproduce, just run `ninja check-lldb` with your patches. Please let me know if you need other informations. Repository: rLLDB LLDB https://reviews.llvm.org/D53368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346045 - Revert "[Symbol] Search symbols with name and type in a symbol file"
Author: davide Date: Fri Nov 2 14:59:14 2018 New Revision: 346045 URL: http://llvm.org/viewvc/llvm-project?rev=346045&view=rev Log: Revert "[Symbol] Search symbols with name and type in a symbol file" It broke MacOS buildbots. Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h lldb/trunk/include/lldb/Symbol/SymbolVendor.h lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h lldb/trunk/source/Symbol/SymbolVendor.cpp lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=346045&r1=346044&r2=346045&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Fri Nov 2 14:59:14 2018 @@ -214,8 +214,6 @@ public: return {}; } - virtual void AddSymbols(Symtab &symtab) {} - //-- /// Notify the SymbolFile that the file addresses in the Sections /// for this module have been changed. Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=346045&r1=346044&r2=346045&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Fri Nov 2 14:59:14 2018 @@ -165,8 +165,6 @@ protected: // file) std::unique_ptr m_sym_file_ap; // A single symbol file. Subclasses // can add more of these if needed. - Symtab *m_symtab; // Save a symtab once to not pass it through `AddSymbols` of -// the symbol file each time when it is needed private: //-- Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=346045&r1=346044&r2=346045&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri Nov 2 14:59:14 2018 @@ -2876,6 +2876,8 @@ Symtab *ObjectFileELF::GetSymtab() { // do the section lookup next time. if (m_symtab_ap == nullptr) m_symtab_ap.reset(new Symtab(this)); + +m_symtab_ap->CalculateSymbolSizes(); } return m_symtab_ap.get(); Modified: lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp?rev=346045&r1=346044&r2=346045&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp Fri Nov 2 14:59:14 2018 @@ -124,6 +124,7 @@ Symtab *ObjectFileJIT::GetSymtab() { if (delegate_sp) delegate_sp->PopulateSymtab(this, *m_symtab_ap); // TODO: get symbols from delegate + m_symtab_ap->Finalize(); } } return m_symtab_ap.get(); Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=346045&r1=346044&r2=346045&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Nov 2 14:59:14 2018 @@ -1315,6 +1315,7 @@ Symtab *ObjectFileMachO::GetSymtab() { std::lock_guard symtab_guard( m_symtab_ap->GetMutex()); ParseSymtab(); + m_symtab_ap->Finalize(); } } return m_symtab_ap.get(); @@ -4806,6 +4807,16 @@ size_t ObjectFileMachO::ParseSymtab() { } } +//StreamFile s(stdout, false); +//s.Printf ("Symbol table before CalculateSymbolSizes():\n"); +//symtab->Dump(&s, NULL, eSortOrderNone); +// Set symbol byte sizes correctly since mach-o nlist entries don't have +// sizes +symtab->CalculateSymbolSizes(); + +//s.Printf ("Symbol table after CalculateSymbolSizes():\n"); +//symtab->Dump(&s, NULL, eS
[Lldb-commits] [PATCH] D54053: [NativePDB] Add the ability to create clang record decls from mangled names.
zturner created this revision. zturner added reviewers: aleksandr.urakov, labath, lemo. Herald added subscribers: erik.pilkington, mgorny. Previously we were not able to accurately represent tag record types with clang record decls. The primary reason for this is that for type information PDB only contains fully instantiated type names. It does not contain rich information about namespaces, declaration contexts (e.g. parent classes, function scopes for local classes, etc), template parameters, or anything else. All you have is a big long string that is a fully instantiated type name. What it does give you, however, is the mangled name of this type. So we can extract all of the relevant information (minus the distinction between outer class and outer namespace) from the mangled name. This patch is the start of this effort. It uses LLVM's demangler to demangle the name, and treat each component as one component of a namespace chain. Obviously this is not true in the general case, as something like `Foo::Bar(double)::`1'::LocalClass<7>::NestedClass` will get treated as if it were in a series of namespaces. However, it's a good start, and clang doesn't actually care for most uses. So we can improve on this incrementally with subsequent patches to make this more accurate. https://reviews.llvm.org/D54053 Files: lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt lldb/source/Plugins/SymbolFile/NativePDB/MangledAST.cpp lldb/source/Plugins/SymbolFile/NativePDB/MangledAST.h lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h === --- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h +++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h @@ -175,7 +175,8 @@ lldb::TypeSP CreateProcedureType(PdbSymUid type_uid, const llvm::codeview::ProcedureRecord &pr); lldb::TypeSP - CreateClassStructUnion(PdbSymUid type_uid, llvm::StringRef name, size_t size, + CreateClassStructUnion(PdbSymUid type_uid, llvm::StringRef name, + llvm::StringRef unique_name, size_t size, clang::TagTypeKind ttk, clang::MSInheritanceAttr::Spelling inheritance); Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp === --- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -51,6 +51,7 @@ #include "Plugins/Language/CPlusPlus/CPlusPlusNameParser.h" +#include "MangledAST.h" #include "PdbSymUid.h" #include "PdbUtil.h" #include "UdtRecordCompleter.h" @@ -731,27 +732,11 @@ } lldb::TypeSP SymbolFileNativePDB::CreateClassStructUnion( -PdbSymUid type_uid, llvm::StringRef name, size_t size, -clang::TagTypeKind ttk, clang::MSInheritanceAttr::Spelling inheritance) { +PdbSymUid type_uid, llvm::StringRef name, llvm::StringRef unique_name, +size_t size, clang::TagTypeKind ttk, +clang::MSInheritanceAttr::Spelling inheritance) { - // Ignore unnamed-tag UDTs. - name = DropNameScope(name); - if (name.empty()) -return nullptr; - - clang::DeclContext *decl_context = m_clang->GetTranslationUnitDecl(); - - lldb::AccessType access = - (ttk == clang::TTK_Class) ? lldb::eAccessPrivate : lldb::eAccessPublic; - - ClangASTMetadata metadata; - metadata.SetUserID(type_uid.toOpaqueId()); - metadata.SetIsDynamicCXXType(false); - - CompilerType ct = - m_clang->CreateRecordType(decl_context, access, name.str().c_str(), ttk, -lldb::eLanguageTypeC_plus_plus, &metadata); - lldbassert(ct.IsValid()); + CompilerType ct = CreateClangDeclFromMangledName(*m_clang, unique_name); clang::CXXRecordDecl *record_decl = m_clang->GetAsCXXRecordDecl(ct.GetOpaqueQualType()); @@ -771,7 +756,7 @@ // FIXME: Search IPI stream for LF_UDT_MOD_SRC_LINE. Declaration decl; return std::make_shared(type_uid.toOpaqueId(), m_clang->GetSymbolFile(), -ConstString(name), size, nullptr, +ct.GetTypeName(), size, nullptr, LLDB_INVALID_UID, Type::eEncodingIsUID, decl, ct, Type::eResolveStateForward); } @@ -782,14 +767,15 @@ clang::MSInheritanceAttr::Spelling inheritance = GetMSInheritance(m_index->tpi().typeCollection(), cr); - return CreateClassStructUnion(type_uid, cr.getName(), cr.getSize(), ttk, -inheritance); + return CreateClassStructUnion(type_uid, cr.getName(), cr.getUniqueName(), +cr.getSiz
Re: [Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
Fix incoming, sorry about that. On Fri, Nov 2, 2018 at 2:57 PM Jonas Devlieghere via Phabricator < revi...@reviews.llvm.org> wrote: > JDevlieghere added a comment. > > Hi Zachary, looks like this broke GreenDragon: > http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12087/console > > Can you have a look please? > > > Repository: > rLLDB LLDB > > https://reviews.llvm.org/D54009 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346046 - Fix the lit test suite.
Author: zturner Date: Fri Nov 2 15:02:09 2018 New Revision: 346046 URL: http://llvm.org/viewvc/llvm-project?rev=346046&view=rev Log: Fix the lit test suite. This change was accidentally missed from the original changeset. Modified: lldb/trunk/lit/lit.site.cfg.py.in Modified: lldb/trunk/lit/lit.site.cfg.py.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.site.cfg.py.in?rev=346046&r1=346045&r2=346046&view=diff == --- lldb/trunk/lit/lit.site.cfg.py.in (original) +++ lldb/trunk/lit/lit.site.cfg.py.in Fri Nov 2 15:02:09 2018 @@ -28,5 +28,8 @@ except KeyError as e: key, = e.args lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) +import lit.llvm +lit.llvm.initialize(lit_config, config) + # Let the main config do the real work. lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/lit.cfg.py") ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
zturner added a subscriber: stella.stamenova. zturner added a comment. Fix incoming, sorry about that. Repository: rLLDB LLDB https://reviews.llvm.org/D54009 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
This revision was automatically updated to reflect the committed changes. Closed by commit rL346049: [FileSystem] Open File instances through the FileSystem. (authored by JDevlieghere, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D54020?vs=172382&id=172447#toc Repository: rL LLVM https://reviews.llvm.org/D54020 Files: lldb/trunk/include/lldb/Host/File.h lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/API/SBStream.cpp lldb/trunk/source/Commands/CommandObjectBugreport.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/StreamFile.cpp lldb/trunk/source/Expression/REPL.cpp lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/FileCache.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Index: lldb/trunk/include/lldb/Host/FileSystem.h === --- lldb/trunk/include/lldb/Host/FileSystem.h +++ lldb/trunk/include/lldb/Host/FileSystem.h @@ -10,6 +10,7 @@ #ifndef liblldb_Host_FileSystem_h #define liblldb_Host_FileSystem_h +#include "lldb/Host/File.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" @@ -49,6 +50,9 @@ /// Wraps ::open in a platform-independent way. int Open(const char *path, int flags, int mode); + Status Open(File &File, const FileSpec &file_spec, uint32_t options, + uint32_t permissions = lldb::eFilePermissionsFileDefault); + /// Returns the modification time of the given file. /// @{ llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const; Index: lldb/trunk/include/lldb/Host/File.h === --- lldb/trunk/include/lldb/Host/File.h +++ lldb/trunk/include/lldb/Host/File.h @@ -64,50 +64,6 @@ m_is_real_terminal(eLazyBoolCalculate), m_supports_colors(eLazyBoolCalculate) {} - //-- - /// Constructor with path. - /// - /// Takes a path to a file which can be just a filename, or a full path. If - /// \a path is not nullptr or empty, this function will call File::Open - /// (const char *path, uint32_t options, uint32_t permissions). - /// - /// @param[in] path - /// The full or partial path to a file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - /// - /// @see File::Open (const char *path, uint32_t options, uint32_t - /// permissions) - //-- - File(const char *path, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - - //-- - /// Constructor with FileSpec. - /// - /// Takes a FileSpec pointing to a file which can be just a filename, or a - /// full path. If \a path is not nullptr or empty, this function will call - /// File::Open (const char *path, uint32_t options, uint32_t permissions). - /// - /// @param[in] filespec - /// The FileSpec for this file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - /// - /// @see File::Open (const char *path, uint32_t options, uint32_t - /// permissions) - //-- - File(const FileSpec &filespec, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - File(int fd, bool transfer_ownership) : IOObject(eFDTypeFile, transfer_ownership), m_descriptor(fd), m_stream(kInvalidStream), m_options(0), m_own_stream(false), @@ -169,23 +125,6 @@ //-- Status GetFileSpec(FileSpec &file_spec) const; - //-- - /// Open a file for read/writing with the specified options. - /// - /// Takes a path to a file which can be just a filename, or a full path. - /// - /// @param[in] path - /// The full or partial path to a file. - /// - /// @param[
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB346049: [FileSystem] Open File instances through the FileSystem. (authored by JDevlieghere, committed by ). Changed prior to commit: https://reviews.llvm.org/D54020?vs=172382&id=172448#toc Repository: rLLDB LLDB https://reviews.llvm.org/D54020 Files: include/lldb/Host/File.h include/lldb/Host/FileSystem.h source/API/SBStream.cpp source/Commands/CommandObjectBugreport.cpp source/Commands/CommandObjectMemory.cpp source/Core/StreamFile.cpp source/Expression/REPL.cpp source/Host/common/File.cpp source/Host/common/FileCache.cpp source/Host/common/FileSystem.cpp source/Interpreter/CommandInterpreter.cpp source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp source/Target/ModuleCache.cpp source/Target/Platform.cpp unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Index: unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp === --- unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp +++ unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp @@ -167,7 +167,7 @@ } TEST_F(PythonDataObjectsTest, TestPythonInteger) { -// Test that integers behave correctly when wrapped by a PythonInteger. + // Test that integers behave correctly when wrapped by a PythonInteger. #if PY_MAJOR_VERSION < 3 // Verify that `PythonInt` works correctly when given a PyInt object. @@ -557,7 +557,9 @@ } TEST_F(PythonDataObjectsTest, TestPythonFile) { - File file(FileSystem::DEV_NULL, File::eOpenOptionRead); + File file; + FileSystem::Instance().Open(file, FileSpec(FileSystem::DEV_NULL), + File::eOpenOptionRead); PythonFile py_file(file, "r"); EXPECT_TRUE(PythonFile::Check(py_file.get())); } Index: source/Core/StreamFile.cpp === --- source/Core/StreamFile.cpp +++ source/Core/StreamFile.cpp @@ -8,6 +8,7 @@ //===--===// #include "lldb/Core/StreamFile.h" +#include "lldb/Host/FileSystem.h" #include @@ -28,14 +29,18 @@ StreamFile::StreamFile(FILE *fh, bool transfer_ownership) : Stream(), m_file(fh, transfer_ownership) {} -StreamFile::StreamFile(const char *path) -: Stream(), - m_file(path, File::eOpenOptionWrite | File::eOpenOptionCanCreate | - File::eOpenOptionCloseOnExec, - lldb::eFilePermissionsFileDefault) {} +StreamFile::StreamFile(const char *path) : Stream(), m_file() { + FileSystem::Instance().Open(m_file, FileSpec(path), + File::eOpenOptionWrite | + File::eOpenOptionCanCreate | + File::eOpenOptionCloseOnExec); +} StreamFile::StreamFile(const char *path, uint32_t options, uint32_t permissions) -: Stream(), m_file(path, options, permissions) {} +: Stream(), m_file() { + + FileSystem::Instance().Open(m_file, FileSpec(path), options, permissions); +} StreamFile::~StreamFile() {} Index: source/Target/Platform.cpp === --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -1280,8 +1280,9 @@ if (fs::is_symlink_file(source.GetPath())) source_open_options |= File::eOpenOptionDontFollowSymlinks; - File source_file(source, source_open_options, lldb::eFilePermissionsUserRW); - Status error; + File source_file; + Status error = FileSystem::Instance().Open( + source_file, source, source_open_options, lldb::eFilePermissionsUserRW); uint32_t permissions = source_file.GetPermissions(error); if (permissions == 0) permissions = lldb::eFilePermissionsFileDefault; Index: source/Target/ModuleCache.cpp === --- source/Target/ModuleCache.cpp +++ source/Target/ModuleCache.cpp @@ -159,9 +159,10 @@ return; m_file_spec = JoinPath(lock_dir_spec, uuid.GetAsString().c_str()); - m_file.Open(m_file_spec.GetCString(), File::eOpenOptionWrite | -File::eOpenOptionCanCreate | -File::eOpenOptionCloseOnExec); + FileSystem::Instance().Open(m_file, m_file_spec, + File::eOpenOptionWrite | + File::eOpenOptionCanCreate | + File::eOpenOptionCloseOnExec); if (!m_file) { error.SetErrorToErrno(); return; Index: source/Interpreter/CommandInterpreter.cpp ===
[Lldb-commits] [lldb] r346049 - [FileSystem] Open File instances through the FileSystem.
Author: jdevlieghere Date: Fri Nov 2 15:34:51 2018 New Revision: 346049 URL: http://llvm.org/viewvc/llvm-project?rev=346049&view=rev Log: [FileSystem] Open File instances through the FileSystem. This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 Modified: lldb/trunk/include/lldb/Host/File.h lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/API/SBStream.cpp lldb/trunk/source/Commands/CommandObjectBugreport.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/StreamFile.cpp lldb/trunk/source/Expression/REPL.cpp lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/FileCache.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Modified: lldb/trunk/include/lldb/Host/File.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=346049&r1=346048&r2=346049&view=diff == --- lldb/trunk/include/lldb/Host/File.h (original) +++ lldb/trunk/include/lldb/Host/File.h Fri Nov 2 15:34:51 2018 @@ -64,50 +64,6 @@ public: m_is_real_terminal(eLazyBoolCalculate), m_supports_colors(eLazyBoolCalculate) {} - //-- - /// Constructor with path. - /// - /// Takes a path to a file which can be just a filename, or a full path. If - /// \a path is not nullptr or empty, this function will call File::Open - /// (const char *path, uint32_t options, uint32_t permissions). - /// - /// @param[in] path - /// The full or partial path to a file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - /// - /// @see File::Open (const char *path, uint32_t options, uint32_t - /// permissions) - //-- - File(const char *path, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - - //-- - /// Constructor with FileSpec. - /// - /// Takes a FileSpec pointing to a file which can be just a filename, or a - /// full path. If \a path is not nullptr or empty, this function will call - /// File::Open (const char *path, uint32_t options, uint32_t permissions). - /// - /// @param[in] filespec - /// The FileSpec for this file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - /// - /// @see File::Open (const char *path, uint32_t options, uint32_t - /// permissions) - //-- - File(const FileSpec &filespec, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - File(int fd, bool transfer_ownership) : IOObject(eFDTypeFile, transfer_ownership), m_descriptor(fd), m_stream(kInvalidStream), m_options(0), m_own_stream(false), @@ -169,23 +125,6 @@ public: //-- Status GetFileSpec(FileSpec &file_spec) const; - //-- - /// Open a file for read/writing with the specified options. - /// - /// Takes a path to a file which can be just a filename, or a full path. - /// - /// @param[in] path - /// The full or partial path to a file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - //-- - Status Open(const char *path, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - Status Close() override; void Clear(); @@ -461,8 +400,10 @@ public: void SetOptions(uint32_t options)
[Lldb-commits] [PATCH] D54056: Add SetAllowJIT (the SBExpressionOptions equivalent of "expression --allow-jit")
jingham created this revision. jingham added a reviewer: aprantl. Herald added a subscriber: lldb-commits. Sometimes you want to make sure that the target doesn't run at all when running an expression, and you'd rather the expression fail if it would have run the target. You can do this with the "expression" command by passing "--allow-jit 0" but there's no way to do that with SBExpressionOptions. This patch adds that setting. Repository: rLLDB LLDB https://reviews.llvm.org/D54056 Files: include/lldb/API/SBExpressionOptions.h packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py packages/Python/lldbsuite/test/expression_command/dont_allow_jit/main.c scripts/interface/SBExpressionOptions.i source/API/SBExpressionOptions.cpp Index: source/API/SBExpressionOptions.cpp === --- source/API/SBExpressionOptions.cpp +++ source/API/SBExpressionOptions.cpp @@ -159,6 +159,15 @@ : m_opaque_ap->default_execution_policy); } +bool SBExpressionOptions::GetAllowJIT() { + return m_opaque_ap->GetExecutionPolicy() != eExecutionPolicyNever; +} + +void SBExpressionOptions::SetAllowJIT(bool allow) { + m_opaque_ap->SetExecutionPolicy(allow ? m_opaque_ap->default_execution_policy +: eExecutionPolicyNever); +} + EvaluateExpressionOptions *SBExpressionOptions::get() const { return m_opaque_ap.get(); } Index: scripts/interface/SBExpressionOptions.i === --- scripts/interface/SBExpressionOptions.i +++ scripts/interface/SBExpressionOptions.i @@ -132,6 +132,14 @@ void SetTopLevel(bool b = true); + +%feature("docstring", "Gets whether to JIT an expression if it cannot be interpreted.") GetAllowJIT; +bool +GetAllowJIT(); + +%feature("docstring", "Sets whether to JIT an expression if it cannot be interpreted.") SetAllowJIT; +void +SetAllowJIT(bool allow); protected: Index: packages/Python/lldbsuite/test/expression_command/dont_allow_jit/main.c === --- packages/Python/lldbsuite/test/expression_command/dont_allow_jit/main.c +++ packages/Python/lldbsuite/test/expression_command/dont_allow_jit/main.c @@ -0,0 +1,15 @@ +#include + +int +call_me(int input) +{ + return printf("I was called: %d.\n", input); +} + +int +main() +{ + int test_var = 10; + printf ("Set a breakpoint here: %d.\n", test_var); + return call_me(100); +} Index: packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py === --- packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py +++ packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py @@ -0,0 +1,94 @@ +""" +Test that --allow-jit=false does disallow JITting: +""" + +from __future__ import print_function + + +import os +import time +import re +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * + +class TestAllowJIT(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +# If your test case doesn't stress debug info, the +# set this to true. That way it won't be run once for +# each debug info format. +NO_DEBUG_INFO_TESTCASE = True + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test_allow_jit_expr_command(self): +"""Test the --allow-jit command line flag""" +self.build() +self.main_source_file = lldb.SBFileSpec("main.c") +self.expr_cmd_test() + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test_allow_jit_options(self): +"""Test the SetAllowJIT SBExpressionOption setting""" +self.build() +self.main_source_file = lldb.SBFileSpec("main.c") +self.expr_options_test() + + + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +def expr_cmd_test(self): +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", self.main_source_file) + +frame = thread.GetFrameAtIndex(0) + +# First make sure we can call the function with +interp = self.dbg.GetCommandInterpreter() +self.expect("expr --allow-jit 1 -- call_me(10)", +substrs = ["(int) $", "= 18"]) +# Now make sure it fails with the "can't IR interpret message" if allow-jit is false: +self.expect("expr --allow-jit 0 -- call_me(10)", +error=True, +substrs = ["Can't run the expression locally"]) + +def expr_
[Lldb-commits] [PATCH] D54056: Add SetAllowJIT (the SBExpressionOptions equivalent of "expression --allow-jit")
aprantl accepted this revision. aprantl added a comment. This revision is now accepted and ready to land. This is great! Why not just call it `--jit`? Repository: rLLDB LLDB https://reviews.llvm.org/D54056 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54056: Add SetAllowJIT (the SBExpressionOptions equivalent of "expression --allow-jit")
jasonmolenda added a comment. To me --jit sounds like an imperative (i.e. don't use the IR interpreter, jit and execute this expression), whereas --allow-jit seems closer to the behavior here. Repository: rLLDB LLDB https://reviews.llvm.org/D54056 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54056: Add SetAllowJIT (the SBExpressionOptions equivalent of "expression --allow-jit")
aprantl added a comment. Ah, I didn't realize that the behavior is to always try to interpret first. Repository: rLLDB LLDB https://reviews.llvm.org/D54056 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54060: Remove OCaml debugger plugin
JDevlieghere created this revision. JDevlieghere added reviewers: davide, zturner, labath, tberghammer. JDevlieghere added a project: LLDB. Herald added a subscriber: mgorny. In January Davide sent an e-mail to the mailing list to suggest removing support for Go and Java. The plan was to have some cool down period to allow users to speak up. However, the actual removal never took place. I decided to move forward and start the removal process. Discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2018-January/013171.html Repository: rLLDB LLDB https://reviews.llvm.org/D54060 Files: include/lldb/Symbol/OCamlASTContext.h source/API/SystemInitializerFull.cpp source/Plugins/Language/CMakeLists.txt source/Plugins/Language/OCaml/CMakeLists.txt source/Plugins/Language/OCaml/OCamlLanguage.cpp source/Plugins/Language/OCaml/OCamlLanguage.h source/Plugins/SymbolFile/DWARF/CMakeLists.txt source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/CMakeLists.txt source/Symbol/OCamlASTContext.cpp tools/lldb-test/SystemInitializerTest.cpp unittests/Language/Highlighting/CMakeLists.txt unittests/Language/Highlighting/HighlighterTest.cpp Index: unittests/Language/Highlighting/HighlighterTest.cpp === --- unittests/Language/Highlighting/HighlighterTest.cpp +++ unittests/Language/Highlighting/HighlighterTest.cpp @@ -12,7 +12,6 @@ #include "lldb/Core/Highlighter.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" -#include "Plugins/Language/OCaml/OCamlLanguage.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" #include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h" @@ -32,14 +31,12 @@ CPlusPlusLanguage::Initialize(); ObjCLanguage::Initialize(); ObjCPlusPlusLanguage::Initialize(); - OCamlLanguage::Initialize(); } void HighlighterTest::TearDownTestCase() { CPlusPlusLanguage::Terminate(); ObjCLanguage::Terminate(); ObjCPlusPlusLanguage::Terminate(); - OCamlLanguage::Terminate(); } static std::string getName(lldb::LanguageType type) { Index: unittests/Language/Highlighting/CMakeLists.txt === --- unittests/Language/Highlighting/CMakeLists.txt +++ unittests/Language/Highlighting/CMakeLists.txt @@ -5,5 +5,4 @@ lldbPluginCPlusPlusLanguage lldbPluginObjCLanguage lldbPluginObjCPlusPlusLanguage -lldbPluginOCamlLanguage ) Index: tools/lldb-test/SystemInitializerTest.cpp === --- tools/lldb-test/SystemInitializerTest.cpp +++ tools/lldb-test/SystemInitializerTest.cpp @@ -14,7 +14,6 @@ #include "lldb/Initialization/SystemInitializerCommon.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Symbol/ClangASTContext.h" -#include "lldb/Symbol/OCamlASTContext.h" #include "lldb/Utility/Timer.h" #include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h" @@ -46,7 +45,6 @@ #include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h" #include "Plugins/JITLoader/GDB/JITLoaderGDB.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" -#include "Plugins/Language/OCaml/OCamlLanguage.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" #include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h" #include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h" @@ -144,7 +142,6 @@ llvm::InitializeAllDisassemblers(); ClangASTContext::Initialize(); - OCamlASTContext::Initialize(); ABIMacOSX_i386::Initialize(); ABIMacOSX_arm::Initialize(); @@ -192,7 +189,6 @@ CPlusPlusLanguage::Initialize(); ObjCLanguage::Initialize(); ObjCPlusPlusLanguage::Initialize(); - OCamlLanguage::Initialize(); #if defined(_WIN32) ProcessWindows::Initialize(); @@ -247,7 +243,6 @@ PluginManager::Terminate(); ClangASTContext::Terminate(); - OCamlASTContext::Terminate(); ABIMacOSX_i386::Terminate(); ABIMacOSX_arm::Terminate(); @@ -290,7 +285,6 @@ CPlusPlusLanguage::Terminate(); ObjCLanguage::Terminate(); ObjCPlusPlusLanguage::Terminate(); - OCamlLanguage::Terminate(); #if defined(__APPLE__) DynamicLoaderDarwinKernel::Terminate(); Index: source/Symbol/OCamlASTContext.cpp === --- source/Symbol/OCamlASTContext.cpp +++ /dev/null @@ -1,670 +0,0 @@ -//===-- OCamlASTContext.cpp *- C++ -//-*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#include "lldb/Symbol/OCamlASTContext.h" -#include "lldb/Core/DumpDataExtractor.h" -#include
[Lldb-commits] [PATCH] D54053: [NativePDB] Add the ability to create clang record decls from mangled names.
lemo accepted this revision. lemo added a comment. This revision is now accepted and ready to land. nice! Comment at: lldb/source/Plugins/SymbolFile/NativePDB/MangledAST.cpp:80 + + lldb::AccessType access = + (ttn->Tag == TagKind::Class) ? lldb::eAccessPrivate : lldb::eAccessPublic; what does this mean? pretend that all the members of a class are private? https://reviews.llvm.org/D54053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54056: Add SetAllowJIT (the SBExpressionOptions equivalent of "expression --allow-jit")
jingham added a comment. --jit wouldn't describe what the flag actually does. Currently allow-jit and the SB Setting I added for it set the execution policy to eExecutionPolicyWhenNeeded, not eExecutionPolicyAlways. So this really does just allow the JIT to be used, it doesn't force it. If we wanted to add the ability to force use of the JIT always, we could either add another flag, or make an enum setting that had {never, always, when needed}. But I can't see why you would want that, except maybe to work around IR interpreter bugs. I'd rather not add options just for working around bugs if I can help it. Repository: rLLDB LLDB https://reviews.llvm.org/D54056 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346053 - Add an SBExpressionOptions setting mirroring the "exec" command's --allow-jit.
Author: jingham Date: Fri Nov 2 16:42:40 2018 New Revision: 346053 URL: http://llvm.org/viewvc/llvm-project?rev=346053&view=rev Log: Add an SBExpressionOptions setting mirroring the "exec" command's --allow-jit. Differential Revision: https://reviews.llvm.org/D54056 Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/ lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/main.c Modified: lldb/trunk/include/lldb/API/SBExpressionOptions.h lldb/trunk/scripts/interface/SBExpressionOptions.i lldb/trunk/source/API/SBExpressionOptions.cpp Modified: lldb/trunk/include/lldb/API/SBExpressionOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExpressionOptions.h?rev=346053&r1=346052&r2=346053&view=diff == --- lldb/trunk/include/lldb/API/SBExpressionOptions.h (original) +++ lldb/trunk/include/lldb/API/SBExpressionOptions.h Fri Nov 2 16:42:40 2018 @@ -90,6 +90,12 @@ public: bool GetTopLevel(); void SetTopLevel(bool b = true); + + // Gets whether we will JIT an expression if it cannot be interpreted + bool GetAllowJIT(); + + // Sets whether we will JIT an expression if it cannot be interpreted + void SetAllowJIT(bool allow); protected: SBExpressionOptions( Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile?rev=346053&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile Fri Nov 2 16:42:40 2018 @@ -0,0 +1,6 @@ +LEVEL = ../../make + +C_SOURCES := main.c +CFLAGS_EXTRAS += -std=c99 + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py?rev=346053&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py Fri Nov 2 16:42:40 2018 @@ -0,0 +1,94 @@ +""" +Test that --allow-jit=false does disallow JITting: +""" + +from __future__ import print_function + + +import os +import time +import re +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * + +class TestAllowJIT(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +# If your test case doesn't stress debug info, the +# set this to true. That way it won't be run once for +# each debug info format. +NO_DEBUG_INFO_TESTCASE = True + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test_allow_jit_expr_command(self): +"""Test the --allow-jit command line flag""" +self.build() +self.main_source_file = lldb.SBFileSpec("main.c") +self.expr_cmd_test() + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test_allow_jit_options(self): +"""Test the SetAllowJIT SBExpressionOption setting""" +self.build() +self.main_source_file = lldb.SBFileSpec("main.c") +self.expr_options_test() + + + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +def expr_cmd_test(self): +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", self.main_source_file) + +frame = thread.GetFrameAtIndex(0) + +# First make sure we can call the function with +interp = self.dbg.GetCommandInterpreter() +self.expect("expr --allow-jit 1 -- call_me(10)", +substrs = ["(int) $", "= 18"]) +# Now make sure it fails with the "can't IR interpret message" if allow-jit is false: +self.expect("expr --allow-jit 0 -- call_me(10)", +error=True, +substrs = ["Can't run the expression locally"]) + +def expr_options_test(self): +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", self.main_source_file) + +frame = thread.
[Lldb-commits] [PATCH] D54056: Add SetAllowJIT (the SBExpressionOptions equivalent of "expression --allow-jit")
This revision was automatically updated to reflect the committed changes. Closed by commit rL346053: Add an SBExpressionOptions setting mirroring the "exec" command's --allow-jit. (authored by jingham, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D54056?vs=172454&id=172465#toc Repository: rL LLVM https://reviews.llvm.org/D54056 Files: lldb/trunk/include/lldb/API/SBExpressionOptions.h lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/main.c lldb/trunk/scripts/interface/SBExpressionOptions.i lldb/trunk/source/API/SBExpressionOptions.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile === --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/Makefile @@ -0,0 +1,6 @@ +LEVEL = ../../make + +C_SOURCES := main.c +CFLAGS_EXTRAS += -std=c99 + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py === --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestSampleTest.py @@ -0,0 +1,94 @@ +""" +Test that --allow-jit=false does disallow JITting: +""" + +from __future__ import print_function + + +import os +import time +import re +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * + +class TestAllowJIT(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +# If your test case doesn't stress debug info, the +# set this to true. That way it won't be run once for +# each debug info format. +NO_DEBUG_INFO_TESTCASE = True + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test_allow_jit_expr_command(self): +"""Test the --allow-jit command line flag""" +self.build() +self.main_source_file = lldb.SBFileSpec("main.c") +self.expr_cmd_test() + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test_allow_jit_options(self): +"""Test the SetAllowJIT SBExpressionOption setting""" +self.build() +self.main_source_file = lldb.SBFileSpec("main.c") +self.expr_options_test() + + + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +def expr_cmd_test(self): +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", self.main_source_file) + +frame = thread.GetFrameAtIndex(0) + +# First make sure we can call the function with +interp = self.dbg.GetCommandInterpreter() +self.expect("expr --allow-jit 1 -- call_me(10)", +substrs = ["(int) $", "= 18"]) +# Now make sure it fails with the "can't IR interpret message" if allow-jit is false: +self.expect("expr --allow-jit 0 -- call_me(10)", +error=True, +substrs = ["Can't run the expression locally"]) + +def expr_options_test(self): +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", self.main_source_file) + +frame = thread.GetFrameAtIndex(0) + +# First make sure we can call the function with the default option set. +options = lldb.SBExpressionOptions() +# Check that the default is to allow JIT: +self.assertEqual(options.GetAllowJIT(), True, "Default is true") + +# Now use the options: +result = frame.EvaluateExpression("call_me(10)", options) +self.assertTrue(result.GetError().Success(), "expression succeeded") +self.assertEqual(result.GetValueAsSigned(), 18, "got the right value.") + +# Now disallow JIT and make sure it fails: +options.SetAllowJIT(False) +# Check that we got the right value: +self.assertEqual(options.GetAllowJIT(), False, "Got False after setting to False") + +# Again use it and ensure we fail: +result = frame.EvaluateExpression("call_me(10)", options) +self.assertTrue(result.GetError().Fail(), "expression failed with no JIT") +self.assertTrue("Can't run the expression locally" in result.GetError().GetCString(), "Got right error") + +# Finally set the allow JIT value back to tr
[Lldb-commits] [PATCH] D54053: [NativePDB] Add the ability to create clang record decls from mangled names.
zturner added a comment. In https://reviews.llvm.org/D54053#1286272, @lemo wrote: > nice! AFAIU this is just the "default" access of the class. I should probably investigate why it's needed in the first place, since it can be deduced from the tag type. https://reviews.llvm.org/D54053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346057 - Make sure to have lit load the configured site config first.
Author: zturner Date: Fri Nov 2 17:06:37 2018 New Revision: 346057 URL: http://llvm.org/viewvc/llvm-project?rev=346057&view=rev Log: Make sure to have lit load the configured site config first. For the lldb unit test suite, we forgot to add the mapping from site config to main config, so when it found the main config in the source tree, it wasn't going and loading the configured version in the build tree first, so the required properties weren't getting set up properly. Modified: lldb/trunk/lit/CMakeLists.txt Modified: lldb/trunk/lit/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=346057&r1=346056&r2=346057&view=diff == --- lldb/trunk/lit/CMakeLists.txt (original) +++ lldb/trunk/lit/CMakeLists.txt Fri Nov 2 17:06:37 2018 @@ -57,7 +57,9 @@ configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in - ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py) + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346058 - Fix some windows-specific fallout from the FileSpec change.
Author: zturner Date: Fri Nov 2 17:07:03 2018 New Revision: 346058 URL: http://llvm.org/viewvc/llvm-project?rev=346058&view=rev Log: Fix some windows-specific fallout from the FileSpec change. Modified: lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Modified: lldb/trunk/source/Host/windows/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=346058&r1=346057&r2=346058&view=diff == --- lldb/trunk/source/Host/windows/Host.cpp (original) +++ lldb/trunk/source/Host/windows/Host.cpp Fri Nov 2 17:07:03 2018 @@ -37,8 +37,9 @@ namespace { bool GetTripleForProcess(const FileSpec &executable, llvm::Triple &triple) { // Open the PE File as a binary file, and parse just enough information to // determine the machine type. - File imageBinary(executable.GetPath().c_str(), File::eOpenOptionRead, - lldb::eFilePermissionsUserRead); + File imageBinary; + FileSystem::Instance().Open(imageBinary, executable, File::eOpenOptionRead, + lldb::eFilePermissionsUserRead); imageBinary.SeekFromStart(0x3c); int32_t peOffset = 0; uint32_t peHead = 0; Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=346058&r1=346057&r2=346058&view=diff == --- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original) +++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Fri Nov 2 17:07:03 2018 @@ -147,7 +147,7 @@ protected: TEST_F(SymbolFilePDBTests, TestAbilitiesForPDB) { // Test that when we have PDB debug info, SymbolFilePDB is used. - FileSpec fspec(m_pdb_test_exe.c_str(), false); + FileSpec fspec(m_pdb_test_exe); ArchSpec aspec("i686-pc-windows"); lldb::ModuleSP module = std::make_shared(fspec, aspec); @@ -165,7 +165,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy // Test that attempting to call ResolveSymbolContext with only a basename // finds all full paths // with the same basename - FileSpec fspec(m_pdb_test_exe.c_str(), false); + FileSpec fspec(m_pdb_test_exe); ArchSpec aspec("i686-pc-windows"); lldb::ModuleSP module = std::make_shared(fspec, aspec); @@ -173,7 +173,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy EXPECT_NE(nullptr, plugin); SymbolFile *symfile = plugin->GetSymbolFile(); - FileSpec header_spec("test-pdb.cpp", false); + FileSpec header_spec("test-pdb.cpp"); SymbolContextList sc_list; uint32_t result_count = symfile->ResolveSymbolContext( header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list); @@ -185,7 +185,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy // Test that attempting to call ResolveSymbolContext with a full path only // finds the one source // file that matches the full path. - FileSpec fspec(m_pdb_test_exe.c_str(), false); + FileSpec fspec(m_pdb_test_exe); ArchSpec aspec("i686-pc-windows"); lldb::ModuleSP module = std::make_shared(fspec, aspec); @@ -194,8 +194,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSy SymbolFile *symfile = plugin->GetSymbolFile(); FileSpec header_spec( - R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec", - false); + R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec"); SymbolContextList sc_list; uint32_t result_count = symfile->ResolveSymbolContext( header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list); @@ -209,7 +208,7 @@ TEST_F(SymbolFilePDBTests, TestLookupOfH // compiled, but only contributes to the combined code of other source files), // a SymbolContext is returned // for each compiland which has line contributions from the requested header. - FileSpec fspec(m_pdb_test_exe.c_str(), false); + FileSpec fspec(m_pdb_test_exe); ArchSpec aspec("i686-pc-windows"); lldb::ModuleSP module = std::make_shared(fspec, aspec); @@ -217,10 +216,10 @@ TEST_F(SymbolFilePDBTests, TestLookupOfH EXPECT_NE(nullptr, plugin); SymbolFile *symfile = plugin->GetSymbolFile(); - FileSpec header_specs[] = {FileSpec("test-pdb.h", false), - FileSpec("test-pdb-nested.h", false)}; - FileSpec main_cpp_spec("test-pdb.cpp", false); - FileSpec alt_cpp_spec("test-pdb-alt.cpp", false); + FileSpec header_specs[] = {FileSpec("test-pdb.h"), + FileSpec("test-pdb-nested.h")}; + FileSpec main_cpp_spec("test-pdb.cpp"); + FileSpec alt_cpp_spec("test-pdb-alt.cpp"); for (const auto &hspec : header_specs) { SymbolContextList sc_list; uint32_t result_count = symfile->ResolveSymbolContext( @@ -237,7 +236,7 @@ TEST_F(SymbolFilePDBTests, TestLookupOfH // compiled, but only contributes to the combin
[Lldb-commits] [PATCH] D54059: Remove Java debugger plugin
teemperor added a comment. Minor detail: The revision title only mentions Java, but this revision removes both Go and Java. Did anyone actually went through with Jim's proposal and posted this proposal to some Go mailing list or so? https://reviews.llvm.org/D54059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
aleksandr.urakov added a comment. Thanks for catching that! Unfortunately, I have no access to MacOS, can you provide some more info about failure, please? Repository: rLLDB LLDB https://reviews.llvm.org/D53368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
davide added a comment. In https://reviews.llvm.org/D53368#1286361, @aleksandr.urakov wrote: > Thanks for catching that! Unfortunately, I have no access to MacOS, can you > provide some more info about failure, please? Unfortunately the bot logs are gone. When I originally looked at them they weren't particularly informative, so I'm afraid the only way would be that of trying to reproduce this thing on a real machine. Repository: rLLDB LLDB https://reviews.llvm.org/D53368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
aleksandr.urakov added a comment. I'm not sure, but have an assumption. Here is the first green build of the green-dragon-24: http://green.lab.llvm.org/green/job/lldb-cmake/12090/ It became green after three changes, one of them is your revert of my commit, while another is Zachary's "Fix the lit test suite". I think that it's Zachary's commit fixed the build, not the revert. Moreover, my commit is Windows specific, I can't figure out, how it can break the MacOS build... So may be we will recommit it back? If it will still fail, then we could take failure logs and revert it back again. Repository: rLLDB LLDB https://reviews.llvm.org/D53368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits