[Lldb-commits] [lldb] r250599 - Teach an old pony a few new tricks.
Author: enrico Date: Fri Oct 16 20:05:50 2015 New Revision: 250599 URL: http://llvm.org/viewvc/llvm-project?rev=250599&view=rev Log: Teach an old pony a few new tricks. ValueObjectPrinter can now mask out pointer values during a printout; also, it supports helper functions to print declarations in different formats if needed Practically speaking however, this change is NFC as nothing yet uses it in the codebase Modified: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Modified: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h?rev=250599&r1=250598&r2=250599&view=diff == --- lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h (original) +++ lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h Fri Oct 16 20:05:50 2015 @@ -22,6 +22,8 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/TypeSummary.h" +#include + namespace lldb_private { struct DumpValueObjectOptions @@ -54,6 +56,11 @@ struct DumpValueObjectOptions ValueObject *valobj, const std::string& summary); }; + +typedef std::function DeclPrintingHelper; uint32_t m_max_depth = UINT32_MAX; lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues; @@ -63,6 +70,7 @@ struct DumpValueObjectOptions std::string m_root_valobj_name; lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown; PointerDepth m_max_ptr_depth; +DeclPrintingHelper m_decl_printing_helper; bool m_use_synthetic : 1; bool m_scope_already_checked : 1; bool m_flat_output : 1; @@ -76,11 +84,13 @@ struct DumpValueObjectOptions bool m_run_validator : 1; bool m_use_type_display_name : 1; bool m_allow_oneliner_mode : 1; +bool m_hide_pointer_value : 1; DumpValueObjectOptions() : m_summary_sp(), m_root_valobj_name(), m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default,0}), +m_decl_printing_helper(), m_use_synthetic(true), m_scope_already_checked(false), m_flat_output(false), @@ -93,7 +103,8 @@ struct DumpValueObjectOptions m_hide_value(false), m_run_validator(false), m_use_type_display_name(true), -m_allow_oneliner_mode(true) +m_allow_oneliner_mode(true), +m_hide_pointer_value(false) {} static const DumpValueObjectOptions @@ -123,6 +134,13 @@ struct DumpValueObjectOptions } DumpValueObjectOptions& +SetDeclPrintingHelper(DeclPrintingHelper helper) +{ +m_decl_printing_helper = helper; +return *this; +} + +DumpValueObjectOptions& SetShowTypes(bool show = false) { m_show_types = show; @@ -254,6 +272,13 @@ struct DumpValueObjectOptions } DumpValueObjectOptions& +SetHidePointerValue (bool hide = false) +{ +m_hide_pointer_value = hide; +return *this; +} + +DumpValueObjectOptions& SetVariableFormatDisplayLanguage (lldb::LanguageType lang = lldb::eLanguageTypeUnknown) { m_varformat_language = lang; @@ -354,11 +379,8 @@ protected: bool PrintLocationIfNeeded (); -bool -PrintTypeIfNeeded (); - -bool -PrintNameIfNeeded (bool show_type); +void +PrintDecl (); bool CheckScopeIfNeeded (); Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=250599&r1=250598&r2=250599&view=diff == --- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original) +++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Fri Oct 16 20:05:50 2015 @@ -99,9 +99,7 @@ ValueObjectPrinter::PrintValueObject () PrintLocationIfNeeded(); m_stream->Indent(); -bool show_type = PrintTypeIfNeeded(); - -PrintNameIfNeeded(show_type); +PrintDecl(); } bool value_printed = false; @@ -253,8 +251,8 @@ ValueObjectPrinter::PrintLocationIfNeede return false; } -bool -ValueObjectPrinter::PrintTypeIfNeeded () +void +ValueObjectPrinter::PrintDecl () { bool show_type = true; // if we are at the root-level and been asked to hide the root's type, then hide it @@ -264,44 +262,89 @@ ValueObjectPrinter::PrintTypeIfNeeded () // otherwise decide according to the usual rules (asked to show types - always at the root level) show_type = options.m_show_types || (m_curr_depth == 0 && !options.m_flat_output); +StreamString typeName; + +// always show the type at the root level if it is invalid if (show_ty
[Lldb-commits] [PATCH] D13840: [LLDB] Fix Clang-tidy modernize-use-override warnings in some files in source/Plugins; other minor fixes.
Eugene.Zelenko created this revision. Eugene.Zelenko added reviewers: brucem, labath, clayborg. Eugene.Zelenko added a subscriber: lldb-commits. Eugene.Zelenko set the repository for this revision to rL LLVM. I checked this patch on my own build on RHEL 6. Repository: rL LLVM http://reviews.llvm.org/D13840 Files: source/Plugins/Process/elf-core/ProcessElfCore.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h source/Plugins/Process/elf-core/ThreadElfCore.h source/Plugins/Process/mach-core/ProcessMachCore.h source/Plugins/Process/mach-core/ThreadMachCore.h source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.h source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h source/Plugins/SymbolVendor/ELF/SymbolVendorELF.h Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h === --- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -1,4 +1,4 @@ -//===-- PythonDataObjects.h*- C++ -*-===// +//===-- PythonDataObjects.h--*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,7 +12,6 @@ // C Includes // C++ Includes - // Other libraries and framework includes // Project includes #include "lldb/lldb-defines.h" @@ -22,6 +21,7 @@ #include "lldb/Interpreter/OptionValue.h" namespace lldb_private { + class PythonString; class PythonList; class PythonDictionary; @@ -29,7 +29,7 @@ class StructuredPythonObject : public StructuredData::Generic { - public: +public: StructuredPythonObject() : StructuredData::Generic() { @@ -41,7 +41,7 @@ Py_XINCREF(GetValue()); } -virtual ~StructuredPythonObject() +~StructuredPythonObject() override { if (Py_IsInitialized()) Py_XDECREF(GetValue()); @@ -56,7 +56,7 @@ void Dump(Stream &s) const override; - private: +private: DISALLOW_COPY_AND_ASSIGN(StructuredPythonObject); }; @@ -104,7 +104,10 @@ Reset(rhs); } -virtual ~PythonObject() { Reset(); } +virtual ~PythonObject() +{ +Reset(); +} void Reset() @@ -304,6 +307,7 @@ StructuredData::DictionarySP CreateStructuredDictionary() const; }; + } // namespace lldb_private -#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H +#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -7,7 +7,6 @@ // //===--===// - #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H @@ -17,6 +16,10 @@ #else +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "PythonDataObjects.h" #include "lldb/Core/IOHandler.h" @@ -70,12 +73,19 @@ const lldb::ProcessSP& process_sp); typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor); + typedef void* (*SWIGPythonGetChildAtIndex)(void *implementor, uint32_t idx); + typedef int (*SWIGPythonGetIndexOfChildWithName)(void *implementor, const char* child_name); + typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data); + typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data); + typedef bool(*SWIGPythonUpdateSynthProviderInstance)(void* data); + typedef bool(*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data); + typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor); typedef bool(*SWIG
Re: [Lldb-commits] [PATCH] D13830: [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in source/Plugins/Process/Utility; other minor fixes.
This revision was automatically updated to reflect the committed changes. Closed by commit rL250593: [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in… (authored by eugenezelenko). Changed prior to commit: http://reviews.llvm.org/D13830?vs=37634&id=37662#toc Repository: rL LLVM http://reviews.llvm.org/D13830 Files: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDummy.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextHistory.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextMemory.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h === --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h @@ -1,15 +1,19 @@ -//===-- RegisterContextPOSIX_powerpc.h ---*- C++ -*-===// +//===-- RegisterContextPOSIX_powerpc.h --*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===--===// -#ifndef liblldb_RegisterContextPOSIX_powerpc_H_ -#define liblldb_RegisterContextPOSIX_powerpc_H_ +#ifndef liblldb_RegisterContextPOSIX_powerpc_h_ +#define liblldb_RegisterContextPOSIX_powerpc_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/Core/Log.h" #include "lldb/Target/RegisterContext.h" #include "RegisterInfoInterface.h" @@ -149,16 +153,16 @@ uint32_t concrete_frame_idx, lldb_private::RegisterInfoInterface *register_info); -~RegisterContextPOSIX_powerpc(); +~RegisterContextPOSIX_powerpc() override; void Invalidate(); void -InvalidateAllRegisters(); +InvalidateAllRegisters() override; size_t -GetRegisterCount(); +GetRegisterCount() override; virtual size_t GetGPRSize(); @@ -170,19 +174,19 @@ GetRegisterOffset(unsigned reg); const lldb_private::RegisterInfo * -GetRegisterInfoAtIndex(size_t reg); +GetRegisterInfoAtIndex(size_t reg) override; size_t -GetRegisterSetCount(); +GetRegisterSetCount() override; const lldb_private::RegisterSet * -GetRegisterSet(size_t set); +GetRegisterSet(size_t set) override; const char * GetRegisterName(unsigned reg); uint32_t -ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num); +ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override; protected: uint64_t m_gpr_powerpc[k_num_gpr_registers_powerpc]; // general purpose registers. @@ -216,4 +220,4 @@ virtual bool WriteVMX() = 0; }; -#endif // #ifndef liblldb_RegisterContextPOSIX_powerpc_H_ +#endif // liblldb_RegisterContextPOSIX_powerpc_h_ Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h === --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h @@ -1,15 +1,19 @@ -//===-- RegisterContextPOSIX_arm.h *- C++ -*-===// +//===-- RegisterContextPOSIX_arm.h --*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===--===// -#ifndef liblldb_RegisterContextPOSIX_arm_H_ -#define liblldb_RegisterContextPOSIX_arm_H_ +#ifndef liblldb_RegisterContextPOSIX_arm_h_ +#define liblldb_Register
[Lldb-commits] [lldb] r250593 - [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in source/Plugins/Process/Utility; other minor fixes.
Author: eugenezelenko Date: Fri Oct 16 19:19:57 2015 New Revision: 250593 URL: http://llvm.org/viewvc/llvm-project?rev=250593&view=rev Log: [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in source/Plugins/Process/Utility; other minor fixes. Differential Revision: http://reviews.llvm.org/D13830 Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextDummy.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextHistory.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextMemory.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h?rev=250593&r1=250592&r2=250593&view=diff == --- lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h Fri Oct 16 19:19:57 2015 @@ -10,6 +10,10 @@ #ifndef liblldb_HistoryThread_h_ #define liblldb_HistoryThread_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Host/Mutex.h" #include "lldb/Core/Broadcaster.h" @@ -37,52 +41,55 @@ class HistoryThread : public lldb_privat public: HistoryThread (lldb_private::Process &process, lldb::tid_t tid, std::vector pcs, uint32_t stop_id, bool stop_id_is_valid); -virtual ~HistoryThread (); +~HistoryThread() override; -virtual lldb::RegisterContextSP -GetRegisterContext (); +lldb::RegisterContextSP +GetRegisterContext() override; -virtual lldb::RegisterContextSP -CreateRegisterContextForFrame (StackFrame *frame); +lldb::RegisterContextSP +CreateRegisterContextForFrame(StackFrame *frame) override; -virtual void -RefreshStateAfterStop() { } +void +RefreshStateAfterStop() override { } bool -CalculateStopInfo () { return false; } +CalculateStopInfo() override +{ +return false; +} void -SetExtendedBacktraceToken (uint64_t token) +SetExtendedBacktraceToken(uint64_t token) override { m_extended_unwind_token = token; } uint64_t -GetExtendedBacktraceToken () +GetExtendedBacktraceToken() override { return m_extended_unwind_token; } const char * -GetQueueName () +GetQueueName() override { return m_queue_name.c_str(); } void -SetQueueName (const char *name) +SetQueueName(const char *name) override { m_queue_name = name; } lldb::queue_id_t -GetQueueID () +GetQueueID() override { return m_queue_id; } void -SetQueueID (lldb::queue_id_t queue) +SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; } @@ -94,7 +101,7 @@ public: } uint32_t -GetExtendedBacktraceOriginatingIndexID (); +GetExtendedBacktraceOriginatingIndexID() override; void SetThreadName (const char *name) @@ -102,14 +109,14 @@ public: m_thread_name = name; } -virtual const char * -GetName () +const char * +GetName() override { return m_thread_name.c_str(); } -virtual void -SetName(const char *name) +void +SetName(const char *name) override { m_thread_name = name; } @@ -133,4 +140,4 @@ protected: } // namespace lldb_private -#endif // liblldb_HistoryThread_h_ +#endif // liblldb_HistoryThread_h_ Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h?rev=250593&r1=250592&r2=250593&view=diff == --- lldb/trunk/source/Plugins/Process/Utility/H
[Lldb-commits] [lldb] r250581 - Handle eFormatVectorOfFloat16
Author: enrico Date: Fri Oct 16 18:42:04 2015 New Revision: 250581 URL: http://llvm.org/viewvc/llvm-project?rev=250581&view=rev Log: Handle eFormatVectorOfFloat16 Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=250581&r1=250580&r2=250581&view=diff == --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Oct 16 18:42:04 2015 @@ -1519,6 +1519,7 @@ protected: case eFormatVectorOfUInt32: case eFormatVectorOfSInt64: case eFormatVectorOfUInt64: +case eFormatVectorOfFloat16: case eFormatVectorOfFloat32: case eFormatVectorOfFloat64: case eFormatVectorOfUInt128: ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13836: Fix write-after-close of file descriptor in ScriptInterpreterPython
zturner created this revision. zturner added reviewers: clayborg, granata.enrico. zturner added a subscriber: lldb-commits. When we acquire the GIL with `Locker`, we save off the current stdio handles, redirect them, and when we release the GIL we put the old handles back. This triggers a potential write-after-close, as follows: In `ScriptInterpreterPython::ExecuteOneLine`, we set up a pipe, lock the gil, kick off a thread to do some work, then close the write end of the pipe. However, the write end of the pipe in this case is the same thing that we set Python's stdout and stderr handles to, and we haven't yet restored them until `ExecuteOneLine` ends, due to the scope in which the RAII object is declared. This has always been fine, but only as a coincidence. In Python 3 it seems that when you set `stderr` to a new file, it writes to the *original* file first (probably to flush it). In the case of `ExecuteOneLine`, that file descriptor has been intentionally closed by caller as a means to break the pipe and join the other thread it was communicating with, so we get an error. The fix here is simple: Just acquire the GIL in a tighter scope so that stdin, stdout, and stderr are reset to their original values before trying to join the read thread. It doesn't *seem* like we need to hold the GIL any longer than this since no Python calls are happening outside of the new smaller scope I've introduced, but let me know if you can think of anything wrong with this. http://reviews.llvm.org/D13836 Files: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -570,9 +570,9 @@ bool GetEmbeddedInterpreterModuleObjects (); -PythonObject m_saved_stdin; -PythonObject m_saved_stdout; -PythonObject m_saved_stderr; +PythonFile m_saved_stdin; +PythonFile m_saved_stdout; +PythonFile m_saved_stderr; PythonObject m_main_module; PythonObject m_lldb_module; PythonDictionary m_session_dict; Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -612,7 +612,7 @@ // Flush the file before giving it to python to avoid interleaved output. in_file.Flush(); -m_saved_stdin = sys_module_dict.GetItemForKey(PythonString("stdin")); +m_saved_stdin = sys_module_dict.GetItemForKey(PythonString("stdin")).AsType(); // This call can deadlock your process if the file is locked PythonFile new_file(in_file, "r"); sys_module_dict.SetItemForKey (PythonString("stdin"), new_file); @@ -626,7 +626,7 @@ // Flush the file before giving it to python to avoid interleaved output. out_file.Flush(); -m_saved_stdout = sys_module_dict.GetItemForKey(PythonString("stdout")); +m_saved_stdout = sys_module_dict.GetItemForKey(PythonString("stdout")).AsType(); PythonFile new_file(out_file, "w"); sys_module_dict.SetItemForKey (PythonString("stdout"), new_file); @@ -641,7 +641,7 @@ // Flush the file before giving it to python to avoid interleaved output. err_file.Flush(); -m_saved_stderr = sys_module_dict.GetItemForKey(PythonString("stderr")); +m_saved_stderr = sys_module_dict.GetItemForKey(PythonString("stderr")).AsType(); PythonFile new_file(err_file, "w"); sys_module_dict.SetItemForKey (PythonString("stderr"), new_file); @@ -812,48 +812,49 @@ FILE *in_file = input_file_sp->GetFile().GetStream(); FILE *out_file = output_file_sp->GetFile().GetStream(); FILE *err_file = error_file_sp->GetFile().GetStream(); -Locker locker(this, - ScriptInterpreterPython::Locker::AcquireLock | - ScriptInterpreterPython::Locker::InitSession | - (options.GetSetLLDBGlobals() ? ScriptInterpreterPython::Locker::InitGlobals : 0) | - ((result && result->GetInteractive()) ? 0: Locker::NoSTDIN), - ScriptInterpreterPython::Locker::FreeAcquiredLock | - ScriptInterpreterPython::Locker::TearDownSession, - in_file, - out_file, -
[Lldb-commits] [lldb] r250580 - Split getting the key from a window from the code that handles the key.
Author: gclayton Date: Fri Oct 16 18:34:40 2015 New Revision: 250580 URL: http://llvm.org/viewvc/llvm-project?rev=250580&view=rev Log: Split getting the key from a window from the code that handles the key. Modified: lldb/trunk/test/lldbcurses.py Modified: lldb/trunk/test/lldbcurses.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbcurses.py?rev=250580&r1=250579&r2=250580&view=diff == --- lldb/trunk/test/lldbcurses.py (original) +++ lldb/trunk/test/lldbcurses.py Fri Oct 16 18:34:40 2015 @@ -402,6 +402,22 @@ class Window(object): def quit_action(self): raise QuitException +def get_key(self, timeout_msec=-1): +self.timeout(timeout_msec) +done = False +c = self.window.getch() +if c == 27: +self.timeout(0) +escape_key = 0 +while True: +escape_key = self.window.getch() +if escape_key == -1: +break +else: +c = c << 8 | escape_key +self.timeout(timeout_msec) +return c + def key_event_loop(self, timeout_msec=-1, n=sys.maxint): '''Run an event loop to receive key presses and pass them along to the responder chain. @@ -412,20 +428,9 @@ class Window(object): for timeout_msec milliseconds. n is the number of times to go through the event loop before exiting''' -self.timeout(timeout_msec) done = False while not done and n > 0: -c = self.window.getch() -if c == 27: -self.timeout(0) -escape_key = 0 -while True: -escape_key = self.window.getch() -if escape_key == -1: -break -else: -c = c << 8 | escape_key -self.timeout(timeout_msec) +c = self.get_key(timeoue_msec) if c != -1: try: self.handle_key(c) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r250576 - Skip hanging watchpoint test on Windows (rather than just xfailing).
Author: amccarth Date: Fri Oct 16 18:19:22 2015 New Revision: 250576 URL: http://llvm.org/viewvc/llvm-project?rev=250576&view=rev Log: Skip hanging watchpoint test on Windows (rather than just xfailing). Modified: lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py Modified: lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py?rev=250576&r1=250575&r2=250576&view=diff == --- lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py (original) +++ lldb/trunk/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py Fri Oct 16 18:19:22 2015 @@ -26,7 +26,7 @@ class WatchpointConditionAPITestCase(Tes self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name} @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported -@expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows +@skipIfWindows # Watchpoints not supported on Windows, and this test hangs def test_watchpoint_cond_api(self): """Test watchpoint condition API.""" self.build(dictionary=self.d) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r250567 - Move TypeSummaryImpl over to LLVM-style RTTI for subclassing
Author: enrico Date: Fri Oct 16 17:51:56 2015 New Revision: 250567 URL: http://llvm.org/viewvc/llvm-project?rev=250567&view=rev Log: Move TypeSummaryImpl over to LLVM-style RTTI for subclassing Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h lldb/trunk/source/API/SBTypeSummary.cpp lldb/trunk/source/DataFormatters/TypeSummary.cpp Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSummary.h?rev=250567&r1=250566&r2=250567&view=diff == --- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h (original) +++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h Fri Oct 16 17:51:56 2015 @@ -61,6 +61,19 @@ namespace lldb_private { class TypeSummaryImpl { public: +enum class Kind +{ +eSummaryString, +eScript, +eCallback +}; + +Kind +GetKind () const +{ +return m_kind; +} + class Flags { public: @@ -260,16 +273,6 @@ namespace lldb_private { uint32_t m_flags; }; -typedef enum Type -{ -eTypeUnknown, -eTypeString, -eTypeScript, -eTypeCallback -} Type; - -TypeSummaryImpl (const TypeSummaryImpl::Flags& flags); - bool Cascades () const { @@ -397,12 +400,6 @@ namespace lldb_private { virtual std::string GetDescription () = 0; -virtual bool -IsScripted () = 0; - -virtual Type -GetType () = 0; - uint32_t& GetRevision () { @@ -417,7 +414,11 @@ namespace lldb_private { uint32_t m_my_revision; Flags m_flags; +TypeSummaryImpl (Kind kind, + const TypeSummaryImpl::Flags& flags); + private: +Kind m_kind; DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl); }; @@ -452,16 +453,9 @@ namespace lldb_private { std::string GetDescription() override; -bool -IsScripted() override -{ -return false; -} - -Type -GetType() override +static bool classof(const TypeSummaryImpl* S) { -return TypeSummaryImpl::eTypeString; +return S->GetKind() == Kind::eSummaryString; } private: @@ -523,16 +517,9 @@ namespace lldb_private { std::string GetDescription() override; -bool -IsScripted() override -{ -return false; -} - -Type -GetType() override +static bool classof(const TypeSummaryImpl* S) { -return TypeSummaryImpl::eTypeCallback; +return S->GetKind() == Kind::eCallback; } typedef std::shared_ptr SharedPointer; @@ -595,16 +582,9 @@ namespace lldb_private { std::string GetDescription() override; -bool -IsScripted() override -{ -return true; -} - -Type -GetType() override +static bool classof(const TypeSummaryImpl* S) { -return TypeSummaryImpl::eTypeScript; +return S->GetKind() == Kind::eScript; } typedef std::shared_ptr SharedPointer; Modified: lldb/trunk/source/API/SBTypeSummary.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=250567&r1=250566&r2=250567&view=diff == --- lldb/trunk/source/API/SBTypeSummary.cpp (original) +++ lldb/trunk/source/API/SBTypeSummary.cpp Fri Oct 16 17:51:56 2015 @@ -12,6 +12,8 @@ #include "lldb/API/SBValue.h" #include "lldb/DataFormatters/DataVisualization.h" +#include "llvm/Support/Casting.h" + using namespace lldb; using namespace lldb_private; @@ -164,9 +166,8 @@ SBTypeSummary::IsFunctionCode() { if (!IsValid()) return false; -if (m_opaque_sp->IsScripted()) +if (ScriptSummaryFormat* script_summary_ptr = llvm::dyn_cast(m_opaque_sp.get())) { -ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get(); const char* ftext = script_summary_ptr->GetPythonScript(); return (ftext && *ftext != 0); } @@ -178,9 +179,8 @@ SBTypeSummary::IsFunctionName() { if (!IsValid()) return false; -if (m_opaque_sp->IsScripted()) +if (ScriptSummaryFormat* script_summary_ptr = llvm::dyn_cast(m_opaque_sp.get())) { -ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get(); const char* ftext = scri
[Lldb-commits] New public staging silent buildbot
Hello everyone, I just added public staging buildbot and every owner of build machine is welcome to use it. Its' copy of our current LLVM buildbot, but it does not send any notifications. The web page is here: http://lab.llvm.org:8014 Any builder could be easy switched to staging buildbot by simple change in local slave configuration: use lab.llvm.org:9994 instead of lab.llvm.org:9990. After this change the slave need to be restarted. I suggest to test new builders on staging builbot for few days first just to be sure everything is working properly. Thanks Galina ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13830: [LLDB] Fix Clang-tidy modernize-use-override warnings in some headers in source/Plugins/Process/Utility; other minor fixes.
Eugene.Zelenko created this revision. Eugene.Zelenko added reviewers: brucem, labath, clayborg. Eugene.Zelenko added a subscriber: lldb-commits. Eugene.Zelenko set the repository for this revision to rL LLVM. Herald added a subscriber: emaste. I checked this patch on my own build on RHEL 6. Repository: rL LLVM http://reviews.llvm.org/D13830 Files: source/Plugins/Process/Utility/HistoryThread.h source/Plugins/Process/Utility/HistoryUnwind.h source/Plugins/Process/Utility/RegisterContextDarwin_arm.h source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h source/Plugins/Process/Utility/RegisterContextDarwin_i386.h source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h source/Plugins/Process/Utility/RegisterContextDummy.h source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h source/Plugins/Process/Utility/RegisterContextHistory.h source/Plugins/Process/Utility/RegisterContextLLDB.h source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h source/Plugins/Process/Utility/RegisterContextMemory.h source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h Index: source/Plugins/Process/Utility/RegisterContextLLDB.h === --- source/Plugins/Process/Utility/RegisterContextLLDB.h +++ source/Plugins/Process/Utility/RegisterContextLLDB.h @@ -10,8 +10,12 @@ #ifndef lldb_RegisterContextLLDB_h_ #define lldb_RegisterContextLLDB_h_ +// C Includes +// C++ Includes #include +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Symbol/UnwindPlan.h" @@ -33,43 +37,40 @@ lldb_private::SymbolContext& sym_ctx, uint32_t frame_number, lldb_private::UnwindLLDB& unwind_lldb); -/// -// pure virtual functions from the base class that we must implement -/// +~RegisterContextLLDB() override = default; -virtual -~RegisterContextLLDB () { } +void +InvalidateAllRegisters() override; -virtual void -InvalidateAllRegisters (); +size_t +GetRegisterCount() override; -virtual size_t -GetRegisterCount (); +const lldb_private::RegisterInfo * +GetRegisterInfoAtIndex(size_t reg) override; -virtual const lldb_private::RegisterInfo * -GetRegisterInfoAtIndex (size_t reg); +size_t +GetRegisterSetCount() override; -virtual size_t -GetRegisterSetCount (); +const lldb_private::RegisterSet * +GetRegisterSet(size_t reg_set) override; -virtual const lldb_private::RegisterSet * -GetRegisterSet (size_t reg_set); +bool +ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value) override; -virtual bool -ReadRegister (const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value); +bool +WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value) override; -virtual bool -WriteRegister (const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value); +bool +ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; -virtual bool -ReadAllRegisterValues (lldb::DataBufferSP &data_sp); +bool +WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; -virtual bool -WriteAllRegisterValues (const lldb::DataBufferSP &data_sp); +uint32_t +ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override; -virtual uint32_t -ConvertRegisterKindToRegisterNumber (lldb::RegisterKind kind, uint32_t num); - bool IsValid () const; @@ -99,7 +100,6 @@ // UnwindLLDB needs to pass around references to RegisterLocations friend class UnwindLLDB; - // Returns true if we have an unwind loop -- the same stack frame unwinding // multiple times. bool @@ -130,7 +130,6 @@ bool IsSkipFrame () const; - //-- /// Determines if a SymbolContext is a trap handler or not /// @@ -221,7 +220,6 @@ bool IsUnwindPlanValidForCurrentPC(lldb::UnwindPlanSP unwind_plan_sp, int &valid_pc_offset); - lldb_private::Thread& m_thread; /// @@ -269,4 +267,4 @@ } // namespace lldb_private -#endif // lldb_RegisterContextLLDB_h_ +#endif // lldb_RegisterContextLLDB_h_ Index: source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h === --- source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h +++ s
Re: [Lldb-commits] [PATCH] D13812: Increase default memory cache line size for android
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. I would rather you be able to ask the current platform for the default memory cache line size and have lldb_private::Process do this automatically on the first memory read if the process property wasn't manually set. So my inline comments will reflect this notion. Comment at: include/lldb/Target/Process.h:70-72 @@ -69,2 +69,5 @@ +lldb::OptionValueSP +GetMemoryCacheLineSizeOption (); + Args Remove Comment at: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp:148 @@ +147,3 @@ +lldb::ProcessSP process_sp = PlatformRemoteGDBServer::DebugProcess(launch_info, debugger, target, error); +AdjustProcessProperties(process_sp); +return process_sp; Remove the call to AdjustProcessProperties(...) and let the process call platform_sp->GetDefaultMemoryCacheLineSize() when it needs to. If the only this this PlatformAndroidRemoteGDBServer::DebugProcess() was doing was to allow calling AdjustProcessProperties() then remove this whole function. Comment at: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp:159 @@ +158,3 @@ +lldb::ProcessSP process_sp = PlatformRemoteGDBServer::Attach(attach_info, debugger, target, error); +AdjustProcessProperties(process_sp); +return process_sp; Remove the call to AdjustProcessProperties(...) and let the process call platform_sp->GetDefaultMemoryCacheLineSize() when it needs to. If the only this this PlatformAndroidRemoteGDBServer::Attach() was doing was to allow calling AdjustProcessProperties() then remove this whole function. Comment at: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp:163-174 @@ -139,1 +162,14 @@ + +void +PlatformAndroidRemoteGDBServer::AdjustProcessProperties(const lldb::ProcessSP &process_sp) +{ +if (! process_sp) +return; + +lldb::OptionValueSP value_sp = process_sp->GetMemoryCacheLineSizeOption(); + +if (value_sp && ! value_sp->OptionWasSet()) +value_sp->SetUInt64Value(g_android_default_cache_size); +} + void Change this to be: ``` uint32_t PlatformAndroidRemoteGDBServer:: GetDefaultMemoryCacheLineSize() { return g_android_default_cache_size; } ``` Add the following to Platform.h inside the lldb_private::Platform class definition: ``` virtual uint32_t GetDefaultMemoryCacheLineSize() { return 0; } ``` Comment at: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h:39-49 @@ -38,1 +38,13 @@ +lldb::ProcessSP +DebugProcess(ProcessLaunchInfo &launch_info, + Debugger &debugger, + Target *target, // Can be NULL, if NULL create a new target, else use existing one + Error &error) override; + +lldb::ProcessSP +Attach(ProcessAttachInfo &attach_info, + Debugger &debugger, + Target *target, // Can be NULL, if NULL create a new target, else use existing one + Error &error) override; + If the only this these fucntions were added for was to allow calling AdjustProcessProperties() then remove these. Comment at: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h:55-56 @@ -42,1 +54,4 @@ +void +AdjustProcessProperties(const lldb::ProcessSP &process_sp); + Change to be: ``` uint32_t GetDefaultMemoryCacheLineSize() override; ``` Comment at: source/Target/Process.cpp:183-189 @@ -182,1 +182,9 @@ +lldb::OptionValueSP +ProcessProperties::GetMemoryCacheLineSizeOption() +{ +const uint32_t idx = ePropertyMemCacheLineSize; +lldb_private::ExecutionContext exe_ctx(m_process); +return m_collection_sp->GetPropertyAtIndex(&exe_ctx, true, idx)->GetValue(); +} + Remove this and modify Process to fetch this information on attach if the process option wasn't set. This means you don't need to expose this OptionValueSP and you can do it all within the process by grabbing the platform from the target and then calling platform_sp->GetDefaultMemoryCacheLineSize(). The default platform implementation should return 0 and if zero is returned (meaning no preference), then continue using the current setting that process was using from the setting, else override the current value. http://reviews.llvm.org/D13812 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.
sivachandra updated this revision to Diff 37630. sivachandra added a comment. Address comments. http://reviews.llvm.org/D13778 Files: include/lldb/API/SBValue.h include/lldb/Core/ValueObject.h include/lldb/Core/ValueObjectCast.h include/lldb/Core/ValueObjectChild.h include/lldb/Core/ValueObjectConstResult.h include/lldb/Core/ValueObjectDynamicValue.h include/lldb/Core/ValueObjectMemory.h include/lldb/Core/ValueObjectRegister.h include/lldb/Core/ValueObjectSyntheticFilter.h include/lldb/Core/ValueObjectVariable.h include/lldb/DataFormatters/TypeSynthetic.h include/lldb/Interpreter/ScriptInterpreter.h scripts/Python/python-wrapper.swig scripts/interface/SBValue.i source/API/SBValue.cpp source/API/SystemInitializerFull.cpp source/Core/ValueObject.cpp 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/ValueObjectSyntheticFilter.cpp source/Core/ValueObjectVariable.cpp source/DataFormatters/TypeSynthetic.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -69,7 +69,7 @@ const char *session_dictionary_name, const lldb::ProcessSP& process_sp); -typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor); +typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor, uint32_t max); typedef void* (*SWIGPythonGetChildAtIndex)(void *implementor, uint32_t idx); typedef int (*SWIGPythonGetIndexOfChildWithName)(void *implementor, const char* child_name); typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data); @@ -196,7 +196,7 @@ StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, lldb_private::Error &error) override; -size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor) override; +size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor, uint32_t max) override; lldb::ValueObjectSP GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx) override; Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -2199,7 +2199,7 @@ } size_t -ScriptInterpreterPython::CalculateNumChildren(const StructuredData::ObjectSP &implementor_sp) +ScriptInterpreterPython::CalculateNumChildren(const StructuredData::ObjectSP &implementor_sp, uint32_t max) { if (!implementor_sp) return 0; @@ -2217,7 +2217,7 @@ { Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); -ret_val = g_swig_calc_children (implementor); +ret_val = g_swig_calc_children (implementor, max); } return ret_val; Index: source/DataFormatters/TypeSynthetic.cpp === --- source/DataFormatters/TypeSynthetic.cpp +++ source/DataFormatters/TypeSynthetic.cpp @@ -201,7 +201,15 @@ { if (!m_wrapper_sp || m_interpreter == NULL) return 0; -return m_interpreter->CalculateNumChildren(m_wrapper_sp); +return m_interpreter->CalculateNumChildren(m_wrapper_sp, UINT32_MAX); +} + +size_t +ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren (uint32_t max) +{ +if (!m_wrapper_sp || m_interpreter == NULL) +return 0; +return m_interpreter->CalculateNumChildren(m_wrapper_sp, max); } bool Index: source/Core/ValueObjectVariable.cpp === --- source/Core/ValueObjectVariable.cpp +++ source/Core/ValueObjectVariable.cpp @@ -91,15 +91,16 @@ } size_t -ValueObjectVariable::CalculateNumChildren() +ValueObjectVariable::CalculateNumChildren(uint32_t max) { CompilerType type(GetCompilerType()); if (!type.IsValid()) return 0; const bool omit_empty_base_classes = true; -return type.GetNumChildren(omit_empty_base_classes); +auto child_count = type.GetNumChildren(omit_empty_base_classes);
Re: [Lldb-commits] [PATCH] D13602: [LLDB] Fix Clang-tidy misc-use-override warnings in some files in include/lldb/Interpreter and Host; other minor fixes.
Eugene.Zelenko added a comment. Ping. Please review this patch, since these files is largest source of modernize-use-override warnings warnings in LLDB code. Repository: rL LLVM http://reviews.llvm.org/D13602 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13684: [LLDB] Fix Clang-tidy modernize-use-override warnings in source/Plugins/ABI; other minor fixes.
This revision was automatically updated to reflect the committed changes. Closed by commit rL250538: [LLDB] Fix Clang-tidy modernize-use-override warnings in source/Plugins/ABI… (authored by eugenezelenko). Changed prior to commit: http://reviews.llvm.org/D13684?vs=37206&id=37622#toc Repository: rL LLVM http://reviews.llvm.org/D13684 Files: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h Index: lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h === --- lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h +++ lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h @@ -20,7 +20,7 @@ class ABISysV_arm : public lldb_private::ABI { public: -~ABISysV_arm() { } +~ABISysV_arm() override = default; size_t GetRedZoneSize () const override; @@ -39,12 +39,6 @@ lldb_private::Error SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; -protected: -lldb::ValueObjectSP -GetReturnValueObjectImpl (lldb_private::Thread &thread, -lldb_private::CompilerType &ast_type) const override; - -public: bool CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan) override; @@ -88,6 +82,7 @@ //-- // Static Functions //-- + static void Initialize(); @@ -103,19 +98,24 @@ //-- // PluginInterface protocol //-- + lldb_private::ConstString GetPluginName() override; uint32_t GetPluginVersion() override; protected: +lldb::ValueObjectSP +GetReturnValueObjectImpl(lldb_private::Thread &thread, + lldb_private::CompilerType &ast_type) const override; + private: ABISysV_arm() : lldb_private::ABI() { // Call CreateInstance instead. } }; -#endif // liblldb_ABISysV_arm_h_ +#endif // liblldb_ABISysV_arm_h_ Index: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h === --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h @@ -22,41 +22,33 @@ public lldb_private::ABI { public: - -~ABIMacOSX_i386() { } +~ABIMacOSX_i386() override = default; -virtual size_t -GetRedZoneSize () const; +size_t +GetRedZoneSize() const override; -virtual bool -PrepareTrivialCall (lldb_private::Thread &thread, -lldb::addr_t sp, -lldb::addr_t func_addr, -lldb::addr_t return_addr, -llvm::ArrayRef args) const; - -virtual bool -GetArgumentValues (lldb_private::Thread &thread, - lldb_private::ValueList &values) const; +bool +PrepareTrivialCall(lldb_private::Thread &thread, + lldb::addr_t sp, + lldb::addr_t func_addr, + lldb::addr_t return_addr, + llvm::ArrayRef args) const override; -virtual lldb_private::Error -SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value); - -protected: -virtual lldb::ValueObjectSP -GetReturnValueObjectImpl (lldb_private::Thread &thread, -lldb_private::CompilerType &ast_type) const; - -public: +bool +GetArgumentValues(lldb_private::Thread &thread, + lldb_private::ValueList &values) const override; + +lldb_private::Error +SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; -virtual bool -CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan); +bool +CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override; -virtual bool -CreateDefaultUnwindPlan (lldb_private::UnwindPlan &unwind_plan); +bool +CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
[Lldb-commits] [lldb] r250538 - [LLDB] Fix Clang-tidy modernize-use-override warnings in source/Plugins/ABI; other minor fixes.
Author: eugenezelenko Date: Fri Oct 16 13:49:42 2015 New Revision: 250538 URL: http://llvm.org/viewvc/llvm-project?rev=250538&view=rev Log: [LLDB] Fix Clang-tidy modernize-use-override warnings in source/Plugins/ABI; other minor fixes. Differential Revision: http://reviews.llvm.org/D13684 Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h?rev=250538&r1=250537&r2=250538&view=diff == --- lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h Fri Oct 16 13:49:42 2015 @@ -20,42 +20,36 @@ class ABIMacOSX_arm : public lldb_private::ABI { public: -~ABIMacOSX_arm() { } +~ABIMacOSX_arm() override = default; -virtual size_t -GetRedZoneSize () const; +size_t +GetRedZoneSize() const override; -virtual bool -PrepareTrivialCall (lldb_private::Thread &thread, -lldb::addr_t sp, -lldb::addr_t func_addr, -lldb::addr_t returnAddress, -llvm::ArrayRef args) const; - -virtual bool -GetArgumentValues (lldb_private::Thread &thread, - lldb_private::ValueList &values) const; +bool +PrepareTrivialCall(lldb_private::Thread &thread, + lldb::addr_t sp, + lldb::addr_t func_addr, + lldb::addr_t returnAddress, + llvm::ArrayRef args) const override; -virtual lldb_private::Error -SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value); - -protected: -virtual lldb::ValueObjectSP -GetReturnValueObjectImpl (lldb_private::Thread &thread, -lldb_private::CompilerType &ast_type) const; +bool +GetArgumentValues(lldb_private::Thread &thread, + lldb_private::ValueList &values) const override; + +lldb_private::Error +SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override; -public: -virtual bool -CreateFunctionEntryUnwindPlan (lldb_private::UnwindPlan &unwind_plan); +bool +CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override; -virtual bool -CreateDefaultUnwindPlan (lldb_private::UnwindPlan &unwind_plan); +bool +CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override; -virtual bool -RegisterIsVolatile (const lldb_private::RegisterInfo *reg_info); +bool +RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override; -virtual bool -CallFrameAddressIsValid (lldb::addr_t cfa) +bool +CallFrameAddressIsValid(lldb::addr_t cfa) override { // Make sure the stack call frame addresses are are 4 byte aligned if (cfa & (4ull - 1ull)) @@ -65,8 +59,8 @@ public: return true; } -virtual bool -CodeAddressIsValid (lldb::addr_t pc) +bool +CodeAddressIsValid(lldb::addr_t pc) override { // Just make sure the address is a valid 32 bit address. Bit zero // might be set due to Thumb function calls, so don't enforce 2 byte @@ -74,20 +68,21 @@ public: return pc <= UINT32_MAX; } -virtual lldb::addr_t -FixCodeAddress (lldb::addr_t pc) +lldb::addr_t +FixCodeAddress(lldb::addr_t pc) override { // ARM uses bit zero to signify a code address is thumb, so we must // strip bit zero in any code addresses. return pc & ~(lldb::addr_t)1; } -virtual const lldb_private::RegisterInfo * -GetRegisterInfoArray (uint32_t &count); +const lldb_private::RegisterInfo * +GetRegisterInfoArray(uint32_t &count) override; //-- // Static Functions //-- + static void Initialize(); @@ -103,13 +98,18 @@ public: //---
[Lldb-commits] [PATCH] D13819: LLDBStandalone: Report nice errors on missing vars
artagnon created this revision. artagnon added reviewers: chaoren, brucem. artagnon added a subscriber: lldb-commits. http://reviews.llvm.org/D13819 Files: cmake/modules/LLDBStandalone.cmake Index: cmake/modules/LLDBStandalone.cmake === --- cmake/modules/LLDBStandalone.cmake +++ cmake/modules/LLDBStandalone.cmake @@ -23,22 +23,35 @@ else() get_filename_component(LLVM_MAIN_SRC_DIR ${LLDB_PATH_TO_LLVM_SOURCE} ABSOLUTE) + set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include") list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules") endif() endif() if (LLDB_PATH_TO_CLANG_SOURCE) get_filename_component(CLANG_MAIN_SRC_DIR ${LLDB_PATH_TO_CLANG_SOURCE} ABSOLUTE) + set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include") endif() list(APPEND CMAKE_MODULE_PATH "${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake") - get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD} - ABSOLUTE) + if (LLDB_PATH_TO_LLVM_BUILD) +get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD} + ABSOLUTE) + else() +message(FATAL_ERROR "Please set LLDB_PATH_TO_LLVM_BUILD to the root " +"directory of LLVM build or install site.") + endif() + + if (LLDB_PATH_TO_CLANG_BUILD) +get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD} + ABSOLUTE) + else() +message(FATAL_ERROR "Please set LLDB_PATH_TO_CLANG_BUILD to the root " +"directory of Clang build or install site.") + endif() - get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD} - ABSOLUTE) # These variables are used by add_llvm_library. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) @@ -67,11 +80,8 @@ set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") - set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include") set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR}) - set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include") - set(CMAKE_INCLUDE_CURRENT_DIR ON) include_directories("${PATH_TO_LLVM_BUILD}/include" "${LLVM_MAIN_INCLUDE_DIR}" Index: cmake/modules/LLDBStandalone.cmake === --- cmake/modules/LLDBStandalone.cmake +++ cmake/modules/LLDBStandalone.cmake @@ -23,22 +23,35 @@ else() get_filename_component(LLVM_MAIN_SRC_DIR ${LLDB_PATH_TO_LLVM_SOURCE} ABSOLUTE) + set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include") list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules") endif() endif() if (LLDB_PATH_TO_CLANG_SOURCE) get_filename_component(CLANG_MAIN_SRC_DIR ${LLDB_PATH_TO_CLANG_SOURCE} ABSOLUTE) + set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include") endif() list(APPEND CMAKE_MODULE_PATH "${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake") - get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD} - ABSOLUTE) + if (LLDB_PATH_TO_LLVM_BUILD) +get_filename_component(PATH_TO_LLVM_BUILD ${LLDB_PATH_TO_LLVM_BUILD} + ABSOLUTE) + else() +message(FATAL_ERROR "Please set LLDB_PATH_TO_LLVM_BUILD to the root " +"directory of LLVM build or install site.") + endif() + + if (LLDB_PATH_TO_CLANG_BUILD) +get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD} + ABSOLUTE) + else() +message(FATAL_ERROR "Please set LLDB_PATH_TO_CLANG_BUILD to the root " +"directory of Clang build or install site.") + endif() - get_filename_component(PATH_TO_CLANG_BUILD ${LLDB_PATH_TO_CLANG_BUILD} - ABSOLUTE) # These variables are used by add_llvm_library. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) @@ -67,11 +80,8 @@ set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") - set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include") set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR}) - set(CLANG_MAIN_INCLUDE_DIR "${CLANG_MAIN_SRC_DIR}/include") - set(CMAKE_INCLUDE_CURRENT_DIR ON) include_directories("${PATH_TO_LLVM_BUILD}/include" "${LLVM_MAIN_INCLUDE_DIR}" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)
granata.enrico added inline comments. Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835 @@ +834,3 @@ + +if (!MI_add_summary(miCategory, "char", MI_char_summary_provider, +lldb::eTypeOptionHideValue | lldb::eTypeOptionSkipPointers)) evgeny777 wrote: > granata.enrico wrote: > > Should you also cover "signed char" and "unsigned char" here? > Hmm. I thought that if regex is false, exact match will be done, won't it? If > yes than simple char type should be signed, right? I think the signedness of char depends on the implementation. Which means that "char" will cover one of them, but not the other. Which is why I was suggesting adding "char", "signed char" and "unsigned char". Just to cover all bases. Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835 @@ +834,3 @@ + +if (!MI_add_summary(miCategory, "char", MI_char_summary_provider, +lldb::eTypeOptionHideValue | lldb::eTypeOptionSkipPointers)) evgeny777 wrote: > granata.enrico wrote: > > evgeny777 wrote: > > > granata.enrico wrote: > > > > Should you also cover "signed char" and "unsigned char" here? > > > Hmm. I thought that if regex is false, exact match will be done, won't > > > it? If yes than simple char type should be signed, right? > > I think the signedness of char depends on the implementation. Which means > > that "char" will cover one of them, but not the other. Which is why I was > > suggesting adding "char", "signed char" and "unsigned char". Just to cover > > all bases. > unsigned - not. signed -yes. One question: if I register summary for "char" - > it will not be called for "unsigned char" and "signed char", right? > If so I will need adding "signed char" and no checks for signed/unsigned > inside summary provider are required, correct? Correct. It will only be called for an exactly matching type name. We strip "useless" qualifiers like "volatile" and "restrict" before doing format matching. But, for obvious reasons, not signed and unsigned. Well, if you add separate formatters for signed char vs. unsigned char, then they will know of course The one for plain "char" might still need to figure it out though. Because given just "char", the signedness depends on the underlying compiler. I know internally we have support for this. If we don't in the SB API, we may need to add support. But that seems like it can be done in a subsequent revision. http://reviews.llvm.org/D13799 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)
evgeny777 added inline comments. Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:37 @@ +36,3 @@ +return false; +stream.Printf("%d %s", (int)value.GetValueAsSigned(), value.GetValue()); +return true; granata.enrico wrote: > I would definitely not stop the revision for this but I wonder if it would > make sense to try and discover whether "char" is signed or unsigned from the > type itself? To my understanding this is not needed (see comment below) Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835 @@ +834,3 @@ + +if (!MI_add_summary(miCategory, "char", MI_char_summary_provider, +lldb::eTypeOptionHideValue | lldb::eTypeOptionSkipPointers)) evgeny777 wrote: > granata.enrico wrote: > > Should you also cover "signed char" and "unsigned char" here? > Hmm. I thought that if regex is false, exact match will be done, won't it? If > yes than simple char type should be signed, right? unsigned - not. signed -yes. One question: if I register summary for "char" - it will not be called for "unsigned char" and "signed char", right? If so I will need adding "signed char" and no checks for signed/unsigned inside summary provider are required, correct? http://reviews.llvm.org/D13799 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r250532 - Make swig generation python scripts python 3 compatible.
Author: zturner Date: Fri Oct 16 12:52:12 2015 New Revision: 250532 URL: http://llvm.org/viewvc/llvm-project?rev=250532&view=rev Log: Make swig generation python scripts python 3 compatible. Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py lldb/trunk/scripts/finishSwigWrapperClasses.py Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=250532&r1=250531&r2=250532&view=diff == --- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original) +++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Fri Oct 16 12:52:12 2015 @@ -1,4 +1,4 @@ -""" Python SWIG post process script for each language +""" Python SWIG post process script for each language -- File: finishSwigPythonLLDB.py @@ -121,7 +121,7 @@ def macosx_copy_file_for_heap( vDictArgs def create_py_pkg( vDictArgs, vstrFrameworkPythonDir, vstrPkgDir, vListPkgFiles ): dbg = utilsDebug.CDebugFnVerbose( "Python script create_py_pkg()" ); dbg.dump_object( "Package file(s):", vListPkgFiles ); -bDbg = vDictArgs.has_key( "-d" ); +bDbg = "-d" in vDictArgs; bOk = True; strMsg = ""; @@ -189,7 +189,7 @@ def create_py_pkg( vDictArgs, vstrFramew def copy_lldbpy_file_to_lldb_pkg_dir( vDictArgs, vstrFrameworkPythonDir, vstrCfgBldDir ): dbg = utilsDebug.CDebugFnVerbose( "Python script copy_lldbpy_file_to_lldb_pkg_dir()" ); bOk = True; -bDbg = vDictArgs.has_key( "-d" ); +bDbg = "-d" in vDictArgs; strMsg = ""; strSrc = os.path.join(vstrCfgBldDir, "lldb.py"); @@ -225,7 +225,7 @@ def copy_lldbpy_file_to_lldb_pkg_dir( vD # Throws: None. #-- def make_symlink_windows( vstrSrcPath, vstrTargetPath ): -print "Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath); +print("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)); dbg = utilsDebug.CDebugFnVerbose( "Python script make_symlink_windows()" ); bOk = True; strErrMsg = ""; @@ -283,13 +283,13 @@ def make_symlink( vDictArgs, vstrFramewo dbg = utilsDebug.CDebugFnVerbose( "Python script make_symlink()" ); bOk = True; strErrMsg = ""; -bDbg = vDictArgs.has_key( "-d" ); +bDbg = "-d" in vDictArgs; strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile); strTarget = os.path.normcase( strTarget ); strSrc = ""; os.chdir( vstrFrameworkPythonDir ); -bMakeFileCalled = vDictArgs.has_key( "-m" ); +bMakeFileCalled = "-m" in vDictArgs; eOSType = utilsOsType.determine_os_type(); if not bMakeFileCalled: return (bOk, strErrMsg); @@ -313,19 +313,19 @@ def make_symlink( vDictArgs, vstrFramewo elif eOSType == utilsOsType.EnumOsType.Windows: if os.path.isfile( strTarget ): if bDbg: -print strMsgSymlinkExists % vstrTargetFile; +print(strMsgSymlinkExists % vstrTargetFile); return (bOk, strErrMsg); if bDbg: -print strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget); +print(strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget)); bOk, strErrMsg = make_symlink_windows( strSrc, strTarget ); else: if os.path.islink( strTarget ): if bDbg: -print strMsgSymlinkExists % vstrTargetFile; +print(strMsgSymlinkExists % vstrTargetFile); return (bOk, strErrMsg); if bDbg: -print strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget); +print(strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget)); bOk, strErrMsg = make_symlink_other_platforms( strSrc, strTarget ); @@ -359,7 +359,7 @@ def make_symlink_liblldb( vDictArgs, vst else: strTarget += ".so"; -bMakeFileCalled = vDictArgs.has_key( "-m" ); +bMakeFileCalled = "-m" in vDictArgs; if not bMakeFileCalled: strSrc = os.path.join("lib", "LLDB"); else: @@ -400,7 +400,7 @@ def make_symlink_darwin_debug( vDictArgs strTarget = vstrDarwinDebugFileName; strSrc = ""; -bMakeFileCalled = vDictArgs.has_key( "-m" ); +bMakeFileCalled = "-m" in vDictArgs; if not bMakeFileCalled: return (bOk, strErrMsg); else: @@ -430,7 +430,7 @@ def make_symlink_argdumper( vDictArgs, v if eOSType == utilsOsType.EnumOsType.Windows: strTarget += ".exe"; -bMakeFileCalled = vDictArgs.has_key( "-m" ); +bMakeFileCalled = "-m" in vDictArgs; if not bMakeFileCalled: return (bOk, strErrMsg); else: @@ -494,15 +494,15 @@ def find_or_create_python_dir( vDictArgs dbg = utilsDebug.CDebugFnVerbose( "Python script find_or_create_python_di
[Lldb-commits] [lldb] r250533 - Make some more of the LLDB/SWIG/Python glue Python 3 aware.
Author: zturner Date: Fri Oct 16 12:52:32 2015 New Revision: 250533 URL: http://llvm.org/viewvc/llvm-project?rev=250533&view=rev Log: Make some more of the LLDB/SWIG/Python glue Python 3 aware. Mostly this is just converting some print statements to print functions. Modified: lldb/trunk/scripts/interface/SBBlock.i lldb/trunk/scripts/interface/SBBreakpoint.i lldb/trunk/scripts/interface/SBCompileUnit.i lldb/trunk/scripts/interface/SBDebugger.i lldb/trunk/scripts/interface/SBEvent.i lldb/trunk/scripts/interface/SBLineEntry.i lldb/trunk/scripts/interface/SBModule.i lldb/trunk/scripts/interface/SBProcess.i lldb/trunk/scripts/interface/SBTarget.i lldb/trunk/scripts/interface/SBTypeCategory.i lldb/trunk/scripts/interface/SBValue.i lldb/trunk/scripts/interface/SBValueList.i lldb/trunk/source/Interpreter/embedded_interpreter.py Modified: lldb/trunk/scripts/interface/SBBlock.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBBlock.i?rev=250533&r1=250532&r2=250533&view=diff == --- lldb/trunk/scripts/interface/SBBlock.i (original) +++ lldb/trunk/scripts/interface/SBBlock.i Fri Oct 16 12:52:32 2015 @@ -128,7 +128,7 @@ public: if range_idx < len(self): return [self.sbblock.GetRangeStartAddress(range_idx), self.sbblock.GetRangeEndAddress(range_idx)] else: -print "error: unsupported item type: %s" % type(key) +print("error: unsupported item type: %s" % type(key)) return None def get_ranges_access_object(self): Modified: lldb/trunk/scripts/interface/SBBreakpoint.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBBreakpoint.i?rev=250533&r1=250532&r2=250533&view=diff == --- lldb/trunk/scripts/interface/SBBreakpoint.i (original) +++ lldb/trunk/scripts/interface/SBBreakpoint.i Fri Oct 16 12:52:32 2015 @@ -67,8 +67,8 @@ TestBreakpointIgnoreCount.py), SBBreakpoint supports breakpoint location iteration, for example, for bl in breakpoint: -print 'breakpoint location load addr: %s' % hex(bl.GetLoadAddress()) -print 'breakpoint location condition: %s' % hex(bl.GetCondition()) +print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress())) +print('breakpoint location condition: %s' % hex(bl.GetCondition())) and rich comparion methods which allow the API program to use, Modified: lldb/trunk/scripts/interface/SBCompileUnit.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBCompileUnit.i?rev=250533&r1=250532&r2=250533&view=diff == --- lldb/trunk/scripts/interface/SBCompileUnit.i (original) +++ lldb/trunk/scripts/interface/SBCompileUnit.i Fri Oct 16 12:52:32 2015 @@ -21,10 +21,10 @@ SBCompileUnit supports line entry iterat compileUnit = context.GetCompileUnit() for lineEntry in compileUnit: -print 'line entry: %s:%d' % (str(lineEntry.GetFileSpec()), -lineEntry.GetLine()) -print 'start addr: %s' % str(lineEntry.GetStartAddress()) -print 'end addr: %s' % str(lineEntry.GetEndAddress()) +print('line entry: %s:%d' % (str(lineEntry.GetFileSpec()), +lineEntry.GetLine())) +print('start addr: %s' % str(lineEntry.GetStartAddress())) +print('end addr: %s' % str(lineEntry.GetEndAddress())) produces: Modified: lldb/trunk/scripts/interface/SBDebugger.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBDebugger.i?rev=250533&r1=250532&r2=250533&view=diff == --- lldb/trunk/scripts/interface/SBDebugger.i (original) +++ lldb/trunk/scripts/interface/SBDebugger.i Fri Oct 16 12:52:32 2015 @@ -33,7 +33,7 @@ debugger = lldb.SBDebugger.Create() debugger.SetAsync (False) # Create a target from a file and arch -print 'Creating a target for \'%s\'' % exe +print('Creating a target for \'%s\'' % exe) target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT) @@ -82,17 +82,17 @@ if target: disassemble_instructions (insts) registerList = frame.GetRegisters() -print 'Frame registers (size of register set = %d):' % registerList.GetSize() +print('Frame registers (size of register set = %d):' % registerList.GetSize()) for value in registerList: #print value -print '%s (number of children = %d):' % (value.GetName(), value.GetNumChildren()) +print('%s (number of children = %d):' % (val
[Lldb-commits] [lldb] r250531 - Fix linkage of `init_lldb` SWIG method in Python 3.
Author: zturner Date: Fri Oct 16 12:52:03 2015 New Revision: 250531 URL: http://llvm.org/viewvc/llvm-project?rev=250531&view=rev Log: Fix linkage of `init_lldb` SWIG method in Python 3. Modified: lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h Modified: lldb/trunk/source/API/SystemInitializerFull.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=250531&r1=250530&r2=250531&view=diff == --- lldb/trunk/source/API/SystemInitializerFull.cpp (original) +++ lldb/trunk/source/API/SystemInitializerFull.cpp Fri Oct 16 12:52:03 2015 @@ -89,9 +89,19 @@ using namespace lldb_private; #ifndef LLDB_DISABLE_PYTHON // Defined in the SWIG source file +#if PY_MAJOR_VERSION >= 3 +extern "C" PyObject* +PyInit__lldb(void); + +#define LLDBSwigPyInit PyInit__lldb + +#else extern "C" void init_lldb(void); +#define LLDBSwigPyInit init_lldb +#endif + // these are the Pythonic implementations of the required callbacks // these are scripting-language specific, which is why they belong here // we still need to use function pointers to them instead of relying @@ -328,7 +338,7 @@ void SystemInitializerFull::InitializeSW { #if !defined(LLDB_DISABLE_PYTHON) ScriptInterpreterPython::InitializeInterpreter( -init_lldb, +LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction, LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript, Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h?rev=250531&r1=250530&r2=250531&view=diff == --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h (original) +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h Fri Oct 16 12:52:03 2015 @@ -32,7 +32,11 @@ class ScriptInterpreterPython : public IOHandlerDelegateMultiline { public: -typedef void (*SWIGInitCallback) (void); +#if PY_MAJOR_VERSION >= 3 +typedef PyObject*(*SWIGInitCallback) (void); +#else +typedef void(*SWIGInitCallback) (void); +#endif typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name, const char *session_dictionary_name, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r250530 - Convert SWIG typemap string operations to PythonObjects.
Author: zturner Date: Fri Oct 16 12:51:49 2015 New Revision: 250530 URL: http://llvm.org/viewvc/llvm-project?rev=250530&view=rev Log: Convert SWIG typemap string operations to PythonObjects. Modified: lldb/trunk/scripts/Python/python-typemaps.swig lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Modified: lldb/trunk/scripts/Python/python-typemaps.swig URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=250530&r1=250529&r2=250530&view=diff == --- lldb/trunk/scripts/Python/python-typemaps.swig (original) +++ lldb/trunk/scripts/Python/python-typemaps.swig Fri Oct 16 12:51:49 2015 @@ -63,34 +63,38 @@ int i; len = 0; while ($1[len]) len++; - lldb_private::PythonList list(len); + using namespace lldb_private; + PythonList list(len); for (i = 0; i < len; i++) -list.SetItemAtIndex(i, lldb_private::PythonString($1[i])); +list.SetItemAtIndex(i, PythonString($1[i])); $result = list.release(); } %typemap(in) char const ** { /* Check if is a list */ - if (PyList_Check($input)) { -int size = PyList_Size($input); -int i = 0; -$1 = (char **) malloc((size+1) * sizeof(char*)); -for (i = 0; i < size; i++) { - PyObject *o = PyList_GetItem($input,i); - if (PyString_Check(o)) -$1[i] = PyString_AsString(o); - else { + using namespace lldb_private; + if (PythonList::Check($input)) { +PythonList py_list(PyRefType::Borrowed, $input); +int size = py_list.GetSize(); + +$1 = (char**)malloc((size+1)*sizeof(char*)); +for (int i = 0; i < size; i++) { + PythonObject o = py_list.GetItemAtIndex(i); + if (!PythonString::Check(o.get())) { PyErr_SetString(PyExc_TypeError,"list must contain strings"); free($1); -return NULL; +return nullptr; } + auto py_str = o.AsType(); + $1[i] = const_cast(py_str.GetString().data()); } -$1[i] = 0; + +$1[size] = 0; } else if ($input == Py_None) { -$1 = NULL; +$1 = nullptr; } else { PyErr_SetString(PyExc_TypeError,"not a list"); -return NULL; +return nullptr; } } @@ -501,12 +505,13 @@ } %typemap(in) FILE * { + using namespace lldb_private; if ($input == Py_None) - $1 = NULL; + $1 = nullptr; else if (!lldb_private::PythonFile::Check($input)) { int fd = PyObject_AsFileDescriptor($input); - lldb_private::PythonString py_mode(lldb_private::PyRefType::Owned, - PyObject_GetAttrString($input, "mode")); + PythonObject py_input(PyRefType::Borrowed, $input); + PythonString py_mode = py_input.GetAttributeValue("mode").AsType(); if (-1 != fd && py_mode.IsValid()) { FILE *f; @@ -521,10 +526,10 @@ } else { - lldb_private::File file; - lldb_private::PythonFile py_file(lldb_private::PyRefType::Borrowed, $input); - if (!py_file.GetUnderlyingFile(file)) - return nullptr; + PythonFile py_file(PyRefType::Borrowed, $input); + File file; + if (!py_file.GetUnderlyingFile(file)) + return nullptr; $1 = file.GetStream(); } @@ -543,26 +548,34 @@ else // if (flags & __SRW) mode[i++] = 'a'; #endif - lldb_private::File file($1, false); - lldb_private::PythonFile py_file(file, mode); + using namespace lldb_private; + File file($1, false); + PythonFile py_file(file, mode); $result = py_file.release(); } %typemap(in) (const char* string, int len) { +using namespace lldb_private; if ($input == Py_None) { $1 = NULL; $2 = 0; } -else if (PyUnicode_Check($input)) -{ -$1 = PyString_AsString(PyUnicode_AsUTF8String($input)); -$2 = strlen($1); -} -else if (PyString_Check($input)) +else if (PythonString::Check($input)) { -$1 = PyString_AsString($input); -$2 = PyString_Size($input); +PythonString py_str(PyRefType::Borrowed, $input); +llvm::StringRef str = py_str.GetString(); +$1 = const_cast(str.data()); +$2 = str.size(); +// In Python 2, if $input is a PyUnicode object then this +// will trigger a Unicode -> String conversion, in which +// case the `PythonString` will now own the PyString. Thus +// if it goes out of scope, the data will be deleted. The +// only way to avoid this is to leak the Python object in +// that case. Note that if there was no conversion, then +// releasing the string will not leak anything, since we +// created this as a borrowed reference. +py_str.release(); } else { Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Pytho
Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.
sivachandra added a comment. When such an error occurs, it is unlikely to be an lldb bug, or data-formatter bug. One can come up with a data structure for which reading a child element would require complete debug info, but reading the # of child elements need not require complete debug info (there could be an instance variable storing the size). Another could be that a child is improperly initialized but the data structure itself is properly initialized. http://reviews.llvm.org/D13778 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13816: Fix a some silly warnings
artagnon created this revision. artagnon added a reviewer: clayborg. artagnon added a subscriber: lldb-commits. http://reviews.llvm.org/D13816 Files: source/Commands/CommandObjectMemory.cpp tools/debugserver/source/RNBRemote.cpp tools/debugserver/source/debugserver.cpp Index: tools/debugserver/source/debugserver.cpp === --- tools/debugserver/source/debugserver.cpp +++ tools/debugserver/source/debugserver.cpp @@ -313,7 +313,6 @@ switch (pid_state) { -default: case eStateInvalid: case eStateUnloaded: case eStateAttaching: @@ -631,28 +630,28 @@ while (mode == eRNBRunLoopModePlatformMode) { std::string set_events_str; -const uint32_t event_mask = RNBContext::event_read_packet_available | +const uint32_t event_mask = RNBContext::event_read_packet_available | RNBContext::event_read_thread_exiting; - + DNBLogThreadedIf (LOG_RNB_EVENTS, "%s ctx.Events().WaitForSetEvents(0x%08x) ...",__FUNCTION__, event_mask); nub_event_t set_events = ctx.Events().WaitForSetEvents(event_mask); DNBLogThreadedIf (LOG_RNB_EVENTS, "%s ctx.Events().WaitForSetEvents(0x%08x) => 0x%08x (%s)",__FUNCTION__, event_mask, set_events, ctx.EventsAsString(set_events, set_events_str)); - + if (set_events) { if (set_events & RNBContext::event_read_packet_available) { if (remote->HandleReceivedPacket() == rnb_not_connected) mode = eRNBRunLoopModeExit; } - + if (set_events & RNBContext::event_read_thread_exiting) { mode = eRNBRunLoopModeExit; } ctx.Events().ResetEvents(set_events); } -} +} return eRNBRunLoopModeExit; } @@ -665,9 +664,9 @@ PortWasBoundCallbackUnixSocket (const void *baton, in_port_t port) { //::printf ("PortWasBoundCallbackUnixSocket (baton = %p, port = %u)\n", baton, port); - + const char *unix_socket_name = (const char *)baton; - + if (unix_socket_name && unix_socket_name[0]) { // We were given a unix socket name to use to communicate the port @@ -679,37 +678,37 @@ perror("error: socket (AF_UNIX, SOCK_STREAM, 0)"); exit(1); } - + saddr_un.sun_family = AF_UNIX; ::strncpy(saddr_un.sun_path, unix_socket_name, sizeof(saddr_un.sun_path) - 1); saddr_un.sun_path[sizeof(saddr_un.sun_path) - 1] = '\0'; saddr_un.sun_len = SUN_LEN (&saddr_un); - + if (::connect (s, (struct sockaddr *)&saddr_un, static_cast(SUN_LEN (&saddr_un))) < 0) { perror("error: connect (socket, &saddr_un, saddr_un_len)"); exit(1); } - + //::printf ("connect () sucess!!\n"); - - + + // We were able to connect to the socket, now write our PID so whomever // launched us will know this process's ID RNBLogSTDOUT ("Listening to port %i...\n", port); - + char pid_str[64]; const int pid_str_len = ::snprintf (pid_str, sizeof(pid_str), "%u", port); const ssize_t bytes_sent = ::send (s, pid_str, pid_str_len, 0); - + if (pid_str_len != bytes_sent) { perror("error: send (s, pid_str, pid_str_len, 0)"); exit (1); } - + //::printf ("send () sucess!!\n"); - + // We are done with the socket close (s); } @@ -887,7 +886,7 @@ #if defined (__arm__) || defined (__arm64__) || defined (__aarch64__) struct sched_param thread_param; int thread_sched_policy; -if (pthread_getschedparam(pthread_self(), &thread_sched_policy, &thread_param) == 0) +if (pthread_getschedparam(pthread_self(), &thread_sched_policy, &thread_param) == 0) { thread_param.sched_priority = 47; pthread_setschedparam(pthread_self(), thread_sched_policy, &thread_param); @@ -909,25 +908,25 @@ //signal (SIGINT, signal_handler); signal (SIGPIPE, signal_handler); signal (SIGHUP, signal_handler); - + // We're always sitting in waitpid or kevent waiting on our target process' death, // we don't need no stinking SIGCHLD's... - + sigset_t sigset; sigemptyset(&sigset); sigaddset(&sigset, SIGCHLD); sigprocmask(SIG_BLOCK, &sigset, NULL); g_remoteSP.reset (new RNBRemote ()); - - + + RNBRemote *remote = g_remoteSP.get(); if (remote == NULL) { RNBLogSTDERR ("error: failed to create a remote connection class\n"); return -1; } - + RNBContext& ctx = remote->Context(); int i; @@ -959,20 +958,20 @@
Re: [Lldb-commits] [PATCH] D13816: Fix a some silly warnings
artagnon updated this revision to Diff 37611. artagnon added a comment. Er, silly mistake (build failure) http://reviews.llvm.org/D13816 Files: source/Commands/CommandObjectMemory.cpp tools/debugserver/source/RNBRemote.cpp tools/debugserver/source/debugserver.cpp Index: tools/debugserver/source/debugserver.cpp === --- tools/debugserver/source/debugserver.cpp +++ tools/debugserver/source/debugserver.cpp @@ -313,7 +313,6 @@ switch (pid_state) { -default: case eStateInvalid: case eStateUnloaded: case eStateAttaching: @@ -631,28 +630,28 @@ while (mode == eRNBRunLoopModePlatformMode) { std::string set_events_str; -const uint32_t event_mask = RNBContext::event_read_packet_available | +const uint32_t event_mask = RNBContext::event_read_packet_available | RNBContext::event_read_thread_exiting; - + DNBLogThreadedIf (LOG_RNB_EVENTS, "%s ctx.Events().WaitForSetEvents(0x%08x) ...",__FUNCTION__, event_mask); nub_event_t set_events = ctx.Events().WaitForSetEvents(event_mask); DNBLogThreadedIf (LOG_RNB_EVENTS, "%s ctx.Events().WaitForSetEvents(0x%08x) => 0x%08x (%s)",__FUNCTION__, event_mask, set_events, ctx.EventsAsString(set_events, set_events_str)); - + if (set_events) { if (set_events & RNBContext::event_read_packet_available) { if (remote->HandleReceivedPacket() == rnb_not_connected) mode = eRNBRunLoopModeExit; } - + if (set_events & RNBContext::event_read_thread_exiting) { mode = eRNBRunLoopModeExit; } ctx.Events().ResetEvents(set_events); } -} +} return eRNBRunLoopModeExit; } @@ -665,9 +664,9 @@ PortWasBoundCallbackUnixSocket (const void *baton, in_port_t port) { //::printf ("PortWasBoundCallbackUnixSocket (baton = %p, port = %u)\n", baton, port); - + const char *unix_socket_name = (const char *)baton; - + if (unix_socket_name && unix_socket_name[0]) { // We were given a unix socket name to use to communicate the port @@ -679,37 +678,37 @@ perror("error: socket (AF_UNIX, SOCK_STREAM, 0)"); exit(1); } - + saddr_un.sun_family = AF_UNIX; ::strncpy(saddr_un.sun_path, unix_socket_name, sizeof(saddr_un.sun_path) - 1); saddr_un.sun_path[sizeof(saddr_un.sun_path) - 1] = '\0'; saddr_un.sun_len = SUN_LEN (&saddr_un); - + if (::connect (s, (struct sockaddr *)&saddr_un, static_cast(SUN_LEN (&saddr_un))) < 0) { perror("error: connect (socket, &saddr_un, saddr_un_len)"); exit(1); } - + //::printf ("connect () sucess!!\n"); - - + + // We were able to connect to the socket, now write our PID so whomever // launched us will know this process's ID RNBLogSTDOUT ("Listening to port %i...\n", port); - + char pid_str[64]; const int pid_str_len = ::snprintf (pid_str, sizeof(pid_str), "%u", port); const ssize_t bytes_sent = ::send (s, pid_str, pid_str_len, 0); - + if (pid_str_len != bytes_sent) { perror("error: send (s, pid_str, pid_str_len, 0)"); exit (1); } - + //::printf ("send () sucess!!\n"); - + // We are done with the socket close (s); } @@ -887,7 +886,7 @@ #if defined (__arm__) || defined (__arm64__) || defined (__aarch64__) struct sched_param thread_param; int thread_sched_policy; -if (pthread_getschedparam(pthread_self(), &thread_sched_policy, &thread_param) == 0) +if (pthread_getschedparam(pthread_self(), &thread_sched_policy, &thread_param) == 0) { thread_param.sched_priority = 47; pthread_setschedparam(pthread_self(), thread_sched_policy, &thread_param); @@ -909,25 +908,25 @@ //signal (SIGINT, signal_handler); signal (SIGPIPE, signal_handler); signal (SIGHUP, signal_handler); - + // We're always sitting in waitpid or kevent waiting on our target process' death, // we don't need no stinking SIGCHLD's... - + sigset_t sigset; sigemptyset(&sigset); sigaddset(&sigset, SIGCHLD); sigprocmask(SIG_BLOCK, &sigset, NULL); g_remoteSP.reset (new RNBRemote ()); - - + + RNBRemote *remote = g_remoteSP.get(); if (remote == NULL) { RNBLogSTDERR ("error: failed to create a remote connection class\n"); return -1; } - + RNBContext& ctx = remote->Context(); int i; @@ -959,20 +958,20 @@
Re: [Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)
evgeny777 added inline comments. Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835 @@ +834,3 @@ + +if (!MI_add_summary(miCategory, "char", MI_char_summary_provider, +lldb::eTypeOptionHideValue | lldb::eTypeOptionSkipPointers)) granata.enrico wrote: > Should you also cover "signed char" and "unsigned char" here? Hmm. I thought that if regex is false, exact match will be done, won't it? If yes than simple char type should be signed, right? http://reviews.llvm.org/D13799 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)
granata.enrico added inline comments. Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:37 @@ +36,3 @@ +return false; +stream.Printf("%d %s", (int)value.GetValueAsSigned(), value.GetValue()); +return true; I would definitely not stop the revision for this but I wonder if it would make sense to try and discover whether "char" is signed or unsigned from the type itself? Comment at: tools/lldb-mi/MICmnLLDBDebugger.cpp:835 @@ +834,3 @@ + +if (!MI_add_summary(miCategory, "char", MI_char_summary_provider, +lldb::eTypeOptionHideValue | lldb::eTypeOptionSkipPointers)) Should you also cover "signed char" and "unsigned char" here? http://reviews.llvm.org/D13799 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r250525 - Update SWIG typemaps to use `PythonFile`.
Author: zturner Date: Fri Oct 16 11:39:18 2015 New Revision: 250525 URL: http://llvm.org/viewvc/llvm-project?rev=250525&view=rev Log: Update SWIG typemaps to use `PythonFile`. Using the Python native C API is non-portable across Python versions, so this patch changes them to use the `PythonFile` class which hides the version specific differences behind a single interface. Modified: lldb/trunk/scripts/Python/python-typemaps.swig lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h Modified: lldb/trunk/scripts/Python/python-typemaps.swig URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=250525&r1=250524&r2=250525&view=diff == --- lldb/trunk/scripts/Python/python-typemaps.swig (original) +++ lldb/trunk/scripts/Python/python-typemaps.swig Fri Oct 16 11:39:18 2015 @@ -503,27 +503,31 @@ %typemap(in) FILE * { if ($input == Py_None) $1 = NULL; - else if (!PyFile_Check($input)) { + else if (!lldb_private::PythonFile::Check($input)) { int fd = PyObject_AsFileDescriptor($input); - PyObject *py_mode = PyObject_GetAttrString($input, "mode"); - if (!py_mode) { - PyErr_SetString(PyExc_TypeError,"not a file-like object"); - return NULL; - } - const char *mode = PyString_AsString(py_mode); - if (-1 != fd && mode) { + lldb_private::PythonString py_mode(lldb_private::PyRefType::Owned, + PyObject_GetAttrString($input, "mode")); + + if (-1 != fd && py_mode.IsValid()) { FILE *f; - if ((f = fdopen(fd, mode))) + if ((f = fdopen(fd, py_mode.GetString().str().c_str( $1 = f; else PyErr_SetString(PyExc_TypeError, strerror(errno)); } else { PyErr_SetString(PyExc_TypeError,"not a file-like object"); - return NULL; + return nullptr; } } else - $1 = PyFile_AsFile($input); + { + lldb_private::File file; + lldb_private::PythonFile py_file(lldb_private::PyRefType::Borrowed, $input); + if (!py_file.GetUnderlyingFile(file)) + return nullptr; + + $1 = file.GetStream(); + } } %typemap(out) FILE * { @@ -539,7 +543,9 @@ else // if (flags & __SRW) mode[i++] = 'a'; #endif - $result = PyFile_FromFile($1, const_cast(""), mode, fflush); + lldb_private::File file($1, false); + lldb_private::PythonFile py_file(file, mode); + $result = py_file.release(); } %typemap(in) (const char* string, int len) { Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=250525&r1=250524&r2=250525&view=diff == --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp (original) +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp Fri Oct 16 11:39:18 2015 @@ -582,6 +582,14 @@ PythonFile::PythonFile(File &file, const Reset(file, mode); } +PythonFile::PythonFile(const char *path, const char *mode) +{ +FILE *fp = nullptr; +fp = fopen(path, mode); +lldb_private::File file(fp, true); +Reset(file, mode); +} + PythonFile::PythonFile(PyRefType type, PyObject *o) { Reset(type, o); @@ -651,4 +659,18 @@ PythonFile::Reset(File &file, const char #endif } +bool +PythonFile::GetUnderlyingFile(File &file) const +{ +if (!IsValid()) +return false; + +file.Close(); +// We don't own the file descriptor returned by this function, make sure the +// File object knows about that. +file.SetDescriptor(PyObject_AsFileDescriptor(m_py_obj), false); +return file.IsValid(); +} + + #endif Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h?rev=250525&r1=250524&r2=250525&view=diff == --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h (original) +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h Fri Oct 16 11:39:18 2015 @@ -323,7 +323,8 @@ public: class PythonFile : public PythonObject { public: -explicit PythonFile(File &file, const char *mode); +PythonFile(File &file, const char *mode); +PythonFile(const char *path, const char *mode); PythonFile(PyRefType type, PyObject *o); ~PythonFile() override; @@ -333,6 +334,8 @@ class PythonFile : public PythonObject void Reset(PyRefType type, PyObject *py_obj) override; void Reset(File &file, const char *mode); + +bool Get
Re: [Lldb-commits] [PATCH] D13754: Split Socket class into Tcp/Udp/DomainSocket subclasses.
ovyalov added inline comments. Comment at: source/Host/posix/DomainSocket.cpp:74 @@ +73,3 @@ +FileSystem::Unlink(FileSpec{name, true}); + +Error error; labath wrote: > If we're going to use unique names, then this won't be necessary (and I would > much rather see a random error opening a socket than a random file > disappearing). BTW, have you considered using abstract sockets for the > lldb-server use case? Albeit linux-specific, I find them much nicer, as they > have no connection to the file system whatsoever. I was thinking about using abstract sockets but didn't try them in runtime on Android - will check. http://reviews.llvm.org/D13754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB
zturner added a comment. Sorry, should have mentioned that the lgtm is contingent on Todd's concerns. I like the idea of having a setting in LLDB that controls the maximum number of threads to use for parallel work. We should probably set this at a very h igh level in dotest so that all instances automatically get this value without having to remember to do it in each test. http://reviews.llvm.org/D13727 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB
zturner accepted this revision. zturner added a comment. Your example makes sense. So go ahead and delete the std async implementation for now. As Tamas said, its very easy to put in, so a better thing to do perhaps is once there's something doing actual parallel work, just test it in a real situation. I still wish there was a way to avoid reinventing the wheel here, but it looks like there's nothing that gives the semantics we need. http://reviews.llvm.org/D13727 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D13812: Increase default memory cache line size for android
labath created this revision. labath added reviewers: clayborg, tberghammer. labath added a subscriber: lldb-commits. Herald added subscribers: srhines, danalbert, tberghammer. ADB packets have a fixed size of 4k. This means the size of memory reads does not affect speed too much (as long as it fits in one packet). Therefore, I am increasing the default memory read size for android to 2k. This value is used only if the user has not modified the default memory-cache-line-size setting. http://reviews.llvm.org/D13812 Files: include/lldb/Target/Process.h source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h source/Target/Process.cpp Index: source/Target/Process.cpp === --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -180,6 +180,14 @@ return m_collection_sp->GetPropertyAtIndexAsUInt64 (NULL, idx, g_properties[idx].default_uint_value); } +lldb::OptionValueSP +ProcessProperties::GetMemoryCacheLineSizeOption() +{ +const uint32_t idx = ePropertyMemCacheLineSize; +lldb_private::ExecutionContext exe_ctx(m_process); +return m_collection_sp->GetPropertyAtIndex(&exe_ctx, true, idx)->GetValue(); +} + Args ProcessProperties::GetExtraStartupCommands () const { Index: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h === --- source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h +++ source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h @@ -36,10 +36,25 @@ Error DisconnectRemote () override; +lldb::ProcessSP +DebugProcess(ProcessLaunchInfo &launch_info, + Debugger &debugger, + Target *target, // Can be NULL, if NULL create a new target, else use existing one + Error &error) override; + +lldb::ProcessSP +Attach(ProcessAttachInfo &attach_info, + Debugger &debugger, + Target *target, // Can be NULL, if NULL create a new target, else use existing one + Error &error) override; + protected: std::string m_device_id; std::map m_port_forwards; +void +AdjustProcessProperties(const lldb::ProcessSP &process_sp); + uint16_t LaunchGDBserverAndGetPort (lldb::pid_t &pid) override; Index: source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp === --- source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" #include "lldb/Host/common/TCPSocket.h" +#include "lldb/Target/ExecutionContext.h" #include "AdbClient.h" #include "PlatformAndroidRemoteGDBServer.h" #include "Utility/UriParser.h" @@ -22,6 +23,7 @@ using namespace platform_android; static const lldb::pid_t g_remote_platform_pid = 0; // Alias for the process id of lldb-platform +static const unsigned int g_android_default_cache_size = 2048; // Fits inside 4k adb packet. static Error ForwardPortWithAdb (const uint16_t local_port, const uint16_t remote_port, std::string& device_id) @@ -136,6 +138,40 @@ return PlatformRemoteGDBServer::DisconnectRemote (); } +lldb::ProcessSP +PlatformAndroidRemoteGDBServer::DebugProcess(ProcessLaunchInfo &launch_info, + Debugger &debugger, + Target *target, // Can be NULL, if NULL create a new target, else use existing one + Error &error) +{ +lldb::ProcessSP process_sp = PlatformRemoteGDBServer::DebugProcess(launch_info, debugger, target, error); +AdjustProcessProperties(process_sp); +return process_sp; +} + +lldb::ProcessSP +PlatformAndroidRemoteGDBServer::Attach(ProcessAttachInfo &attach_info, +Debugger &debugger, +Target *target, // Can be NULL, if NULL create a new target, else use existing one +Error &error) +{ +lldb::ProcessSP process_sp = PlatformRemoteGDBServer::Attach(attach_info, debugger, target, error); +AdjustProcessProperties(process_sp); +return process_sp; +} + +void +PlatformAndroidRemoteGDBServer::AdjustProcessProperties(const lldb::ProcessSP &process_sp) +{ +if (! process_sp) +return; + +lldb::OptionValueSP value_sp = process_sp->GetMemoryCacheLineSizeOption(); + +if (value_sp && ! value_sp->OptionWasSet()) +value_sp->SetUInt64Value(g_android_default_cache_size); +} + void PlatformAndroidRemoteGDBServer::DeleteForwardPort (lldb::pid_t pid) { Index: include/lldb/Target/Process.h === --- include/lldb/Target/Process.h +++ include/lldb/Target/Process.h @@ -67,6 +67,9 @@ uint64_t GetMemoryCacheLineSize () const; +lldb::OptionValueSP +GetMemoryCacheLin
Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB
tfiala added a comment. I'm in agreement with Pavel's assessment on this. Regarding the tests, I had brought that up with Greg earlier. We can handle that in a few different ways: - We do nothing, and perhaps some collections of tests run slower if they are all pounding on their thread pools at the same time with heavy CPU work. - We add a "max cpu" setting to lldb and just have an option that flips it to something relatively low (enough to test the concurrent nature but not giving it too much CPU). The test suite can then limit this. - Add a ninja-like cpu monitor to the test runner for the non-pool test runners (and also get those running right on Windows), and only keep enough test workers running to keep the machine hot. That would self adjust. (I haven't thought about this at all so I don't yet have an idea of how hard it will be to do it in an all-platform-encompasing way, but I'm sure it's a solvable problem). Just some thoughts http://reviews.llvm.org/D13727 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.
labath added a comment. How big of an error does it have to be for that to happen? Is that something we would consider an "lldb bug"/"data formatter bug" or it can be caused by something out of our control, like missing debug info on one of the children? http://reviews.llvm.org/D13778 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.
sivachandra added a comment. There could be an error reading the k-th element for k < n.In which case, we will wrongly conclude that there are only k-1 elements. http://reviews.llvm.org/D13778 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB
labath added a comment. In http://reviews.llvm.org/D13727#268747, @tberghammer wrote: > Based on Pavel's example and some additional experimenting we done I am not > sure if std::async will give us any benefit even on Windows as it don't limit > the number of threads to the number of cores (because it can't do if it want > to implement the standard). I have no problem with having 2 implementation > (considering that one of them is very simple) but if it don't give us any > benefit, then I would prefer to ignore it. To back these with some numbers, let me explain what I have done: I have modified the f() function in my example to do some actual work (count to a very large number). On my Windows VM with hardware_concurrency()==16, after one second, I had about 70 threads running (more than 4 times the number of cpus). Since our tasks are going to be cpu-intensive, there is no point in having more than 16 of them running, and using std::async will cause a lot of contention, which will slow everything down. I believe the async implementation is not suited for our purpose here and we should not use it. http://reviews.llvm.org/D13727 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB
tberghammer added a comment. Based on Pavel's example and some additional experimenting we done I am not sure if std::async will give us any benefit even on Windows as it don't limit the number of threads to the number of cores (because it can't do if it want to implement the standard). I have no problem with having 2 implementation (considering that one of them is very simple) but if it don't give us any benefit, then I would prefer to ignore it. http://reviews.llvm.org/D13727 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB
tberghammer updated this revision to Diff 37566. tberghammer added a comment. Create optional std::async based implementation http://reviews.llvm.org/D13727 Files: include/lldb/Utility/TaskPool.h source/Utility/CMakeLists.txt source/Utility/TaskPool.cpp unittests/Utility/CMakeLists.txt unittests/Utility/TaskPoolTest.cpp Index: unittests/Utility/TaskPoolTest.cpp === --- /dev/null +++ unittests/Utility/TaskPoolTest.cpp @@ -0,0 +1,62 @@ +#include "gtest/gtest.h" + +#include "lldb/Utility/TaskPool.h" + +TEST (TaskPoolTest, AddTask) +{ +auto fn = [](int x) { return x * x + 1; }; + +auto f1 = TaskPool::AddTask(fn, 1); +auto f2 = TaskPool::AddTask(fn, 2); +auto f3 = TaskPool::AddTask(fn, 3); +auto f4 = TaskPool::AddTask(fn, 4); + +ASSERT_EQ (10, f3.get()); +ASSERT_EQ ( 2, f1.get()); +ASSERT_EQ (17, f4.get()); +ASSERT_EQ ( 5, f2.get()); +} + +TEST (TaskPoolTest, RunTasks) +{ +std::vector r(4); + +auto fn = [](int x, int& y) { y = x * x + 1; }; + +TaskPool::RunTasks( +[fn, &r]() { fn(1, r[0]); }, +[fn, &r]() { fn(2, r[1]); }, +[fn, &r]() { fn(3, r[2]); }, +[fn, &r]() { fn(4, r[3]); } +); + +ASSERT_EQ ( 2, r[0]); +ASSERT_EQ ( 5, r[1]); +ASSERT_EQ (10, r[2]); +ASSERT_EQ (17, r[3]); +} + +TEST (TaskPoolTest, TaskRunner) +{ +auto fn = [](int x) { return std::make_pair(x, x * x); }; + +TaskRunner> tr; +tr.AddTask(fn, 1); +tr.AddTask(fn, 2); +tr.AddTask(fn, 3); +tr.AddTask(fn, 4); + +int count = 0; +while (true) +{ +auto f = tr.WaitForNextCompletedTask(); +if (!f.valid()) +break; + +++count; +std::pair v = f.get(); +ASSERT_EQ (v.first * v.first, v.second); +} + +ASSERT_EQ(4, count); +} Index: unittests/Utility/CMakeLists.txt === --- unittests/Utility/CMakeLists.txt +++ unittests/Utility/CMakeLists.txt @@ -1,4 +1,5 @@ add_lldb_unittest(UtilityTests StringExtractorTest.cpp + TaskPoolTest.cpp UriParserTest.cpp ) Index: source/Utility/TaskPool.cpp === --- /dev/null +++ source/Utility/TaskPool.cpp @@ -0,0 +1,92 @@ +//===- TaskPool.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/Utility/TaskPool.h" + +#ifdef USE_HAND_WRITTEN_THREAD_POOL + +namespace +{ +class TaskPoolImpl +{ +public: +static TaskPoolImpl& +GetInstance(); + +void +AddTask(std::function&& task_fn); + +private: +TaskPoolImpl(uint32_t num_threads); + +static void +Worker(TaskPoolImpl* pool); + +std::queue> m_tasks; +std::mutexm_tasks_mutex; +uint32_t m_thread_count; +}; + +} // end of anonymous namespace + +TaskPoolImpl& +TaskPoolImpl::GetInstance() +{ +static TaskPoolImpl g_task_pool_impl(std::thread::hardware_concurrency()); +return g_task_pool_impl; +} + +void +TaskPool::AddTaskImpl(std::function&& task_fn) +{ +TaskPoolImpl::GetInstance().AddTask(std::move(task_fn)); +} + +TaskPoolImpl::TaskPoolImpl(uint32_t num_threads) : +m_thread_count(0) +{ +} + +void +TaskPoolImpl::AddTask(std::function&& task_fn) +{ +static const uint32_t max_threads = std::thread::hardware_concurrency(); + +std::unique_lock lock(m_tasks_mutex); +m_tasks.emplace(std::move(task_fn)); +if (m_thread_count < max_threads) +{ +m_thread_count++; +lock.unlock(); + +std::thread (Worker, this).detach(); +} +} + +void +TaskPoolImpl::Worker(TaskPoolImpl* pool) +{ +while (true) +{ +std::unique_lock lock(pool->m_tasks_mutex); +if (pool->m_tasks.empty()) +{ +pool->m_thread_count--; +break; +} + +std::function f = pool->m_tasks.front(); +pool->m_tasks.pop(); +lock.unlock(); + +f(); +} +} + +#endif // USE_HAND_WRITTEN_THREAD_POOL Index: source/Utility/CMakeLists.txt === --- source/Utility/CMakeLists.txt +++ source/Utility/CMakeLists.txt @@ -14,6 +14,7 @@ StringExtractor.cpp StringExtractorGDBRemote.cpp StringLexer.cpp + TaskPool.cpp TimeSpecTimeout.cpp UriParser.cpp ) Index: include/lldb/Utility/TaskPool.h === --- /dev/null +++ include/lldb/Utility/TaskPool.h @@ -0,0 +1,212 @@ +//===- TaskPool.h ---*- C++
[Lldb-commits] [PATCH] D13799: [lldb-mi] display summary for simple types + refactor (use lldb formatting for all cases)
evgeny777 created this revision. evgeny777 added reviewers: granata.enrico, ki.stfu, abidh. evgeny777 added subscribers: lldb-commits, KLapshin. Current revision do not use lldb type summaries for simple types with no children (like function pointers). So this patch makes MI use lldb type summaries for evaluation of all types of objects, so MI own formatters are no longer needed. http://reviews.llvm.org/D13799 Files: test/tools/lldb-mi/data/TestMiData.py test/tools/lldb-mi/symbol/TestMiSymbol.py tools/lldb-mi/MICmnLLDBDebugger.cpp tools/lldb-mi/MICmnLLDBDebugger.h tools/lldb-mi/MICmnLLDBUtilSBValue.cpp tools/lldb-mi/MICmnLLDBUtilSBValue.h Index: tools/lldb-mi/MICmnLLDBUtilSBValue.h === --- tools/lldb-mi/MICmnLLDBUtilSBValue.h +++ tools/lldb-mi/MICmnLLDBUtilSBValue.h @@ -51,11 +51,8 @@ private: template CMIUtilString ReadCStringFromHostMemory(lldb::SBValue &vrValue, const MIuint vnMaxLen = UINT32_MAX) const; bool GetSimpleValue(const bool vbHandleArrayType, CMIUtilString &vrValue) const; -CMIUtilString GetSimpleValueChar() const; -CMIUtilString GetSimpleValueCStringPointer() const; -CMIUtilString GetSimpleValueCStringArray() const; bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple &vwrMiValueTuple, const MIuint vnDepth = 1) const; -CMIUtilString GetValueSummary() const; +CMIUtilString GetValueSummary(bool valueOnly, const CMIUtilString& failVal = CMIUtilString()) const; // Statics: private: Index: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp === --- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp +++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp @@ -123,31 +123,13 @@ const MIuint nChildren = m_rValue.GetNumChildren(); if (nChildren == 0) { -if (m_bHandleCharType && IsCharType()) -{ -vwrValue = GetSimpleValueChar(); -return MIstatus::success; -} -else -{ -const char *pValue = m_rValue.GetValue(); -vwrValue = pValue != nullptr ? pValue : m_pUnkwn; -return MIstatus::success; -} +vwrValue = GetValueSummary(!m_bHandleCharType && IsCharType(), m_pUnkwn); +return MIstatus::success; } else if (IsPointerType()) { -if (m_bHandleCharType && IsPointeeCharType()) -{ -vwrValue = GetSimpleValueCStringPointer(); -return MIstatus::success; -} -else -{ -const char *pValue = m_rValue.GetValue(); -vwrValue = pValue != nullptr ? pValue : m_pUnkwn; -return MIstatus::success; -} +vwrValue = GetValueSummary(!m_bHandleCharType && IsPointeeCharType(), m_pUnkwn); +return MIstatus::success; } else if (IsArrayType()) { @@ -157,7 +139,7 @@ bPrintCharArrayAsString) && bPrintCharArrayAsString; if (bPrintCharArrayAsString && m_bHandleCharType && IsFirstChildCharType()) { -vwrValue = GetSimpleValueCStringArray(); +vwrValue = GetValueSummary(false); return MIstatus::success; } else if (vbHandleArrayType) @@ -170,152 +152,15 @@ { // Treat composite value which has registered summary // (for example with AddCXXSummary) as simple value -vwrValue = GetValueSummary(); +vwrValue = GetValueSummary(false); if (!vwrValue.empty()) return MIstatus::success; } // Composite variable type i.e. struct return MIstatus::failure; } -//++ -// Details: Retrieve from the LLDB SB Value object the char value of the variable. -// Type:Method. -// Args:None. -// Return: CMIUtilString - The char value of the variable. -// Throws: None. -//-- -CMIUtilString -CMICmnLLDBUtilSBValue::GetSimpleValueChar() const -{ -const CMIUtilString& summary = GetValueSummary(); -if (!summary.empty()) -return summary; - -const uint64_t value = m_rValue.GetValueAsUnsigned(); -if (value == 0) -{ -const uint64_t nFailValue = 1; -if (nFailValue == m_rValue.GetValueAsUnsigned(nFailValue)) -return m_pUnkwn; -} - -const lldb::BasicType eType = m_rValue.GetType().GetBasicType(); -switch (eType) -{ -default: -assert(0 && "value must be a char type"); -case lldb::eBasicTypeChar: -case lldb::eBasicTypeSignedChar: -case lldb::eBasicTypeUnsignedChar: -{ -const CMIUtilString prefix(CMIUtilString::ConvertToPrintableASCII((char)value)); -return CMIUtilString::Format("%" PRIu8 " '%s'", (uint8_t)value, prefix.c_str()); -} -case lldb::eBasicTypeCh
Re: [Lldb-commits] [PATCH] D13772: Fix temporary directory computation on linux (pr25147)
This revision was automatically updated to reflect the committed changes. Closed by commit rL250502: Fix temporary directory computation on linux (pr25147) (authored by labath). Changed prior to commit: http://reviews.llvm.org/D13772?vs=37485&id=37565#toc Repository: rL LLVM http://reviews.llvm.org/D13772 Files: lldb/trunk/source/Host/android/HostInfoAndroid.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp Index: lldb/trunk/source/Host/android/HostInfoAndroid.cpp === --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp @@ -91,11 +91,14 @@ bool HostInfoAndroid::ComputeTempFileBaseDirectory(FileSpec &file_spec) { -if (HostInfoLinux::ComputeTempFileBaseDirectory(file_spec)) -return true; +bool success = HostInfoLinux::ComputeTempFileBaseDirectory(file_spec); -// If the default mechanism for computing the temp directory failed then -// fall back to /data/local/tmp -file_spec = FileSpec("/data/local/tmp", false); -return true; +// On Android, there is no path which is guaranteed to be writable. If the user has not +// provided a path via an environment variable, the generic algorithm will deduce /tmp, which +// is plain wrong. In that case we have an invalid directory, we substitute the path with +// /data/local/tmp, which is correct at least in some cases (i.e., when running as shell user). +if (!success || !file_spec.Exists()) +file_spec = FileSpec("/data/local/tmp", false); + +return file_spec.Exists(); } Index: lldb/trunk/source/Host/common/HostInfoBase.cpp === --- lldb/trunk/source/Host/common/HostInfoBase.cpp +++ lldb/trunk/source/Host/common/HostInfoBase.cpp @@ -20,6 +20,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Host.h" +#include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include @@ -344,19 +345,9 @@ bool HostInfoBase::ComputeTempFileBaseDirectory(FileSpec &file_spec) { -file_spec.Clear(); - -const char *tmpdir_cstr = getenv("TMPDIR"); -if (tmpdir_cstr == nullptr) -{ -tmpdir_cstr = getenv("TMP"); -if (tmpdir_cstr == nullptr) -tmpdir_cstr = getenv("TEMP"); -} -if (!tmpdir_cstr) -return false; - -file_spec = FileSpec(tmpdir_cstr, false); +llvm::SmallVector tmpdir; +llvm::sys::path::system_temp_directory(/*ErasedOnReboot*/ true, tmpdir); +file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size()), true); return true; } Index: lldb/trunk/source/Host/android/HostInfoAndroid.cpp === --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp @@ -91,11 +91,14 @@ bool HostInfoAndroid::ComputeTempFileBaseDirectory(FileSpec &file_spec) { -if (HostInfoLinux::ComputeTempFileBaseDirectory(file_spec)) -return true; +bool success = HostInfoLinux::ComputeTempFileBaseDirectory(file_spec); -// If the default mechanism for computing the temp directory failed then -// fall back to /data/local/tmp -file_spec = FileSpec("/data/local/tmp", false); -return true; +// On Android, there is no path which is guaranteed to be writable. If the user has not +// provided a path via an environment variable, the generic algorithm will deduce /tmp, which +// is plain wrong. In that case we have an invalid directory, we substitute the path with +// /data/local/tmp, which is correct at least in some cases (i.e., when running as shell user). +if (!success || !file_spec.Exists()) +file_spec = FileSpec("/data/local/tmp", false); + +return file_spec.Exists(); } Index: lldb/trunk/source/Host/common/HostInfoBase.cpp === --- lldb/trunk/source/Host/common/HostInfoBase.cpp +++ lldb/trunk/source/Host/common/HostInfoBase.cpp @@ -20,6 +20,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Host.h" +#include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include @@ -344,19 +345,9 @@ bool HostInfoBase::ComputeTempFileBaseDirectory(FileSpec &file_spec) { -file_spec.Clear(); - -const char *tmpdir_cstr = getenv("TMPDIR"); -if (tmpdir_cstr == nullptr) -{ -tmpdir_cstr = getenv("TMP"); -if (tmpdir_cstr == nullptr) -tmpdir_cstr = getenv("TEMP"); -} -if (!tmpdir_cstr) -return false; - -file_spec = FileSpec(tmpdir_cstr, false); +llvm::SmallVector tmpdir; +llvm::sys::path::system_temp_directory(/*ErasedOnReboot*/ true, tmpdir); +file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size()), true); return true; } ___
[Lldb-commits] [lldb] r250502 - Fix temporary directory computation on linux (pr25147)
Author: labath Date: Fri Oct 16 04:32:05 2015 New Revision: 250502 URL: http://llvm.org/viewvc/llvm-project?rev=250502&view=rev Log: Fix temporary directory computation on linux (pr25147) Summary: On linux, the environment variables for temp directories that lldb checks for are generally not defined, and the temp directory computation failed. This caused expression evaluation to fall back to creating "/tmp/lldb-*.expr" debugging files instead of the usual "$TMP/lldb/pid/lldb-*.expr". Crucially, these files were not cleaned up on lldb exit, which caused clutter in the /tmp folder, especially on long-running machines (e.g. builtbots). This commit fixes lldb to use llvm::sys::path::system_temp_directory, which does the same environment variable dance, but (!) also falls back to the P_tmpdir macro, which is how the temp directory is defined on linux. Since the linux temp path computation now succeeds, I needed to also modify Android path computation to check for actual directory existence, rather then checking whether the operation failed. Reviewers: clayborg, tberghammer Subscribers: tberghammer, lldb-commits, danalbert, srhines, emaste Differential Revision: http://reviews.llvm.org/D13772 Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=250502&r1=250501&r2=250502&view=diff == --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original) +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Fri Oct 16 04:32:05 2015 @@ -91,11 +91,14 @@ HostInfoAndroid::ResolveLibraryPath(cons bool HostInfoAndroid::ComputeTempFileBaseDirectory(FileSpec &file_spec) { -if (HostInfoLinux::ComputeTempFileBaseDirectory(file_spec)) -return true; +bool success = HostInfoLinux::ComputeTempFileBaseDirectory(file_spec); -// If the default mechanism for computing the temp directory failed then -// fall back to /data/local/tmp -file_spec = FileSpec("/data/local/tmp", false); -return true; +// On Android, there is no path which is guaranteed to be writable. If the user has not +// provided a path via an environment variable, the generic algorithm will deduce /tmp, which +// is plain wrong. In that case we have an invalid directory, we substitute the path with +// /data/local/tmp, which is correct at least in some cases (i.e., when running as shell user). +if (!success || !file_spec.Exists()) +file_spec = FileSpec("/data/local/tmp", false); + +return file_spec.Exists(); } Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=250502&r1=250501&r2=250502&view=diff == --- lldb/trunk/source/Host/common/HostInfoBase.cpp (original) +++ lldb/trunk/source/Host/common/HostInfoBase.cpp Fri Oct 16 04:32:05 2015 @@ -20,6 +20,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Host.h" +#include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include @@ -344,19 +345,9 @@ HostInfoBase::ComputeProcessTempFileDire bool HostInfoBase::ComputeTempFileBaseDirectory(FileSpec &file_spec) { -file_spec.Clear(); - -const char *tmpdir_cstr = getenv("TMPDIR"); -if (tmpdir_cstr == nullptr) -{ -tmpdir_cstr = getenv("TMP"); -if (tmpdir_cstr == nullptr) -tmpdir_cstr = getenv("TEMP"); -} -if (!tmpdir_cstr) -return false; - -file_spec = FileSpec(tmpdir_cstr, false); +llvm::SmallVector tmpdir; +llvm::sys::path::system_temp_directory(/*ErasedOnReboot*/ true, tmpdir); +file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size()), true); return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13727: Add task pool to LLDB
labath added a comment. Zachary, I don't think using std::async is a good idea because it provides a very different threading model than the one we want here. Let me demonstrate that with an example: #include #include #include #include #include using namespace std; unsigned X = 0; mutex m; condition_variable cv; int f() { unique_lock l(m); X++; printf("X = %d\n", X); cv.wait(l, [] { return X > 1000; }); cv.notify_one(); return X; } int main() { vector> v; for(unsigned i = 0; i < 1000; ++i) v.push_back(async(launch::async, f)); v.push_back(async(launch::async, f)); // break here for(auto &f: v) printf("future = %d\n", f.get()); return 0; } This (convoluted) example starts 1000 (+1) asynchronous tasks and wires them up in a way that they can't complete until all of them are running. If the implementation was limiting the number of concurrently running tasks to n<1000, then this program would not complete. Nevertheless, it *does* complete. When I run this program under linux, it completes instantly. That's because linux implementation of std::async just kicks off a new thread for each task let's them run freely. Windows (for better or for worse) does something different here. Initially, it only spawns a small number of tasks and then periodically checks if the tasks have finished, and if not, it starts a more of them. That's why it takes this program several minutes to complete, but it still completes, and if you check it with a debugger in the end, you will see that there were 1000 threads running (i.e. it was not doing anything clever, like multiplexing multiple tasks over the same OS thread, etc.). This is not the threading model we want here I think (in fact we should probably ban using any communication between the tasks in the pool). Our requirement seems to be "being able to limit the number of tasks running concurrently". Having the thread pool exhibit one behavior on windows and another elsewhere would be very confusing and error-prone. Having said that, I do think there is one more thing that speaks against having hardware_concurrency() threads running constantly, that we haven't considered yet. It is our test suite. It already spawns a large number of LLDB processes in parallel, and having each process spawn a large number of threads might be dangerous. Tamas, if you're going to keep the threads alive, I think we should evaluate the impact of it on our test suite. Considering all of this, I think it is a good idea to shut down threads when they are not used as an initial implementation. Later, we can evaluate potential improvements, like keeping some number of threads on stand-by. http://reviews.llvm.org/D13727 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13730: Resubmit: RenderScript command for printing allocation contents
This revision was automatically updated to reflect the committed changes. Closed by commit rL250499: Resubmit: RenderScript command for printing allocation contents (authored by EwanCrawford). Changed prior to commit: http://reviews.llvm.org/D13730?vs=37356&id=37562#toc Repository: rL LLVM http://reviews.llvm.org/D13730 Files: lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/DataFormatters/FormatManager.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h === --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -202,6 +202,8 @@ void DumpKernels(Stream &strm) const; +bool DumpAllocation(Stream &strm, StackFrame* frame_ptr, const uint32_t id); + void ListAllocations(Stream &strm, StackFrame* frame_ptr, bool recompute); void AttemptBreakpointAtKernelName(Stream &strm, const char *name, Error &error, lldb::TargetSP target); @@ -298,6 +300,8 @@ void CaptureAllocationInit1(RuntimeHook* hook_info, ExecutionContext& context); void CaptureSetGlobalVar1(RuntimeHook* hook_info, ExecutionContext& context); +AllocationDetails* FindAllocByID(Stream &strm, const uint32_t alloc_id); + // // Helper functions for jitting the runtime // @@ -310,6 +314,10 @@ bool JITElementPacked(AllocationDetails* allocation, StackFrame* frame_ptr); +bool JITAllocationSize(AllocationDetails* allocation, StackFrame* frame_ptr, const uint32_t elem_size); + +bool JITAllocationStride(AllocationDetails* allocation, StackFrame* frame_ptr); + // Search for a script detail object using a target address. // If a script does not currently exist this function will return nullptr. // If 'create' is true and there is no previous script with this address, Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp === --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Host/StringConvert.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/Type.h" #include "lldb/Target/Process.h" @@ -188,6 +189,9 @@ // Maps Allocation DataKind enum to printable strings static const char* RsDataKindToString[]; +// Maps allocation types to format sizes for printing. +static const unsigned int RSTypeToFormat[][3]; + // Give each allocation an ID as a way // for commands to reference it. const unsigned int id; @@ -201,6 +205,8 @@ empirical_type type_ptr;// Pointer to the RS Type of the Allocation empirical_type element_ptr; // Pointer to the RS Element of the Type empirical_type context; // Pointer to the RS Context of the Allocation +empirical_type size;// Size of the allocation +empirical_type stride; // Stride between rows of the allocation // Give each allocation an id, so we can reference it in user commands. AllocationDetails(): id(ID++) @@ -242,6 +248,31 @@ {"bool", "bool2", "bool3", "bool4"} }; +// Used as an index into the RSTypeToFormat array elements +enum TypeToFormatIndex { + eFormatSingle = 0, + eFormatVector, + eElementSize +}; + +// { format enum of single element, format enum of element vector, size of element} +const unsigned int RenderScriptRuntime::AllocationDetails::RSTypeToFormat[][3] = +{ +{eFormatHex, eFormatHex, 1}, // RS_TYPE_NONE +{eFormatFloat, eFormatVectorOfFloat16, 2}, // RS_TYPE_FLOAT_16 +{eFormatFloat, eFormatVectorOfFloat32, sizeof(float)}, // RS_TYPE_FLOAT_32 +{eFormatFloat, eFormatVectorOfFloat64, sizeof(double)}, // RS_TYPE_FLOAT_64 +{eFormatDecimal, eFormatVectorOfSInt8, sizeof(int8_t)}, // RS_TYPE_SIGNED_8 +{eFormatDecimal, eFormatVectorOfSInt16, sizeof(int16_t)}, // RS_TYPE_SIGNED_16 +{eFormatDecimal, eFormatVectorOfSInt32, sizeof(int32_t)}, // RS_TYPE_SIGNED_32 +{eFormatDecimal, eFormatVectorOfSInt64, sizeof(int64_t)}, // RS_TYPE_SIGNED_64 +{eFormatDecimal, eFormatVectorOfUInt8, sizeof(uint8_t)}, // RS_TYPE_UNSIGNED_8 +{eFormatDecimal, eFormatVectorOfUInt16, sizeof(uint16_t)}, // RS_TYPE_UNSIGNED_16 +{eFormatDecimal,
[Lldb-commits] [lldb] r250499 - Resubmit: RenderScript command for printing allocation contents
Author: ewancrawford Date: Fri Oct 16 03:28:47 2015 New Revision: 250499 URL: http://llvm.org/viewvc/llvm-project?rev=250499&view=rev Log: Resubmit: RenderScript command for printing allocation contents Previous commit r250281 broke TestDataFormatterSmartArray.py Resolved in in this patch by adding the new enum eFormatVectorOfFloat16 to FormatManager. Differential Revision: http://reviews.llvm.org/D13730 Modified: lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/DataFormatters/FormatManager.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=250499&r1=250498&r2=250499&view=diff == --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Oct 16 03:28:47 2015 @@ -146,6 +146,7 @@ namespace lldb { eFormatVectorOfUInt32, eFormatVectorOfSInt64, eFormatVectorOfUInt64, +eFormatVectorOfFloat16, eFormatVectorOfFloat32, eFormatVectorOfFloat64, eFormatVectorOfUInt128, Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=250499&r1=250498&r2=250499&view=diff == --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Oct 16 03:28:47 2015 @@ -271,6 +271,7 @@ public: case eFormatVectorOfUInt32: case eFormatVectorOfSInt64: case eFormatVectorOfUInt64: +case eFormatVectorOfFloat16: case eFormatVectorOfFloat32: case eFormatVectorOfFloat64: case eFormatVectorOfUInt128: Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=250499&r1=250498&r2=250499&view=diff == --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Fri Oct 16 03:28:47 2015 @@ -2012,6 +2012,12 @@ DataExtractor::Dump (Stream *s, s->PutChar('}'); break; +case eFormatVectorOfFloat16: +s->PutChar('{'); +offset = Dump (s, offset, eFormatFloat, 2, item_byte_size / 2, item_byte_size / 2, LLDB_INVALID_ADDRESS, 0, 0); +s->PutChar('}'); +break; + case eFormatVectorOfFloat32: s->PutChar('{'); offset = Dump (s, offset, eFormatFloat, 4, item_byte_size / 4, item_byte_size / 4, LLDB_INVALID_ADDRESS, 0, 0); Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=250499&r1=250498&r2=250499&view=diff == --- lldb/trunk/source/DataFormatters/FormatManager.cpp (original) +++ lldb/trunk/source/DataFormatters/FormatManager.cpp Fri Oct 16 03:28:47 2015 @@ -67,6 +67,7 @@ g_format_infos[] = { eFormatVectorOfUInt32 , '\0' , "uint32_t[]" }, { eFormatVectorOfSInt64 , '\0' , "int64_t[]" }, { eFormatVectorOfUInt64 , '\0' , "uint64_t[]" }, +{ eFormatVectorOfFloat16, '\0' , "float16[]" }, { eFormatVectorOfFloat32, '\0' , "float32[]" }, { eFormatVectorOfFloat64, '\0' , "float64[]" }, { eFormatVectorOfUInt128, '\0' , "uint128_t[]" }, @@ -534,6 +535,7 @@ FormatManager::GetSingleItemFormat(lldb: case eFormatVectorOfUInt128: return eFormatHex; +case eFormatVectorOfFloat16: case eFormatVectorOfFloat32: case eFormatVectorOfFloat64: return eFormatFloat; Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=250499&r1=250498&r2=250499&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Fri Oct 16 03:28:47 2015 @@ -14,6 +
Re: [Lldb-commits] [PATCH] D13778: [SBValue] Add a method HasChildAtIndex.
labath added a subscriber: labath. labath added a comment. Not really my area, but couldn't the needed functionality be implemented on top of GetChildAtIndex(). I mean, if GetChildAtIndex(50) returns a valid SBValue, then the container has at least 50 elements, right? Then `HasAtLeastNChildren(n) == GetChildAtIndex(n).IsValid()` and we don't need to add anything to the public API. Or am I missing something here... (?) http://reviews.llvm.org/D13778 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D13754: Split Socket class into Tcp/Udp/DomainSocket subclasses.
labath added inline comments. Comment at: source/Host/posix/DomainSocket.cpp:74 @@ +73,3 @@ +FileSystem::Unlink(FileSpec{name, true}); + +Error error; If we're going to use unique names, then this won't be necessary (and I would much rather see a random error opening a socket than a random file disappearing). BTW, have you considered using abstract sockets for the lldb-server use case? Albeit linux-specific, I find them much nicer, as they have no connection to the file system whatsoever. http://reviews.llvm.org/D13754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits