diff options
40 files changed, 651 insertions, 691 deletions
diff --git a/lldb/include/lldb/API/SBBroadcaster.h b/lldb/include/lldb/API/SBBroadcaster.h index 0ef408c13ed..058cd1d4e46 100644 --- a/lldb/include/lldb/API/SBBroadcaster.h +++ b/lldb/include/lldb/API/SBBroadcaster.h @@ -39,7 +39,7 @@ public: AddListener (const lldb::SBListener &listener, uint32_t event_mask); const char * - GetName (); + GetName () const; bool EventTypeHasListeners (uint32_t event_type); diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h index 206fbbb658d..16cd3d50046 100644 --- a/lldb/include/lldb/API/SBStream.h +++ b/lldb/include/lldb/API/SBStream.h @@ -70,6 +70,7 @@ protected: friend class SBSymbolContext; friend class SBTarget; friend class SBThread; + friend class SBValue; #ifndef SWIG diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index 0a32eee6448..feeb20a06db 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -89,11 +89,14 @@ public: Dereference (); bool - TypeIsPtrType (); + TypeIsPointerType (); bool GetDescription (lldb::SBStream &description); + bool + GetExpressionPath (lldb::SBStream &description); + protected: friend class SBValueList; friend class SBFrame; diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h index 6dfdcdcf889..d0559aef1b4 100644 --- a/lldb/include/lldb/Core/Address.h +++ b/lldb/include/lldb/Core/Address.h @@ -247,21 +247,6 @@ public: uint32_t addr_byte_size = UINT32_MAX) const; //------------------------------------------------------------------ - /// Dump a debug description of this object to a Stream. - /// - /// Dump a debug description of the contents of this object to the - /// supplied stream \a s. - /// - /// The debug description contains verbose internal state such - /// and pointer values, reference counts, etc. - /// - /// @param[in] s - /// The stream to which to dump the object descripton. - //------------------------------------------------------------------ - void - DumpDebug (Stream *s) const; - - //------------------------------------------------------------------ /// Get the file address. /// /// If an address comes from a file on disk that has section diff --git a/lldb/include/lldb/Core/Broadcaster.h b/lldb/include/lldb/Core/Broadcaster.h index 217e38baa15..078aa36d47b 100644 --- a/lldb/include/lldb/Core/Broadcaster.h +++ b/lldb/include/lldb/Core/Broadcaster.h @@ -12,10 +12,10 @@ // C Includes // C++ Includes +#include <map> #include <string> #include <vector> - // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" @@ -142,6 +142,35 @@ public: const ConstString & GetBroadcasterName (); + + //------------------------------------------------------------------ + /// Get the event name(s) for one or more event bits. + /// + /// @param[in] event_mask + /// A bit mask that indicates which events to get names for. + /// + /// @return + /// The NULL terminated C string name of this Broadcaster. + //------------------------------------------------------------------ + bool + GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const; + + //------------------------------------------------------------------ + /// Set the name for an event bit. + /// + /// @param[in] event_mask + /// A bit mask that indicates which events the listener is + /// asking to monitor. + /// + /// @return + /// The NULL terminated C string name of this Broadcaster. + //------------------------------------------------------------------ + void + SetEventName (uint32_t event_mask, const char *name) + { + m_event_names[event_mask] = name; + } + bool EventTypeHasListeners (uint32_t event_type); @@ -207,13 +236,15 @@ protected: // Classes that inherit from Broadcaster can see and modify these //------------------------------------------------------------------ typedef std::vector< std::pair<Listener*,uint32_t> > collection; + typedef std::map<uint32_t, std::string> event_names_map; // Prefix the name of our member variables with "m_broadcaster_" // since this is a class that gets subclassed. const ConstString m_broadcaster_name; ///< The name of this broadcaster object. - collection m_broadcaster_listeners; ///< A list of Listener / event_mask pairs that are listening to this broadcaster. - Mutex m_broadcaster_listeners_mutex; ///< A mutex that protects \a m_broadcaster_listeners. + event_names_map m_event_names; ///< Optionally define event names for readability and logging for each event bit + collection m_listeners; ///< A list of Listener / event_mask pairs that are listening to this broadcaster. + Mutex m_listeners_mutex; ///< A mutex that protects \a m_listeners. Listener *m_hijacking_listener; // A simple mechanism to intercept events in lieu of a real Listener collection stack. - uint32_t m_hijack_mask; + uint32_t m_hijacking_mask; private: //------------------------------------------------------------------ diff --git a/lldb/include/lldb/Core/FileSpec.h b/lldb/include/lldb/Core/FileSpec.h index f2a4fd7c226..bca7c4adf53 100644 --- a/lldb/include/lldb/Core/FileSpec.h +++ b/lldb/include/lldb/Core/FileSpec.h @@ -348,10 +348,14 @@ public: /// The maximum length or \a path. /// /// @return - /// \b true if the extracted fullpath fits into \a path, \b - /// false otherwise. + /// Returns the number of characters that would be needed to + /// properly copy the full path into \a path. If the returned + /// number is less than \a max_path_length, then the path is + /// properly copied and terminated. If the return value is + /// >= \a max_path_length, then the path was truncated (but is + /// still NULL terminated). //------------------------------------------------------------------ - bool + size_t GetPath (char *path, size_t max_path_length) const; FileType diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 7267026b3da..8b1ba1c3878 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -88,7 +88,7 @@ public: } virtual void - GetExpressionPath (Stream &s);//, ValueObject *child); + GetExpressionPath (Stream &s); virtual bool IsInScope (StackFrame *frame) diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index 41677b59cb7..99154f4f1b5 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -8,24 +8,18 @@ /* Begin PBXBuildFile section */ 260C876A10F538E700BB2B04 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260C876910F538E700BB2B04 /* Foundation.framework */; }; - 2615DB851208A9C90021781D /* StopInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 2615DB841208A9C90021781D /* StopInfo.h */; }; 2615DB871208A9E40021781D /* StopInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2615DB861208A9E40021781D /* StopInfo.cpp */; }; 2615DBCA1208B5FC0021781D /* StopInfoMachException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2615DBC81208B5FC0021781D /* StopInfoMachException.cpp */; }; - 2615DBCB1208B5FC0021781D /* StopInfoMachException.h in Headers */ = {isa = PBXBuildFile; fileRef = 2615DBC91208B5FC0021781D /* StopInfoMachException.h */; }; 261744781168585B005ADD65 /* SBType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 261744771168585B005ADD65 /* SBType.cpp */; }; 2617447A11685869005ADD65 /* SBType.h in Headers */ = {isa = PBXBuildFile; fileRef = 2617447911685869005ADD65 /* SBType.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2618D7901240115500F2B8FE /* SectionLoadList.h in Headers */ = {isa = PBXBuildFile; fileRef = 2618D78F1240115500F2B8FE /* SectionLoadList.h */; }; 2618D7921240116900F2B8FE /* SectionLoadList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2618D7911240116900F2B8FE /* SectionLoadList.cpp */; }; - 2618D959124056C700F2B8FE /* NameToDIE.h in Headers */ = {isa = PBXBuildFile; fileRef = 2618D957124056C700F2B8FE /* NameToDIE.h */; }; 2618D9EB12406FE600F2B8FE /* NameToDIE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2618D9EA12406FE600F2B8FE /* NameToDIE.cpp */; }; 261B5A5411C3F2AD00AABD0A /* SharingPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 261B5A5211C3F2AD00AABD0A /* SharingPtr.cpp */; }; - 261B5A5511C3F2AD00AABD0A /* SharingPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 261B5A5311C3F2AD00AABD0A /* SharingPtr.h */; settings = {ATTRIBUTES = (Public, ); }; }; 262CFC7711A4510000946C6C /* debugserver in Resources */ = {isa = PBXBuildFile; fileRef = 26CE05A0115C31E50022F371 /* debugserver */; }; + 2635DA87127D0D0400675BC1 /* SharingPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 261B5A5311C3F2AD00AABD0A /* SharingPtr.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26368A3C126B697600E8659F /* darwin-debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26368A3B126B697600E8659F /* darwin-debug.cpp */; }; 26368AF7126B960500E8659F /* darwin-debug in Resources */ = {isa = PBXBuildFile; fileRef = 26579F68126A25920007C5CB /* darwin-debug */; }; 26424E3D125986CB0016D82C /* ValueObjectConstResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26424E3C125986CB0016D82C /* ValueObjectConstResult.cpp */; }; - 26424E3F125986D30016D82C /* ValueObjectConstResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 26424E3E125986D30016D82C /* ValueObjectConstResult.h */; }; - 264723A611FA076E00DE380C /* CleanUp.h in Headers */ = {isa = PBXBuildFile; fileRef = 264723A511FA076E00DE380C /* CleanUp.h */; }; 265ABF6310F42EE900531910 /* DebugSymbols.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 265ABF6210F42EE900531910 /* DebugSymbols.framework */; }; 2668020E115FD12C008E1FE4 /* lldb-defines.h in Headers */ = {isa = PBXBuildFile; fileRef = 26BC7C2510F1B3BC00F91463 /* lldb-defines.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2668020F115FD12C008E1FE4 /* lldb-enumerations.h in Headers */ = {isa = PBXBuildFile; fileRef = 26BC7C2610F1B3BC00F91463 /* lldb-enumerations.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -69,14 +63,13 @@ 26680336116005EF008E1FE4 /* SBBreakpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF16CC7114086A1007A7B3F /* SBBreakpointLocation.cpp */; }; 26680337116005F1008E1FE4 /* SBBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF16A9C11402D5B007A7B3F /* SBBreakpoint.cpp */; }; 2668035C11601108008E1FE4 /* LLDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26680207115FD0ED008E1FE4 /* LLDB.framework */; }; - 268F9D53123AA15200B91E9B /* SBSymbolContextList.h in Headers */ = {isa = PBXBuildFile; fileRef = 268F9D52123AA15200B91E9B /* SBSymbolContextList.h */; }; + 268F9D53123AA15200B91E9B /* SBSymbolContextList.h in Headers */ = {isa = PBXBuildFile; fileRef = 268F9D52123AA15200B91E9B /* SBSymbolContextList.h */; settings = {ATTRIBUTES = (Public, ); }; }; 268F9D55123AA16600B91E9B /* SBSymbolContextList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268F9D54123AA16600B91E9B /* SBSymbolContextList.cpp */; }; 26B42B1F1187A92B0079C8C8 /* lldb-include.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42B1E1187A92B0079C8C8 /* lldb-include.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26B42C4D1187ABA50079C8C8 /* LLDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42C4C1187ABA50079C8C8 /* LLDB.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 26C72C94124322890068DC16 /* SBStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C72C93124322890068DC16 /* SBStream.h */; }; + 26C72C94124322890068DC16 /* SBStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C72C93124322890068DC16 /* SBStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26C72C961243229A0068DC16 /* SBStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C72C951243229A0068DC16 /* SBStream.cpp */; }; 26D27C9F11ED3A4E0024D721 /* ELFHeader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */; }; - 26D27CA011ED3A4E0024D721 /* ELFHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 26D27C9E11ED3A4E0024D721 /* ELFHeader.h */; }; 26D5B06511B07550009A862E /* StoppointCallbackContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E0910F1B83100F91463 /* StoppointCallbackContext.cpp */; }; 26D5B06611B07550009A862E /* Breakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E0A10F1B83100F91463 /* Breakpoint.cpp */; }; 26D5B06711B07550009A862E /* BreakpointID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E0B10F1B83100F91463 /* BreakpointID.cpp */; }; @@ -324,53 +317,30 @@ 26F5C32D10F3DFDD009D5894 /* libtermcap.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */; }; 26F5C37510F3F61B009D5894 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C37410F3F61B009D5894 /* libobjc.dylib */; }; 26F5C39110F3FA26009D5894 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* CoreFoundation.framework */; }; - 4911934C1226383D00578B7F /* ASTStructExtractor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4911934B1226383D00578B7F /* ASTStructExtractor.h */; }; 491193521226386000578B7F /* ASTStructExtractor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 491193501226386000578B7F /* ASTStructExtractor.cpp */; }; 49307AAE11DEA4D90081F992 /* IRForTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49307AAD11DEA4D90081F992 /* IRForTarget.cpp */; }; - 49307AB211DEA4F20081F992 /* IRForTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 49307AB111DEA4F20081F992 /* IRForTarget.h */; }; 49445C2612245E3600C11A81 /* ClangExpressionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49445C2512245E3600C11A81 /* ClangExpressionParser.cpp */; }; - 49445C2A12245E5500C11A81 /* ClangExpressionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 49445C2912245E5500C11A81 /* ClangExpressionParser.h */; }; - 49445E351225AB6A00C11A81 /* ClangUserExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = 49445E341225AB6A00C11A81 /* ClangUserExpression.h */; }; 497C86BE122823D800B54702 /* ClangUtilityFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 497C86BD122823D800B54702 /* ClangUtilityFunction.cpp */; }; - 497C86C2122823F300B54702 /* ClangUtilityFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 497C86C1122823F300B54702 /* ClangUtilityFunction.h */; }; 49A8A3A011D568A300AD3B68 /* ASTResultSynthesizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49A8A39F11D568A300AD3B68 /* ASTResultSynthesizer.cpp */; }; - 49A8A3A411D568BF00AD3B68 /* ASTResultSynthesizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49A8A3A311D568BF00AD3B68 /* ASTResultSynthesizer.h */; }; - 49BB309611F79450001A4197 /* TaggedASTType.h in Headers */ = {isa = PBXBuildFile; fileRef = 49BB309511F79450001A4197 /* TaggedASTType.h */; }; 49CF982A122C70BD007A0B96 /* IRDynamicChecks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49CF9829122C70BD007A0B96 /* IRDynamicChecks.cpp */; }; - 49CF9834122C718B007A0B96 /* IRDynamicChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = 49CF9833122C718B007A0B96 /* IRDynamicChecks.h */; }; - 49D4FE831210B5FB00CDB854 /* ClangPersistentVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D4FE821210B5FB00CDB854 /* ClangPersistentVariables.h */; }; 49D4FE891210B61C00CDB854 /* ClangPersistentVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D4FE871210B61C00CDB854 /* ClangPersistentVariables.cpp */; }; - 49D7072711B5AD03001AD875 /* ClangASTSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D7072611B5AD03001AD875 /* ClangASTSource.h */; }; 49D7072911B5AD11001AD875 /* ClangASTSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D7072811B5AD11001AD875 /* ClangASTSource.cpp */; settings = {COMPILER_FLAGS = "-fno-rtti"; }; }; 49DA743011DE6A5A006AEF7E /* IRToDWARF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49DA742F11DE6A5A006AEF7E /* IRToDWARF.cpp */; }; - 49DA743511DE6BB2006AEF7E /* IRToDWARF.h in Headers */ = {isa = PBXBuildFile; fileRef = 49DA743411DE6BB2006AEF7E /* IRToDWARF.h */; }; - 49E45FAA11F660DC008F7B28 /* ClangASTType.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E45FA911F660DC008F7B28 /* ClangASTType.h */; }; 49E45FAF11F660FE008F7B28 /* ClangASTType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */; }; 49F1A74611B3388F003ED505 /* ClangExpressionDeclMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */; }; - 49F1A74A11B338AE003ED505 /* ClangExpressionDeclMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 49F1A74911B338AE003ED505 /* ClangExpressionDeclMap.h */; }; 49FB515E121481B000DF8983 /* DWARFExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7ED810F1B86700F91463 /* DWARFExpression.cpp */; }; 4C08CDE811C81EF8001610A8 /* ThreadSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */; }; - 4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */; }; 4C0A91D812511CB900CA6636 /* AppleObjCTrampolineHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0A91D412511CB900CA6636 /* AppleObjCTrampolineHandler.cpp */; }; - 4C0A91D912511CB900CA6636 /* AppleObjCTrampolineHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C0A91D512511CB900CA6636 /* AppleObjCTrampolineHandler.h */; }; 4C0A91DA12511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0A91D612511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */; }; - 4C0A91DB12511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C0A91D712511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h */; }; 4C139EA5124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */; }; - 4C139EA6124A8B03000BFF8D /* AppleObjCRuntimeV2.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */; }; 4C1AB23B1263E5F400D0F04A /* ThreadPlanTestCondition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C1AB23A1263E5F400D0F04A /* ThreadPlanTestCondition.cpp */; }; - 4C1AB23F1263E61100D0F04A /* ThreadPlanTestCondition.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1AB23E1263E61100D0F04A /* ThreadPlanTestCondition.h */; }; 4C5DBBC811E3FEC60035160F /* CommandObjectCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */; }; - 4C5DBBC911E3FEC60035160F /* CommandObjectCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */; }; 4C74CB6312288704006A8171 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C74CB6212288704006A8171 /* Carbon.framework */; }; 4CA9637B11B6E99A00780E28 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; }; - 4CB4430B12491DDA00C13DC2 /* LanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB4430912491DDA00C13DC2 /* LanguageRuntime.h */; }; 4CB4430C12491DDA00C13DC2 /* LanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB4430A12491DDA00C13DC2 /* LanguageRuntime.cpp */; }; - 4CB4436B124944B000C13DC2 /* ItaniumABILanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB44369124944B000C13DC2 /* ItaniumABILanguageRuntime.h */; }; 4CB4436C124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB4436A124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp */; }; - 4CB443BD1249920C00C13DC2 /* CPPLanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB443BB1249920C00C13DC2 /* CPPLanguageRuntime.h */; }; 4CB443BE1249920C00C13DC2 /* CPPLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB443BC1249920C00C13DC2 /* CPPLanguageRuntime.cpp */; }; 4CB443F312499B5000C13DC2 /* ObjCLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB443F212499B5000C13DC2 /* ObjCLanguageRuntime.cpp */; }; - 4CB443F712499B6E00C13DC2 /* ObjCLanguageRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB443F612499B6E00C13DC2 /* ObjCLanguageRuntime.h */; }; 69A01E211236C5D400C660B5 /* Condition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69A01E1B1236C5D400C660B5 /* Condition.cpp */; }; 69A01E221236C5D400C660B5 /* Host.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69A01E1C1236C5D400C660B5 /* Host.cpp */; }; 69A01E241236C5D400C660B5 /* Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69A01E1E1236C5D400C660B5 /* Mutex.cpp */; }; @@ -381,13 +351,10 @@ 961FABBD1235DE1600F93A47 /* UnwindTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 961FABBA1235DE1600F93A47 /* UnwindTable.cpp */; }; 961FABE51235F15900F93A47 /* UnwindAssemblyProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 961FABE41235F15900F93A47 /* UnwindAssemblyProfiler.cpp */; }; 961FABEA1235F26800F93A47 /* UnwindAssemblyProfiler-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 961FABE81235F26800F93A47 /* UnwindAssemblyProfiler-x86.cpp */; }; - 961FABEB1235F26800F93A47 /* UnwindAssemblyProfiler-x86.h in Headers */ = {isa = PBXBuildFile; fileRef = 961FABE91235F26800F93A47 /* UnwindAssemblyProfiler-x86.h */; }; 961FAC19123605A200F93A47 /* ArchDefaultUnwindPlan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 961FAC18123605A200F93A47 /* ArchDefaultUnwindPlan.cpp */; }; 961FAC1E12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 961FAC1C12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.cpp */; }; - 961FAC1F12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.h in Headers */ = {isa = PBXBuildFile; fileRef = 961FAC1D12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.h */; }; 96A6D9C61249D96F00250B38 /* ArchVolatileRegs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 96A6D9C51249D96F00250B38 /* ArchVolatileRegs.cpp */; }; 96A6D9C91249D98800250B38 /* ArchVolatileRegs-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 96A6D9C71249D98800250B38 /* ArchVolatileRegs-x86.cpp */; }; - 96A6D9CA1249D98800250B38 /* ArchVolatileRegs-x86.h in Headers */ = {isa = PBXBuildFile; fileRef = 96A6D9C81249D98800250B38 /* ArchVolatileRegs-x86.h */; }; 9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; }; 9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -396,7 +363,6 @@ 9A357673116E7B6400E8ED2F /* SBStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A357672116E7B6400E8ED2F /* SBStringList.cpp */; }; 9A3576A8116E9AB700E8ED2F /* SBHostOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A3576A7116E9AB700E8ED2F /* SBHostOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9A3576AA116E9AC700E8ED2F /* SBHostOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3576A9116E9AC700E8ED2F /* SBHostOS.cpp */; }; - 9A4633DB11F65D8600955CE1 /* UserSettingsController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A4633DA11F65D8600955CE1 /* UserSettingsController.h */; }; 9A4633DD11F65D9A00955CE1 /* UserSettingsController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4633DC11F65D9A00955CE1 /* UserSettingsController.cpp */; }; 9AA69DA61188F52100D753A0 /* PseudoTerminal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2682F16A115EDA0D00CCFF99 /* PseudoTerminal.cpp */; }; 9AA69DAF118A023300D753A0 /* SBInputReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AA69DAE118A023300D753A0 /* SBInputReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -406,9 +372,7 @@ 9AC703AF117675410086C050 /* SBInstruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC703AE117675410086C050 /* SBInstruction.cpp */; }; 9AC703B1117675490086C050 /* SBInstructionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC703B0117675490086C050 /* SBInstructionList.cpp */; }; AF68D2561255416E002FF25B /* RegisterContextLLDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF68D2541255416E002FF25B /* RegisterContextLLDB.cpp */; }; - AF68D2571255416E002FF25B /* RegisterContextLLDB.h in Headers */ = {isa = PBXBuildFile; fileRef = AF68D2551255416E002FF25B /* RegisterContextLLDB.h */; }; AF68D3311255A111002FF25B /* UnwindLLDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */; }; - AF68D3321255A111002FF25B /* UnwindLLDB.h in Headers */ = {isa = PBXBuildFile; fileRef = AF68D3301255A110002FF25B /* UnwindLLDB.h */; }; AF94005911C03F6500085DB9 /* SymbolVendor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF94005711C03F6500085DB9 /* SymbolVendor.cpp */; }; /* End PBXBuildFile section */ @@ -2351,85 +2315,49 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 2668020E115FD12C008E1FE4 /* lldb-defines.h in Headers */, + 2668020F115FD12C008E1FE4 /* lldb-enumerations.h in Headers */, + 26DE1E6C11616C2E00A093E2 /* lldb-forward.h in Headers */, + 26DE1E6B11616C2E00A093E2 /* lldb-forward-rtti.h in Headers */, + 26B42B1F1187A92B0079C8C8 /* lldb-include.h in Headers */, + 26680214115FD12C008E1FE4 /* lldb-types.h in Headers */, + 26B42C4D1187ABA50079C8C8 /* LLDB.h in Headers */, + 26DE204311618ACA00A093E2 /* SBAddress.h in Headers */, + 26DE205711618FC500A093E2 /* SBBlock.h in Headers */, 26680219115FD13D008E1FE4 /* SBBreakpoint.h in Headers */, 2668021A115FD13D008E1FE4 /* SBBreakpointLocation.h in Headers */, 2668021B115FD13D008E1FE4 /* SBBroadcaster.h in Headers */, 2668021D115FD13D008E1FE4 /* SBCommandInterpreter.h in Headers */, 2668021E115FD13D008E1FE4 /* SBCommandReturnObject.h in Headers */, 2668021F115FD13D008E1FE4 /* SBCommunication.h in Headers */, + 26DE205511618FB800A093E2 /* SBCompileUnit.h in Headers */, 26680220115FD13D008E1FE4 /* SBDebugger.h in Headers */, 26680221115FD13D008E1FE4 /* SBDefines.h in Headers */, 26680222115FD13D008E1FE4 /* SBError.h in Headers */, 26680223115FD13D008E1FE4 /* SBEvent.h in Headers */, 26680224115FD13D008E1FE4 /* SBFileSpec.h in Headers */, 26680225115FD13D008E1FE4 /* SBFrame.h in Headers */, + 26DE205311618FAC00A093E2 /* SBFunction.h in Headers */, + 9A3576A8116E9AB700E8ED2F /* SBHostOS.h in Headers */, + 9AA69DAF118A023300D753A0 /* SBInputReader.h in Headers */, + 9AC7038E117674FB0086C050 /* SBInstruction.h in Headers */, + 9AC70390117675270086C050 /* SBInstructionList.h in Headers */, + 26DE205911618FE700A093E2 /* SBLineEntry.h in Headers */, 26680227115FD13D008E1FE4 /* SBListener.h in Headers */, + 26DE204F11618E9800A093E2 /* SBModule.h in Headers */, 2668022A115FD13D008E1FE4 /* SBProcess.h in Headers */, 2668022B115FD13D008E1FE4 /* SBSourceManager.h in Headers */, + 26C72C94124322890068DC16 /* SBStream.h in Headers */, + 9A357671116E7B5200E8ED2F /* SBStringList.h in Headers */, + 26DE205B11618FF600A093E2 /* SBSymbol.h in Headers */, + 26DE204111618AB900A093E2 /* SBSymbolContext.h in Headers */, + 268F9D53123AA15200B91E9B /* SBSymbolContextList.h in Headers */, 2668022C115FD13D008E1FE4 /* SBTarget.h in Headers */, 2668022E115FD13D008E1FE4 /* SBThread.h in Headers */, - 2668020E115FD12C008E1FE4 /* lldb-defines.h in Headers */, - 2668020F115FD12C008E1FE4 /* lldb-enumerations.h in Headers */, - 26680214115FD12C008E1FE4 /* lldb-types.h in Headers */, - 26DE1E6B11616C2E00A093E2 /* lldb-forward-rtti.h in Headers */, - 26DE1E6C11616C2E00A093E2 /* lldb-forward.h in Headers */, - 26DE204111618AB900A093E2 /* SBSymbolContext.h in Headers */, - 26DE204311618ACA00A093E2 /* SBAddress.h in Headers */, - 26DE204F11618E9800A093E2 /* SBModule.h in Headers */, - 26DE205311618FAC00A093E2 /* SBFunction.h in Headers */, - 26DE205511618FB800A093E2 /* SBCompileUnit.h in Headers */, - 26DE205711618FC500A093E2 /* SBBlock.h in Headers */, - 26DE205911618FE700A093E2 /* SBLineEntry.h in Headers */, - 26DE205B11618FF600A093E2 /* SBSymbol.h in Headers */, - 9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */, 2617447A11685869005ADD65 /* SBType.h in Headers */, + 9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */, 9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */, - 9A357671116E7B5200E8ED2F /* SBStringList.h in Headers */, - 9A3576A8116E9AB700E8ED2F /* SBHostOS.h in Headers */, - 9AC7038E117674FB0086C050 /* SBInstruction.h in Headers */, - 9AC70390117675270086C050 /* SBInstructionList.h in Headers */, - 26B42B1F1187A92B0079C8C8 /* lldb-include.h in Headers */, - 26B42C4D1187ABA50079C8C8 /* LLDB.h in Headers */, - 9AA69DAF118A023300D753A0 /* SBInputReader.h in Headers */, - 49F1A74A11B338AE003ED505 /* ClangExpressionDeclMap.h in Headers */, - 49D7072711B5AD03001AD875 /* ClangASTSource.h in Headers */, - 261B5A5511C3F2AD00AABD0A /* SharingPtr.h in Headers */, - 4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */, - 49A8A3A411D568BF00AD3B68 /* ASTResultSynthesizer.h in Headers */, - 49DA743511DE6BB2006AEF7E /* IRToDWARF.h in Headers */, - 49307AB211DEA4F20081F992 /* IRForTarget.h in Headers */, - 4C5DBBC911E3FEC60035160F /* CommandObjectCommands.h in Headers */, - 26D27CA011ED3A4E0024D721 /* ELFHeader.h in Headers */, - 9A4633DB11F65D8600955CE1 /* UserSettingsController.h in Headers */, - 49E45FAA11F660DC008F7B28 /* ClangASTType.h in Headers */, - 49BB309611F79450001A4197 /* TaggedASTType.h in Headers */, - 264723A611FA076E00DE380C /* CleanUp.h in Headers */, - 2615DB851208A9C90021781D /* StopInfo.h in Headers */, - 2615DBCB1208B5FC0021781D /* StopInfoMachException.h in Headers */, - 49D4FE831210B5FB00CDB854 /* ClangPersistentVariables.h in Headers */, - 49445C2A12245E5500C11A81 /* ClangExpressionParser.h in Headers */, - 49445E351225AB6A00C11A81 /* ClangUserExpression.h in Headers */, - 4911934C1226383D00578B7F /* ASTStructExtractor.h in Headers */, - 497C86C2122823F300B54702 /* ClangUtilityFunction.h in Headers */, - 49CF9834122C718B007A0B96 /* IRDynamicChecks.h in Headers */, - 961FABEB1235F26800F93A47 /* UnwindAssemblyProfiler-x86.h in Headers */, - 961FAC1F12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.h in Headers */, - 268F9D53123AA15200B91E9B /* SBSymbolContextList.h in Headers */, - 2618D7901240115500F2B8FE /* SectionLoadList.h in Headers */, - 2618D959124056C700F2B8FE /* NameToDIE.h in Headers */, - 26C72C94124322890068DC16 /* SBStream.h in Headers */, - 4CB4430B12491DDA00C13DC2 /* LanguageRuntime.h in Headers */, - 4CB4436B124944B000C13DC2 /* ItaniumABILanguageRuntime.h in Headers */, - 4CB443BD1249920C00C13DC2 /* CPPLanguageRuntime.h in Headers */, - 4CB443F712499B6E00C13DC2 /* ObjCLanguageRuntime.h in Headers */, - 96A6D9CA1249D98800250B38 /* ArchVolatileRegs-x86.h in Headers */, - 4C139EA6124A8B03000BFF8D /* AppleObjCRuntimeV2.h in Headers */, - 4C0A91D912511CB900CA6636 /* AppleObjCTrampolineHandler.h in Headers */, - 4C0A91DB12511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h in Headers */, - AF68D2571255416E002FF25B /* RegisterContextLLDB.h in Headers */, - AF68D3321255A111002FF25B /* UnwindLLDB.h in Headers */, - 26424E3F125986D30016D82C /* ValueObjectConstResult.h in Headers */, - 4C1AB23F1263E61100D0F04A /* ThreadPlanTestCondition.h in Headers */, + 2635DA87127D0D0400675BC1 /* SharingPtr.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp index 86d7fcb752a..618a2f54905 100644 --- a/lldb/source/API/SBAddress.cpp +++ b/lldb/source/API/SBAddress.cpp @@ -25,31 +25,15 @@ SBAddress::SBAddress () : SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (lldb_object_ptr) m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr)); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBAddress::SBAddress (lldb_object_ptr=%p) " - "=> this.ap = %p (%s)", lldb_object_ptr, m_opaque_ap.get(), sstr.GetData()); - } } SBAddress::SBAddress (const SBAddress &rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (rhs.IsValid()) m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get())); - - if (log) - log->Printf ("SBAddress::SBAddress (rhs.m_opaque_ap = %p) => this.ap = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); } SBAddress::~SBAddress () @@ -59,17 +43,8 @@ SBAddress::~SBAddress () const SBAddress & SBAddress::operator = (const SBAddress &rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (this != &rhs) - { - if (rhs.IsValid()) - m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get())); - } - if (log) - log->Printf ("SBAddress::operator= (rhs.ap = %p) => this.ap = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); - + if (this != &rhs && rhs.IsValid()) + m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get())); return *this; } @@ -113,21 +88,18 @@ lldb::addr_t SBAddress::GetLoadAddress (const SBTarget &target) const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBAddress::GetLoadAddress"); if (m_opaque_ap.get()) { lldb::addr_t addr = m_opaque_ap->GetLoadAddress (target.get()); if (log) - log->Printf ("SBAddress::GetLoadAddress (target.sp=%p) => %p", target.get(), addr); + log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%llx", target.get(), addr); return addr; } else { if (log) - log->Printf ("SBAddress::GetLoadAddress (target.sp=%p) => LLDB_INVALID_ADDRESS", target.get()); + log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS", target.get()); return LLDB_INVALID_ADDRESS; } } @@ -183,11 +155,11 @@ SBAddress::get () bool SBAddress::GetDescription (SBStream &description) { + // Call "ref()" on the stream to make sure it creates a backing stream in + // case there isn't one already... description.ref(); if (m_opaque_ap.get()) - { - m_opaque_ap->DumpDebug (description.get()); - } + m_opaque_ap->Dump (description.get(), NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4); else description.Printf ("No value"); diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index d14865902b0..cb936241efa 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -242,7 +242,7 @@ SBBreakpointLocation::GetBreakpoint () { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBBreakpointLocation::GetBreakpoint (this.sp=%p) => SBBreakpoint: m_opaque_sp=%p, '%s'", + log->Printf ("SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s", m_opaque_sp.get(), sb_bp.get(), sstr.GetData()); } return sb_bp; diff --git a/lldb/source/API/SBBroadcaster.cpp b/lldb/source/API/SBBroadcaster.cpp index ba6bc2f591f..348b710bdd8 100644 --- a/lldb/source/API/SBBroadcaster.cpp +++ b/lldb/source/API/SBBroadcaster.cpp @@ -37,7 +37,7 @@ SBBroadcaster::SBBroadcaster (const char *name) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (name='%s') => SBBroadcaster(%p)", + log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)", name, m_opaque); } @@ -111,10 +111,10 @@ SBBroadcaster::AddListener (const SBListener &listener, uint32_t event_mask) } const char * -SBBroadcaster::GetName () +SBBroadcaster::GetName () const { if (m_opaque) - return m_opaque->GetBroadcasterName().AsCString(); + return m_opaque->GetBroadcasterName().GetCString(); return NULL; } diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index 0c30ac93672..d5ccd20e417 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -73,8 +73,8 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command_line='%s', result=%p, add_to_history=%i)", - m_opaque_ptr, command_line, &result, add_to_history); + log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)", + m_opaque_ptr, command_line, result.get(), add_to_history); result.Clear(); if (m_opaque_ptr) @@ -93,8 +93,8 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb { SBStream sstr; result.GetDescription (sstr); - log->Printf ("SBCommandInterpreter(%p)::HandleCommand (\"%s\") => SBCommandReturnObject(%p): '%s'", - m_opaque_ptr, command_line, result.get(), sstr.GetData()); + log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p): %s, add_to_history=%i) => %i", + m_opaque_ptr, command_line, result.get(), sstr.GetData(), add_to_history, result.GetStatus()); } return result.GetStatus(); diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp index d4091ce49bf..778ecb0e4c3 100644 --- a/lldb/source/API/SBCommandReturnObject.cpp +++ b/lldb/source/API/SBCommandReturnObject.cpp @@ -19,10 +19,6 @@ using namespace lldb_private; SBCommandReturnObject::SBCommandReturnObject () : m_opaque_ap (new CommandReturnObject ()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBCommandReturnObject::SBCommandReturnObject () => this.ap = %p", m_opaque_ap.get()); } SBCommandReturnObject::~SBCommandReturnObject () @@ -42,20 +38,17 @@ SBCommandReturnObject::GetOutput () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommandReturnObject::GetOutput ()"); - if (m_opaque_ap.get()) { if (log) - log->Printf ("SBCommandReturnObject::GetOutput (this.ap=%p) => '%s'", m_opaque_ap.get(), + log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"", m_opaque_ap.get(), m_opaque_ap->GetOutputStream().GetData()); return m_opaque_ap->GetOutputStream().GetData(); } if (log) - log->Printf ("SBCommandReturnObject::GetOutput (this.ap=%p) => 'NULL'", m_opaque_ap.get()); + log->Printf ("SBCommandReturnObject(%p)::GetOutput () => NULL", m_opaque_ap.get()); return NULL; } @@ -65,20 +58,17 @@ SBCommandReturnObject::GetError () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommandReturnObject::GetError ()"); - if (m_opaque_ap.get()) { if (log) - log->Printf ("SBCommandReturnObject::GetError (this.ap=%p) => '%s'", m_opaque_ap.get(), + log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"", m_opaque_ap.get(), m_opaque_ap->GetErrorStream().GetData()); return m_opaque_ap->GetErrorStream().GetData(); } if (log) - log->Printf ("SBCommandReturnObject::GetError (this.ap=%p) => 'NULL'", m_opaque_ap.get()); + log->Printf ("SBCommandReturnObject(%p)::GetError () => NULL", m_opaque_ap.get()); return NULL; } diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp index e628e228b85..fca4882f523 100644 --- a/lldb/source/API/SBCommunication.cpp +++ b/lldb/source/API/SBCommunication.cpp @@ -31,8 +31,8 @@ SBCommunication::SBCommunication(const char * broadcaster_name) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommunication::SBCommunication (broadcaster_name='%s') => " - "SBCommunication(%p): owned = 1", broadcaster_name, m_opaque); + log->Printf ("SBCommunication::SBCommunication (broadcaster_name=\"%s\") => " + "SBCommunication(%p)", broadcaster_name, m_opaque); } SBCommunication::~SBCommunication() diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp index f93e0121ab8..39505075847 100644 --- a/lldb/source/API/SBCompileUnit.cpp +++ b/lldb/source/API/SBCompileUnit.cpp @@ -27,15 +27,6 @@ SBCompileUnit::SBCompileUnit () : SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr=%p)" - " => this.obj = %p (%s)", lldb_object_ptr, m_opaque_ptr, sstr.GetData()); - } } SBCompileUnit::~SBCompileUnit () @@ -69,9 +60,6 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCompileUnit::GetLineEntryAtIndex (this.obj=%p, idx=%d)", m_opaque_ptr, idx); - SBLineEntry sb_line_entry; if (m_opaque_ptr) { @@ -88,8 +76,8 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const { SBStream sstr; sb_line_entry.GetDescription (sstr); - log->Printf ("SBCompileUnit::GetLineEntryAtIndex (this.obj=%p, idx=%d) => SBLineEntry: '%s'", m_opaque_ptr, - idx, sstr.GetData()); + log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'", + m_opaque_ptr, idx, sb_line_entry.get(), sstr.GetData()); } return sb_line_entry; @@ -100,14 +88,7 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - //{ - // SBStream sstr; - // inline_file_spec->GetDescription (sstr); - // log->Printf ("SBCompileUnit::FindLineEntryIndex (this.obj=%p, start_idx=%d, line=%d, inline_file_spec='%s')", - // m_opaque_ptr, start_idx, line, sstr.GetData()); - //} - + uint32_t index = UINT32_MAX; if (m_opaque_ptr) { FileSpec file_spec; @@ -117,30 +98,28 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec file_spec = *m_opaque_ptr; - uint32_t ret_value = m_opaque_ptr->FindLineEntry (start_idx, - line, - inline_file_spec ? inline_file_spec->get() : NULL, - NULL); - if (log) - { - SBStream sstr; - inline_file_spec->GetDescription (sstr); - log->Printf ("SBCompileUnit::FindLineEntryIndex(this.obj=%p, start_idx=%d, line=%d, inline_file_spec='%s')" - "=> '%d'", m_opaque_ptr, start_idx, line, sstr.GetData(), ret_value); - } - - return ret_value; + index = m_opaque_ptr->FindLineEntry (start_idx, + line, + inline_file_spec ? inline_file_spec->get() : NULL, + NULL); } if (log) { SBStream sstr; - inline_file_spec->GetDescription (sstr); - log->Printf ("SBCompileUnit::FindLineEntryIndex (this.obj=%p, start_idx=%d, line=%d, inline_file_spec='%s')" - " => '%d'", m_opaque_ptr, start_idx, line, sstr.GetData(), UINT32_MAX); + if (index == UINT32_MAX) + { + log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => NOT FOUND", + m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL); + } + else + { + log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => %u", + m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL, index); + } } - return UINT32_MAX; + return index; } bool diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index a0aa1257571..cf49d754da7 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -118,8 +118,8 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), - fh, (transfer_ownership ? "true" : "false")); + log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(), + fh, transfer_ownership); if (m_opaque_sp) m_opaque_sp->SetInputFileHandle (fh, transfer_ownership); @@ -132,8 +132,8 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership) if (log) - log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), - fh, (transfer_ownership ? "true" : "false")); + log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(), + fh, transfer_ownership); if (m_opaque_sp) m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership); @@ -146,8 +146,8 @@ SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership) if (log) - log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), - fh, (transfer_ownership ? "true" : "false")); + log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(), + fh, transfer_ownership); if (m_opaque_sp) m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership); @@ -459,7 +459,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename, Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename='%s', tiple = %s) => SBTarget(%p)", + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)", m_opaque_sp.get(), filename, target_triple, target.get()); } @@ -511,7 +511,7 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn if (log) { - log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename='%s', arch = %s) => SBTarget(%p)", + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)", m_opaque_sp.get(), filename, archname, target.get()); } @@ -553,7 +553,7 @@ SBDebugger::CreateTarget (const char *filename) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - log->Printf ("SBDebugger(%p)::CreateTarget (filename='%s') => SBTarget(%p)", + log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)", m_opaque_sp.get(), filename, target.get()); } return target; @@ -636,8 +636,8 @@ SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data='%s', size_t=%d)", m_opaque_sp.get(), - baton, (const char *) data, (uint32_t) data_len); + log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data=\"%.*s\", size_t=%zu)", m_opaque_sp.get(), + baton, (int) data_len, (const char *) data, data_len); if (m_opaque_sp) m_opaque_sp->DispatchInput ((const char *) data, data_len); @@ -756,7 +756,7 @@ SBDebugger::GetPrompt() const Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger(%p)::GetPrompt () => '%s'", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", m_opaque_sp.get(), (m_opaque_sp ? m_opaque_sp->GetPrompt() : "")); if (m_opaque_sp) @@ -815,7 +815,7 @@ SBDebugger::GetDescription (SBStream &description) { const char *name = m_opaque_sp->GetInstanceName().AsCString(); lldb::user_id_t id = m_opaque_sp->GetID(); - description.Printf ("Debugger (instance: '%s', id: %d)", name, id); + description.Printf ("Debugger (instance: \"%s\", id: %d)", name, id); } else description.Printf ("No value"); diff --git a/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp index 229b894e799..935a869e57b 100644 --- a/lldb/source/API/SBError.cpp +++ b/lldb/source/API/SBError.cpp @@ -26,18 +26,8 @@ SBError::SBError () : SBError::SBError (const SBError &rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (rhs.IsValid()) m_opaque_ap.reset (new Error(*rhs)); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBError::SBError (const SBError rhs.ap=%p) => SBError(%p): %s", - rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData()); - } } @@ -48,8 +38,6 @@ SBError::~SBError() const SBError & SBError::operator = (const SBError &rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - void *old_error = m_opaque_ap.get(); if (rhs.IsValid()) { if (m_opaque_ap.get()) @@ -58,17 +46,7 @@ SBError::operator = (const SBError &rhs) m_opaque_ap.reset (new Error(*rhs)); } else - { m_opaque_ap.reset(); - } - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBError(%p)::operator= (SBError(%p)) => SBError(%s)", - old_error, rhs.m_opaque_ap.get(), sstr.GetData()); - } return *this; } diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp index d5653dfb7e0..a976c42037a 100644 --- a/lldb/source/API/SBEvent.cpp +++ b/lldb/source/API/SBEvent.cpp @@ -33,26 +33,12 @@ SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len) : m_event_sp (new Event (event_type, new EventDataBytes (cstr, cstr_len))), m_opaque (m_event_sp.get()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - log->Printf ("SBEvent::SBEvent (event_type=0x%8.8x, cstr='%s', cstr_len=%d) => SBEvent(%p)", - event_type, - cstr, - cstr_len, - m_opaque); - } } SBEvent::SBEvent (EventSP &event_sp) : m_event_sp (event_sp), m_opaque (event_sp.get()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBEvent::SBEvent (event_sp=%p) => SBEvent(%p)", event_sp.get(), m_opaque); } SBEvent::~SBEvent() @@ -79,7 +65,14 @@ SBEvent::GetType () const event_type = lldb_event->GetType(); if (log) - log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", get(), event_type); + { + StreamString sstr; + if (lldb_event && lldb_event->GetBroadcaster() && lldb_event->GetBroadcaster()->GetEventNames(sstr, event_type, true)) + log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x (%s)", get(), event_type, sstr.GetData()); + else + log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", get(), event_type); + + } return event_type; } @@ -98,28 +91,26 @@ bool SBEvent::BroadcasterMatchesPtr (const SBBroadcaster *broadcaster) { if (broadcaster) - { - Event *lldb_event = get(); - if (lldb_event) - return lldb_event->BroadcasterIs (broadcaster->get()); - } + return BroadcasterMatchesRef (*broadcaster); return false; } bool SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); Event *lldb_event = get(); bool success = false; if (lldb_event) success = lldb_event->BroadcasterIs (broadcaster.get()); + // For logging, this gets a little chatty so only enable this when verbose logging is on + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p)) => %i", + log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i", get(), broadcaster.get(), + broadcaster.GetName(), success); return success; @@ -181,7 +172,7 @@ SBEvent::GetCStringFromEvent (const SBEvent &event) Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBEvent(%p)::GetCStringFromEvent () => '%s'", + log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"", event.get(), reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()))); diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp index 9aa3f8ace8f..fc223405eb5 100644 --- a/lldb/source/API/SBFileSpec.cpp +++ b/lldb/source/API/SBFileSpec.cpp @@ -34,7 +34,7 @@ SBFileSpec::SBFileSpec (const SBFileSpec &rhs) : { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => SBFileSpec(%p) ('%s')", + log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => SBFileSpec(%p): %s", rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData()); } } @@ -51,7 +51,7 @@ SBFileSpec::SBFileSpec (const char *path, bool resolve) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec::SBFileSpec (path='%s', resolve=%i) => SBFileSpec(%p)", path, + log->Printf ("SBFileSpec::SBFileSpec (path=\"%s\", resolve=%i) => SBFileSpec(%p)", path, resolve, m_opaque_ap.get()); } @@ -114,7 +114,12 @@ SBFileSpec::GetFilename() const Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s ? s : ""); + { + if (s) + log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s); + else + log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get()); + } return s; } @@ -127,7 +132,12 @@ SBFileSpec::GetDirectory() const s = m_opaque_ap->GetDirectory().AsCString(); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", m_opaque_ap.get(), s ? s : ""); + { + if (s) + log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", m_opaque_ap.get(), s); + else + log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL", m_opaque_ap.get()); + } return s; } @@ -136,22 +146,17 @@ SBFileSpec::GetPath (char *dst_path, size_t dst_len) const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - uint32_t result; + uint32_t result = 0; if (m_opaque_ap.get()) - { result = m_opaque_ap->GetPath (dst_path, dst_len); - if (log) - log->Printf ("SBFileSpec(%p)::GetPath (dst_path, dst_len) => dst_path='%s', dst_len='%d', " - "result='%d'", m_opaque_ap.get(), dst_path, (uint32_t) dst_len, result); - return result; - } if (log) - log->Printf ("SBFileSpec(%p)::GetPath (dst_path, dst_len) => NULL (0)", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%zu) => %u", + m_opaque_ap.get(), result, dst_path, dst_len, result); - if (dst_path && dst_len) + if (result == 0 && dst_path && dst_len > 0) *dst_path = '\0'; - return 0; + return result; } @@ -195,14 +200,9 @@ SBFileSpec::GetDescription (SBStream &description) const { if (m_opaque_ap.get()) { - const char *filename = GetFilename(); - const char *dir_name = GetDirectory(); - if (!filename && !dir_name) - description.Printf ("No value"); - else if (!dir_name) - description.Printf ("%s", filename); - else - description.Printf ("%s/%s", dir_name, filename); + char path[PATH_MAX]; + if (m_opaque_ap->GetPath(path, sizeof(path))) + description.Printf ("%s", path); } else description.Printf ("No value"); diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index cb03d69d119..1d9080825d1 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -210,7 +210,7 @@ SBFrame::GetPC () const Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame(%p)::GetPC () => %0xllx", m_opaque_sp.get(), addr); + log->Printf ("SBFrame(%p)::GetPC () => 0x%llx", m_opaque_sp.get(), addr); return addr; } @@ -239,7 +239,7 @@ SBFrame::GetSP () const addr = m_opaque_sp->GetRegisterContext()->GetSP(); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame(%p)::GetSP () => %0xllx", m_opaque_sp.get(), addr); + log->Printf ("SBFrame(%p)::GetSP () => 0x%llx", m_opaque_sp.get(), addr); return addr; } @@ -254,7 +254,7 @@ SBFrame::GetFP () const Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame(%p)::GetFP () => %0xllx", m_opaque_sp.get(), addr); + log->Printf ("SBFrame(%p)::GetFP () => 0x%llx", m_opaque_sp.get(), addr); return addr; } @@ -536,11 +536,8 @@ SBFrame::GetDescription (SBStream &description) { if (m_opaque_sp) { - SBLineEntry line_entry = GetLineEntry (); - SBFileSpec file_spec = line_entry.GetFileSpec (); - uint32_t line = line_entry.GetLine (); - description.Printf("SBFrame: idx = %u ('%s', %s, line %d)", m_opaque_sp->GetFrameIndex(), - GetFunction().GetName(), file_spec.GetFilename(), line); + Stream &s = description.ref(); + m_opaque_sp->DumpUsingSettingsFormat (&s); } else description.Printf ("No value"); @@ -553,7 +550,7 @@ SBFrame::EvaluateExpression (const char *expr) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - lldb::SBValue expr_result_value; + lldb::SBValue expr_result; if (log) log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\")...", m_opaque_sp.get(), expr); @@ -567,11 +564,11 @@ SBFrame::EvaluateExpression (const char *expr) if (exe_ctx.target) prefix = exe_ctx.target->GetExpressionPrefixContentsAsCString(); - *expr_result_value = ClangUserExpression::Evaluate (exe_ctx, expr, prefix); + *expr_result = ClangUserExpression::Evaluate (exe_ctx, expr, prefix); } if (log) - log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr_result_value.get()); + log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr, expr_result.get()); - return expr_result_value; + return expr_result; } diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp index 2efd37c31ba..34f879af709 100644 --- a/lldb/source/API/SBFunction.cpp +++ b/lldb/source/API/SBFunction.cpp @@ -30,16 +30,6 @@ SBFunction::SBFunction () : SBFunction::SBFunction (lldb_private::Function *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBFunction::SBFunction (lldb_object_ptr=%p) => this.obj = %p ('%s')", lldb_object_ptr, - m_opaque_ptr, sstr.GetData()); - - } } SBFunction::~SBFunction () @@ -56,30 +46,36 @@ SBFunction::IsValid () const const char * SBFunction::GetName() const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFunction::GetName ()"); - + const char *cstr = NULL; if (m_opaque_ptr) - { - if (log) - log->Printf ("SBFunction::GetName (this.obj=%p) => '%s'", m_opaque_ptr, - m_opaque_ptr->GetMangled().GetName().AsCString()); - return m_opaque_ptr->GetMangled().GetName().AsCString(); - } + cstr = m_opaque_ptr->GetMangled().GetName().AsCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFunction::GetName (this.obj=%p) => NULL", m_opaque_ptr); - return NULL; + { + if (cstr) + log->Printf ("SBFunction(%p)::GetName () => \"%s\"", m_opaque_ptr, cstr); + else + log->Printf ("SBFunction(%p)::GetName () => NULL", m_opaque_ptr); + } + return cstr; } const char * SBFunction::GetMangledName () const { + const char *cstr = NULL; if (m_opaque_ptr) - return m_opaque_ptr->GetMangled().GetMangledName().AsCString(); - return NULL; + cstr = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (cstr) + log->Printf ("SBFunction(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, cstr); + else + log->Printf ("SBFunction(%p)::GetMangledName () => NULL", m_opaque_ptr); + } + return cstr; } bool diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp index 7efb8f77ac9..86cb66cccdb 100644 --- a/lldb/source/API/SBHostOS.cpp +++ b/lldb/source/API/SBHostOS.cpp @@ -38,7 +38,7 @@ SBHostOS::ThreadCreate Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBHostOS::ThreadCreate (name='%s', thread_function=%p, thread_arg=%p, error_ptr=%p)", name, + log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name, thread_function, thread_arg, error_ptr); // CAROLINE: FIXME: You need to log a return value? diff --git a/lldb/source/API/SBInputReader.cpp b/lldb/source/API/SBInputReader.cpp index 616638b6717..98b03c1c0d0 100644 --- a/lldb/source/API/SBInputReader.cpp +++ b/lldb/source/API/SBInputReader.cpp @@ -88,7 +88,7 @@ SBInputReader::Initialize if (log) log->Printf("SBInputReader(%p)::Initialize (SBDebugger(%p), callback_function=%p, callback_baton=%p, " - "granularity='%s', end_token='%s', prompt='%s', echo=%i)", + "granularity=%s, end_token=\"%s\", prompt=\"%s\", echo=%i)", m_opaque_sp.get(), debugger.get(), callback_function, diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp index b79761fac8b..80bf84e6a3e 100644 --- a/lldb/source/API/SBLineEntry.cpp +++ b/lldb/source/API/SBLineEntry.cpp @@ -9,8 +9,9 @@ #include "lldb/API/SBLineEntry.h" #include "lldb/API/SBStream.h" -#include "lldb/Symbol/LineEntry.h" +#include "lldb/Core/StreamString.h" #include "lldb/Core/Log.h" +#include "lldb/Symbol/LineEntry.h" using namespace lldb; using namespace lldb_private; @@ -24,17 +25,8 @@ SBLineEntry::SBLineEntry () : SBLineEntry::SBLineEntry (const SBLineEntry &rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (rhs.IsValid()) - { m_opaque_ap.reset (new lldb_private::LineEntry (*rhs)); - } - - if (log) - log->Printf ("SBLineEntry::SBLineEntry (rhs.ap=%p) => this.ap = %p ", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); - } @@ -42,24 +34,15 @@ SBLineEntry::SBLineEntry (const SBLineEntry &rhs) : SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (lldb_object_ptr) m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr)); - - if (log) - log->Printf ("SBLineEntry::SBLineEntry (lldb_object_ptr=%p) => this.ap = %p", - lldb_object_ptr, m_opaque_ap.get()); } const SBLineEntry & SBLineEntry::operator = (const SBLineEntry &rhs) { - if (this != &rhs) - { - if (rhs.IsValid()) - m_opaque_ap.reset (new lldb_private::LineEntry(*rhs)); - } + if (this != &rhs && rhs.IsValid()) + m_opaque_ap.reset (new lldb_private::LineEntry(*rhs)); return *this; } @@ -81,21 +64,19 @@ SBLineEntry::~SBLineEntry () SBAddress SBLineEntry::GetStartAddress () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBLineEntry::GetStartAddress ()"); SBAddress sb_address; if (m_opaque_ap.get()) sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - SBStream sstr; - sb_address.GetDescription (sstr); - log->Printf ("SBLineEntry::GetStartAddress (this.ap=%p) => SBAddress (this.ap = %p, (%s)", m_opaque_ap.get(), - sb_address.get(), sstr.GetData()); + StreamString sstr; + if (sb_address.get()) + sb_address->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4); + log->Printf ("SBLineEntry(%p)::GetStartAddress () => SBAddress (%p): %s", + m_opaque_ap.get(), sb_address.get(), sstr.GetData()); } return sb_address; @@ -110,6 +91,15 @@ SBLineEntry::GetEndAddress () const sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress()); sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize()); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + StreamString sstr; + if (sb_address.get()) + sb_address->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4); + log->Printf ("SBLineEntry(%p)::GetEndAddress () => SBAddress (%p): %s", + m_opaque_ap.get(), sb_address.get(), sstr.GetData()); + } return sb_address; } @@ -125,9 +115,6 @@ SBLineEntry::GetFileSpec () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBLineEntry::GetFileSpec ()"); - SBFileSpec sb_file_spec; if (m_opaque_ap.get() && m_opaque_ap->file) sb_file_spec.SetFileSpec(m_opaque_ap->file); @@ -136,7 +123,7 @@ SBLineEntry::GetFileSpec () const { SBStream sstr; sb_file_spec.GetDescription (sstr); - log->Printf ("SBLineEntry::GetFileSpec (this.ap=%p) => SBFileSpec : this.ap = %p, '%s'", m_opaque_ap.get(), + log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_ap.get(), sb_file_spec.get(), sstr.GetData()); } @@ -148,15 +135,12 @@ SBLineEntry::GetLine () const { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBLineEntry::GetLine ()"); - uint32_t line = 0; if (m_opaque_ap.get()) line = m_opaque_ap->line; if (log) - log->Printf ("SBLineEntry::GetLine (this.ap=%p) => %d", m_opaque_ap.get(), line); + log->Printf ("SBLineEntry(%p)::GetLine () => %u", m_opaque_ap.get(), line); return line; } @@ -211,14 +195,11 @@ SBLineEntry::GetDescription (SBStream &description) { if (m_opaque_ap.get()) { - // Line entry: File, line x {, column y}: Addresses: <start_addr> - <end_addr> char file_path[PATH_MAX*2]; m_opaque_ap->file.GetPath (file_path, sizeof (file_path)); - description.Printf ("Line entry: %s, line %d", file_path, GetLine()); + description.Printf ("%s:%u", file_path, GetLine()); if (GetColumn() > 0) - description.Printf (", column %d", GetColumn()); - description.Printf (": Addresses: 0x%p - 0x%p", GetStartAddress().GetFileAddress() , - GetEndAddress().GetFileAddress()); + description.Printf (":%u", GetColumn()); } else description.Printf ("No value"); diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp index d291ac1cf3a..b6fbcf6dba7 100644 --- a/lldb/source/API/SBListener.cpp +++ b/lldb/source/API/SBListener.cpp @@ -7,15 +7,16 @@ // //===----------------------------------------------------------------------===// +#include "lldb/API/SBListener.h" +#include "lldb/API/SBBroadcaster.h" +#include "lldb/API/SBEvent.h" +#include "lldb/API/SBStream.h" +#include "lldb/Core/Broadcaster.h" #include "lldb/Core/Listener.h" #include "lldb/Core/Log.h" -#include "lldb/lldb-forward-rtti.h" +#include "lldb/Core/StreamString.h" #include "lldb/Host/TimeValue.h" -#include "lldb/API/SBListener.h" -#include "lldb/API/SBEvent.h" -#include "lldb/API/SBBroadcaster.h" -#include "lldb/API/SBStream.h" using namespace lldb; using namespace lldb_private; @@ -34,7 +35,7 @@ SBListener::SBListener (const char *name) : Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener::SBListener (name='%s') => this.obj = %p", + log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)", name, m_opaque_ptr); } @@ -42,11 +43,6 @@ SBListener::SBListener (Listener &listener) : m_opaque_ptr (&listener), m_opaque_ptr_owned (false) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBListener::SBListener (listener=%p) => this.obj = %p", - &listener, m_opaque_ptr); } SBListener::~SBListener () @@ -87,18 +83,48 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - uint32_t aquired_event_mask = 0; + uint32_t acquired_event_mask = 0; if (m_opaque_ptr && broadcaster.IsValid()) { - aquired_event_mask = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); + acquired_event_mask = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); } log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x", - m_opaque_ptr, broadcaster.get(), event_mask, aquired_event_mask); + { + StreamString sstr_requested; + StreamString sstr_acquired; + + Broadcaster *lldb_broadcaster = broadcaster.get(); + if (lldb_broadcaster) + { + const bool got_requested_names = lldb_broadcaster->GetEventNames (sstr_requested, event_mask, false); + const bool got_acquired_names = lldb_broadcaster->GetEventNames (sstr_acquired, acquired_event_mask, false); + log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p): %s, event_mask=0x%8.8x%s%s%s) => 0x%8.8x%s%s%s", + m_opaque_ptr, + lldb_broadcaster, + lldb_broadcaster->GetBroadcasterName().GetCString(), + event_mask, + got_requested_names ? " (" : "", + sstr_requested.GetData(), + got_requested_names ? ")" : "", + acquired_event_mask, + got_acquired_names ? " (" : "", + sstr_acquired.GetData(), + got_acquired_names ? ")" : ""); + } + else + { + log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x", + m_opaque_ptr, + lldb_broadcaster, + event_mask, + acquired_event_mask); + + } + } - return aquired_event_mask; + return acquired_event_mask; } bool @@ -112,44 +138,57 @@ SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t e } bool -SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event) +SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event) { - - //if (log) - //{ - // SBStream sstr; - // event.GetDescription (sstr); - // log->Printf ("SBListener::WaitForEvent (%d, %s)", num_seconds, sstr.GetData()); - //} + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (timeout_secs == UINT32_MAX) + { + log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p))...", + m_opaque_ptr, event.get()); + } + else + { + log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p))...", + m_opaque_ptr, timeout_secs, event.get()); + } + } + bool success = false; if (m_opaque_ptr) { TimeValue time_value; - if (num_seconds != UINT32_MAX) + if (timeout_secs != UINT32_MAX) { - assert (num_seconds != 0); // Take this out after all calls with timeout set to zero have been removed.... + assert (timeout_secs != 0); // Take this out after all calls with timeout set to zero have been removed.... time_value = TimeValue::Now(); - time_value.OffsetWithSeconds (num_seconds); + time_value.OffsetWithSeconds (timeout_secs); } EventSP event_sp; if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp)) { event.reset (event_sp); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBListener(%p)::WaitForEvent (num_seconds=%d, SBEvent(%p)) => 1", - m_opaque_ptr, num_seconds, event.get()); - return true; + success = true; } } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener(%p)::WaitForEvent (num_seconds=%d, SBEvent(%p)) => 0", - m_opaque_ptr, num_seconds, event.get()); - - event.reset (NULL); - return false; + { + if (timeout_secs == UINT32_MAX) + { + log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p)) => %i", + m_opaque_ptr, event.get(), success); + } + else + { + log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p)) => %i", + m_opaque_ptr, timeout_secs, event.get(), success); + } + } + if (!success) + event.reset (NULL); + return success; } bool diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index 55e691bb583..58ff07ddcb5 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -51,10 +51,8 @@ SBModule::GetFileSpec () const if (log) { - SBStream sstr; - file_spec.GetDescription (sstr); - log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_sp.get(), - file_spec.get(), sstr.GetData()); + log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)", + m_opaque_sp.get(), file_spec.get()); } return file_spec; diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 23152aa43d5..9ea9f754abc 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -152,7 +152,7 @@ SBProcess::PutSTDIN (const char *src, size_t src_len) } if (log) - log->Printf ("SBProcess(%p)::PutSTDIN (src='%s', src_len=%d) => %d", + log->Printf ("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%d) => %d", m_opaque_sp.get(), src, (uint32_t) src_len, @@ -164,47 +164,37 @@ SBProcess::PutSTDIN (const char *src, size_t src_len) size_t SBProcess::GetSTDOUT (char *dst, size_t dst_len) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - size_t ret_val = 0; + size_t bytes_read = 0; if (m_opaque_sp != NULL) { Error error; - ret_val = m_opaque_sp->GetSTDOUT (dst, dst_len, error); + bytes_read = m_opaque_sp->GetSTDOUT (dst, dst_len, error); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess(%p)::GetSTDOUT (dst='%.*s', dst_len=%d) => %d", - m_opaque_sp.get(), - (uint32_t) dst_len, - dst, - (uint32_t) dst_len, - (uint32_t) ret_val); + log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%zu) => %zu", + m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read); - return ret_val; + return bytes_read; } size_t SBProcess::GetSTDERR (char *dst, size_t dst_len) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - size_t ret_val = 0; + size_t bytes_read = 0; if (m_opaque_sp != NULL) { Error error; - ret_val = m_opaque_sp->GetSTDERR (dst, dst_len, error); + bytes_read = m_opaque_sp->GetSTDERR (dst, dst_len, error); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess(%p)::GetSTDERR (dst='%.*s', dst_len=%d) => %d", - m_opaque_sp.get(), - (uint32_t) dst_len, - dst, - (uint32_t) dst_len, - (uint32_t) ret_val); + log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%zu) => %zu", + m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read); - return ret_val; + return bytes_read; } void @@ -263,7 +253,7 @@ SBProcess::SetSelectedThreadByID (uint32_t tid) ret_val = m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid); if (log) - log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=%d) => '%s'", + log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4x) => %s", m_opaque_sp.get(), tid, (ret_val ? "true" : "false")); return ret_val; @@ -297,7 +287,7 @@ SBProcess::GetState () Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess(%p)::GetState () => '%s'", + log->Printf ("SBProcess(%p)::GetState () => %s", m_opaque_sp.get(), lldb_private::StateAsCString (ret_val)); @@ -557,7 +547,7 @@ SBProcess::GetStateFromEvent (const SBEvent &event) StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get()); if (log) - log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => '%s'", event.get(), + log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s", event.get(), lldb_private::StateAsCString (ret_val)); return ret_val; diff --git a/lldb/source/API/SBSymbolContext.cpp b/lldb/source/API/SBSymbolContext.cpp index 3b0b5fc0e61..9d97f545d9a 100644 --- a/lldb/source/API/SBSymbolContext.cpp +++ b/lldb/source/API/SBSymbolContext.cpp @@ -9,8 +9,10 @@ #include "lldb/API/SBSymbolContext.h" #include "lldb/API/SBStream.h" -#include "lldb/Symbol/SymbolContext.h" #include "lldb/Core/Log.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Symbol.h" +#include "lldb/Symbol/SymbolContext.h" using namespace lldb; using namespace lldb_private; @@ -112,13 +114,18 @@ SBSymbolContext::GetFunction () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - SBFunction ret_function (m_opaque_ap.get() ? m_opaque_ap->function : NULL); + Function *function = NULL; + + if (m_opaque_ap.get()) + function = m_opaque_ap->function; + + SBFunction sb_function (function); if (log) - log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p): %s", - m_opaque_ap.get(), ret_function.get(), ret_function.GetName()); + log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p)", + m_opaque_ap.get(), function); - return ret_function; + return sb_function; } SBBlock @@ -138,11 +145,8 @@ SBSymbolContext::GetLineEntry () if (log) { - SBStream sstr; - sb_line_entry.GetDescription (sstr); - log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p): %s", - m_opaque_ap.get(), - sb_line_entry.get(), sstr.GetData()); + log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p)", + m_opaque_ap.get(), sb_line_entry.get()); } return sb_line_entry; @@ -153,17 +157,20 @@ SBSymbolContext::GetSymbol () { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - SBSymbol ret_symbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL); + Symbol *symbol = NULL; + + if (m_opaque_ap.get()) + symbol = m_opaque_ap->symbol; + + SBSymbol sb_symbol (symbol); if (log) { - SBStream sstr; - ret_symbol.GetDescription (sstr); - log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p): %s", m_opaque_ap.get(), - ret_symbol.get(), sstr.GetData()); + log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p)", + m_opaque_ap.get(), symbol); } - return ret_symbol; + return sb_symbol; } lldb_private::SymbolContext* diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index d31ad562ddb..72aef3fd2fe 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -57,29 +57,11 @@ SBTarget::SBTarget () SBTarget::SBTarget (const SBTarget& rhs) : m_opaque_sp (rhs.m_opaque_sp) { -// Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); -// -// if (log) -// { -// SBStream sstr; -// GetDescription (sstr, lldb::eDescriptionLevelBrief); -// log->Printf ("SBTarget::SBTarget (rhs.sp=%p) => SBTarget(%p): %s", -// rhs.m_opaque_sp.get(), m_opaque_sp.get(), sstr.GetData()); -// } } SBTarget::SBTarget(const TargetSP& target_sp) : m_opaque_sp (target_sp) { -// Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); -// -// if (log) -// { -// SBStream sstr; -// GetDescription (sstr, lldb::eDescriptionLevelBrief); -// log->Printf ("SBTarget::SBTarget (target_sp=%p) => SBTarget(%p): %s", -// target_sp.get(), m_opaque_sp.get(), sstr.GetData()); -// } } //---------------------------------------------------------------------- @@ -106,10 +88,8 @@ SBTarget::GetProcess () Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - SBStream sstr; - sb_process.GetDescription (sstr); - log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p): %s", m_opaque_sp.get(), - sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)", + m_opaque_sp.get(), sb_process.get()); } return sb_process; @@ -138,10 +118,8 @@ SBTarget::CreateProcess () Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - SBStream sstr; - sb_process.GetDescription (sstr); - log->Printf ("SBTarget(%p)::CreateProcess () => SBProcess(%p): %s", m_opaque_sp.get(), - sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::CreateProcess () => SBProcess(%p)", + m_opaque_sp.get(), sb_process.get()); } return sb_process; @@ -170,10 +148,8 @@ SBTarget::LaunchProcess log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - SBStream sstr; - sb_process.GetDescription (sstr); - log->Printf ("SBTarget(%p)::LaunchProcess (...) => SBProcess(%p): %s", - m_opaque_sp.get(), sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::LaunchProcess (...) => SBProcess(%p)", + m_opaque_sp.get(), sb_process.get()); } return sb_process; @@ -250,10 +226,8 @@ SBTarget::Launch log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - SBStream sstr; - sb_process.GetDescription (sstr); - log->Printf ("SBTarget(%p)::Launch (...) => SBProceess(%p): %s", - m_opaque_sp.get(), sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::Launch (...) => SBProceess(%p)", + m_opaque_sp.get(), sb_process.get()); } return sb_process; @@ -342,7 +316,6 @@ SBTarget::AttachToProcessWithName SBFileSpec SBTarget::GetExecutable () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBFileSpec exe_file_spec; if (m_opaque_sp) @@ -352,18 +325,11 @@ SBTarget::GetExecutable () exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec()); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - if (exe_file_spec.Exists()) - { - SBStream sstr; - exe_file_spec.GetDescription (sstr); - log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p): %s", m_opaque_sp.get(), - exe_file_spec.get(), sstr.GetData()); - } - else - log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec (%p): Unable to find valid file", - m_opaque_sp.get(), exe_file_spec.get()); + log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)", + m_opaque_sp.get(), exe_file_spec.get()); } return exe_file_spec; @@ -428,13 +394,13 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t l { SBStream sstr; sb_bp.GetDescription (sstr); - const char *dir = sb_file_spec.GetDirectory(); - const char *file = sb_file_spec.GetFilename(); - log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s%s%s:%u ) => SBBreakpoint(%p): %s", + char path[PATH_MAX]; + sb_file_spec->GetPath (path, sizeof(path)); + log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s", m_opaque_sp.get(), - dir ? dir : "", dir ? "/" : "", file ? file : "", + path, line, - sb_bp.get(), + sb_bp.get(), sstr.GetData()); } @@ -462,11 +428,8 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_na if (log) { - SBStream sstr; - sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => " - "SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name, module_name, sb_bp.get(), - sstr.GetData()); + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)", + m_opaque_sp.get(), symbol_name, module_name, sb_bp.get()); } return sb_bp; @@ -496,11 +459,8 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo if (log) { - SBStream sstr; - sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") " - "=> SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name_regex, module_name, - sb_bp.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)", + m_opaque_sp.get(), symbol_name_regex, module_name, sb_bp.get()); } return sb_bp; @@ -519,10 +479,7 @@ SBTarget::BreakpointCreateByAddress (addr_t address) if (log) { - SBStream sstr; - sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (%p, address=%p) => " - "SBBreakpoint(%p): %s", m_opaque_sp.get(), address, sb_bp.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (%p, address=%p) => SBBreakpoint(%p)", m_opaque_sp.get(), address, sb_bp.get()); } return sb_bp; @@ -539,10 +496,8 @@ SBTarget::FindBreakpointByID (break_id_t bp_id) if (log) { - SBStream sstr; - sb_breakpoint.GetDescription (sstr); - log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p): %s", - m_opaque_sp.get(), (uint32_t) bp_id, sb_breakpoint.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)", + m_opaque_sp.get(), (uint32_t) bp_id, sb_breakpoint.get()); } return sb_breakpoint; @@ -663,10 +618,8 @@ SBTarget::GetModuleAtIndex (uint32_t idx) if (log) { - SBStream sstr; - sb_module.GetDescription (sstr); - log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p): %s", - m_opaque_sp.get(), idx, sb_module.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)", + m_opaque_sp.get(), idx, sb_module.get()); } return sb_module; diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index fc13631b137..ca356244d78 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -38,14 +38,14 @@ using namespace lldb; using namespace lldb_private; +//---------------------------------------------------------------------- +// Constructors +//---------------------------------------------------------------------- SBThread::SBThread () : m_opaque_sp () { } -//---------------------------------------------------------------------- -// Thread constructor -//---------------------------------------------------------------------- SBThread::SBThread (const ThreadSP& lldb_object_sp) : m_opaque_sp (lldb_object_sp) { @@ -57,6 +57,18 @@ SBThread::SBThread (const SBThread &rhs) : } //---------------------------------------------------------------------- +// Assignment operator +//---------------------------------------------------------------------- + +const lldb::SBThread & +SBThread::operator = (const SBThread &rhs) +{ + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; + return *this; +} + +//---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- SBThread::~SBThread() @@ -490,14 +502,6 @@ SBThread::GetFrameAtIndex (uint32_t idx) return sb_frame; } -const lldb::SBThread & -SBThread::operator = (const SBThread &rhs) -{ - if (this != &rhs) - m_opaque_sp = rhs.m_opaque_sp; - return *this; -} - bool SBThread::operator == (const SBThread &rhs) const { diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index e5476ff277c..54f822ee574 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -42,14 +42,6 @@ SBValue::SBValue () : SBValue::SBValue (const lldb::ValueObjectSP &value_sp) : m_opaque_sp (value_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBValue::SBValue (%p) => (%s)", m_opaque_sp.get(), sstr.GetData()); - } } SBValue::~SBValue() @@ -59,7 +51,10 @@ SBValue::~SBValue() bool SBValue::IsValid () const { - return (m_opaque_sp.get() != NULL); + // If this function ever changes to anything that does more than just + // check if the opaque shared pointer is non NULL, then we need to update + // all "if (m_opaque_sp)" code in this file. + return m_opaque_sp.get() != NULL; } SBError @@ -76,26 +71,39 @@ SBValue::GetError() const char * SBValue::GetName() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBValue::GetName () ptr=%p => '%s'", - m_opaque_sp.get(), - m_opaque_sp ? m_opaque_sp->GetName().AsCString() : "<invalid>"); + const char *name = NULL; + if (m_opaque_sp) + name = m_opaque_sp->GetName().GetCString(); - if (IsValid()) - return m_opaque_sp->GetName().GetCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (name) + log->Printf ("SBValue(%p)::GetName () => \"%s\"", m_opaque_sp.get(), name); + else + log->Printf ("SBValue(%p)::GetName () => NULL", m_opaque_sp.get(), name); + } - return NULL; + return name; } const char * SBValue::GetTypeName () { - if (IsValid()) - return m_opaque_sp->GetTypeName().AsCString(); - else - return NULL; + const char *name = NULL; + if (m_opaque_sp) + name = m_opaque_sp->GetTypeName().GetCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (name) + log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", m_opaque_sp.get(), name); + else + log->Printf ("SBValue(%p)::GetTypeName () => NULL", m_opaque_sp.get()); + } + + return name; } size_t @@ -103,9 +111,13 @@ SBValue::GetByteSize () { size_t result = 0; - if (IsValid()) + if (m_opaque_sp) result = m_opaque_sp->GetByteSize(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::GetByteSize () => %zu", m_opaque_sp.get(), result); + return result; } @@ -114,69 +126,128 @@ SBValue::IsInScope (const SBFrame &frame) { bool result = false; - if (IsValid()) + if (m_opaque_sp) result = m_opaque_sp->IsInScope (frame.get()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::IsInScope () => %i", m_opaque_sp.get(), result); + return result; } const char * SBValue::GetValue (const SBFrame &frame) { - const char *value_string = NULL; + const char *cstr = NULL; if ( m_opaque_sp) - value_string = m_opaque_sp->GetValueAsCString (frame.get()); - return value_string; + cstr = m_opaque_sp->GetValueAsCString (frame.get()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (cstr) + log->Printf ("SBValue(%p)::GetValue (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), frame.get(), cstr); + else + log->Printf ("SBValue(%p)::GetValue (SBFrame(%p)) => NULL", m_opaque_sp.get(), frame.get()); + } + + return cstr; } ValueType SBValue::GetValueType () { + ValueType result = eValueTypeInvalid; if (m_opaque_sp) - return m_opaque_sp->GetValueType(); - return eValueTypeInvalid; + result = m_opaque_sp->GetValueType(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + switch (result) + { + case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", m_opaque_sp.get()); break; + case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", m_opaque_sp.get()); break; + case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", m_opaque_sp.get()); break; + case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", m_opaque_sp.get()); break; + case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", m_opaque_sp.get()); break; + case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", m_opaque_sp.get()); break; + case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", m_opaque_sp.get()); break; + case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", m_opaque_sp.get()); break; + default: log->Printf ("SBValue(%p)::GetValueType () => %i ???", m_opaque_sp.get(), result); break; + } + } + return result; } const char * SBValue::GetObjectDescription (const SBFrame &frame) { - const char *value_string = NULL; + const char *cstr = NULL; if ( m_opaque_sp) - value_string = m_opaque_sp->GetObjectDescription (frame.get()); - return value_string; + cstr = m_opaque_sp->GetObjectDescription (frame.get()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (cstr) + log->Printf ("SBValue(%p)::GetObjectDescription (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), frame.get(), cstr); + else + log->Printf ("SBValue(%p)::GetObjectDescription (SBFrame(%p)) => NULL", m_opaque_sp.get(), frame.get()); + } + return cstr; } bool SBValue::GetValueDidChange (const SBFrame &frame) { - if (IsValid()) - return m_opaque_sp->GetValueDidChange (frame.get()); - return false; + bool result = false; + if (m_opaque_sp) + result = m_opaque_sp->GetValueDidChange (frame.get()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::GetValueDidChange (SBFrame(%p)) => %i", m_opaque_sp.get(), frame.get(), result); + + return result; } const char * SBValue::GetSummary (const SBFrame &frame) { - const char *value_string = NULL; - if ( m_opaque_sp) - value_string = m_opaque_sp->GetSummaryAsCString(frame.get()); - return value_string; + const char *cstr = NULL; + if (m_opaque_sp) + cstr = m_opaque_sp->GetSummaryAsCString(frame.get()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (cstr) + log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), frame.get(), cstr); + else + log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => NULL", m_opaque_sp.get(), frame.get()); + } + return cstr; } const char * SBValue::GetLocation (const SBFrame &frame) { - const char *value_string = NULL; - if (IsValid()) - value_string = m_opaque_sp->GetLocationAsCString(frame.get()); - return value_string; + const char *cstr = NULL; + if (m_opaque_sp) + cstr = m_opaque_sp->GetLocationAsCString(frame.get()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (cstr) + log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), frame.get(), cstr); + else + log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => NULL", m_opaque_sp.get(), frame.get()); + } + return cstr; } bool SBValue::SetValueFromCString (const SBFrame &frame, const char *value_str) { bool success = false; - if (IsValid()) + if (m_opaque_sp) success = m_opaque_sp->SetValueFromCString (frame.get(), value_str); return success; } @@ -186,21 +257,34 @@ SBValue::GetChildAtIndex (uint32_t idx) { lldb::ValueObjectSP child_sp; - if (IsValid()) + if (m_opaque_sp) { child_sp = m_opaque_sp->GetChildAtIndex (idx, true); } SBValue sb_value (child_sp); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", m_opaque_sp.get(), idx, sb_value.get()); + return sb_value; } uint32_t SBValue::GetIndexOfChildWithName (const char *name) { - if (IsValid()) - return m_opaque_sp->GetIndexOfChildWithName (ConstString(name)); - return UINT32_MAX; + uint32_t idx = UINT32_MAX; + if (m_opaque_sp) + idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name)); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + if (idx == UINT32_MAX) + log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", m_opaque_sp.get(), name, idx); + else + log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", m_opaque_sp.get(), name, idx); + } + return idx; } SBValue @@ -209,12 +293,17 @@ SBValue::GetChildMemberWithName (const char *name) lldb::ValueObjectSP child_sp; const ConstString str_name (name); - if (IsValid()) + if (m_opaque_sp) { child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true); } SBValue sb_value (child_sp); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), name, sb_value.get()); + return sb_value; } @@ -224,10 +313,12 @@ SBValue::GetNumChildren () { uint32_t num_children = 0; - if (IsValid()) - { + if (m_opaque_sp) num_children = m_opaque_sp->GetNumChildren(); - } + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::GetNumChildren () => %u", m_opaque_sp.get(), num_children); return num_children; } @@ -237,10 +328,8 @@ SBValue::ValueIsStale () { bool result = true; - if (IsValid()) - { + if (m_opaque_sp) result = m_opaque_sp->GetValueIsValid(); - } return result; } @@ -249,25 +338,31 @@ SBValue::ValueIsStale () SBValue SBValue::Dereference () { - if (IsValid()) + SBValue sb_value; + if (m_opaque_sp) { if (m_opaque_sp->IsPointerType()) - { - return GetChildAtIndex(0); - } + sb_value = GetChildAtIndex(0); } - return *this; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", m_opaque_sp.get(), sb_value.get()); + + return sb_value; } bool -SBValue::TypeIsPtrType () +SBValue::TypeIsPointerType () { bool is_ptr_type = false; - if (IsValid()) - { + if (m_opaque_sp) is_ptr_type = m_opaque_sp->IsPointerType(); - } + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", m_opaque_sp.get(), is_ptr_type); + return is_ptr_type; } @@ -306,6 +401,17 @@ SBValue::operator*() const } bool +SBValue::GetExpressionPath (SBStream &description) +{ + if (m_opaque_sp) + { + m_opaque_sp->GetExpressionPath (description.ref()); + return true; + } + return false; +} + +bool SBValue::GetDescription (SBStream &description) { if (m_opaque_sp) diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index d8e1f2568a4..a038dd83edc 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -410,7 +410,8 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum break; case DumpStyleModuleWithFileAddress: - s->Printf("%s[", m_section->GetModule()->GetFileSpec().GetFilename().AsCString()); + if (m_section) + s->Printf("%s[", m_section->GetModule()->GetFileSpec().GetFilename().AsCString()); // Fall through case DumpStyleFileAddress: { @@ -422,7 +423,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum return false; } s->Address (file_addr, addr_size); - if (style == DumpStyleModuleWithFileAddress) + if (style == DumpStyleModuleWithFileAddress && m_section) s->PutChar(']'); } break; @@ -737,21 +738,6 @@ Address::CalculateSymbolContext (SymbolContext *sc) } } -void -Address::DumpDebug(Stream *s) const -{ - *s << (void *)this << ": " << "Address"; - if (m_section != NULL) - { - *s << ", section = " << (void *)m_section << " (" << m_section->GetName() << "), offset = " << m_offset; - } - else - { - *s << ", vm_addr = " << m_offset; - } - s->EOL(); -} - int Address::CompareFileAddress (const Address& a, const Address& b) { diff --git a/lldb/source/Core/Broadcaster.cpp b/lldb/source/Core/Broadcaster.cpp index 484737329a6..28cd7cb294b 100644 --- a/lldb/source/Core/Broadcaster.cpp +++ b/lldb/source/Core/Broadcaster.cpp @@ -23,10 +23,10 @@ using namespace lldb_private; Broadcaster::Broadcaster (const char *name) : m_broadcaster_name (name), - m_broadcaster_listeners (), - m_broadcaster_listeners_mutex (Mutex::eMutexTypeRecursive), + m_listeners (), + m_listeners_mutex (Mutex::eMutexTypeRecursive), m_hijacking_listener(NULL), - m_hijack_mask(UINT32_MAX) + m_hijacking_mask(UINT32_MAX) { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); if (log) @@ -42,17 +42,17 @@ Broadcaster::~Broadcaster() // Scope for "listeners_locker" { - Mutex::Locker listeners_locker(m_broadcaster_listeners_mutex); + Mutex::Locker listeners_locker(m_listeners_mutex); // Make sure the listener forgets about this broadcaster. We do // this in the broadcaster in case the broadcaster object initiates // the removal. - collection::iterator pos, end = m_broadcaster_listeners.end(); - for (pos = m_broadcaster_listeners.begin(); pos != end; ++pos) + collection::iterator pos, end = m_listeners.end(); + for (pos = m_listeners.begin(); pos != end; ++pos) pos->first->BroadcasterWillDestruct (this); - m_broadcaster_listeners.clear(); + m_listeners.clear(); } } @@ -62,6 +62,37 @@ Broadcaster::GetBroadcasterName () return m_broadcaster_name; } +bool +Broadcaster::GetEventNames (Stream &s, uint32_t event_mask, bool prefix_with_broadcaster_name) const +{ + uint32_t num_names_added = 0; + if (event_mask && !m_event_names.empty()) + { + event_names_map::const_iterator end = m_event_names.end(); + for (uint32_t bit=1u, mask=event_mask; mask != 0 && bit != 0; bit <<= 1, mask >>= 1) + { + if (mask & 1) + { + event_names_map::const_iterator pos = m_event_names.find(bit); + if (pos != end) + { + if (num_names_added > 0) + s.PutCString(", "); + + if (prefix_with_broadcaster_name) + { + s.PutCString (m_broadcaster_name.GetCString()); + s.PutChar('.'); + } + s.PutCString(pos->second.c_str()); + ++num_names_added; + } + } + } + } + return num_names_added > 0; +} + void Broadcaster::AddInitialEventsToListener (Listener *listener, uint32_t requested_events) { @@ -71,13 +102,13 @@ Broadcaster::AddInitialEventsToListener (Listener *listener, uint32_t requested_ uint32_t Broadcaster::AddListener (Listener* listener, uint32_t event_mask) { - Mutex::Locker locker(m_broadcaster_listeners_mutex); - collection::iterator pos, end = m_broadcaster_listeners.end(); + Mutex::Locker locker(m_listeners_mutex); + collection::iterator pos, end = m_listeners.end(); collection::iterator existing_pos = end; // See if we already have this listener, and if so, update its mask uint32_t taken_event_types = 0; - for (pos = m_broadcaster_listeners.begin(); pos != end; ++pos) + for (pos = m_listeners.begin(); pos != end; ++pos) { if (pos->first == listener) existing_pos = pos; @@ -96,7 +127,7 @@ Broadcaster::AddListener (Listener* listener, uint32_t event_mask) if (existing_pos == end) { // Grant a new listener the available event bits - m_broadcaster_listeners.push_back(std::make_pair(listener, available_event_types)); + m_listeners.push_back(std::make_pair(listener, available_event_types)); } else { @@ -117,16 +148,16 @@ Broadcaster::AddListener (Listener* listener, uint32_t event_mask) bool Broadcaster::EventTypeHasListeners (uint32_t event_type) { - Mutex::Locker locker (m_broadcaster_listeners_mutex); + Mutex::Locker locker (m_listeners_mutex); - if (m_hijacking_listener != NULL && event_type & m_hijack_mask) + if (m_hijacking_listener != NULL && event_type & m_hijacking_mask) return true; - if (m_broadcaster_listeners.empty()) + if (m_listeners.empty()) return false; - collection::iterator pos, end = m_broadcaster_listeners.end(); - for (pos = m_broadcaster_listeners.begin(); pos != end; ++pos) + collection::iterator pos, end = m_listeners.end(); + for (pos = m_listeners.begin(); pos != end; ++pos) { if (pos->second & event_type) return true; @@ -137,10 +168,10 @@ Broadcaster::EventTypeHasListeners (uint32_t event_type) bool Broadcaster::RemoveListener (Listener* listener, uint32_t event_mask) { - Mutex::Locker locker(m_broadcaster_listeners_mutex); - collection::iterator pos, end = m_broadcaster_listeners.end(); + Mutex::Locker locker(m_listeners_mutex); + collection::iterator pos, end = m_listeners.end(); // See if we already have this listener, and if so, update its mask - for (pos = m_broadcaster_listeners.begin(); pos != end; ++pos) + for (pos = m_listeners.begin(); pos != end; ++pos) { if (pos->first == listener) { @@ -148,7 +179,7 @@ Broadcaster::RemoveListener (Listener* listener, uint32_t event_mask) pos->second &= ~event_mask; // If all bits have been relinquished then remove this listener if (pos->second == 0) - m_broadcaster_listeners.erase (pos); + m_listeners.erase (pos); return true; } } @@ -191,7 +222,7 @@ Broadcaster::PrivateBroadcastEvent (EventSP &event_sp, bool unique) unique); } - if (m_hijacking_listener != NULL && m_hijack_mask & event_type) + if (m_hijacking_listener != NULL && m_hijacking_mask & event_type) { if (unique && m_hijacking_listener->PeekAtNextEventForBroadcasterWithType (this, event_type)) return; @@ -199,12 +230,12 @@ Broadcaster::PrivateBroadcastEvent (EventSP &event_sp, bool unique) } else { - Mutex::Locker event_types_locker(m_broadcaster_listeners_mutex); - collection::iterator pos, end = m_broadcaster_listeners.end(); + Mutex::Locker event_types_locker(m_listeners_mutex); + collection::iterator pos, end = m_listeners.end(); // Iterate through all listener/mask pairs - for (pos = m_broadcaster_listeners.begin(); pos != end; ++pos) + for (pos = m_listeners.begin(); pos != end; ++pos) { // If the listener's mask matches any bits that we just set, then // put the new event on its event queue. @@ -235,21 +266,21 @@ Broadcaster::BroadcastEventIfUnique (uint32_t event_type, EventData *event_data) bool Broadcaster::HijackBroadcaster (Listener *listener, uint32_t event_mask) { - Mutex::Locker event_types_locker(m_broadcaster_listeners_mutex); + Mutex::Locker event_types_locker(m_listeners_mutex); if (m_hijacking_listener != NULL) return false; m_hijacking_listener = listener; - m_hijack_mask = event_mask; + m_hijacking_mask = event_mask; return true; } void Broadcaster::RestoreBroadcaster () { - Mutex::Locker event_types_locker(m_broadcaster_listeners_mutex); - + Mutex::Locker event_types_locker(m_listeners_mutex); m_hijacking_listener = NULL; + m_hijacking_mask = 0; } diff --git a/lldb/source/Core/FileSpec.cpp b/lldb/source/Core/FileSpec.cpp index a2e994d4af7..c0129915dec 100644 --- a/lldb/source/Core/FileSpec.cpp +++ b/lldb/source/Core/FileSpec.cpp @@ -559,41 +559,27 @@ FileSpec::GetFilename() const // needed as the directory and path are stored in separate string // values. //------------------------------------------------------------------ -bool -FileSpec::GetPath(char *path, size_t max_path_length) const +size_t +FileSpec::GetPath(char *path, size_t path_max_len) const { - if (max_path_length) + if (path_max_len) { - const char *dirname = m_directory.AsCString(); - const char *filename = m_filename.AsCString(); + const char *dirname = m_directory.GetCString(); + const char *filename = m_filename.GetCString(); if (dirname) { if (filename) - { - return (size_t)::snprintf (path, max_path_length, "%s/%s", dirname, filename) < max_path_length; - } + return ::snprintf (path, path_max_len, "%s/%s", dirname, filename); else - { - size_t dir_len = m_directory.GetLength() + 1; - if (dir_len < max_path_length) - { - ::memcpy (path, dirname, dir_len); - return true; - } - } + return ::snprintf (path, path_max_len, "%s", dirname); } else if (filename) { - size_t filename_len = m_filename.GetLength() + 1; - if (filename_len < max_path_length) - { - ::memcpy (path, filename, filename_len); - return true; - } + return ::snprintf (path, path_max_len, "%s", filename); } } path[0] = '\0'; - return false; + return 0; } //------------------------------------------------------------------ diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp index 16063e483af..2b7b7175e4d 100644 --- a/lldb/source/Core/Log.cpp +++ b/lldb/source/Core/Log.cpp @@ -116,6 +116,7 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args) const char *thread_name_str = Host::GetThreadName (getpid(), Host::GetCurrentThreadID()); if (thread_name_str) header.Printf ("%s ", thread_name_str); + } header.PrintfVarArg (format, args); diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 4a04dedca88..02ed8652d78 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -380,13 +380,16 @@ Module::GetDescription (Stream *s) { Mutex::Locker locker (m_mutex); - s->Printf("Module %s/%s%s%s%s\n", - m_file.GetDirectory().AsCString(), - m_file.GetFilename().AsCString(), - m_object_name ? "(" : "", - m_object_name ? m_object_name.GetCString() : "", - m_object_name ? ")" : ""); + if (m_arch.IsValid()) + s->Printf("(%s) ", m_arch.AsCString()); + char path[PATH_MAX]; + if (m_file.GetPath(path, sizeof(path))) + s->PutCString(path); + + const char *object_name = m_object_name.GetCString(); + if (object_name) + s->Printf("(%s)", object_name); } void diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 51702d0e251..2f10ae2ad0a 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -22,6 +22,7 @@ #include <sys/wait.h> #if defined (__APPLE__) +#include <dispatch/dispatch.h> #include <libproc.h> #include <mach-o/dyld.h> #endif @@ -545,6 +546,13 @@ Host::GetThreadName (lldb::pid_t pid, lldb::tid_t tid) name = ThreadNameAccessor (true, pid, tid, NULL); } } + + if (name == NULL) + { + dispatch_queue_t current_queue = ::dispatch_get_current_queue (); + if (current_queue != NULL) + name = dispatch_queue_get_label (current_queue); + } } #endif } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 3f9e902de47..6c90854c297 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -58,7 +58,7 @@ CommandInterpreter::CommandInterpreter ScriptLanguage script_language, bool synchronous_execution ) : - Broadcaster ("CommandInterpreter"), + Broadcaster ("lldb.command-interpreter"), m_debugger (debugger), m_synchronous_execution (synchronous_execution), m_skip_lldbinit_files (false) @@ -69,7 +69,10 @@ CommandInterpreter::CommandInterpreter var_name.Printf ("[%s].script-lang", dbg_name); debugger.GetSettingsController()->SetVariable (var_name.GetData(), lang_name.c_str(), lldb::eVarSetOperationAssign, false, - m_debugger.GetInstanceName().AsCString()); + m_debugger.GetInstanceName().AsCString()); + SetEventName (eBroadcastBitThreadShouldExit, "thread-should-exit"); + SetEventName (eBroadcastBitResetPrompt, "reset-prompt"); + SetEventName (eBroadcastBitQuitCommandReceived, "quit"); } void diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index b6537276ffa..d71626790bf 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -66,7 +66,7 @@ Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener //---------------------------------------------------------------------- Process::Process(Target &target, Listener &listener) : UserID (LLDB_INVALID_PROCESS_ID), - Broadcaster ("Process"), + Broadcaster ("lldb.process"), ProcessInstanceSettings (*(Process::GetSettingsController().get())), m_target (target), m_public_state (eStateUnloaded), @@ -92,6 +92,11 @@ Process::Process(Target &target, Listener &listener) : if (log) log->Printf ("%p Process::Process()", this); + SetEventName (eBroadcastBitStateChanged, "state-changed"); + SetEventName (eBroadcastBitInterrupt, "interrupt"); + SetEventName (eBroadcastBitSTDOUT, "stdout-available"); + SetEventName (eBroadcastBitSTDERR, "stderr-available"); + listener.StartListeningForEvents (this, eBroadcastBitStateChanged | eBroadcastBitInterrupt | diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 7716e50491a..08b0e771fa6 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -35,7 +35,7 @@ using namespace lldb_private; // Target constructor //---------------------------------------------------------------------- Target::Target(Debugger &debugger) : - Broadcaster("Target"), + Broadcaster("lldb.target"), TargetInstanceSettings (*(Target::GetSettingsController().get())), m_debugger (debugger), m_images(), @@ -48,6 +48,10 @@ Target::Target(Debugger &debugger) : m_image_search_paths (ImageSearchPathsChanged, this), m_scratch_ast_context_ap(NULL) { + SetEventName (eBroadcastBitBreakpointChanged, "breakpoint-changed"); + SetEventName (eBroadcastBitModulesLoaded, "modules-loaded"); + SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT); if (log) log->Printf ("%p Target::Target()", this); |