From jmolenda at apple.com Mon Oct 25 06:12:08 2010 From: jmolenda at apple.com (Jason Molenda) Date: Mon, 25 Oct 2010 11:12:08 -0000 Subject: [Lldb-commits] [lldb] r117256 - in /lldb/trunk: include/lldb/ include/lldb/Symbol/ include/lldb/Target/ lldb.xcodeproj/ source/ source/Plugins/Process/Utility/ source/Symbol/ source/Target/ Message-ID: <20101025111208.45D862A6C12C@llvm.org> Author: jmolenda Date: Mon Oct 25 06:12:07 2010 New Revision: 117256 URL: http://llvm.org/viewvc/llvm-project?rev=117256&view=rev Log: Check in the native lldb unwinder. Not yet enabled as the default unwinder but there are no known backtrace problems with the code at this point. Added 'log enable lldb unwind' to help diagnose backtrace problems; this output needs a little refining but it's a good first step. eh_frame information is currently read unconditionally - the code is structured to allow this to be delayed until it's actually needed. There is a performance hit when you have to parse the eh_frame information for any largeish executable/library so it's necessary to avoid if possible. It's confusing having both the UnwindPlan::RegisterLocation struct and the RegisterConextLLDB::RegisterLocation struct, I need to rename one of them. The writing of registers isn't done in the RegisterConextLLDB subclass yet; neither is the running of complex DWARF expressions from eh_frame (e.g. used for _sigtramp on Mac OS X). Added: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Modified: lldb/trunk/include/lldb/Symbol/UnwindPlan.h lldb/trunk/include/lldb/Target/RegisterContext.h lldb/trunk/include/lldb/lldb-private-log.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp lldb/trunk/source/Symbol/FuncUnwinders.cpp lldb/trunk/source/Symbol/UnwindPlan.cpp lldb/trunk/source/Target/RegisterContext.cpp lldb/trunk/source/lldb-log.cpp lldb/trunk/source/lldb.cpp Modified: lldb/trunk/include/lldb/Symbol/UnwindPlan.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindPlan.h?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/UnwindPlan.h (original) +++ lldb/trunk/include/lldb/Symbol/UnwindPlan.h Mon Oct 25 06:12:07 2010 @@ -4,6 +4,7 @@ #include "lldb/lldb-private.h" #include "lldb/Core/AddressRange.h" #include "lldb/Core/Stream.h" +#include "lldb/Core/ConstString.h" #include #include @@ -69,18 +70,32 @@ void SetSame(); + bool IsSame () const { return m_type == isSame; } + + bool IsUnspecified () const { return m_type == unspecified; } + + bool IsCFAPlusOffset () const { return m_type == isCFAPlusOffset; } + + bool IsAtCFAPlusOffset () const { return m_type == atCFAPlusOffset; } + + bool IsInOtherRegister () const { return m_type == inOtherRegister; } + + bool IsAtDWARFExpression () const { return m_type == atDWARFExpression; } + + bool IsDWARFExpression () const { return m_type == isDWARFExpression; } + void SetAtCFAPlusOffset (int32_t offset); void SetIsCFAPlusOffset (int32_t offset); void SetInRegister (uint32_t reg_num); + uint32_t GetRegisterNumber () const { return m_location.reg_num; } + RestoreType GetLocationType () const { return m_type; } int32_t GetOffset () const { return m_location.offset; } - uint32_t GetRegNum () const { return m_location.reg_num; } - void GetDWARFExpr (const uint8_t **opcodes, uint16_t& len) const { *opcodes = m_location.expr.opcodes; len = m_location.expr.length; } void @@ -159,6 +174,13 @@ m_cfa_offset = offset; } + // Return the number of registers we have locations for + int + GetRegisterCount () const + { + return m_register_locations.size(); + } + void Clear (); @@ -176,13 +198,20 @@ public: - UnwindPlan () : m_register_kind(-1), m_row_list(), m_plan_valid_address_range() { } + UnwindPlan () : m_register_kind(-1), m_row_list(), m_plan_valid_address_range(), m_source_name() + { + m_plan_valid_address_range.SetByteSize (0); + } void Dump (Stream& s, Thread* thread) const; void AppendRow (const Row& row); + // Returns a pointer to the best row for the given offset into the function's instructions. + // If offset is -1 it indicates that the function start is unknown - the final row in the UnwindPlan is returned. + // In practice, the UnwindPlan for a function with no known start address will be the architectural default + // UnwindPlan which will only have one row. const Row* GetRowForFunctionOffset (int offset) const; @@ -207,6 +236,12 @@ const UnwindPlan::Row& GetRowAtIndex (uint32_t idx) const; + lldb_private::ConstString + GetSourceName () const; + + void + SetSourceName (const char *); + int GetRowCount () const; @@ -217,6 +252,7 @@ AddressRange m_plan_valid_address_range; uint32_t m_register_kind; // The RegisterKind these register numbers are in terms of - will need to be // translated to lldb native reg nums at unwind time + lldb_private::ConstString m_source_name; // for logging, where this UnwindPlan originated from }; // class UnwindPlan } // namespace lldb_private Modified: lldb/trunk/include/lldb/Target/RegisterContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/RegisterContext.h?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/RegisterContext.h (original) +++ lldb/trunk/include/lldb/Target/RegisterContext.h Mon Oct 25 06:12:07 2010 @@ -28,6 +28,8 @@ //------------------------------------------------------------------ RegisterContext (Thread &thread, StackFrame *frame); + RegisterContext (Thread &thread); + virtual ~RegisterContext (); @@ -50,18 +52,12 @@ GetRegisterSet (uint32_t reg_set) = 0; virtual bool - ReadRegisterValue (uint32_t reg, Scalar &value) = 0; - - virtual bool ReadRegisterBytes (uint32_t reg, DataExtractor &data) = 0; virtual bool ReadAllRegisterValues (lldb::DataBufferSP &data_sp) = 0; virtual bool - WriteRegisterValue (uint32_t reg, const Scalar &value) = 0; - - virtual bool WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0) = 0; virtual bool @@ -73,6 +69,12 @@ //------------------------------------------------------------------ // Subclasses can override these functions if desired //------------------------------------------------------------------ + virtual bool + ReadRegisterValue (uint32_t reg, Scalar &value); + + virtual bool + WriteRegisterValue (uint32_t reg, const Scalar &value); + virtual uint32_t NumSupportedHardwareBreakpoints (); @@ -143,7 +145,10 @@ WriteRegisterFromUnsigned (uint32_t reg, uint64_t uval); bool - ConvertBetweenRegisterKinds (int source_rk, uint32_t source_regnum, int target_rk, uint32_t target_regnum); + ConvertBetweenRegisterKinds (int source_rk, uint32_t source_regnum, int target_rk, uint32_t& target_regnum); + + void + SetStackFrame (StackFrame *frame); //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions Modified: lldb/trunk/include/lldb/lldb-private-log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-log.h (original) +++ lldb/trunk/include/lldb/lldb-private-log.h Mon Oct 25 06:12:07 2010 @@ -34,6 +34,7 @@ #define LIBLLDB_LOG_COMMUNICATION (1u << 12) #define LIBLLDB_LOG_CONNECTION (1u << 13) #define LIBLLDB_LOG_HOST (1u << 14) +#define LIBLLDB_LOG_UNWIND (1u << 15) #define LIBLLDB_LOG_ALL (UINT32_MAX) #define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\ LIBLLDB_LOG_THREAD |\ Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Oct 25 06:12:07 2010 @@ -406,6 +406,10 @@ 9AC70390117675270086C050 /* SBInstructionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC7038F117675270086C050 /* SBInstructionList.h */; settings = {ATTRIBUTES = (Public, ); }; }; 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 */ @@ -1130,6 +1134,10 @@ 9AF16A9E11402D69007A7B3F /* SBBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBBreakpoint.h; path = include/lldb/API/SBBreakpoint.h; sourceTree = ""; }; 9AF16CC611408686007A7B3F /* SBBreakpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBBreakpointLocation.h; path = include/lldb/API/SBBreakpointLocation.h; sourceTree = ""; }; 9AF16CC7114086A1007A7B3F /* SBBreakpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBBreakpointLocation.cpp; path = source/API/SBBreakpointLocation.cpp; sourceTree = ""; }; + AF68D2541255416E002FF25B /* RegisterContextLLDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextLLDB.cpp; path = Utility/RegisterContextLLDB.cpp; sourceTree = ""; }; + AF68D2551255416E002FF25B /* RegisterContextLLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextLLDB.h; path = Utility/RegisterContextLLDB.h; sourceTree = ""; }; + AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnwindLLDB.cpp; path = Utility/UnwindLLDB.cpp; sourceTree = ""; }; + AF68D3301255A110002FF25B /* UnwindLLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnwindLLDB.h; path = Utility/UnwindLLDB.h; sourceTree = ""; }; AF94005711C03F6500085DB9 /* SymbolVendor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolVendor.cpp; path = source/Symbol/SymbolVendor.cpp; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1646,6 +1654,10 @@ 26B4666E11A2080F00CF6220 /* Utility */ = { isa = PBXGroup; children = ( + AF68D32F1255A110002FF25B /* UnwindLLDB.cpp */, + AF68D3301255A110002FF25B /* UnwindLLDB.h */, + AF68D2541255416E002FF25B /* RegisterContextLLDB.cpp */, + AF68D2551255416E002FF25B /* RegisterContextLLDB.h */, 96A6D9C71249D98800250B38 /* ArchVolatileRegs-x86.cpp */, 96A6D9C81249D98800250B38 /* ArchVolatileRegs-x86.h */, 961FAC1C12360C7D00F93A47 /* ArchDefaultUnwindPlan-x86.cpp */, @@ -2417,6 +2429,8 @@ 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 */, ); @@ -2917,6 +2931,8 @@ 4C139EA5124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp in Sources */, 4C0A91D812511CB900CA6636 /* AppleObjCTrampolineHandler.cpp in Sources */, 4C0A91DA12511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */, + AF68D2561255416E002FF25B /* RegisterContextLLDB.cpp in Sources */, + AF68D3311255A111002FF25B /* UnwindLLDB.cpp in Sources */, 26424E3D125986CB0016D82C /* ValueObjectConstResult.cpp in Sources */, 4C1AB23B1263E5F400D0F04A /* ThreadPlanTestCondition.cpp in Sources */, ); Modified: lldb/trunk/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp Mon Oct 25 06:12:07 2010 @@ -64,6 +64,7 @@ row.SetRegisterInfo (LLDB_REGNUM_GENERIC_SP, regloc); m_32bit_default.AppendRow (row); + m_32bit_default.SetSourceName ("architectural default"); row.Clear(); @@ -80,6 +81,7 @@ row.SetRegisterInfo (LLDB_REGNUM_GENERIC_SP, regloc); m_64bit_default.AppendRow (row); + m_64bit_default.SetSourceName ("architectural default"); } Added: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=117256&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (added) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Mon Oct 25 06:12:07 2010 @@ -0,0 +1,986 @@ +//===-- RegisterContextLLDB.cpp --------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/lldb-private.h" +#include "RegisterContextLLDB.h" +#include "lldb/Target/Thread.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/Symbol.h" +#include "lldb/Core/Address.h" +#include "lldb/Core/AddressRange.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Process.h" +#include "lldb/Utility/ArchDefaultUnwindPlan.h" +#include "lldb/Symbol/FuncUnwinders.h" +#include "lldb/Core/DataBufferHeap.h" +#include "lldb/Utility/ArchVolatileRegs.h" +#include "lldb/Core/Log.h" + +using namespace lldb; +using namespace lldb_private; + + +RegisterContextLLDB::RegisterContextLLDB (Thread& thread, + const RegisterContextSP &next_frame, + SymbolContext& sym_ctx, + int frame_number) : + RegisterContext (thread), m_thread(thread), m_next_frame(next_frame), + m_zeroth_frame(false), m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(), + m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_frame_number (frame_number) +{ + m_base_reg_ctx = m_thread.GetRegisterContext(); + if (m_next_frame.get() == NULL) + { + InitializeZerothFrame (); + } + else + { + InitializeNonZerothFrame (); + } +} + +// Initialize a RegisterContextLLDB which is the first frame of a stack -- the zeroth frame or currently +// executing frame. + +void +RegisterContextLLDB::InitializeZerothFrame() +{ + m_zeroth_frame = true; + StackFrameSP frame_sp (m_thread.GetStackFrameAtIndex (0)); + if (m_base_reg_ctx == NULL) + { + m_frame_type = eNotAValidFrame; + return; + } + m_sym_ctx = frame_sp->GetSymbolContext (eSymbolContextEverything); + const AddressRange *addr_range_ptr; + if (m_sym_ctx.function) + addr_range_ptr = &m_sym_ctx.function->GetAddressRange(); + else if (m_sym_ctx.symbol) + addr_range_ptr = m_sym_ctx.symbol->GetAddressRangePtr(); + + Address current_pc = frame_sp->GetFrameCodeAddress(); + + static ConstString sigtramp_name ("_sigtramp"); + if ((m_sym_ctx.function && m_sym_ctx.function->GetMangled().GetMangledName() == sigtramp_name) + || (m_sym_ctx.symbol && m_sym_ctx.symbol->GetMangled().GetMangledName() == sigtramp_name)) + { + m_frame_type = eSigtrampFrame; + } + else + { + // FIXME: Detect eDebuggerFrame here. + m_frame_type = eNormalFrame; + } + + // If we were able to find a symbol/function, set addr_range_ptr to the bounds of that symbol/function. + // else treat the current pc value as the start_pc and record no offset. + if (addr_range_ptr) + { + m_start_pc = addr_range_ptr->GetBaseAddress(); + m_current_offset = frame_sp->GetFrameCodeAddress().GetOffset() - m_start_pc.GetOffset(); + } + else + { + m_start_pc = current_pc; + m_current_offset = -1; + } + + // We've set m_frame_type, m_zeroth_frame, and m_sym_ctx before this call. + // This call sets the m_all_registers_available, m_fast_unwind_plan, and m_full_unwind_plan member variables. + GetUnwindPlansForFrame (current_pc); + + const UnwindPlan::Row *active_row = NULL; + int cfa_offset = 0; + int row_register_kind; + if (m_full_unwind_plan && m_full_unwind_plan->PlanValidAtAddress (current_pc)) + { + active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); + row_register_kind = m_full_unwind_plan->GetRegisterKind (); + } + + if (active_row == NULL) + { + m_frame_type = eNotAValidFrame; + return; + } + + addr_t cfa_regval; + if (!ReadGPRValue (row_register_kind, active_row->GetCFARegister(), cfa_regval)) + { + m_frame_type = eNotAValidFrame; + return; + } + else + { + } + cfa_offset = active_row->GetCFAOffset (); + + m_cfa = cfa_regval + cfa_offset; + + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + if (log) + { + log->Printf("%*sThread %u Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); + } +} + +// Initialize a RegisterContextLLDB for the non-zeroth frame -- rely on the RegisterContextLLDB "below" it +// to provide things like its current pc value. + +void +RegisterContextLLDB::InitializeNonZerothFrame() +{ + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + if (m_next_frame.get() == NULL) + { + m_frame_type = eNotAValidFrame; + return; + } + if (!((RegisterContextLLDB*)m_next_frame.get())->IsValid()) + { + m_frame_type = eNotAValidFrame; + return; + } + if (m_base_reg_ctx == NULL) + { + m_frame_type = eNotAValidFrame; + return; + } + + m_zeroth_frame = false; + + addr_t pc; + if (!ReadGPRValue (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d could not get pc value", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number); + } + m_frame_type = eNotAValidFrame; + return; + } + Address current_pc; + m_thread.GetProcess().GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, current_pc); + + // If we don't have a Module for some reason, we're not going to find symbol/function information - just + // stick in some reasonable defaults and hope we can unwind past this frame. + if (!current_pc.IsValid() || current_pc.GetModule() == NULL) + { + if (log) + { + log->Printf("%*sThread %u Frame %d using architectural default unwind method", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number); + } + ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); + ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); + if (arch_default) + { + m_fast_unwind_plan = NULL; + m_full_unwind_plan = arch_default->GetArchDefaultUnwindPlan (m_thread, current_pc); + m_frame_type = eNormalFrame; + m_all_registers_available = false; + m_current_offset = -1; + addr_t cfa_regval; + int row_register_kind = m_full_unwind_plan->GetRegisterKind (); + uint32_t cfa_regnum = m_full_unwind_plan->GetRowForFunctionOffset(0)->GetCFARegister(); + int cfa_offset = m_full_unwind_plan->GetRowForFunctionOffset(0)->GetCFAOffset(); + if (!ReadGPRValue (row_register_kind, cfa_regnum, cfa_regval)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d failed to get cfa value", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number); + } + m_frame_type = eNormalFrame; + return; + } + m_cfa = cfa_regval + cfa_offset; + if (log) + { + log->Printf("%*sThread %u Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); + } + return; + } + m_frame_type = eNotAValidFrame; + return; + } + + // set up our m_sym_ctx SymbolContext + current_pc.GetModule()->ResolveSymbolContextForAddress (current_pc, eSymbolContextFunction | eSymbolContextSymbol, m_sym_ctx); + + const AddressRange *addr_range_ptr; + if (m_sym_ctx.function) + addr_range_ptr = &m_sym_ctx.function->GetAddressRange(); + else if (m_sym_ctx.symbol) + addr_range_ptr = m_sym_ctx.symbol->GetAddressRangePtr(); + + static ConstString sigtramp_name ("_sigtramp"); + if ((m_sym_ctx.function && m_sym_ctx.function->GetMangled().GetMangledName() == sigtramp_name) + || (m_sym_ctx.symbol && m_sym_ctx.symbol->GetMangled().GetMangledName() == sigtramp_name)) + { + m_frame_type = eSigtrampFrame; + } + else + { + // FIXME: Detect eDebuggerFrame here. + m_frame_type = eNormalFrame; + } + + // If we were able to find a symbol/function, set addr_range_ptr to the bounds of that symbol/function. + // else treat the current pc value as the start_pc and record no offset. + if (addr_range_ptr) + { + m_start_pc = addr_range_ptr->GetBaseAddress(); + m_current_offset = current_pc.GetOffset() - m_start_pc.GetOffset(); + } + else + { + m_start_pc = current_pc; + m_current_offset = -1; + } + + // We've set m_frame_type, m_zeroth_frame, and m_sym_ctx before this call. + // This call sets the m_all_registers_available, m_fast_unwind_plan, and m_full_unwind_plan member variables. + GetUnwindPlansForFrame (current_pc); + + const UnwindPlan::Row *active_row = NULL; + int cfa_offset = 0; + int row_register_kind; + if (m_fast_unwind_plan && m_fast_unwind_plan->PlanValidAtAddress (current_pc)) + { + active_row = m_fast_unwind_plan->GetRowForFunctionOffset (m_current_offset); + row_register_kind = m_fast_unwind_plan->GetRegisterKind (); + } + else if (m_full_unwind_plan && m_full_unwind_plan->PlanValidAtAddress (current_pc)) + { + active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); + row_register_kind = m_full_unwind_plan->GetRegisterKind (); + } + + if (active_row == NULL) + { + m_frame_type = eNotAValidFrame; + return; + } + + addr_t cfa_regval; + if (!ReadGPRValue (row_register_kind, active_row->GetCFARegister(), cfa_regval)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d failed to get cfa reg %d/%d", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + row_register_kind, active_row->GetCFARegister()); + } + m_frame_type = eNotAValidFrame; + return; + } + cfa_offset = active_row->GetCFAOffset (); + + m_cfa = cfa_regval + cfa_offset; + + if (log) + { + log->Printf("%*sThread %u Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); + } +} + + + + +// On entry to this method, +// +// 1. m_frame_type should already be set to eSigtrampFrame/eDebuggerFrame +// if either of those are correct, and +// 2. m_zeroth_frame should be set to true if this is frame 0 and +// 3. m_sym_ctx should already be filled in. +// +// On exit this function will have set +// +// a. m_all_registers_available (true if we can provide any requested register, false if only a subset are provided) +// b. m_fast_unwind_plan (fast unwind plan that walks the stack while filling in only minimal registers, may be NULL) +// c. m_full_unwind_plan (full unwind plan that can provide all registers possible, will *not* be NULL) +// +// The argument current_pc should be the current pc value in the function. + +void +RegisterContextLLDB::GetUnwindPlansForFrame (Address current_pc) +{ + UnwindPlan *arch_default_up = NULL; + ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); + ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); + if (arch_default) + { + arch_default_up = arch_default->GetArchDefaultUnwindPlan (m_thread, current_pc); + } + + bool behaves_like_zeroth_frame = false; + + if (m_zeroth_frame) + { + behaves_like_zeroth_frame = true; + } + if (m_next_frame.get() && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eSigtrampFrame) + { + behaves_like_zeroth_frame = true; + } + if (m_next_frame.get() && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eDebuggerFrame) + { + behaves_like_zeroth_frame = true; + } + + if (behaves_like_zeroth_frame) + { + m_all_registers_available = true; + } + else + { +// If we need to implement gdb's decrement-pc-value-by-one-before-function-check macro, it would be here. +// current_pc.SetOffset (current_pc.GetOffset() - 1); + m_all_registers_available = false; + } + + // No Module for the current pc, try using the architecture default unwind. + if (current_pc.GetModule() == NULL || current_pc.GetModule()->GetObjectFile() == NULL) + { + m_fast_unwind_plan = NULL; + m_full_unwind_plan = arch_default_up; + m_frame_type = eNormalFrame; + return; + } + + FuncUnwindersSP fu; + if (current_pc.GetModule() && current_pc.GetModule()->GetObjectFile()) + { + fu = current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (current_pc, m_sym_ctx); + } + + // No FuncUnwinders available for this pc, try using architectural default unwind. + if (fu.get() == NULL) + { + m_fast_unwind_plan = NULL; + m_full_unwind_plan = arch_default_up; + m_frame_type = eNormalFrame; + return; + } + + // If we're in _sigtramp(), unwinding past this frame requires special knowledge. On Mac OS X this knowledge + // is properly encoded in the eh_frame section, so prefer that if available. + if (m_frame_type == eSigtrampFrame) + { + m_fast_unwind_plan = NULL; + UnwindPlan *up = fu->GetUnwindPlanAtCallSite (); + if (up->PlanValidAtAddress (current_pc)) + { + m_fast_unwind_plan = NULL; + m_full_unwind_plan = up; + return; + } + } + + + UnwindPlan *fast, *callsite, *noncallsite; + fast = callsite = noncallsite = NULL; + + if (fu->GetUnwindPlanFastUnwind (m_thread) + && fu->GetUnwindPlanFastUnwind (m_thread)->PlanValidAtAddress (current_pc)) + { + fast = fu->GetUnwindPlanFastUnwind (m_thread); + } + + // Typically this is the unwind created by inspecting the assembly language instructions + if (fu->GetUnwindPlanAtNonCallSite (m_thread) + && fu->GetUnwindPlanAtNonCallSite (m_thread)->PlanValidAtAddress (current_pc)) + { + noncallsite = fu->GetUnwindPlanAtNonCallSite (m_thread); + } + + + // Typically this is unwind info from an eh_frame section intended for exception handling; only valid at call sites + if (fu->GetUnwindPlanAtCallSite () + && fu->GetUnwindPlanAtCallSite ()->PlanValidAtAddress (current_pc)) + { + callsite = fu->GetUnwindPlanAtCallSite (); + } + + m_fast_unwind_plan = NULL; + m_full_unwind_plan = NULL; + + if (fast) + { + m_fast_unwind_plan = fast; + } + + if (behaves_like_zeroth_frame && noncallsite) + { + m_full_unwind_plan = noncallsite; + } + else + { + if (callsite) + { + m_full_unwind_plan = callsite; + } + else + { + m_full_unwind_plan = noncallsite; + } + } + + if (m_full_unwind_plan == NULL) + { + m_full_unwind_plan = arch_default_up; + } + + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + if (log) + { + const char *has_fast = ""; + if (m_fast_unwind_plan) + has_fast = ", and has a fast UnwindPlan"; + log->Printf("%*sThread %u Frame %d frame uses %s for full UnwindPlan%s", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + m_full_unwind_plan->GetSourceName().GetCString(), has_fast); + } + + return; +} + +void +RegisterContextLLDB::Invalidate () +{ + m_frame_type = eNotAValidFrame; +} + +size_t +RegisterContextLLDB::GetRegisterCount () +{ + return m_base_reg_ctx->GetRegisterCount(); +} + +const RegisterInfo * +RegisterContextLLDB::GetRegisterInfoAtIndex (uint32_t reg) +{ + return m_base_reg_ctx->GetRegisterInfoAtIndex (reg); +} + +size_t +RegisterContextLLDB::GetRegisterSetCount () +{ + return m_base_reg_ctx->GetRegisterSetCount (); +} + +const RegisterSet * +RegisterContextLLDB::GetRegisterSet (uint32_t reg_set) +{ + return m_base_reg_ctx->GetRegisterSet (reg_set); +} + +uint32_t +RegisterContextLLDB::ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) +{ + return m_base_reg_ctx->ConvertRegisterKindToRegisterNumber (kind, num); +} + +bool +RegisterContextLLDB::ReadRegisterBytesFromRegisterLocation (uint32_t regnum, RegisterLocation regloc, DataExtractor &data) +{ + if (!IsValid()) + return false; + + if (regloc.type == eRegisterInRegister) + { + data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); + data.SetByteOrder (m_thread.GetProcess().GetByteOrder()); + if (m_next_frame.get() == NULL) + { + return m_base_reg_ctx->ReadRegisterBytes (regloc.location.register_number, data); + } + else + { + return m_next_frame->ReadRegisterBytes (regloc.location.register_number, data); + } + } + if (regloc.type == eRegisterNotSaved) + { + return false; + } + if (regloc.type == eRegisterSavedAtHostMemoryLocation) + { + assert ("FIXME debugger inferior function call unwind"); + } + if (regloc.type != eRegisterSavedAtMemoryLocation) + { + assert ("Unknown RegisterLocation type."); + } + + const RegisterInfo *reg_info = m_base_reg_ctx->GetRegisterInfoAtIndex (regnum); + DataBufferSP data_sp (new DataBufferHeap (reg_info->byte_size, 0)); + data.SetData (data_sp, 0, reg_info->byte_size); + data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); + + if (regloc.type == eRegisterValueInferred) + { + data.SetByteOrder (eByteOrderHost); + switch (reg_info->byte_size) + { + case 1: + { + uint8_t val = regloc.location.register_value; + memcpy (data_sp->GetBytes(), &val, sizeof (val)); + data.SetByteOrder (eByteOrderHost); + return true; + } + case 2: + { + uint16_t val = regloc.location.register_value; + memcpy (data_sp->GetBytes(), &val, sizeof (val)); + data.SetByteOrder (eByteOrderHost); + return true; + } + case 4: + { + uint32_t val = regloc.location.register_value; + memcpy (data_sp->GetBytes(), &val, sizeof (val)); + data.SetByteOrder (eByteOrderHost); + return true; + } + case 8: + { + uint64_t val = regloc.location.register_value; + memcpy (data_sp->GetBytes(), &val, sizeof (val)); + data.SetByteOrder (eByteOrderHost); + return true; + } + } + return false; + } + + assert (regloc.type == eRegisterSavedAtMemoryLocation); + Error error; + data.SetByteOrder (m_thread.GetProcess().GetByteOrder()); + if (!m_thread.GetProcess().ReadMemory (regloc.location.target_memory_location, data_sp->GetBytes(), reg_info->byte_size, error)) + return false; + return true; +} + +bool +RegisterContextLLDB::IsValid () const +{ + return m_frame_type != eNotAValidFrame; +} + +// Answer the question: Where did THIS frame save the CALLER frame ("previous" frame)'s register value? + +bool +RegisterContextLLDB::SavedLocationForRegister (uint32_t lldb_regnum, RegisterLocation ®loc) +{ + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + + // Have we already found this register location? + std::map::const_iterator iterator; + if (m_registers.size() > 0) + { + iterator = m_registers.find (lldb_regnum); + if (iterator != m_registers.end()) + { + regloc = iterator->second; + return true; + } + } + + // Are we looking for the CALLER's stack pointer? The stack pointer is defined to be the same as THIS frame's + // CFA so just return the CFA value. This is true on x86-32/x86-64 at least. + uint32_t sp_regnum; + if (m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, eRegisterKindLLDB, sp_regnum) + && sp_regnum == lldb_regnum) + { + // make sure we won't lose precision copying an addr_t (m_cfa) into a uint64_t (.register_value) + assert (sizeof (addr_t) <= sizeof (uint64_t)); + regloc.type = eRegisterValueInferred; + regloc.location.register_value = m_cfa; + m_registers[lldb_regnum] = regloc; + return true; + } + + // Look through the available UnwindPlans for the register location. + + UnwindPlan::Row::RegisterLocation unwindplan_regloc; + bool have_unwindplan_regloc = false; + if (m_fast_unwind_plan) + { + const UnwindPlan::Row *active_row = m_fast_unwind_plan->GetRowForFunctionOffset (m_current_offset); + uint32_t row_regnum; + if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, m_fast_unwind_plan->GetRegisterKind(), row_regnum)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return false; + } + if (active_row->GetRegisterInfo (row_regnum, unwindplan_regloc)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d supplying caller's saved reg %d's location using FastUnwindPlan", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + have_unwindplan_regloc = true; + } + } + else if (m_full_unwind_plan) + { + const UnwindPlan::Row *active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); + uint32_t row_regnum; + if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, m_full_unwind_plan->GetRegisterKind(), row_regnum)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return false; + } + + if (active_row->GetRegisterInfo (row_regnum, unwindplan_regloc)) + { + have_unwindplan_regloc = true; + if (log) + { + log->Printf("%*sThread %u Frame %d supplying caller's saved reg %d's location using %s UnwindPlan", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum, m_full_unwind_plan->GetSourceName().GetCString()); + } + } + } + if (have_unwindplan_regloc == false) + { + // If a volatile register is being requested, we don't want to forward m_next_frame's register contents + // up the stack -- the register is not retrievable at this frame. + ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); + ArchVolatileRegs *volatile_regs = ArchVolatileRegs::FindPlugin (arch); + if (volatile_regs && volatile_regs->RegisterIsVolatile (m_thread, lldb_regnum)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d did not supply reg location for %d because it is volatile", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return false; + } + + if (m_next_frame.get()) + { + return ((RegisterContextLLDB*)m_next_frame.get())->SavedLocationForRegister (lldb_regnum, regloc); + } + else + { + // This is frame 0 - we should return the actual live register context value + RegisterLocation new_regloc; + new_regloc.type = eRegisterInRegister; + new_regloc.location.register_number = lldb_regnum; + m_registers[lldb_regnum] = new_regloc; + regloc = new_regloc; + if (log) + { + log->Printf("%*sThread %u Frame %d register %d is in the thread's live register context", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return true; + } + if (log) + { + log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return false; + } + + // unwindplan_regloc has valid contents about where to retrieve the register + if (unwindplan_regloc.IsUnspecified()) + { + RegisterLocation new_regloc; + new_regloc.type = eRegisterNotSaved; + m_registers[lldb_regnum] = new_regloc; + if (log) + { + log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return false; + } + + if (unwindplan_regloc.IsSame()) + { + if (m_next_frame.get()) + { + return ((RegisterContextLLDB*)m_next_frame.get())->SavedLocationForRegister (lldb_regnum, regloc); + } + else + { + if (log) + { + log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return false; + } + } + + if (unwindplan_regloc.IsCFAPlusOffset()) + { + int offset = unwindplan_regloc.GetOffset(); + regloc.type = eRegisterValueInferred; + regloc.location.register_value = m_cfa + offset; + m_registers[lldb_regnum] = regloc; + return true; + } + + if (unwindplan_regloc.IsAtCFAPlusOffset()) + { + int offset = unwindplan_regloc.GetOffset(); + regloc.type = eRegisterSavedAtMemoryLocation; + regloc.location.target_memory_location = m_cfa + offset; + m_registers[lldb_regnum] = regloc; + return true; + } + + if (unwindplan_regloc.IsInOtherRegister()) + { + uint32_t unwindplan_regnum = unwindplan_regloc.GetRegisterNumber(); + uint32_t row_regnum_in_lldb; + if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (m_full_unwind_plan->GetRegisterKind(), unwindplan_regnum, eRegisterKindLLDB, row_regnum_in_lldb)) + { + if (log) + { + log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + return false; + } + regloc.type = eRegisterInRegister; + regloc.location.register_number = row_regnum_in_lldb; + m_registers[lldb_regnum] = regloc; + return true; + } + + if (log) + { + log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_regnum); + } + + assert ("UnwindPlan::Row types atDWARFExpression and isDWARFExpression are unsupported."); + return false; +} + +// Retrieve a general purpose register value for THIS from, as saved by the NEXT frame, i.e. the frame that +// this frame called. e.g. +// +// foo () { } +// bar () { foo (); } +// main () { bar (); } +// +// stopped in foo() so +// frame 0 - foo +// frame 1 - bar +// frame 2 - main +// and this RegisterContext is for frame 1 (bar) - if we want to get the pc value for frame 1, we need to ask +// where frame 0 (the "next" frame) saved that and retrieve the value. + +// Assumes m_base_reg_ctx has been set +bool +RegisterContextLLDB::ReadGPRValue (int register_kind, uint32_t regnum, addr_t &value) +{ + if (!IsValid()) + return false; + + uint32_t lldb_regnum; + if (register_kind == eRegisterKindLLDB) + { + lldb_regnum = regnum; + } + else if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (register_kind, regnum, eRegisterKindLLDB, lldb_regnum)) + { + return false; + } + + uint32_t offset = 0; + DataExtractor data; + data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); + data.SetByteOrder (m_thread.GetProcess().GetByteOrder()); + + // if this is frame 0 (currently executing frame), get the requested reg contents from the actual thread registers + if (m_next_frame.get() == NULL) + { + if (m_base_reg_ctx->ReadRegisterBytes (lldb_regnum, data)) + { + data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); + value = data.GetAddress (&offset); + return true; + } + else + { + return false; + } + } + + RegisterLocation regloc; + if (!((RegisterContextLLDB*)m_next_frame.get())->SavedLocationForRegister (lldb_regnum, regloc)) + { + return false; + } + if (!ReadRegisterBytesFromRegisterLocation (lldb_regnum, regloc, data)) + { + return false; + } + data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); + value = data.GetAddress (&offset); + return true; +} + +// Find the value of a register in THIS frame + +bool +RegisterContextLLDB::ReadRegisterBytes (uint32_t lldb_reg, DataExtractor& data) +{ + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + if (!IsValid()) + return false; + + if (log) + { + log->Printf("%*sThread %u Frame %d looking for register saved location for reg %d", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_reg); + } + + // If this is the 0th frame, hand this over to the live register context + if (m_next_frame.get() == NULL) + { + if (log) + { + log->Printf("%*sThread %u Frame %d passing along to the live register context for reg %d", + m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + lldb_reg); + } + return m_base_reg_ctx->ReadRegisterBytes (lldb_reg, data); + } + + RegisterLocation regloc; + // Find out where the NEXT frame saved THIS frame's register contents + if (!((RegisterContextLLDB*)m_next_frame.get())->SavedLocationForRegister (lldb_reg, regloc)) + return false; + + return ReadRegisterBytesFromRegisterLocation (lldb_reg, regloc, data); +} + +bool +RegisterContextLLDB::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) +{ + assert ("not yet implemented"); // FIXME + return false; +} + +bool +RegisterContextLLDB::WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset) +{ + assert ("not yet implemented"); // FIXME + return false; +} + +bool +RegisterContextLLDB::WriteAllRegisterValues (const lldb::DataBufferSP& data_sp) +{ + assert ("not yet implemented"); // FIXME + return false; +} + +// Retrieve the pc value for THIS from + +bool +RegisterContextLLDB::GetCFA (addr_t& cfa) +{ + if (!IsValid()) + { + return false; + } + if (m_cfa == LLDB_INVALID_ADDRESS) + { + return false; + } + cfa = m_cfa; + return true; +} + +// Retrieve the address of the start of the function of THIS frame + +bool +RegisterContextLLDB::GetStartPC (addr_t& start_pc) +{ + if (!IsValid()) + return false; + if (!m_start_pc.IsValid()) + { + return GetPC (start_pc); + } + start_pc = m_start_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()); + return true; +} + +// Retrieve the current pc value for THIS frame, as saved by the NEXT frame. + +bool +RegisterContextLLDB::GetPC (addr_t& pc) +{ + if (!IsValid()) + return false; + if (ReadGPRValue (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc)) + { + // A pc value of 0 or 1 is impossible in the middle of the stack -- it indicates the end of a stack walk. + // On the currently executing frame (or such a frame interrupted asynchronously by sigtramp et al) this may + // occur if code has jumped through a NULL pointer -- we want to be able to unwind past that frame to help + // find the bug. + + if (m_all_registers_available == false + && (pc == 0 || pc == 1)) + { + return false; + } + else + { + return true; + } + } + else + { + return false; + } +} Added: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h?rev=117256&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (added) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Mon Oct 25 06:12:07 2010 @@ -0,0 +1,177 @@ +//===-- RegisterContextLLDB.h --------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_RegisterContextLLDB_h_ +#define lldb_RegisterContextLLDB_h_ + +#include + +#include "lldb/lldb-private.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Symbol/SymbolContext.h" + +class RegisterContextLLDB : public lldb_private::RegisterContext +{ +public: + RegisterContextLLDB (lldb_private::Thread &thread, + const lldb::RegisterContextSP& next_frame, + lldb_private::SymbolContext& sym_ctx, + int frame_number); + + /// + // pure virtual functions from the base class that we must implement + /// + + virtual + ~RegisterContextLLDB () { } + + virtual void + Invalidate (); + + virtual size_t + GetRegisterCount (); + + virtual const lldb::RegisterInfo * + GetRegisterInfoAtIndex (uint32_t reg); + + virtual size_t + GetRegisterSetCount (); + + virtual const lldb::RegisterSet * + GetRegisterSet (uint32_t reg_set); + + virtual bool + ReadRegisterBytes (uint32_t reg, lldb_private::DataExtractor &data); + + virtual bool + ReadAllRegisterValues (lldb::DataBufferSP &data_sp); + + virtual bool + WriteRegisterBytes (uint32_t reg, lldb_private::DataExtractor &data, uint32_t data_offset = 0); + + virtual bool + WriteAllRegisterValues (const lldb::DataBufferSP &data_sp); + + virtual uint32_t + ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num); + + bool + IsValid () const; + + bool + GetCFA (lldb::addr_t& cfa); + + bool + GetStartPC (lldb::addr_t& start_pc); + + bool + GetPC (lldb::addr_t& start_pc); + +private: + + typedef enum FrameType + { + eNormalFrame, + eSigtrampFrame, + eDebuggerFrame, // a debugger inferior function call frame; we get caller's registers from debugger + eNotAValidFrame // this frame is invalid for some reason - most likely it is past the top (end) of the stack + }; + + enum RegisterLocationTypes + { + eRegisterNotSaved = 0, // register was not preserved by callee. If volatile reg, is unavailable + eRegisterSavedAtMemoryLocation, // register is saved at a specific word of target mem (target_memory_location) + eRegisterInRegister, // register is available in a (possible other) register (register_number) + eRegisterSavedAtHostMemoryLocation, // register is saved at a word in lldb's address space + eRegisterValueInferred // register val was computed (and is in register_value) + }; + + struct RegisterLocation + { + int type; + union + { + lldb::addr_t target_memory_location; + uint32_t register_number; // in eRegisterKindLLDB register numbering system + void* host_memory_location; + uint64_t register_value; // eRegisterValueInferred - e.g. stack pointer == cfa + offset + } location; + }; + + + void + InitializeZerothFrame (); + + void + InitializeNonZerothFrame(); + + // Provide a location for where THIS function saved the CALLER's register value + // Or a frame "below" this one savedit, i.e. a function called by this one, preserved a register that this + // function didn't modify/use. + // + // The RegisterLocation type may be set to eRegisterNotAvailable -- this will happen for a volatile register + // bieng queried mid-stack. Instead of floating frame 0's contents of that register up the stack (which may + // or may not be the value of that reg when the function was executing), we won't return any value. + // + // If a non-volatile register (a "preserved" register) is requested mid-stack and no frames "below" the requested + // stack have saved the register anywhere, it is safe to assume that frame 0's register values are still the same + // as the requesting frame's. + // + bool + SavedLocationForRegister (uint32_t lldb_regnum, RegisterLocation ®loc); + + bool + ReadRegisterBytesFromRegisterLocation (uint32_t regnum, RegisterLocation regloc, lldb_private::DataExtractor &data); + + bool + WriteRegisterBytesFromRegisterLocation (uint32_t regnum, RegisterLocation regloc, lldb_private::Scalar value); + + // Get the contents of a general purpose (address-size) register for this frame + // (usually retrieved from the m_next_frame) + // m_base_reg_ectx and m_next_frame should both be initialized appropriately before calling. + bool + ReadGPRValue (int register_kind, uint32_t regnum, lldb::addr_t &value); + + void + GetUnwindPlansForFrame (lldb_private::Address current_pc); + + lldb_private::Thread& m_thread; + lldb::RegisterContextSP m_next_frame; + + lldb_private::RegisterContext *m_base_reg_ctx; // RegisterContext of frame 0 (live register values only) + + /// + // The following tell us how to retrieve the CALLER's register values (ie the "previous" frame, aka the frame above) + // i.e. where THIS frame saved them + /// + + lldb_private::UnwindPlan *m_fast_unwind_plan; // may be NULL + lldb_private::UnwindPlan *m_full_unwind_plan; + bool m_zeroth_frame; // Is this the bottom-most, i.e. currently executing, frame? + bool m_all_registers_available; // Can we retrieve all regs or just nonvolatile regs? + int m_frame_type; // enum FrameType + int m_current_offset; // how far into the function we've executed; -1 if unknown + lldb_private::SymbolContext& m_sym_ctx; + + int m_frame_number; // What stack frame level this frame is - used for debug logging + + lldb::addr_t m_cfa; + lldb_private::Address m_start_pc; + + std::map m_registers; // where to find reg values for this frame + + //------------------------------------------------------------------ + // For RegisterContextLLDB only + //------------------------------------------------------------------ + + DISALLOW_COPY_AND_ASSIGN (RegisterContextLLDB); +}; + +#endif // lldb_RegisterContextLLDB_h_ Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Mon Oct 25 06:12:07 2010 @@ -125,7 +125,7 @@ bool get_non_call_site_unwind_plan (UnwindPlan &unwind_plan); - bool get_fast_unwind_plan (UnwindPlan &unwind_plan); + bool get_fast_unwind_plan (AddressRange& func, UnwindPlan &unwind_plan); bool find_first_non_prologue_insn (Address &address); @@ -166,7 +166,7 @@ AssemblyParse_x86::AssemblyParse_x86 (Target& target, Thread* thread, int cpu, AddressRange func) : m_target (target), m_thread (thread), m_cpu(cpu), m_func_bounds(func) -{ +{ int *initialized_flag = NULL; m_lldb_ip_regnum = m_lldb_sp_regnum = m_lldb_fp_regnum = -1; if (cpu == k_i386) @@ -489,7 +489,7 @@ if (EDGetDisassembler (&disasm, "i386-apple-darwin", kEDAssemblySyntaxX86ATT) != 0) { - false; + return false; } uint64_t addr_offset = addr.GetOffset(); @@ -498,7 +498,7 @@ arg.target = &m_target; if (EDCreateInsts (&cur_insn, 1, disasm, read_byte_for_edis, addr_offset, &arg) != 1) { - false; + return false; } length = EDInstByteSize (cur_insn); EDReleaseInst (cur_insn); @@ -566,12 +566,11 @@ goto loopnext; } + // This is the start() function (or a pthread equivalent), it starts with a pushl $0x0 which puts the + // saved pc value of 0 on the stack. In this case we want to pretend we didn't see a stack movement at all -- + // normally the saved pc value is already on the stack by the time the function starts executing. if (push_0_pattern_p ()) { - row.SetOffset (current_func_text_offset + insn_len); - current_sp_bytes_offset_from_cfa += m_wordsize; - row.SetCFAOffset (current_sp_bytes_offset_from_cfa); - unwind_plan.AppendRow (row); goto loopnext; } @@ -648,14 +647,78 @@ current_func_text_offset += insn_len; } + unwind_plan.SetSourceName ("assembly insn profiling"); + return true; } +/* The "fast unwind plan" is valid for functions that follow the usual convention of + using the frame pointer register (ebp, rbp), i.e. the function prologue looks like + push %rbp [0x55] + mov %rsp,%rbp [0x48 0x89 0xe5] (this is a 2-byte insn seq on i386) +*/ + bool -AssemblyParse_x86::get_fast_unwind_plan (UnwindPlan &unwind_plan) +AssemblyParse_x86::get_fast_unwind_plan (AddressRange& func, UnwindPlan &unwind_plan) { - UnwindPlan up; - return false; + UnwindPlan::Row row; + UnwindPlan::Row::RegisterLocation pc_reginfo; + UnwindPlan::Row::RegisterLocation sp_reginfo; + UnwindPlan::Row::RegisterLocation fp_reginfo; + unwind_plan.SetRegisterKind (eRegisterKindLLDB); + + if (!func.GetBaseAddress().IsValid()) + return false; + + uint8_t bytebuf[4]; + Error error; + if (m_target.ReadMemory (func.GetBaseAddress(), bytebuf, sizeof (bytebuf), error) == -1) + return false; + + uint8_t i386_prologue[] = {0x55, 0x89, 0xe5}; + uint8_t x86_64_prologue[] = {0x55, 0x48, 0x89, 0xe5}; + int prologue_size; + + if (memcmp (bytebuf, i386_prologue, sizeof (i386_prologue)) == 0) + { + prologue_size = sizeof (i386_prologue); + } + else if (memcmp (bytebuf, x86_64_prologue, sizeof (x86_64_prologue)) == 0) + { + prologue_size = sizeof (x86_64_prologue); + } + else + { + return false; + } + + pc_reginfo.SetAtCFAPlusOffset (-m_wordsize); + row.SetRegisterInfo (m_lldb_ip_regnum, pc_reginfo); + + sp_reginfo.SetIsCFAPlusOffset (0); + row.SetRegisterInfo (m_lldb_sp_regnum, sp_reginfo); + + // Zero instructions into the function + row.SetCFARegister (m_lldb_sp_regnum); + row.SetCFAOffset (m_wordsize); + row.SetOffset (0); + unwind_plan.AppendRow (row); + + // push %rbp has executed - stack moved, rbp now saved + row.SetCFAOffset (2 * m_wordsize); + fp_reginfo.SetAtCFAPlusOffset (2 * -m_wordsize); + row.SetRegisterInfo (m_lldb_fp_regnum, fp_reginfo); + row.SetOffset (1); + unwind_plan.AppendRow (row); + + // mov %rsp, %rbp has executed + row.SetCFARegister (m_lldb_fp_regnum); + row.SetCFAOffset (2 * m_wordsize); + row.SetOffset (prologue_size); /// 3 or 4 bytes depending on arch + unwind_plan.AppendRow (row); + + unwind_plan.SetPlanValidAddressRange (func); + return true; } bool @@ -712,7 +775,7 @@ UnwindAssemblyProfiler_x86::GetFastUnwindPlan (AddressRange& func, Thread& thread, UnwindPlan &unwind_plan) { AssemblyParse_x86 asm_parse(thread.GetProcess().GetTarget(), &thread, m_cpu, func); - return asm_parse.get_fast_unwind_plan (unwind_plan); + return asm_parse.get_fast_unwind_plan (func, unwind_plan); } bool Added: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=117256&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (added) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Mon Oct 25 06:12:07 2010 @@ -0,0 +1,141 @@ +//===-- UnwindLLDB.cpp -------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Target/Thread.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Core/Module.h" +#include "lldb/Symbol/FuncUnwinders.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Utility/ArchDefaultUnwindPlan.h" +#include "UnwindLLDB.h" +#include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Core/Log.h" + +using namespace lldb; +using namespace lldb_private; + +UnwindLLDB::UnwindLLDB (Thread &thread) : + Unwind (thread), + m_frames() +{ +} + +uint32_t +UnwindLLDB::GetFrameCount() +{ + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + if (m_frames.empty()) + { + // First, set up the 0th (initial) frame + Cursor first_cursor; + RegisterContextSP no_frame; // an empty shared pointer + RegisterContextLLDB *first_register_ctx = new RegisterContextLLDB(m_thread, no_frame, first_cursor.sctx, 0); + if (!first_register_ctx->IsValid()) + { + delete first_register_ctx; + return 0; + } + if (!first_register_ctx->GetCFA (first_cursor.cfa)) + { + delete first_register_ctx; + return 0; + } + if (!first_register_ctx->GetPC (first_cursor.start_pc)) + { + delete first_register_ctx; + return 0; + } + // Reuse the StackFrame provided by the processor native machine context for the first frame + first_register_ctx->SetStackFrame (m_thread.GetStackFrameAtIndex(0).get()); + RegisterContextSP temp_rcs(first_register_ctx); + first_cursor.reg_ctx = temp_rcs; + m_frames.push_back (first_cursor); + + // Now walk up the rest of the stack + while (1) + { + Cursor cursor; + RegisterContextLLDB *register_ctx; + int cur_idx = m_frames.size (); + register_ctx = new RegisterContextLLDB (m_thread, m_frames[cur_idx - 1].reg_ctx, cursor.sctx, cur_idx); + if (!register_ctx->IsValid()) + { + delete register_ctx; + if (log) + { + log->Printf("%*sThread %u Frame %d invalid RegisterContext for this frame, stopping stack walk", + cur_idx, "", m_thread.GetIndexID(), cur_idx); + } + break; + } + if (!register_ctx->GetCFA (cursor.cfa)) + { + delete register_ctx; + if (log) + { + log->Printf("%*sThread %u Frame %d did not get CFA for this frame, stopping stack walk", + cur_idx, "", m_thread.GetIndexID(), cur_idx); + } + break; + } + if (!register_ctx->GetPC (cursor.start_pc)) + { + delete register_ctx; + if (log) + { + log->Printf("%*sThread %u Frame %d did not get PC for this frame, stopping stack walk", + cur_idx, "", m_thread.GetIndexID(), cur_idx); + } + break; + } + RegisterContextSP temp_rcs(register_ctx); + StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, temp_rcs, cursor.cfa, cursor.start_pc, &cursor.sctx); + register_ctx->SetStackFrame (frame); + cursor.reg_ctx = temp_rcs; + m_frames.push_back (cursor); + } + } + return m_frames.size (); +} + +bool +UnwindLLDB::GetFrameInfoAtIndex (uint32_t idx, addr_t& cfa, addr_t& pc) +{ + // FIXME don't get the entire stack if it isn't needed. + if (m_frames.size() == 0) + GetFrameCount(); + + if (idx < m_frames.size ()) + { + cfa = m_frames[idx].cfa; + pc = m_frames[idx].start_pc; + return true; + } + return false; +} + +RegisterContext * +UnwindLLDB::CreateRegisterContextForFrame (StackFrame *frame) +{ + uint32_t idx = frame->GetFrameIndex (); + + // FIXME don't get the entire stack if it isn't needed. + if (m_frames.size() == 0) + GetFrameCount(); + + if (idx == 0) + { + return m_thread.GetRegisterContext(); + } + if (idx < m_frames.size ()) + return m_frames[idx].reg_ctx.get(); + return NULL; +} Added: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=117256&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (added) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Mon Oct 25 06:12:07 2010 @@ -0,0 +1,70 @@ +//===-- UnwindLLDB.h --------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_UnwindLLDB_h_ +#define lldb_UnwindLLDB_h_ + +#include "lldb/lldb-private.h" +#include "lldb/Target/Unwind.h" +#include "lldb/Symbol/FuncUnwinders.h" +#include "lldb/Symbol/UnwindPlan.h" +#include "RegisterContextLLDB.h" +#include "lldb/Target/RegisterContext.h" +#include + + +namespace lldb_private { + +class UnwindLLDB : public lldb_private::Unwind +{ +public: + UnwindLLDB (lldb_private::Thread &thread); + + virtual + ~UnwindLLDB() { } + + void + Clear() + { + m_frames.clear(); + } + + virtual uint32_t + GetFrameCount(); + + bool + GetFrameInfoAtIndex (uint32_t frame_idx, + lldb::addr_t& cfa, + lldb::addr_t& start_pc); + + lldb_private::RegisterContext * + CreateRegisterContextForFrame (lldb_private::StackFrame *frame); + +private: + struct Cursor + { + lldb::addr_t start_pc; // The start address of the function/symbol for this frame - current pc if unknown + lldb::addr_t cfa; // The canonical frame address for this stack frame + lldb_private::SymbolContext sctx; // A symbol context we'll contribute to & provide to the StackFrame creation + lldb::RegisterContextSP reg_ctx; // These are all RegisterContextLLDB's + + Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { } + }; + + std::vector m_frames; + + //------------------------------------------------------------------ + // For UnwindLLDB only + //------------------------------------------------------------------ + DISALLOW_COPY_AND_ASSIGN (UnwindLLDB); +}; + +} + +#endif // lldb_UnwindLLDB_h_ Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original) +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Mon Oct 25 06:12:07 2010 @@ -347,7 +347,14 @@ // is relative to the FDE offset, into a __eh_frame section // offset if (m_is_eh_frame) + { + unwind_plan.SetSourceName ("eh_frame CFI"); cie_offset = current_entry + 4 - cie_offset; + } + else + { + unwind_plan.SetSourceName ("DWARF CFI"); + } const CIE *cie = GetCIE (cie_offset); assert (cie != NULL); Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original) +++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Mon Oct 25 06:12:07 2010 @@ -71,9 +71,14 @@ FuncUnwinders::GetUnwindPlanAtNonCallSite (Thread& thread) { if (m_unwind_at_non_call_site != NULL) - m_unwind_at_non_call_site; - m_unwind_at_non_call_site = new UnwindPlan; - m_assembly_profiler->GetNonCallSiteUnwindPlanFromAssembly (m_range, thread, *m_unwind_at_non_call_site); + return m_unwind_at_non_call_site; + UnwindPlan *up = new UnwindPlan; + if (!m_assembly_profiler->GetNonCallSiteUnwindPlanFromAssembly (m_range, thread, *up)) + { + delete up; + return NULL; + } + m_unwind_at_non_call_site = up; return m_unwind_at_non_call_site; } @@ -82,8 +87,13 @@ { if (m_fast_unwind != NULL) return m_fast_unwind; - m_fast_unwind = new UnwindPlan; - m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *m_fast_unwind); + UnwindPlan *up = new UnwindPlan; + if (!m_assembly_profiler->GetFastUnwindPlan (m_range, thread, *up)) + { + delete up; + return NULL; + } + m_fast_unwind = up; return m_fast_unwind; } Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/Symbol/UnwindPlan.cpp (original) +++ lldb/trunk/source/Symbol/UnwindPlan.cpp Mon Oct 25 06:12:07 2010 @@ -11,6 +11,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" +#include "lldb/Core/ConstString.h" using namespace lldb; using namespace lldb_private; @@ -220,6 +221,10 @@ UnwindPlan::GetRowForFunctionOffset (int offset) const { const UnwindPlan::Row *rowp = NULL; + if (offset == -1 && m_row_list.size() > 0) + { + return &m_row_list[m_row_list.size() - 1]; + } for (int i = 0; i < m_row_list.size(); ++i) { if (m_row_list[i].GetOffset() <= offset) @@ -268,7 +273,10 @@ void UnwindPlan::SetPlanValidAddressRange (const AddressRange& range) { - m_plan_valid_address_range = range; + if (range.GetBaseAddress().IsValid() && range.GetByteSize() != 0) + { + m_plan_valid_address_range = range; + } // .GetBaseAddress() = addr; // m_plan_valid_address_range.SetByteSize (range.GetByteSize()); } @@ -276,7 +284,7 @@ bool UnwindPlan::PlanValidAtAddress (Address addr) { - if (!m_plan_valid_address_range.GetBaseAddress().IsValid()) + if (!m_plan_valid_address_range.GetBaseAddress().IsValid() || m_plan_valid_address_range.GetByteSize() == 0) return true; if (m_plan_valid_address_range.ContainsFileAddress (addr)) @@ -288,9 +296,20 @@ void UnwindPlan::Dump (Stream& s, Thread *thread) const { - s.Printf ("Address range of this UnwindPlan: "); - m_plan_valid_address_range.Dump (&s, &thread->GetProcess().GetTarget(), Address::DumpStyleSectionNameOffset); - s.Printf ("\n"); + if (!m_source_name.IsEmpty()) + { + s.Printf ("This UnwindPlan originally sourced from %s\n", m_source_name.GetCString()); + } + if (m_plan_valid_address_range.GetBaseAddress().IsValid() && m_plan_valid_address_range.GetByteSize() > 0) + { + s.Printf ("Address range of this UnwindPlan: "); + m_plan_valid_address_range.Dump (&s, &thread->GetProcess().GetTarget(), Address::DumpStyleSectionNameOffset); + s.Printf ("\n"); + } + else + { + s.Printf ("No valid address range recorded for this UnwindPlan.\n"); + } s.Printf ("UnwindPlan register kind %d", m_register_kind); switch (m_register_kind) { @@ -308,3 +327,15 @@ m_row_list[i].Dump(s, m_register_kind, thread); } } + +void +UnwindPlan::SetSourceName (const char *source) +{ + m_source_name = ConstString (source); +} + +ConstString +UnwindPlan::GetSourceName () const +{ + return m_source_name; +} Modified: lldb/trunk/source/Target/RegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/RegisterContext.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/Target/RegisterContext.cpp (original) +++ lldb/trunk/source/Target/RegisterContext.cpp Mon Oct 25 06:12:07 2010 @@ -12,6 +12,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Target/RegisterContext.h" +#include "lldb/Core/DataExtractor.h" #include "lldb/Core/Scalar.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/StackFrame.h" @@ -21,7 +22,7 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// RegisterContext constructor +// RegisterContext constructors //---------------------------------------------------------------------- RegisterContext::RegisterContext (Thread &thread, StackFrame *frame) : m_thread (thread), @@ -29,6 +30,12 @@ { } +RegisterContext::RegisterContext (Thread &thread) : + m_thread (thread), + m_frame (NULL) +{ +} + //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- @@ -200,6 +207,12 @@ return false; } +void +RegisterContext::SetStackFrame (StackFrame *frame) +{ + m_frame = frame; +} + Target * RegisterContext::CalculateTarget () { @@ -236,7 +249,7 @@ bool -RegisterContext::ConvertBetweenRegisterKinds (int source_rk, uint32_t source_regnum, int target_rk, uint32_t target_regnum) +RegisterContext::ConvertBetweenRegisterKinds (int source_rk, uint32_t source_regnum, int target_rk, uint32_t& target_regnum) { const uint32_t num_registers = GetRegisterCount(); for (uint32_t reg = 0; reg < num_registers; ++reg) @@ -258,3 +271,121 @@ } return false; } + +bool +RegisterContext::ReadRegisterValue (uint32_t reg, Scalar &value) +{ + DataExtractor data; + if (!ReadRegisterBytes (reg, data)) + return false; + + const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg); + uint32_t offset = 0; + switch (reg_info->encoding) + { + case eEncodingUint: + switch (reg_info->byte_size) + { + case 1: + { + value = data.GetU8 (&offset); + return true; + } + case 2: + { + value = data.GetU16 (&offset); + return true; + } + case 4: + { + value = data.GetU32 (&offset); + return true; + } + case 8: + { + value = data.GetU64 (&offset); + return true; + } + } + break; + case eEncodingSint: + switch (reg_info->byte_size) + { + case 1: + { + int8_t v; + if (data.ExtractBytes (0, sizeof (int8_t), eByteOrderHost, &v) != sizeof (int8_t)) + return false; + value = v; + return true; + } + case 2: + { + int16_t v; + if (data.ExtractBytes (0, sizeof (int16_t), eByteOrderHost, &v) != sizeof (int16_t)) + return false; + value = v; + return true; + } + case 4: + { + int32_t v; + if (data.ExtractBytes (0, sizeof (int32_t), eByteOrderHost, &v) != sizeof (int32_t)) + return false; + value = v; + return true; + } + case 8: + { + int64_t v; + if (data.ExtractBytes (0, sizeof (int64_t), eByteOrderHost, &v) != sizeof (int64_t)) + return false; + value = v; + return true; + } + } + break; + case eEncodingIEEE754: + switch (reg_info->byte_size) + { + case sizeof (float): + { + float v; + if (data.ExtractBytes (0, sizeof (float), eByteOrderHost, &v) != sizeof (float)) + return false; + value = v; + return true; + } + case sizeof (double): + { + double v; + if (data.ExtractBytes (0, sizeof (double), eByteOrderHost, &v) != sizeof (double)) + return false; + value = v; + return true; + } + case sizeof (long double): + { + double v; + if (data.ExtractBytes (0, sizeof (long double), eByteOrderHost, &v) != sizeof (long double)) + return false; + value = v; + return true; + } + } + break; + } + return false; +} + +bool +RegisterContext::WriteRegisterValue (uint32_t reg, const Scalar &value) +{ + DataExtractor data; + if (!value.IsValid()) + return false; + if (!value.GetData (data)) + return false; + + return WriteRegisterBytes (reg, data); +} Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Mon Oct 25 06:12:07 2010 @@ -152,6 +152,7 @@ else if (strcasestr(arg, "comm") == arg) flag_bits |= LIBLLDB_LOG_COMMUNICATION; else if (strcasestr(arg, "conn") == arg) flag_bits |= LIBLLDB_LOG_CONNECTION; else if (strcasestr(arg, "host") == arg) flag_bits |= LIBLLDB_LOG_HOST; + else if (strcasestr(arg, "unwind") == arg) flag_bits |= LIBLLDB_LOG_UNWIND; else { feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); @@ -186,6 +187,7 @@ "\tshlib - log shared library related activities\n" "\tstate - log private and public process state changes\n" "\tstep - log step related activities\n" + "\tunwind - log stack unwind activities\n" "\tverbose - enable verbose loggging\n" "\twatch - log watchpoint related activities\n"); } Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=117256&r1=117255&r2=117256&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Mon Oct 25 06:12:07 2010 @@ -69,6 +69,7 @@ SymbolFileDWARFDebugMap::Initialize(); SymbolFileSymtab::Initialize(); UnwindAssemblyProfiler_x86::Initialize(); + ArchDefaultUnwindPlan_x86::Initialize(); ArchVolatileRegs_x86::Initialize(); #ifdef __APPLE__ @@ -110,6 +111,7 @@ SymbolFileDWARFDebugMap::Terminate(); SymbolFileSymtab::Terminate(); UnwindAssemblyProfiler_x86::Terminate(); + ArchDefaultUnwindPlan_x86::Terminate(); ArchVolatileRegs_x86::Terminate(); #ifdef __APPLE__ From johnny.chen at apple.com Mon Oct 25 13:26:20 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 25 Oct 2010 18:26:20 -0000 Subject: [Lldb-commits] [lldb] r117278 - /lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py Message-ID: <20101025182620.842722A6C12C@llvm.org> Author: johnny Date: Mon Oct 25 13:26:20 2010 New Revision: 117278 URL: http://llvm.org/viewvc/llvm-project?rev=117278&view=rev Log: Skip this test module for the time being until we get a newer clang on lldb tot. Modified: lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py Modified: lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py?rev=117278&r1=117277&r2=117278&view=diff ============================================================================== --- lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py (original) +++ lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py Mon Oct 25 13:26:20 2010 @@ -8,6 +8,7 @@ import lldb, lldbutil from lldbtest import * + at unittest2.skip("rdar://problem/8584431 Assert in clang while evaluating expression") class BreakpointConditionsTestCase(TestBase): mydir = "breakpoint_conditions" From johnny.chen at apple.com Mon Oct 25 13:43:29 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 25 Oct 2010 18:43:29 -0000 Subject: [Lldb-commits] [lldb] r117281 - /lldb/trunk/test/lldbutil.py Message-ID: <20101025184329.9FD262A6C12C@llvm.org> Author: johnny Date: Mon Oct 25 13:43:29 2010 New Revision: 117281 URL: http://llvm.org/viewvc/llvm-project?rev=117281&view=rev Log: Also prints out the stop reason string for lldbutil.PrintStackTrace(thread). Modified: lldb/trunk/test/lldbutil.py Modified: lldb/trunk/test/lldbutil.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=117281&r1=117280&r2=117281&view=diff ============================================================================== --- lldb/trunk/test/lldbutil.py (original) +++ lldb/trunk/test/lldbutil.py Mon Oct 25 13:43:29 2010 @@ -173,8 +173,9 @@ lines = GetLineNumbers(thread) addrs = GetPCAddresses(thread) - print >> output, "Stack trace for thread id={0:#x} name={1} queue={2}:".format( - thread.GetThreadID(), thread.GetName(), thread.GetQueueName()) + print >> output, "Stack trace for thread id={0:#x} name={1} queue={2} stop reason={3}:".format( + thread.GetThreadID(), thread.GetName(), thread.GetQueueName(), + StopReasonString(thread.GetStopReason())) for i in range(depth): frame = thread.GetFrameAtIndex(i) From johnny.chen at apple.com Mon Oct 25 14:13:53 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 25 Oct 2010 19:13:53 -0000 Subject: [Lldb-commits] [lldb] r117287 - /lldb/trunk/test/lldbutil.py Message-ID: <20101025191353.14D222A6C12C@llvm.org> Author: johnny Date: Mon Oct 25 14:13:52 2010 New Revision: 117287 URL: http://llvm.org/viewvc/llvm-project?rev=117287&view=rev Log: Only prints out the stop reason if it is not invalid. Modified: lldb/trunk/test/lldbutil.py Modified: lldb/trunk/test/lldbutil.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=117287&r1=117286&r2=117287&view=diff ============================================================================== --- lldb/trunk/test/lldbutil.py (original) +++ lldb/trunk/test/lldbutil.py Mon Oct 25 14:13:52 2010 @@ -173,9 +173,12 @@ lines = GetLineNumbers(thread) addrs = GetPCAddresses(thread) - print >> output, "Stack trace for thread id={0:#x} name={1} queue={2} stop reason={3}:".format( - thread.GetThreadID(), thread.GetName(), thread.GetQueueName(), - StopReasonString(thread.GetStopReason())) + if thread.GetStopReason() != lldb.eStopReasonInvalid: + desc = "stop reason=" + StopReasonString(thread.GetStopReason()) + else: + desc = "" + print >> output, "Stack trace for thread id={0:#x} name={1} queue={2} ".format( + thread.GetThreadID(), thread.GetName(), thread.GetQueueName()) + desc for i in range(depth): frame = thread.GetFrameAtIndex(i) From gclayton at apple.com Mon Oct 25 15:08:15 2010 From: gclayton at apple.com (Greg Clayton) Date: Mon, 25 Oct 2010 20:08:15 -0000 Subject: [Lldb-commits] [lldb] r117292 - /lldb/trunk/source/Target/Target.cpp Message-ID: <20101025200815.9124B2A6C12C@llvm.org> Author: gclayton Date: Mon Oct 25 15:08:15 2010 New Revision: 117292 URL: http://llvm.org/viewvc/llvm-project?rev=117292&view=rev Log: Don't set the default architecture to x86_64. Leave it NULL so that it isn't set to anything and so that any single architecture binary will adopt that architecture instead of posting an error stating the binary doesn't contain "x86_64". Modified: lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117292&r1=117291&r2=117292&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Mon Oct 25 15:08:15 2010 @@ -1014,7 +1014,7 @@ Target::SettingsController::global_settings_table[] = { //{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"}, - { "default-arch", eSetVarTypeString, "x86_64", NULL, false, false, "Default architecture to choose, when there's a choice." }, + { "default-arch", eSetVarTypeString, NULL, NULL, false, false, "Default architecture to choose, when there's a choice." }, { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL } }; From johnny.chen at apple.com Mon Oct 25 15:39:20 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 25 Oct 2010 20:39:20 -0000 Subject: [Lldb-commits] [lldb] r117304 - /lldb/trunk/examples/test/.lldbtest-config2 Message-ID: <20101025203920.2F4F32A6C12C@llvm.org> Author: johnny Date: Mon Oct 25 15:39:20 2010 New Revision: 117304 URL: http://llvm.org/viewvc/llvm-project?rev=117304&view=rev Log: A simple config to test both x86_64 and i386 architectures. Added: lldb/trunk/examples/test/.lldbtest-config2 Added: lldb/trunk/examples/test/.lldbtest-config2 URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/test/.lldbtest-config2?rev=117304&view=auto ============================================================================== --- lldb/trunk/examples/test/.lldbtest-config2 (added) +++ lldb/trunk/examples/test/.lldbtest-config2 Mon Oct 25 15:39:20 2010 @@ -0,0 +1 @@ +archs = ["x86_64", "i386"] From johnny.chen at apple.com Mon Oct 25 16:38:35 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 25 Oct 2010 21:38:35 -0000 Subject: [Lldb-commits] [lldb] r117318 - /lldb/trunk/examples/test/.lldbtest-config2 Message-ID: <20101025213835.D05A42A6C12C@llvm.org> Author: johnny Date: Mon Oct 25 16:38:35 2010 New Revision: 117318 URL: http://llvm.org/viewvc/llvm-project?rev=117318&view=rev Log: Add comment explaining the options used to invoke the test driver. Modified: lldb/trunk/examples/test/.lldbtest-config2 Modified: lldb/trunk/examples/test/.lldbtest-config2 URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/test/.lldbtest-config2?rev=117318&r1=117317&r2=117318&view=diff ============================================================================== --- lldb/trunk/examples/test/.lldbtest-config2 (original) +++ lldb/trunk/examples/test/.lldbtest-config2 Mon Oct 25 16:38:35 2010 @@ -1 +1,19 @@ +# Example config file for running the test suite for both 64 and 32-bit +# architectures. +# +# I use the following command to invoke the test driver: +# +# /Volumes/data/lldb/svn/trunk/test $ ./dotest.py -r /Volumes/data/lldb-test/archs -s session -c ../examples/test/.lldbtest-config2 -v -w . 2> ~/Developer/Log/lldbtest.log +# +# The '-r' option tells the driver to relocate the test execution to +# /Volumes/data/lldb-test/archs which must not exist before the run. +# +# Test failures/errors will be recorded into the 'session' directory due to the +# '-s' option, e.g., /Volumes/data/lldb-test/archs.arch=i386/test/session could +# contain the following three session info files: +# +# -rw-r--r-- 1 johnny admin 1737 Oct 25 13:25 TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log +# -rw-r--r-- 1 johnny admin 1733 Oct 25 13:25 TestClassTypes.ClassTypesTestCase.test_with_dwarf_and_run_command.log +# -rw-r--r-- 1 johnny admin 4677 Oct 25 13:26 TestObjCMethods.FoundationTestCase.test_data_type_and_expr_with_dsym.log + archs = ["x86_64", "i386"] From johnny.chen at apple.com Mon Oct 25 18:57:27 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 25 Oct 2010 23:57:27 -0000 Subject: [Lldb-commits] [lldb] r117330 - /lldb/trunk/source/Commands/CommandObjectFrame.cpp Message-ID: <20101025235727.1DB9C2A6C12C@llvm.org> Author: johnny Date: Mon Oct 25 18:57:26 2010 New Revision: 117330 URL: http://llvm.org/viewvc/llvm-project?rev=117330&view=rev Log: Add an extra SPC character after '.' for the 'frame variable' help text. Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=117330&r1=117329&r2=117330&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Mon Oct 25 18:57:26 2010 @@ -402,7 +402,7 @@ "Show frame variables. All argument and local variables " "that are in scope will be shown when no arguments are given. " "If any arguments are specified, they can be names of " - "argument, local, file static and file global variables." + "argument, local, file static and file global variables. " "Children of aggregate variables can be specified such as " "'var->child.x'.", NULL) From jingham at apple.com Mon Oct 25 19:27:45 2010 From: jingham at apple.com (Jim Ingham) Date: Tue, 26 Oct 2010 00:27:45 -0000 Subject: [Lldb-commits] [lldb] r117341 - in /lldb/trunk: include/lldb/Target/StopInfo.h source/Target/ThreadPlanCallFunction.cpp Message-ID: <20101026002745.831132A6C12C@llvm.org> Author: jingham Date: Mon Oct 25 19:27:45 2010 New Revision: 117341 URL: http://llvm.org/viewvc/llvm-project?rev=117341&view=rev Log: The call function thread plan should allow internal breakpoints to continue on. Also made stopping in mid-expression evaluation when we hit a breakpoint/signal work. Modified: lldb/trunk/include/lldb/Target/StopInfo.h lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/include/lldb/Target/StopInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StopInfo.h?rev=117341&r1=117340&r2=117341&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/StopInfo.h (original) +++ lldb/trunk/include/lldb/Target/StopInfo.h Mon Oct 25 19:27:45 2010 @@ -46,6 +46,14 @@ return m_thread; } + // The value of the StopInfo depends on the StopReason. + // StopReason Meaning + // ---------------------------------------------- + // eStopReasonBreakpoint BreakpointSiteID + // eStopReasonSignal Signal number + // eStopReasonWatchpoint WatchpointSiteID + // eStopReasonPlanComplete No significance + uint64_t GetValue() const { Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=117341&r1=117340&r2=117341&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Mon Oct 25 19:27:45 2010 @@ -14,11 +14,14 @@ // Other libraries and framework includes // Project includes #include "lldb/lldb-private-log.h" +#include "lldb/Breakpoint/Breakpoint.h" +#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Address.h" #include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" @@ -171,9 +174,45 @@ bool ThreadPlanCallFunction::PlanExplainsStop () { - // If the subplan is running, any crashes are attributable to us. + // If our subplan knows why we stopped, even if it's done (which would forward the question to us) + // we answer yes. + if(m_subplan_sp.get() != NULL && m_subplan_sp->PlanExplainsStop()) + return true; - return (m_subplan_sp.get() != NULL); + // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack. + if (!OkayToDiscard()) + return false; + + // Otherwise, check the case where we stopped for an internal breakpoint, in that case, continue on. + // If it is not an internal breakpoint, consult OkayToDiscard. + lldb::StopInfoSP stop_info_sp = GetPrivateStopReason(); + if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonBreakpoint) + { + uint64_t break_site_id = stop_info_sp->GetValue(); + lldb::BreakpointSiteSP bp_site_sp = m_thread.GetProcess().GetBreakpointSiteList().FindByID(break_site_id); + if (bp_site_sp) + { + uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); + bool is_internal = true; + for (uint32_t i = 0; i < num_owners; i++) + { + if (!bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().IsInternal()) + { + is_internal = false; + break; + } + } + if (is_internal) + return false; + } + + return OkayToDiscard(); + } + else + { + // If the subplan is running, any crashes are attributable to us. + return (m_subplan_sp.get() != NULL); + } } bool From scallanan at apple.com Mon Oct 25 19:31:56 2010 From: scallanan at apple.com (Sean Callanan) Date: Tue, 26 Oct 2010 00:31:56 -0000 Subject: [Lldb-commits] [lldb] r117342 - in /lldb/trunk/source: Expression/ClangExpressionDeclMap.cpp Expression/ClangExpressionParser.cpp Expression/IRForTarget.cpp Target/ThreadPlanCallFunction.cpp Message-ID: <20101026003156.F08292A6C12C@llvm.org> Author: spyffe Date: Mon Oct 25 19:31:56 2010 New Revision: 117342 URL: http://llvm.org/viewvc/llvm-project?rev=117342&view=rev Log: Fixed a problem where function calls on i386 weren't being generated correctly. Also added a messy way to single-step through expressions that I will improve soon. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Expression/ClangExpressionParser.cpp lldb/trunk/source/Expression/IRForTarget.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=117342&r1=117341&r2=117342&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Oct 25 19:31:56 2010 @@ -88,8 +88,12 @@ } if (m_materialized_location) - { + { +//#define SINGLE_STEP_EXPRESSIONS + +#ifndef SINGLE_STEP_EXPRESSIONS m_exe_ctx.process->DeallocateMemory(m_materialized_location); +#endif m_materialized_location = 0; } } Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=117342&r1=117341&r2=117342&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Mon Oct 25 19:31:56 2010 @@ -467,13 +467,19 @@ std::string error_string; + llvm::Reloc::Model relocation_model = llvm::TargetMachine::getRelocationModel(); + + llvm::TargetMachine::setRelocationModel(llvm::Reloc::PIC_); + m_execution_engine.reset(llvm::ExecutionEngine::createJIT (module, &error_string, m_jit_mm, - CodeGenOpt::Default, + CodeGenOpt::Less, true, CodeModel::Small)); + llvm::TargetMachine::setRelocationModel(relocation_model); + if (!m_execution_engine.get()) { err.SetErrorToGenericError(); Modified: lldb/trunk/source/Expression/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=117342&r1=117341&r2=117342&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRForTarget.cpp (original) +++ lldb/trunk/source/Expression/IRForTarget.cpp Mon Oct 25 19:31:56 2010 @@ -335,6 +335,9 @@ if (!m_decl_map->GetFunctionAddress (g_sel_registerName_str, srN_addr)) return false; + if (log) + log->Printf("Found sel_registerName at 0x%llx", srN_addr); + // Build the function type: struct objc_selector *sel_registerName(uint8_t*) // The below code would be "more correct," but in actuality what's required is uint8_t* Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=117342&r1=117341&r2=117342&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Mon Oct 25 19:31:56 2010 @@ -276,10 +276,13 @@ void ThreadPlanCallFunction::DidPush () { +//#define SINGLE_STEP_EXPRESSIONS + +#ifndef SINGLE_STEP_EXPRESSIONS m_subplan_sp.reset(new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads)); m_thread.QueueThreadPlan(m_subplan_sp, false); - +#endif } bool From jmolenda at apple.com Mon Oct 25 19:47:17 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 26 Oct 2010 00:47:17 -0000 Subject: [Lldb-commits] [lldb] r117343 - in /lldb/trunk/source/Plugins/Process/Utility: RegisterContextLLDB.cpp UnwindAssemblyProfiler-x86.cpp UnwindLLDB.cpp Message-ID: <20101026004717.597822A6C12C@llvm.org> Author: jmolenda Date: Mon Oct 25 19:47:17 2010 New Revision: 117343 URL: http://llvm.org/viewvc/llvm-project?rev=117343&view=rev Log: Get a disassembler based on the correct architecture for assembly prologue profiling. Change the log print statements to elide the thread number, make some of them only print when IsLogVerbose(). Add a couple of sanity checks for impossible CFA values so backtraces don't go too far off into the weeds. Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=117343&r1=117342&r2=117343&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Mon Oct 25 19:47:17 2010 @@ -126,10 +126,23 @@ m_cfa = cfa_regval + cfa_offset; Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + + // A couple of sanity checks.. + if (m_cfa == (addr_t) -1 || m_cfa == 0 || m_cfa == 1) + { + if (log) + { + log->Printf("%*sFrame %d could not find a valid cfa address", + m_frame_number, "", m_frame_number); + } + m_frame_type = eNotAValidFrame; + return; + } + if (log) { - log->Printf("%*sThread %u Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + m_frame_number, "", m_frame_number, (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); } } @@ -164,8 +177,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d could not get pc value", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number); + log->Printf("%*sFrame %d could not get pc value", + m_frame_number, "", m_frame_number); } m_frame_type = eNotAValidFrame; return; @@ -179,8 +192,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d using architectural default unwind method", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number); + log->Printf("%*sFrame %d using architectural default unwind method", + m_frame_number, "", m_frame_number); } ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); @@ -199,8 +212,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d failed to get cfa value", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number); + log->Printf("%*sFrame %d failed to get cfa value", + m_frame_number, "", m_frame_number); } m_frame_type = eNormalFrame; return; @@ -208,8 +221,8 @@ m_cfa = cfa_regval + cfa_offset; if (log) { - log->Printf("%*sThread %u Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + m_frame_number, "", m_frame_number, (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); } return; @@ -281,8 +294,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d failed to get cfa reg %d/%d", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d failed to get cfa reg %d/%d", + m_frame_number, "", m_frame_number, row_register_kind, active_row->GetCFARegister()); } m_frame_type = eNotAValidFrame; @@ -292,10 +305,22 @@ m_cfa = cfa_regval + cfa_offset; + // A couple of sanity checks.. + if (m_cfa == (addr_t) -1 || m_cfa == 0 || m_cfa == 1) + { + if (log) + { + log->Printf("%*sFrame %d could not find a valid cfa address", + m_frame_number, "", m_frame_number); + } + m_frame_type = eNotAValidFrame; + return; + } + if (log) { - log->Printf("%*sThread %u Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + m_frame_number, "", m_frame_number, (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); } } @@ -448,13 +473,13 @@ } Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); - if (log) + if (log && IsLogVerbose()) { const char *has_fast = ""; if (m_fast_unwind_plan) has_fast = ", and has a fast UnwindPlan"; - log->Printf("%*sThread %u Frame %d frame uses %s for full UnwindPlan%s", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d frame uses %s for full UnwindPlan%s", + m_frame_number, "", m_frame_number, m_full_unwind_plan->GetSourceName().GetCString(), has_fast); } @@ -630,8 +655,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number, "", m_frame_number, lldb_regnum); } return false; @@ -640,8 +665,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d supplying caller's saved reg %d's location using FastUnwindPlan", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d supplying caller's saved reg %d's location using FastUnwindPlan", + m_frame_number, "", m_frame_number, lldb_regnum); } have_unwindplan_regloc = true; @@ -655,8 +680,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number, "", m_frame_number, lldb_regnum); } return false; @@ -665,10 +690,10 @@ if (active_row->GetRegisterInfo (row_regnum, unwindplan_regloc)) { have_unwindplan_regloc = true; - if (log) + if (log && IsLogVerbose ()) { - log->Printf("%*sThread %u Frame %d supplying caller's saved reg %d's location using %s UnwindPlan", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d supplying caller's saved reg %d's location using %s UnwindPlan", + m_frame_number, "", m_frame_number, lldb_regnum, m_full_unwind_plan->GetSourceName().GetCString()); } } @@ -683,8 +708,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d did not supply reg location for %d because it is volatile", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d did not supply reg location for %d because it is volatile", + m_frame_number, "", m_frame_number, lldb_regnum); } return false; @@ -702,18 +727,12 @@ new_regloc.location.register_number = lldb_regnum; m_registers[lldb_regnum] = new_regloc; regloc = new_regloc; - if (log) - { - log->Printf("%*sThread %u Frame %d register %d is in the thread's live register context", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, - lldb_regnum); - } return true; } if (log) { - log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number, "", m_frame_number, lldb_regnum); } return false; @@ -727,8 +746,8 @@ m_registers[lldb_regnum] = new_regloc; if (log) { - log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number, "", m_frame_number, lldb_regnum); } return false; @@ -744,8 +763,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number, "", m_frame_number, lldb_regnum); } return false; @@ -778,8 +797,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number, "", m_frame_number, lldb_regnum); } return false; @@ -792,8 +811,8 @@ if (log) { - log->Printf("%*sThread %u Frame %d could not supply caller's reg %d location", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number, "", m_frame_number, lldb_regnum); } @@ -875,10 +894,10 @@ if (!IsValid()) return false; - if (log) + if (log && IsLogVerbose ()) { - log->Printf("%*sThread %u Frame %d looking for register saved location for reg %d", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d looking for register saved location for reg %d", + m_frame_number, "", m_frame_number, lldb_reg); } @@ -887,8 +906,8 @@ { if (log) { - log->Printf("%*sThread %u Frame %d passing along to the live register context for reg %d", - m_frame_number, "", m_thread.GetIndexID(), m_frame_number, + log->Printf("%*sFrame %d passing along to the live register context for reg %d", + m_frame_number, "", m_frame_number, lldb_reg); } return m_base_reg_ctx->ReadRegisterBytes (lldb_reg, data); Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp?rev=117343&r1=117342&r2=117343&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Mon Oct 25 19:47:17 2010 @@ -480,14 +480,14 @@ const char *triple; // FIXME should probably pass down the ArchSpec and work from that to make a portable triple if (m_cpu == k_i386) - triple = "i386-apple-darwin"; + triple = "i386-unknown-unknown"; else - triple = "x86_64-apple-darwin"; + triple = "x86_64-unknown-unknown"; EDDisassemblerRef disasm; EDInstRef cur_insn; - if (EDGetDisassembler (&disasm, "i386-apple-darwin", kEDAssemblySyntaxX86ATT) != 0) + if (EDGetDisassembler (&disasm, triple, kEDAssemblySyntaxX86ATT) != 0) { return false; } @@ -565,7 +565,15 @@ unwind_plan.AppendRow (row); goto loopnext; } - + + if (mov_rsp_rbp_pattern_p ()) + { + row.SetOffset (current_func_text_offset + insn_len); + row.SetCFARegister (m_lldb_fp_regnum); + unwind_plan.AppendRow (row); + goto loopnext; + } + // This is the start() function (or a pthread equivalent), it starts with a pushl $0x0 which puts the // saved pc value of 0 on the stack. In this case we want to pretend we didn't see a stack movement at all -- // normally the saved pc value is already on the stack by the time the function starts executing. @@ -617,14 +625,6 @@ goto loopnext; } - if (mov_rsp_rbp_pattern_p ()) - { - row.SetOffset (current_func_text_offset + insn_len); - row.SetCFARegister (m_lldb_fp_regnum); - unwind_plan.AppendRow (row); - goto loopnext; - } - if (ret_pattern_p ()) { // we know where the end of the function is; set the limit on the PlanValidAddressRange Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=117343&r1=117342&r2=117343&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Mon Oct 25 19:47:17 2010 @@ -71,8 +71,8 @@ delete register_ctx; if (log) { - log->Printf("%*sThread %u Frame %d invalid RegisterContext for this frame, stopping stack walk", - cur_idx, "", m_thread.GetIndexID(), cur_idx); + log->Printf("%*sFrame %d invalid RegisterContext for this frame, stopping stack walk", + cur_idx, "", cur_idx); } break; } @@ -81,8 +81,18 @@ delete register_ctx; if (log) { - log->Printf("%*sThread %u Frame %d did not get CFA for this frame, stopping stack walk", - cur_idx, "", m_thread.GetIndexID(), cur_idx); + log->Printf("%*sFrame %d did not get CFA for this frame, stopping stack walk", + cur_idx, "", cur_idx); + } + break; + } + if (cursor.cfa == (addr_t) -1 || cursor.cfa == 1 || cursor.cfa == 0) + { + delete register_ctx; + if (log) + { + log->Printf("%*sFrame %d did not get a valid CFA for this frame, stopping stack walk", + cur_idx, "", cur_idx); } break; } @@ -91,8 +101,8 @@ delete register_ctx; if (log) { - log->Printf("%*sThread %u Frame %d did not get PC for this frame, stopping stack walk", - cur_idx, "", m_thread.GetIndexID(), cur_idx); + log->Printf("%*sFrame %d did not get PC for this frame, stopping stack walk", + cur_idx, "", cur_idx); } break; } From ctice at apple.com Mon Oct 25 22:11:13 2010 From: ctice at apple.com (Caroline Tice) Date: Tue, 26 Oct 2010 03:11:13 -0000 Subject: [Lldb-commits] [lldb] r117349 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Core/ include/lldb/Target/ scripts/Python/ source/ source/API/ source/Commands/ source/Core/ source/Interpreter/ source/Target/ Message-ID: <20101026031113.EBAAD2A6C12C@llvm.org> Author: ctice Date: Mon Oct 25 22:11:13 2010 New Revision: 117349 URL: http://llvm.org/viewvc/llvm-project?rev=117349&view=rev Log: First pass at adding logging capabilities for the API functions. At the moment it logs the function calls, their arguments and the return values. This is not complete or polished, but I am committing it now, at the request of someone who really wants to use it, even though it's not really done. It currently does not attempt to log all the functions, just the most important ones. I will be making further adjustments to the API logging code over the next few days/weeks. (Suggestions for improvements are welcome). Update the Python build scripts to re-build the swig C++ file whenever the python-extensions.swig file is modified. Correct the help for 'log enable' command (give it the correct number & type of arguments). Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h lldb/trunk/include/lldb/API/SBError.h lldb/trunk/include/lldb/API/SBEvent.h lldb/trunk/include/lldb/API/SBFileSpec.h lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/include/lldb/API/SBThread.h lldb/trunk/include/lldb/Core/Communication.h lldb/trunk/include/lldb/Core/InputReader.h lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/include/lldb/lldb-private-log.h lldb/trunk/scripts/Python/build-swig-Python.sh lldb/trunk/scripts/Python/python-extensions.swig lldb/trunk/source/API/SBAddress.cpp lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/API/SBBroadcaster.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBCommandReturnObject.cpp lldb/trunk/source/API/SBCommunication.cpp lldb/trunk/source/API/SBCompileUnit.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBError.cpp lldb/trunk/source/API/SBEvent.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBFunction.cpp lldb/trunk/source/API/SBHostOS.cpp lldb/trunk/source/API/SBInputReader.cpp lldb/trunk/source/API/SBLineEntry.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBSymbol.cpp lldb/trunk/source/API/SBSymbolContext.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SBType.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/API/SBValueList.cpp lldb/trunk/source/Commands/CommandObjectLog.cpp lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Core/InputReader.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Interpreter/CommandObject.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/lldb-log.cpp Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Mon Oct 25 22:11:13 2010 @@ -75,7 +75,7 @@ IsResolved (); bool - GetDescription (const char *description_level, lldb::SBStream &description); + GetDescription (DescriptionLevel level, lldb::SBStream &description); SBBreakpoint GetBreakpoint (); Modified: lldb/trunk/include/lldb/API/SBError.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBError.h (original) +++ lldb/trunk/include/lldb/API/SBError.h Mon Oct 25 22:11:13 2010 @@ -68,6 +68,9 @@ bool GetDescription (lldb::SBStream &description); + bool + GetDescription (lldb::SBStream &description) const; + protected: friend class SBArguments; friend class SBDebugger; Modified: lldb/trunk/include/lldb/API/SBEvent.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBEvent.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBEvent.h (original) +++ lldb/trunk/include/lldb/API/SBEvent.h Mon Oct 25 22:11:13 2010 @@ -57,6 +57,9 @@ bool GetDescription (lldb::SBStream &description); + bool + GetDescription (lldb::SBStream &description) const; + protected: friend class SBListener; friend class SBBroadcaster; Modified: lldb/trunk/include/lldb/API/SBFileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFileSpec.h (original) +++ lldb/trunk/include/lldb/API/SBFileSpec.h Mon Oct 25 22:11:13 2010 @@ -56,6 +56,9 @@ bool GetDescription (lldb::SBStream &description); + bool + GetDescription (lldb::SBStream &description) const; + private: friend class SBBlock; friend class SBCompileUnit; Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Mon Oct 25 22:11:13 2010 @@ -162,7 +162,10 @@ #endif bool - GetDescription (lldb::SBStream &description); + GetDescription (lldb::SBStream &description, lldb::DescriptionLevel); + + bool + GetDescription (lldb::SBStream &description, lldb::DescriptionLevel) const; protected: friend class SBAddress; Modified: lldb/trunk/include/lldb/API/SBThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBThread.h (original) +++ lldb/trunk/include/lldb/API/SBThread.h Mon Oct 25 22:11:13 2010 @@ -91,6 +91,9 @@ bool GetDescription (lldb::SBStream &description); + bool + GetDescription (lldb::SBStream &description) const; + protected: friend class SBBreakpoint; friend class SBBreakpointLocation; Modified: lldb/trunk/include/lldb/Core/Communication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Communication.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Communication.h (original) +++ lldb/trunk/include/lldb/Core/Communication.h Mon Oct 25 22:11:13 2010 @@ -331,6 +331,9 @@ SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback, void *callback_baton); + static const char * + ConnectionStatusAsCString (lldb::ConnectionStatus status); + private: //------------------------------------------------------------------ // For Communication only Modified: lldb/trunk/include/lldb/Core/InputReader.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/InputReader.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/InputReader.h (original) +++ lldb/trunk/include/lldb/Core/InputReader.h Mon Oct 25 22:11:13 2010 @@ -95,6 +95,9 @@ void WaitOnReaderIsDone (); + static const char * + GranularityAsCString (lldb::InputReaderGranularity granularity); + protected: friend class Debugger; Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Mon Oct 25 22:11:13 2010 @@ -98,6 +98,9 @@ virtual void CalculateSymbolContext (SymbolContext* sc); + void + GetDescription (Stream *s); + //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Target.h (original) +++ lldb/trunk/include/lldb/Target/Target.h Mon Oct 25 22:11:13 2010 @@ -183,7 +183,7 @@ /// The stream to which to dump the object descripton. //------------------------------------------------------------------ void - Dump (Stream *s); + Dump (Stream *s, lldb::DescriptionLevel description_level); const lldb::ProcessSP & CreateProcess (Listener &listener, const char *plugin_name = NULL); Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Mon Oct 25 22:11:13 2010 @@ -241,6 +241,12 @@ bool ThreadStoppedForAReason (); + static const char * + RunModeAsCString (lldb::RunMode mode); + + static const char * + StopReasonAsCString (lldb::StopReason reason); + virtual const char * GetInfo () = 0; Modified: lldb/trunk/include/lldb/lldb-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-enumerations.h Mon Oct 25 22:11:13 2010 @@ -533,6 +533,7 @@ eArgTypeFunctionName, eArgTypeIndex, eArgTypeLineNum, + eArgTypeLogCategory, eArgTypeLogChannel, eArgTypeMethod, eArgTypeName, Modified: lldb/trunk/include/lldb/lldb-private-log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-log.h (original) +++ lldb/trunk/include/lldb/lldb-private-log.h Mon Oct 25 22:11:13 2010 @@ -35,6 +35,7 @@ #define LIBLLDB_LOG_CONNECTION (1u << 13) #define LIBLLDB_LOG_HOST (1u << 14) #define LIBLLDB_LOG_UNWIND (1u << 15) +#define LIBLLDB_LOG_API (1u << 16) #define LIBLLDB_LOG_ALL (UINT32_MAX) #define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\ LIBLLDB_LOG_THREAD |\ Modified: lldb/trunk/scripts/Python/build-swig-Python.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/scripts/Python/build-swig-Python.sh (original) +++ lldb/trunk/scripts/Python/build-swig-Python.sh Mon Oct 25 22:11:13 2010 @@ -19,6 +19,7 @@ swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp swig_input_file=${SRC_ROOT}/scripts/lldb.swig +swig_input_file2=${SRC_ROOT}/scripts/Python/python-extensions.swig if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] @@ -119,6 +120,19 @@ fi fi +if [ $NeedToUpdate == 0 ] +then + if [ ${swig_input_file2} -nt ${swig_output_file} ] + then + NeedToUpdate=1 + if [ $Debug == 1 ] + then + echo "${swig_input_file2} is newer than ${swig_output_file}" + echo "swig file will need to be re-built." + fi + fi +fi + os_name=`uname -s` python_version=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` @@ -147,6 +161,10 @@ exit 0 else echo "SWIG needs to be re-run." + if [ -f ${swig_output_file} ] + then + rm ${swig_output_file} + fi fi Modified: lldb/trunk/scripts/Python/python-extensions.swig URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/scripts/Python/python-extensions.swig (original) +++ lldb/trunk/scripts/Python/python-extensions.swig Mon Oct 25 22:11:13 2010 @@ -23,7 +23,7 @@ %extend lldb::SBBreakpointLocation { PyObject *lldb::SBBreakpointLocation::__repr__ (){ lldb::SBStream description; - $self->GetDescription ("full", description); + $self->GetDescription (lldb::eDescriptionLevelFull, description); return PyString_FromString (description.GetData()); } } @@ -128,7 +128,7 @@ %extend lldb::SBTarget { PyObject *lldb::SBTarget::__repr__ (){ lldb::SBStream description; - $self->GetDescription (description); + $self->GetDescription (description, lldb::eDescriptionLevelBrief); return PyString_FromString (description.GetData()); } } Modified: lldb/trunk/source/API/SBAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBAddress.cpp (original) +++ lldb/trunk/source/API/SBAddress.cpp Mon Oct 25 22:11:13 2010 @@ -11,27 +11,49 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBStream.h" #include "lldb/Core/Address.h" +#include "lldb/Core/Log.h" using namespace lldb; +using namespace lldb_private; SBAddress::SBAddress () : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBAddress::SBAddress () ==> this = %p (%s)", this); } SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + 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 (const lldb_private::Address *lldb_object_ptr) lldb_object_ptr = %p " + "==> this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + } } SBAddress::SBAddress (const SBAddress &rhs) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + if (rhs.IsValid()) m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get())); + + if (log) + log->Printf ("SBAddress::SBAddress (const SBAddress &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); } SBAddress::~SBAddress () @@ -41,11 +63,17 @@ 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= (const SBAddress rhs) rhs = %p ==> this = %p", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + return *this; } @@ -88,10 +116,24 @@ 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()) - return m_opaque_ap->GetLoadAddress(target.get()); + { + lldb::addr_t addr = m_opaque_ap->GetLoadAddress (target.get()); + if (log) + log->Printf ("SBAddress::GetLoadAddress ==> %p", addr); + return addr; + } else + { + if (log) + log->Printf ("SBAddress::GetLoadAddress ==> LLDB_INVALID_ADDRESS"); return LLDB_INVALID_ADDRESS; + } } bool Modified: lldb/trunk/source/API/SBBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpoint.cpp (original) +++ lldb/trunk/source/API/SBBreakpoint.cpp Mon Oct 25 22:11:13 2010 @@ -19,6 +19,7 @@ #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Address.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" #include "lldb/Target/Process.h" @@ -66,17 +67,39 @@ SBBreakpoint::SBBreakpoint () : m_opaque_sp () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBBreakpoint::SBBreakpoint () ==> this = %p", this); } SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) : m_opaque_sp (rhs.m_opaque_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBBreakpoint::SBBreakpoint (const SBBreakpoint &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p (%s)", + rhs.m_opaque_sp.get(), this, sstr.GetData()); + } } SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) : m_opaque_sp (bp_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf("SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) bp_sp.get() = %p ==> this = %p (%s)", + bp_sp.get(), this, sstr.GetData()); + } } SBBreakpoint::~SBBreakpoint() @@ -86,18 +109,42 @@ const SBBreakpoint & SBBreakpoint::operator = (const SBBreakpoint& rhs) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBreakpoint::operator="); + if (this != &rhs) { m_opaque_sp = rhs.m_opaque_sp; } + + if (log) + log->Printf ("SBBreakpoint::operator= (const SBBreakpoint &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", + rhs.m_opaque_sp.get(), this); + return *this; } break_id_t SBBreakpoint::GetID () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBreakpoint::GetID"); + if (m_opaque_sp) - return m_opaque_sp->GetID(); + { + break_id_t id = m_opaque_sp->GetID(); + if (log) + log->Printf ("SBBreakpoint::GetID ==> %d", id); + return id; + } + + if (log) + log->Printf ("SBBreakpoint::GetID ==> LLDB_INVALID_BREAK_ID"); + return LLDB_INVALID_BREAK_ID; } @@ -185,6 +232,11 @@ void SBBreakpoint::SetEnabled (bool enable) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBreakpoint::SetEnabled (%s)", (enable ? "true" : "false")); + if (m_opaque_sp) m_opaque_sp->SetEnabled (enable); } @@ -201,6 +253,11 @@ void SBBreakpoint::SetIgnoreCount (uint32_t count) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBreakpoint::SetIgnoreCount (%d)", count); + if (m_opaque_sp) m_opaque_sp->SetIgnoreCount (count); } @@ -220,10 +277,24 @@ uint32_t SBBreakpoint::GetHitCount () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBreakpoint::GetHitCount"); + if (m_opaque_sp) + { + uint32_t hit_count = m_opaque_sp->GetHitCount(); + if (log) + log->Printf ("SBBreakpoint::GetHitCount ==> %d", hit_count); return m_opaque_sp->GetHitCount(); + } else + { + if (log) + log->Printf ("SBBreakpoint::GetHitCount ==> 0"); return 0; + } } uint32_t @@ -389,9 +460,21 @@ void SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBreakpoint::SetCallback :"); + if (m_opaque_sp.get()) { BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton)); + if (log) + { + // CAROLINE: FIXME!! + //StreamString sstr; + //baton_sp->GetDescription (sstr, lldb::eDescriptionLevelFull); + //log->Printf ("%s", sstr.GetData()); + } m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false); } } Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Mon Oct 25 22:11:13 2010 @@ -21,6 +21,7 @@ #include "lldb/lldb-defines.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Target/ThreadSpec.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" #include "lldb/Target/ThreadSpec.h" @@ -29,16 +30,26 @@ using namespace lldb_private; - -//class SBBreakpointLocation - SBBreakpointLocation::SBBreakpointLocation () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBBreakpointLocation::SBBreakpointLocation () ==> this = %p", this); } SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) : m_opaque_sp (break_loc_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (lldb::eDescriptionLevelBrief, sstr); + log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp) " + "break_loc_sp.get() = %p ==> this = %p (%s)", break_loc_sp.get(), this, sstr.GetData()); + } } SBBreakpointLocation::~SBBreakpointLocation () @@ -210,20 +221,10 @@ } bool -SBBreakpointLocation::GetDescription (const char *description_level, SBStream &description) +SBBreakpointLocation::GetDescription (DescriptionLevel level, SBStream &description) { if (m_opaque_sp) { - DescriptionLevel level; - if (strcmp (description_level, "brief") == 0) - level = eDescriptionLevelBrief; - else if (strcmp (description_level, "full") == 0) - level = eDescriptionLevelFull; - else if (strcmp (description_level, "verbose") == 0) - level = eDescriptionLevelVerbose; - else - level = eDescriptionLevelBrief; - description.ref(); m_opaque_sp->GetDescription (description.get(), level); description.get()->EOL(); @@ -237,9 +238,21 @@ SBBreakpoint SBBreakpointLocation::GetBreakpoint () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBreakpointLocation::GetBreakpoint ()"); + SBBreakpoint sb_bp; if (m_opaque_sp) *sb_bp = m_opaque_sp->GetBreakpoint ().GetSP(); + + if (log) + { + SBStream sstr; + sb_bp.GetDescription (sstr); + log->Printf ("SBBreakpointLocation::GetBreakpoint ==> %s", sstr.GetData()); + } return sb_bp; } Modified: lldb/trunk/source/API/SBBroadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBBroadcaster.cpp (original) +++ lldb/trunk/source/API/SBBroadcaster.cpp Mon Oct 25 22:11:13 2010 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/Broadcaster.h" +#include "lldb/Core/Log.h" #include "lldb/lldb-forward-rtti.h" #include "lldb/API/SBBroadcaster.h" @@ -22,6 +23,10 @@ m_opaque (NULL), m_opaque_owned (false) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBBroadcastetr::SBBroadcaster () ==> this = %p", this); } @@ -29,12 +34,22 @@ m_opaque (new Broadcaster (name)), m_opaque_owned (true) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBBroadcaster::SBBroadcaster (const char *name) name = '%s' ==> this = %p (m_opaque = %p)", + name, this, m_opaque); } SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) : m_opaque (broadcaster), m_opaque_owned (owns) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) " + " broadcaster = %p, owns = %s ==> this = %p", broadcaster, (owns ? "true" : "false"), this); } SBBroadcaster::~SBBroadcaster() @@ -45,6 +60,11 @@ void SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBroadcaster::BroadcastEventByType (%d, %s)", event_type, (unique ? "true" : "false")); + if (m_opaque == NULL) return; Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Mon Oct 25 22:11:13 2010 @@ -23,6 +23,7 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBTarget.h" #include "lldb/API/SBListener.h" +#include "lldb/API/SBStream.h" #include "lldb/API/SBStringList.h" using namespace lldb; @@ -32,6 +33,11 @@ SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) : m_opaque_ptr (interpreter) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) interpreter = %p" + " ==> this = %p", interpreter, this); } SBCommandInterpreter::~SBCommandInterpreter () @@ -64,6 +70,12 @@ lldb::ReturnStatus SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter::HandleCommand ('%s', result, %s)", command_line, + (add_to_history ? "true" : "false")); + result.Clear(); if (m_opaque_ptr) { @@ -74,6 +86,14 @@ result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } + + if (log) + { + SBStream sstr; + result.GetDescription (sstr); + log->Printf ("SBCommandInterpreter::HandleCommand ==> %s", sstr.GetData()); + } + return result.GetStatus(); } @@ -209,7 +229,16 @@ SBBroadcaster SBCommandInterpreter::GetBroadcaster () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter::GetBroadcaster ()"); + SBBroadcaster broadcaster (m_opaque_ptr, false); + + if (log) + log->Printf ("SBCommandInterpreter::GetBroadcaster ==> %p", m_opaque_ptr); + return broadcaster; } Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandReturnObject.cpp (original) +++ lldb/trunk/source/API/SBCommandReturnObject.cpp Mon Oct 25 22:11:13 2010 @@ -10,6 +10,7 @@ #include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBStream.h" +#include "lldb/Core/Log.h" #include "lldb/Interpreter/CommandReturnObject.h" using namespace lldb; @@ -18,6 +19,10 @@ SBCommandReturnObject::SBCommandReturnObject () : m_opaque_ap (new CommandReturnObject ()) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBCommandReturnObject::SBCommandReturnObject () ==> this = %p", this); } SBCommandReturnObject::~SBCommandReturnObject () @@ -35,16 +40,42 @@ const char * 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 ==> %s", m_opaque_ap->GetOutputStream().GetData()); return m_opaque_ap->GetOutputStream().GetData(); + } + + if (log) + log->Printf ("SBCommandReturnObject::GetOutput ==> NULL"); + return NULL; } const char * 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 ==> %s", m_opaque_ap->GetErrorStream().GetData()); return m_opaque_ap->GetErrorStream().GetData(); + } + + if (log) + log->Printf ("SBCommandReturnObject::GetError ==> NULL"); + return NULL; } Modified: lldb/trunk/source/API/SBCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommunication.cpp (original) +++ lldb/trunk/source/API/SBCommunication.cpp Mon Oct 25 22:11:13 2010 @@ -11,6 +11,7 @@ #include "lldb/API/SBBroadcaster.h" #include "lldb/Core/Communication.h" #include "lldb/Core/ConnectionFileDescriptor.h" +#include "lldb/Core/Log.h" using namespace lldb; using namespace lldb_private; @@ -21,12 +22,21 @@ m_opaque (NULL), m_opaque_owned (false) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBCommunication::SBCommunication () ==> this = %p", this); } SBCommunication::SBCommunication(const char * broadcaster_name) : m_opaque (new Communication (broadcaster_name)), m_opaque_owned (true) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBCommunication::SBCommunication (const char *broadcaster_name) broadcaster_name = '%s' ==> " + "this = %p (m_opaque = %p)", broadcaster_name, this, m_opaque); } SBCommunication::~SBCommunication() @@ -76,19 +86,36 @@ ConnectionStatus SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommunication::AdoptFileDescriptor (%d, %s)", fd, (owns_fd ? "true" : "false")); + if (m_opaque) { if (m_opaque->HasConnection ()) { if (m_opaque->IsConnected()) - m_opaque->Disconnect (); + m_opaque->Disconnect(); } m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd)); if (m_opaque->IsConnected()) + { + if (log) + log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusSuccess"); return eConnectionStatusSuccess; + } else + { + if (log) + log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusLostConnection"); return eConnectionStatusLostConnection; + } } + + if (log) + log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusNoConnection"); + return eConnectionStatusNoConnection; } @@ -96,9 +123,19 @@ ConnectionStatus SBCommunication::Disconnect () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommunication::Disconnect ()"); + + ConnectionStatus status= eConnectionStatusNoConnection; if (m_opaque) - return m_opaque->Disconnect (); - return eConnectionStatusNoConnection; + status = m_opaque->Disconnect (); + + if (log) + log->Printf ("SBCommunication::Disconnect ==> %s", Communication::ConnectionStatusAsCString (status)); + + return status; } bool @@ -131,18 +168,38 @@ bool SBCommunication::ReadThreadStart () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommunication::ReadThreadStart ()"); + + bool success = false; if (m_opaque) - return m_opaque->StartReadThread (); - return false; + success = m_opaque->StartReadThread (); + + if (log) + log->Printf ("SBCommunication::ReadThreadStart ==> %s", (success ? "true" : "false")); + + return success; } bool SBCommunication::ReadThreadStop () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommunication::ReadThreadStop ()"); + + bool success = false; if (m_opaque) - return m_opaque->StopReadThread (); - return false; + success = m_opaque->StopReadThread (); + + if (log) + log->Printf ("SBCommunication::ReadThreadStop ==> %s", (success ? "true" : "false")); + + return success; } bool @@ -160,11 +217,23 @@ void *callback_baton ) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommunication::SetReadThreadBytesReceivedCallback (callback, baton)"); + // CAROLINE: Fixme: Fix the arguments printed out in the log message above + if (m_opaque) { m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton); + if (log) + log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> true"); return true; } + + if (log) + log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> false"); + return false; } Modified: lldb/trunk/source/API/SBCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBCompileUnit.cpp (original) +++ lldb/trunk/source/API/SBCompileUnit.cpp Mon Oct 25 22:11:13 2010 @@ -13,6 +13,7 @@ #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/LineTable.h" +#include "lldb/Core/Log.h" using namespace lldb; using namespace lldb_private; @@ -21,11 +22,24 @@ SBCompileUnit::SBCompileUnit () : m_opaque_ptr (NULL) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBCompileUnit::SBCompileUnit () ==> this = %p", this); } SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) lldb_object_ptr = %p" + " this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + } } SBCompileUnit::~SBCompileUnit () @@ -57,6 +71,11 @@ SBLineEntry SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCompileUnit::GetLineEntryAtIndex (%d)", idx); + SBLineEntry sb_line_entry; if (m_opaque_ptr) { @@ -68,12 +87,29 @@ sb_line_entry.SetLineEntry(line_entry); } } + + if (log) + { + SBStream sstr; + sb_line_entry.GetDescription (sstr); + log->Printf ("SBCompileUnit::GetLineEntryAtIndex ==> %s", sstr.GetData()); + } + return sb_line_entry; } uint32_t SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + SBStream sstr; + inline_file_spec->GetDescription (sstr); + log->Printf ("SBCompileUnit::FindLineEntryIndex (%d, %d, %s)", start_idx, line, sstr.GetData()); + } + if (m_opaque_ptr) { FileSpec file_spec; @@ -82,11 +118,20 @@ else file_spec = *m_opaque_ptr; - return m_opaque_ptr->FindLineEntry (start_idx, - line, - inline_file_spec ? inline_file_spec->get() : NULL, - NULL); + + uint32_t ret_value = m_opaque_ptr->FindLineEntry (start_idx, + line, + inline_file_spec ? inline_file_spec->get() : NULL, + NULL); + if (log) + log->Printf ("SBCompileUnit::FindLineEntryIndex ==> %d", ret_value); + + return ret_value; } + + if (log) + log->Printf ("SBCompileUnit::FindLineEntryIndex ==> %d", UINT32_MAX); + return UINT32_MAX; } Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Mon Oct 25 22:11:13 2010 @@ -37,6 +37,11 @@ void SBDebugger::Initialize () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::Initialize ()"); + Debugger::Initialize(); } @@ -49,14 +54,32 @@ void SBDebugger::Clear () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::Clear ()"); + m_opaque_sp.reset(); } SBDebugger SBDebugger::Create() { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::Create ()"); + SBDebugger debugger; debugger.reset(Debugger::CreateInstance()); + + if (log) + { + SBStream sstr; + debugger.GetDescription (sstr); + log->Printf ("SBDebugger::Create ==> %s", sstr.GetData()); + } + return debugger; } @@ -95,6 +118,11 @@ void SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::SetInputFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false")); + if (m_opaque_sp) m_opaque_sp->SetInputFileHandle (fh, transfer_ownership); } @@ -102,6 +130,12 @@ void SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + + if (log) + log->Printf ("SBDebugger::SetOutputFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false")); + if (m_opaque_sp) m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership); } @@ -109,6 +143,12 @@ void SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + + if (log) + log->Printf ("SBDebugger::SetErrorFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false")); + if (m_opaque_sp) m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership); } @@ -140,9 +180,15 @@ SBCommandInterpreter SBDebugger::GetCommandInterpreter () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::GetCommandInterpreter ()"); + SBCommandInterpreter sb_interpreter; if (m_opaque_sp) sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter()); + return sb_interpreter; } @@ -181,9 +227,15 @@ SBListener SBDebugger::GetListener () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::GetListener ()"); + SBListener sb_listener; if (m_opaque_sp) sb_listener.reset(&m_opaque_sp->GetListener(), false); + return sb_listener; } @@ -357,6 +409,11 @@ const char * SBDebugger::StateAsCString (lldb::StateType state) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::StateAsCString ==> %s", lldb_private::StateAsCString (state)); + return lldb_private::StateAsCString (state); } @@ -369,6 +426,12 @@ bool SBDebugger::StateIsStoppedState (lldb::StateType state) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::StateIsStoppedState ==> %s", + (lldb_private::StateIsStoppedState (state) ? "true" : "false")); + return lldb_private::StateIsStoppedState (state); } @@ -393,6 +456,11 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::CreateTargetWithFileAndArch (%s, %s)", filename, archname); + SBTarget target; if (m_opaque_sp) { @@ -430,6 +498,14 @@ target.reset(target_sp); } } + + if (log) + { + SBStream sstr; + target.GetDescription (sstr, lldb::eDescriptionLevelFull); + log->Printf ("SBDebugger::CreateTargetWithFileAndArch ==> %s", sstr.GetData()); + } + return target; } @@ -522,15 +598,33 @@ SBTarget SBDebugger::GetSelectedTarget () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::GetSelectedTarget ()"); + SBTarget sb_target; if (m_opaque_sp) sb_target.reset(m_opaque_sp->GetTargetList().GetSelectedTarget ()); + + if (log) + { + SBStream sstr; + sb_target.GetDescription (sstr, lldb::eDescriptionLevelBrief); + log->Printf ("SBDebugger::GetSelectedTarget ==> %s", sstr.GetData()); + } + return sb_target; } void SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::DispatchInput (%p, %s, %d)", baton, (const char *) data, (uint32_t) data_len); + if (m_opaque_sp) m_opaque_sp->DispatchInput ((const char *) data, data_len); } @@ -538,6 +632,11 @@ void SBDebugger::PushInputReader (SBInputReader &reader) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::PushInputReader (%p)", &reader); + if (m_opaque_sp && reader.IsValid()) { InputReaderSP reader_sp(*reader); @@ -640,6 +739,11 @@ const char * SBDebugger::GetPrompt() const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBDebugger::GetPrompt ==> '%s'", (m_opaque_sp ? m_opaque_sp->GetPrompt() : "")); + if (m_opaque_sp) return m_opaque_sp->GetPrompt (); return 0; Modified: lldb/trunk/source/API/SBError.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBError.cpp (original) +++ lldb/trunk/source/API/SBError.cpp Mon Oct 25 22:11:13 2010 @@ -10,6 +10,7 @@ #include "lldb/API/SBError.h" #include "lldb/API/SBStream.h" #include "lldb/Core/Error.h" +#include "lldb/Core/Log.h" #include @@ -20,13 +21,27 @@ SBError::SBError () : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBError::SBError () ==> this = %p", this); } SBError::SBError (const SBError &rhs) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + if (rhs.IsValid()) m_opaque_ap.reset (new Error(*rhs)); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBError::SBError (const SBError &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p (%s)", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this, sstr.GetData()); + } } @@ -37,6 +52,16 @@ const SBError & SBError::operator = (const SBError &rhs) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + SBStream sstr; + rhs.GetDescription (sstr); + log->Printf ("SBError::operator= (const SBError &rhs) rhs.m_opaque_ap.get() = %p (%s)", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), sstr.GetData()); + } + if (rhs.IsValid()) { if (m_opaque_ap.get()) @@ -48,6 +73,10 @@ { m_opaque_ap.reset(); } + + if (log) + log->Printf ("SBError::operator= ==> this = %p", this); + return *this; } @@ -70,9 +99,19 @@ bool SBError::Fail () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBError::Fail ()"); + + bool ret_value = false; if (m_opaque_ap.get()) - return m_opaque_ap->Fail(); - return false; + ret_value = m_opaque_ap->Fail(); + + if (log) + log->Printf ("SBError::Fail ==> %s", (ret_value ? "true" : "false")); + + return ret_value; } bool @@ -198,3 +237,22 @@ return true; } + +bool +SBError::GetDescription (SBStream &description) const +{ + if (m_opaque_ap.get()) + { + if (Success()) + description.Printf ("Status: Success"); + else + { + const char * err_string = GetCString(); + description.Printf ("Status: Error: %s", (err_string != NULL ? err_string : "")); + } + } + else + description.Printf ("No value"); + + return true; +} Modified: lldb/trunk/source/API/SBEvent.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBEvent.cpp (original) +++ lldb/trunk/source/API/SBEvent.cpp Mon Oct 25 22:11:13 2010 @@ -27,18 +27,34 @@ m_event_sp (), m_opaque (NULL) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBEvent::SBEvent () ==> this = %p", this); } 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 | LIBLLDB_LOG_VERBOSE); + + if (log) + { + log->Printf ("SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len)"); + log->Printf (" event_type = %d, cstr = '%s', cstr_len = %d ==> this = %p (m_opaque = %p)", event_type, + cstr, cstr_len, this, 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 | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBEvent::SBEvent (EventSP &event_sp) event_sp.get() = %p ==> this = %p", event_sp.get(), this); } SBEvent::~SBEvent() @@ -57,10 +73,20 @@ uint32_t SBEvent::GetType () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBEvent::GetType ()"); + const Event *lldb_event = get(); + uint32_t event_type = 0; if (lldb_event) - return lldb_event->GetType(); - return 0; + event_type = lldb_event->GetType(); + + if (log) + log->Printf ("SBEvent::GetType ==> %d", event_type); + + return event_type; } SBBroadcaster @@ -88,10 +114,20 @@ bool SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBEvent::BroadcasterMatchesRef (broacaster) broadcaster = %p", &broadcaster); + Event *lldb_event = get(); + bool success = false; if (lldb_event) - return lldb_event->BroadcasterIs (broadcaster.get()); - return false; + success = lldb_event->BroadcasterIs (broadcaster.get()); + + if (log) + log->Printf ("SBEvent::BroadcasterMathesRef ==> %s", (success ? "true" : "false")); + + return success; } void @@ -147,6 +183,12 @@ const char * SBEvent::GetCStringFromEvent (const SBEvent &event) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("GetCStringFromEvent ==> %s", + reinterpret_cast(EventDataBytes::GetBytesFromEvent (event.get()))); + return reinterpret_cast(EventDataBytes::GetBytesFromEvent (event.get())); } @@ -164,3 +206,17 @@ return true; } + +bool +SBEvent::GetDescription (SBStream &description) const +{ + if (m_opaque) + { + description.ref(); + m_opaque->Dump (description.get()); + } + else + description.Printf ("No value"); + + return true; +} Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Mon Oct 25 22:11:13 2010 @@ -10,6 +10,7 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBStream.h" #include "lldb/Core/FileSpec.h" +#include "lldb/Core/Log.h" using namespace lldb; using namespace lldb_private; @@ -19,11 +20,25 @@ SBFileSpec::SBFileSpec () : m_opaque_ap() { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBFileSpec::SBFileSpec () ==> this = %p", this); } SBFileSpec::SBFileSpec (const SBFileSpec &rhs) : m_opaque_ap() { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + rhs.GetDescription (sstr); + log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec &rhs) rhs.m_opaque_ap.get() = %p (%s) ==> this = %p", + rhs.m_opaque_ap.get(), sstr.GetData(), this); + } + if (rhs.m_opaque_ap.get()) m_opaque_ap.reset (new FileSpec (rhs.get())); } @@ -37,6 +52,12 @@ SBFileSpec::SBFileSpec (const char *path, bool resolve) : m_opaque_ap(new FileSpec (path, resolve)) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBFileSpec::SBFileSpec (const char *path, bool resolve) path = '%s', resolve = %s ==> " + "this = %p (m_opaque_ap.get() = %p)", path, (resolve ? "true" : "false"), this, + m_opaque_ap.get()); } SBFileSpec::~SBFileSpec () @@ -63,9 +84,19 @@ bool SBFileSpec::Exists () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFileSpec::Exists ()"); + + bool result = false; if (m_opaque_ap.get()) - return m_opaque_ap->Exists(); - return false; + result = m_opaque_ap->Exists(); + + if (log) + log->Printf ("SBFileSpec::Exists ==> %s", (result ? "true" : "false")); + + return result; } bool @@ -85,8 +116,21 @@ const char * SBFileSpec::GetFilename() const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFileSpec::GetFilename ()"); + if (m_opaque_ap.get()) + { + if (log) + log->Printf ("SBFileSpec::GetFilename ==> %s", m_opaque_ap->GetFilename().AsCString()); return m_opaque_ap->GetFilename().AsCString(); + } + + if (log) + log->Printf ("SBFileSpec::GetFilename ==> NULL"); + return NULL; } @@ -101,8 +145,22 @@ uint32_t SBFileSpec::GetPath (char *dst_path, size_t dst_len) const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFileSpec::GetPath (dst_path, dst_len)"); + + uint32_t result; if (m_opaque_ap.get()) - return m_opaque_ap->GetPath (dst_path, dst_len); + { + result = m_opaque_ap->GetPath (dst_path, dst_len); + if (log) + log->Printf ("SBFileSpec::GetPath ==> %s (%d)", dst_path, result); + return result; + } + + if (log) + log->Printf ("SBFileSpec::GetPath ==> NULL (0)"); if (dst_path && dst_len) *dst_path = '\0'; @@ -164,3 +222,23 @@ return true; } + +bool +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); + } + else + description.Printf ("No value"); + + return true; +} Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Mon Oct 25 22:11:13 2010 @@ -16,6 +16,7 @@ #include "lldb/Core/Address.h" #include "lldb/Core/ConstString.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" #include "lldb/Core/ValueObjectRegister.h" @@ -45,11 +46,24 @@ SBFrame::SBFrame () : m_opaque_sp () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBFrame::SBFrame () ==> this = %p", this); } SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) : m_opaque_sp (lldb_object_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) lldb_object_sp.get() = %p " + " ==> this = %p (%s)", lldb_object_sp.get(), this, sstr.GetData()); + } } SBFrame::~SBFrame() @@ -73,9 +87,18 @@ SBSymbolContext SBFrame::GetSymbolContext (uint32_t resolve_scope) const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFrame::GetSymbolContext (%d)", resolve_scope); + SBSymbolContext sb_sym_ctx; if (m_opaque_sp) sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope)); + + if (log) + log->Printf ("SBFrame::GetSymbolContext ==> SBSymbolContext (this = %p)", &sb_sym_ctx); + return sb_sym_ctx; } @@ -89,7 +112,16 @@ SBCompileUnit SBFrame::GetCompileUnit () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFrame::GetCompileUnit()"); + SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit); + + if (log) + log->Printf ("SBFrame::GetCompileUnit ==> SBCompileUnit (this = %p", &sb_comp_unit); + return sb_comp_unit; } @@ -140,17 +172,37 @@ lldb::addr_t SBFrame::GetPC () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFrame::GetPC ()"); + + lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) - return m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget()); - return LLDB_INVALID_ADDRESS; + addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget()); + + if (log) + log->Printf ("SBFrame::GetPC ==> %p", addr); + + return addr; } bool SBFrame::SetPC (lldb::addr_t new_pc) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFrame::SetPC (%p)", new_pc); + + bool ret_val = false; if (m_opaque_sp) - return m_opaque_sp->GetRegisterContext()->SetPC (new_pc); - return false; + ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc); + + if (log) + log->Printf ("SBFrame::SetPC ==> %s", (ret_val ? "true" : "false")); + + return ret_val; } lldb::addr_t @@ -165,9 +217,19 @@ lldb::addr_t SBFrame::GetFP () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFrame::GetFP ()"); + + lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) - return m_opaque_sp->GetRegisterContext()->GetFP(); - return LLDB_INVALID_ADDRESS; + addr = m_opaque_sp->GetRegisterContext()->GetFP(); + + if (log) + log->Printf ("SBFrame::GetFP ==> %p", addr); + + return addr; } @@ -303,13 +365,30 @@ SBThread SBFrame::GetThread () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFrame::GetThread ()"); + SBThread sb_thread (m_opaque_sp->GetThread().GetSP()); + + if (log) + log->Printf ("SBFrame::GetThread ==> SBThread (this = %p)", &sb_thread); + return sb_thread; } const char * SBFrame::Disassemble () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + Log *verbose_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (verbose_log) + verbose_log->Printf ("SBFrame::Disassemble () ==> %s", m_opaque_sp->Disassemble()); + else if (log) + log->Printf ("SBFrame::Disassemble ()"); + if (m_opaque_sp) return m_opaque_sp->Disassemble(); return NULL; @@ -329,6 +408,18 @@ bool statics, bool in_scope_only) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + log->Printf ("SBFrame::GetVariables (bool arguments, bool locals, bool statics, bool in_scope_only)"); + log->Printf (" arguments = %s, locals = %s, statics = %s, in_scope_only = %s", + (arguments ? "true" : "false"), + (locals ? "true" : "false"), + (statics ? "true" : "false"), + (in_scope_only ? "true" : "false")); + } + SBValueList value_list; if (m_opaque_sp) { @@ -375,12 +466,29 @@ } } } + + if (log) + { + log->Printf ("SBFrame::GetVariables ==> SBValueList (this = %p)", &value_list); + //uint32_t num_vars = value_list.GetSize(); + //for (uint32_t i = 0; i < num_vars; ++i) + //{ + // SBValue value = value_list.GetValueAtIndex (i); + // log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this)); + //} + } + return value_list; } lldb::SBValueList SBFrame::GetRegisters () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFrame::GetRegisters ()"); + SBValueList value_list; if (m_opaque_sp) { @@ -394,6 +502,18 @@ } } } + + if (log) + { + log->Printf ("SBFrame::Registers ==> SBValueList (this = %p)", &value_list ); + //uint32_t num_vars = value_list.GetSize(); + //for (uint32_t i = 0; i < num_vars; ++i) + //{ + // SBValue value = value_list.GetValueAtIndex (i); + // log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this)); + //} + } + return value_list; } Modified: lldb/trunk/source/API/SBFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBFunction.cpp (original) +++ lldb/trunk/source/API/SBFunction.cpp Mon Oct 25 22:11:13 2010 @@ -11,6 +11,7 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBStream.h" #include "lldb/Core/Disassembler.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" @@ -24,11 +25,24 @@ SBFunction::SBFunction () : m_opaque_ptr (NULL) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBFunction::SBFunction () ==> this = %p", this); } SBFunction::SBFunction (lldb_private::Function *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBFunction::SBFunction (lldb_Private::Function *lldb_object_ptr) lldb_object_ptr = %p " + " ==> this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + } } SBFunction::~SBFunction () @@ -45,8 +59,20 @@ const char * SBFunction::GetName() const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBFunction::GetName ()"); + if (m_opaque_ptr) + { + if (log) + log->Printf ("SBFunction::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString()); return m_opaque_ptr->GetMangled().GetName().AsCString(); + } + + if (log) + log->Printf ("SBFunction::GetName ==> NULL"); return NULL; } Modified: lldb/trunk/source/API/SBHostOS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBHostOS.cpp (original) +++ lldb/trunk/source/API/SBHostOS.cpp Mon Oct 25 22:11:13 2010 @@ -10,6 +10,7 @@ #include "lldb/API/SBHostOS.h" #include "lldb/API/SBError.h" #include "lldb/Core/FileSpec.h" +#include "lldb/Core/Log.h" #include "lldb/Host/Host.h" using namespace lldb; @@ -34,6 +35,13 @@ SBError *error_ptr ) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBHostOS::ThreadCreate (%s, %p, %p, error_ptr)", name, thread_function, thread_arg); + + // CAROLINE: FIXME: You need to log a return value? + return Host::ThreadCreate (name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL); } Modified: lldb/trunk/source/API/SBInputReader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBInputReader.cpp (original) +++ lldb/trunk/source/API/SBInputReader.cpp Mon Oct 25 22:11:13 2010 @@ -13,8 +13,10 @@ #include "lldb/API/SBDebugger.h" #include "lldb/API/SBError.h" #include "lldb/API/SBInputReader.h" +#include "lldb/API/SBStream.h" #include "lldb/API/SBStringList.h" #include "lldb/Core/InputReader.h" +#include "lldb/Core/Log.h" using namespace lldb; @@ -26,16 +28,30 @@ m_callback_baton (NULL) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBInputReader::SBInputReader () ==> this = %p", this); } SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) : m_opaque_sp (reader_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) reader_sp.get = %p" + " ==> this = %p", this); } SBInputReader::SBInputReader (const SBInputReader &rhs) : m_opaque_sp (rhs.m_opaque_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf("SBInputReader::SBInputReader (const SBInputReader &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", + rhs.m_opaque_sp.get(), this); } SBInputReader::~SBInputReader () @@ -72,6 +88,17 @@ bool echo ) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + log->Printf("SBInputReader::Initialize (SBDebugger &debugger, Callback callback_function, void *baton, " + "lldb::InputReaderGranularity granularity, const char *end_token, const char *prompt, bool echo)"); + log->Printf(" debugger (this = %p), callback_function, callback_baton = %p, granularity = %s, " + "end_token = '%s', prompt = '%s', echo = %s", &debugger, callback_baton, + InputReader::GranularityAsCString (granularity), end_token, prompt, (echo ? "true" : "false")); + } + SBError sb_error; m_opaque_sp.reset (new InputReader (debugger.ref())); @@ -95,6 +122,13 @@ m_callback_baton = NULL; } + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBInputReader::Initialize ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData()); + } + return sb_error; } @@ -162,10 +196,19 @@ bool SBInputReader::IsActive () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBInputReader::IsActive ()"); + + bool ret_value = false; if (m_opaque_sp) - return m_opaque_sp->IsActive(); - else - return false; + ret_value = m_opaque_sp->IsActive(); + + if (log) + log->Printf ("SBInputReader::IsActive ==> %s", (ret_value ? "true" : "false")); + + return ret_value; } InputReaderGranularity Modified: lldb/trunk/source/API/SBLineEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBLineEntry.cpp (original) +++ lldb/trunk/source/API/SBLineEntry.cpp Mon Oct 25 22:11:13 2010 @@ -10,22 +10,35 @@ #include "lldb/API/SBLineEntry.h" #include "lldb/API/SBStream.h" #include "lldb/Symbol/LineEntry.h" +#include "lldb/Core/Log.h" using namespace lldb; +using namespace lldb_private; SBLineEntry::SBLineEntry () : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBLineEntry::SBLineEntry () ==> this = %p", this); } SBLineEntry::SBLineEntry (const SBLineEntry &rhs) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + if (rhs.IsValid()) { m_opaque_ap.reset (new lldb_private::LineEntry (*rhs)); } + + if (log) + log->Printf ("SBLineEntry::SBLineEntry (const SBLineEntry &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p ", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + } @@ -33,8 +46,14 @@ SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + if (lldb_object_ptr) m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr)); + + if (log) + log->Printf ("SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) lldb_object_ptr = %p" + " ==> this = %p (m_opaque_ap.get() = %p)", lldb_object_ptr, this, m_opaque_ap.get()); } const SBLineEntry & @@ -66,9 +85,22 @@ 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()); + + if (log) + { + SBStream sstr; + sb_address.GetDescription (sstr); + log->Printf ("SBLineEntry::GetStartAddress ==> SBAddress (this = %p, (%s)", &sb_address, sstr.GetData()); + } + return sb_address; } @@ -94,18 +126,41 @@ SBFileSpec 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); + + if (log) + { + SBStream sstr; + sb_file_spec.GetDescription (sstr); + log->Printf ("SBLineEntry::GetFileSpec ==> SBFileSpec (this = %p, '%s'", &sb_file_spec, sstr.GetData()); + } + return sb_file_spec; } uint32_t 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()) - return m_opaque_ap->line; - return 0; + line = m_opaque_ap->line; + + if (log) + log->Printf ("SBLineEntry::GetLine ==> %d", line); + + return line; } Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Mon Oct 25 22:11:13 2010 @@ -8,12 +8,14 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/Listener.h" +#include "lldb/Core/Log.h" #include "lldb/lldb-forward-rtti.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; @@ -23,18 +25,32 @@ m_opaque_ptr (NULL), m_opaque_ptr_owned (false) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBListener::SBListener () ==> this = %p", this); } SBListener::SBListener (const char *name) : m_opaque_ptr (new Listener (name)), m_opaque_ptr_owned (true) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBListener::SBListener (const char *name) name = %s ==> this = %p (m_opaque_ptr = %p)", + name, this, m_opaque_ptr); } SBListener::SBListener (Listener &listener) : m_opaque_ptr (&listener), m_opaque_ptr_owned (false) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBListener::SBListener (Listener &listener) *listener = %p ==> this = %p (m_opaque_ptr = %p)", + &listener, this, m_opaque_ptr); } SBListener::~SBListener () @@ -73,11 +89,24 @@ uint32_t SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + log->Printf ("SBListener::StartListeningForEvents (const SBBroadcaster &broadcaster, uint32_t event_mask)" + " &broadcaster = %p, event_mask = %d", &broadcaster, event_mask); + } + + uint32_t ret_value = 0; if (m_opaque_ptr && broadcaster.IsValid()) { - return m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); + ret_value = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); } - return false; + + if (log) + log->Printf ("SBListener::StartListeneingForEvents ==> %d", ret_value); + + return ret_value; } bool @@ -93,6 +122,15 @@ bool SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + SBStream sstr; + event.GetDescription (sstr); + log->Printf ("SBListener::WaitForEvent (%d, %s)", num_seconds, sstr.GetData()); + } + if (m_opaque_ptr) { TimeValue time_value; @@ -106,9 +144,15 @@ if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp)) { event.reset (event_sp); + if (log) + log->Printf ("SBListener::WaitForEvent ==> true"); return true; } } + + if (log) + log->Printf ("SBListener::WaitForEvent ==> false"); + event.reset (NULL); return false; } Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Mon Oct 25 22:11:13 2010 @@ -13,18 +13,30 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBStream.h" #include "lldb/Core/Module.h" +#include "lldb/Core/Log.h" +#include "lldb/Core/STreamString.h" using namespace lldb; +using namespace lldb_private; SBModule::SBModule () : m_opaque_sp () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBModule::SBModule () ==> this = %p", this); } SBModule::SBModule (const lldb::ModuleSP& module_sp) : m_opaque_sp (module_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBModule::SBModule (const lldb::ModuleSP &module_sp) module_sp.get() = %p ==> this = %p", + module_sp.get(), this); } SBModule::~SBModule () @@ -40,17 +52,46 @@ SBFileSpec SBModule::GetFileSpec () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBModule::GetFileSpec ()"); + SBFileSpec file_spec; if (m_opaque_sp) file_spec.SetFileSpec(m_opaque_sp->GetFileSpec()); + + if (log) + { + SBStream sstr; + file_spec.GetDescription (sstr); + log->Printf ("SBModule::GetFileSpec ==> SBFileSpec (this = %p, 's')", &file_spec, sstr.GetData()); + } + return file_spec; } const uint8_t * SBModule::GetUUIDBytes () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBModule::GetUUIDBytes ()"); + if (m_opaque_sp) + { + if (log) + { + StreamString sstr; + m_opaque_sp->GetUUID().Dump (&sstr); + log->Printf ("SBModule::GetUUIDBytes ==> '%s'", sstr.GetData()); + } return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes(); + } + + if (log) + log->Printf ("SBModule::GetUUIDBytes ==> NULL"); return NULL; } @@ -134,7 +175,7 @@ if (m_opaque_sp) { description.ref(); - m_opaque_sp->Dump (description.get()); + m_opaque_sp->GetDescription (description.get()); } else description.Printf ("No value"); Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Mon Oct 25 22:11:13 2010 @@ -16,6 +16,7 @@ #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Debugger.h" +#include "lldb/Core/Log.h" #include "lldb/Core/State.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" @@ -42,6 +43,10 @@ SBProcess::SBProcess () : m_opaque_sp() { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBProcess::SBProcess () ==> this = %p", this); } @@ -52,12 +57,22 @@ SBProcess::SBProcess (const SBProcess& rhs) : m_opaque_sp (rhs.m_opaque_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBProcess::SBProcess (const SBProcess &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", + rhs.m_opaque_sp.get(), this); } SBProcess::SBProcess (const lldb::ProcessSP &process_sp) : m_opaque_sp (process_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBProcess::SBProcess (const lldb::ProcessSP &process_sp) process_sp.get() = %p ==> this = %p", + process_sp.get(), this); } //---------------------------------------------------------------------- @@ -90,29 +105,62 @@ uint32_t SBProcess::GetNumThreads () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetNumThreads ()"); + + uint32_t num_threads = 0; if (m_opaque_sp) { const bool can_update = true; - return m_opaque_sp->GetThreadList().GetSize(can_update); + num_threads = m_opaque_sp->GetThreadList().GetSize(can_update); } - return 0; + + if (log) + log->Printf ("SBProcess::GetNumThreads ==> %d", num_threads); + + return num_threads; } SBThread SBProcess::GetSelectedThread () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetSelectedThread ()"); + SBThread sb_thread; if (m_opaque_sp) sb_thread.SetThread (m_opaque_sp->GetThreadList().GetSelectedThread()); + + if (log) + { + SBStream sstr; + sb_thread.GetDescription (sstr); + log->Printf ("SBProcess::GetSelectedThread ==> SBThread (this = %p, '%s')", &sb_thread, sstr.GetData()); + } + return sb_thread; } SBTarget SBProcess::GetTarget() const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetTarget ()"); + SBTarget sb_target; if (m_opaque_sp) sb_target = m_opaque_sp->GetTarget().GetSP(); + + if (log) + log->Printf ("SBProcess::GetTarget ==> SBTarget (this = %p, m_opaque_sp.get())", &sb_target, + sb_target.get()); + return sb_target; } @@ -120,37 +168,64 @@ size_t SBProcess::PutSTDIN (const char *src, size_t src_len) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::PutSTDIN (%s, %d)", src, src_len); + + size_t ret_val = 0; if (m_opaque_sp != NULL) { Error error; - return m_opaque_sp->PutSTDIN (src, src_len, error); + ret_val = m_opaque_sp->PutSTDIN (src, src_len, error); } - else - return 0; + + if (log) + log->Printf ("SBProcess::PutSTDIN ==> %d", ret_val); + + return ret_val; } size_t SBProcess::GetSTDOUT (char *dst, size_t dst_len) const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetSTDOUT (char *dst, size_t dst_Len)"); + + size_t ret_val = 0; if (m_opaque_sp != NULL) { Error error; - return m_opaque_sp->GetSTDOUT (dst, dst_len, error); + ret_val = m_opaque_sp->GetSTDOUT (dst, dst_len, error); } - else - return 0; + + if (log) + log->Printf ("SBProcess::GetSTDOUT ==> %d", ret_val); + + return ret_val; } size_t SBProcess::GetSTDERR (char *dst, size_t dst_len) const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetSTDERR (char *dst, size_t dst_len)"); + + size_t ret_val = 0; if (m_opaque_sp != NULL) { Error error; - return m_opaque_sp->GetSTDERR (dst, dst_len, error); + ret_val = m_opaque_sp->GetSTDERR (dst, dst_len, error); } - else - return 0; + + if (log) + log->Printf ("SBProcess::GetSTDERR ==> %d", ret_val); + + return ret_val; } void @@ -202,27 +277,59 @@ bool SBProcess::SetSelectedThreadByID (uint32_t tid) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::SetSelectedThreadByID (%d)", tid); + + bool ret_val = false; if (m_opaque_sp != NULL) - return m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid); - return false; + ret_val = m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid); + + if (log) + log->Printf ("SBProcess::SetSelectedThreadByID ==> %s", (ret_val ? "true" : "false")); + + return ret_val; } SBThread SBProcess::GetThreadAtIndex (size_t index) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetThreadAtIndex (%d)"); + SBThread thread; if (m_opaque_sp) thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index)); + + if (log) + { + SBStream sstr; + thread.GetDescription (sstr); + log->Printf ("SBProcess::GetThreadAtIndex ==> SBThread (this = %p, '%s')", &thread, sstr.GetData()); + } + return thread; } StateType SBProcess::GetState () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetState ()"); + + StateType ret_val = eStateInvalid; if (m_opaque_sp != NULL) - return m_opaque_sp->GetState(); - else - return eStateInvalid; + ret_val = m_opaque_sp->GetState(); + + if (log) + log->Printf ("SBProcess::GetState ==> %s", lldb_private::StateAsCString (ret_val)); + + return ret_val; } @@ -247,19 +354,37 @@ lldb::pid_t SBProcess::GetProcessID () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetProcessID ()"); + + lldb::pid_t ret_val = LLDB_INVALID_PROCESS_ID; if (m_opaque_sp) - return m_opaque_sp->GetID(); - else - return LLDB_INVALID_PROCESS_ID; + ret_val = m_opaque_sp->GetID(); + + if (log) + log->Printf ("SBProcess::GetProcessID ==> %d", ret_val); + + return ret_val; } uint32_t SBProcess::GetAddressByteSize () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetAddressByteSize()"); + + uint32_t size = 0; if (m_opaque_sp) - return m_opaque_sp->GetAddressByteSize(); - else - return 0; + size = m_opaque_sp->GetAddressByteSize(); + + if (log) + log->Printf ("SBProcess::GetAddressByteSize ==> %d", size); + + return size; } bool @@ -286,6 +411,11 @@ SBError SBProcess::Continue () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::Continue ()"); + SBError sb_error; if (IsValid()) { @@ -300,6 +430,13 @@ else sb_error.SetErrorString ("SBProcess is invalid"); + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess::Continue ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData()); + } + return sb_error; } @@ -320,22 +457,48 @@ SBError SBProcess::Stop () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::Stop ()"); + SBError sb_error; if (IsValid()) sb_error.SetError (m_opaque_sp->Halt()); else sb_error.SetErrorString ("SBProcess is invalid"); + + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess::Stop ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData()); + } + return sb_error; } SBError SBProcess::Kill () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::Kill ()"); + SBError sb_error; if (m_opaque_sp) sb_error.SetError (m_opaque_sp->Destroy()); else sb_error.SetErrorString ("SBProcess is invalid"); + + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess::Kill ==> SBError (this = %p,'%s')", &sb_error, sstr.GetData()); + } + return sb_error; } @@ -405,7 +568,21 @@ StateType SBProcess::GetStateFromEvent (const SBEvent &event) { - return Process::ProcessEventData::GetStateFromEvent (event.get()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + SBStream sstr; + event.GetDescription (sstr); + log->Printf ("SBProcess::GetStateFromEvent (%s)", sstr.GetData()); + } + + StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get()); + + if (log) + log->Printf ("SBProcess::GetStateFromEvent ==> %s", lldb_private::StateAsCString (ret_val)); + + return ret_val; } bool @@ -425,7 +602,16 @@ SBBroadcaster SBProcess::GetBroadcaster () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::GetBroadcaster ()"); SBBroadcaster broadcaster(m_opaque_sp.get(), false); + + if (log) + log->Printf ("SBProcess::GetBroadcaster ==> SBBroadcaster (this = %p, m_opaque = %p)", &broadcaster, + m_opaque_sp.get()); + return broadcaster; } @@ -438,6 +624,11 @@ size_t SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBProcess::ReadMemory (%p, %p, %d, sb_error)", addr, dst, dst_len); + size_t bytes_read = 0; if (IsValid()) @@ -451,6 +642,9 @@ sb_error.SetErrorString ("SBProcess is invalid"); } + if (log) + log->Printf ("SBProcess::ReadMemory ==> %d", bytes_read); + return bytes_read; } @@ -490,7 +684,7 @@ description.Printf ("SBProcess: pid = %d, state = %s, threads = %d%s%s", m_opaque_sp->GetID(), - SBDebugger::StateAsCString (GetState()), + lldb_private::StateAsCString (GetState()), GetNumThreads(), exe_name ? ", executable = " : "", exe_name ? exe_name : ""); Modified: lldb/trunk/source/API/SBSymbol.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbol.cpp (original) +++ lldb/trunk/source/API/SBSymbol.cpp Mon Oct 25 22:11:13 2010 @@ -10,6 +10,7 @@ #include "lldb/API/SBSymbol.h" #include "lldb/API/SBStream.h" #include "lldb/Core/Disassembler.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ExecutionContext.h" @@ -21,11 +22,24 @@ SBSymbol::SBSymbol () : m_opaque_ptr (NULL) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBSymbol::SBSymbol () ==> this = %p", this); } SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) lldb_object_ptr = %p ==> " + "this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + } } SBSymbol::~SBSymbol () @@ -42,8 +56,21 @@ const char * SBSymbol::GetName() const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBSymbol::GetName ()"); + if (m_opaque_ptr) + { + if (log) + log->Printf ("SBSymbol::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString()); return m_opaque_ptr->GetMangled().GetName().AsCString(); + } + + if (log) + log->Printf ("SBSymbol::GetName ==> NULL"); + return NULL; } Modified: lldb/trunk/source/API/SBSymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbolContext.cpp (original) +++ lldb/trunk/source/API/SBSymbolContext.cpp Mon Oct 25 22:11:13 2010 @@ -10,6 +10,7 @@ #include "lldb/API/SBSymbolContext.h" #include "lldb/API/SBStream.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Core/Log.h" using namespace lldb; using namespace lldb_private; @@ -19,18 +20,38 @@ SBSymbolContext::SBSymbolContext () : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBSymbolContext::SBSymbolContext () ==> this = %p", this); } SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + if (sc_ptr) m_opaque_ap.reset (new SymbolContext (*sc_ptr)); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBSymbolContext::SBSymcolContext (const SymbolContext *sc_ptr) sc_ptr = %p ==> this = %p (%s)", + sc_ptr, this, sstr.GetData()); + } } SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBSymbolContext::SBSymcolContext (const SBSymbolContext &rhs) rhs.m_opaque_ap.get() = %p " + "==> this = %p", (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + if (rhs.IsValid()) { if (m_opaque_ap.get()) @@ -38,6 +59,7 @@ else ref() = *rhs.m_opaque_ap; } + } SBSymbolContext::~SBSymbolContext () @@ -83,9 +105,22 @@ SBModule SBSymbolContext::GetModule () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBSymbolContext::GetModule ()"); + SBModule sb_module; if (m_opaque_ap.get()) sb_module.SetModule(m_opaque_ap->module_sp); + + if (log) + { + SBStream sstr; + sb_module.GetDescription (sstr); + log->Printf ("SBSymbolContext::GetModule ==> SBModule (this = %p, '%s')", &sb_module, sstr.GetData()); + } + return sb_module; } @@ -98,7 +133,18 @@ SBFunction SBSymbolContext::GetFunction () { - return SBFunction (m_opaque_ap.get() ? m_opaque_ap->function : NULL); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBSymbolContext::GetFunction ()"); + + SBFunction ret_function (m_opaque_ap.get() ? m_opaque_ap->function : NULL); + + if (log) + log->Printf ("SBSymbolContext::GetFunction ==> SBFunction (this = %p, '%s')", &ret_function, + ret_function.GetName()); + + return ret_function; } SBBlock @@ -110,17 +156,44 @@ SBLineEntry SBSymbolContext::GetLineEntry () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBSymbolContext::GetLineEntry ()"); + SBLineEntry sb_line_entry; if (m_opaque_ap.get()) sb_line_entry.SetLineEntry (m_opaque_ap->line_entry); + if (log) + { + SBStream sstr; + sb_line_entry.GetDescription (sstr); + log->Printf ("SBSymbolContext::GetLineEntry ==> SBLineEntry (this = %p, '%s')", &sb_line_entry, + sstr.GetData()); + } + return sb_line_entry; } SBSymbol SBSymbolContext::GetSymbol () { - return SBSymbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBSymbolContext::GetSymbol ()"); + + SBSymbol ret_symbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL); + + if (log) + { + SBStream sstr; + ret_symbol.GetDescription (sstr); + log->Printf ("SBSymbolContext::GetSymbol ==> SBSymbol (this = %p, '%s')", &ret_symbol, sstr.GetData()); + } + + return ret_symbol; } lldb_private::SymbolContext* Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Mon Oct 25 22:11:13 2010 @@ -26,6 +26,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/FileSpec.h" +#include "lldb/Core/Log.h" #include "lldb/Core/RegularExpression.h" #include "lldb/Core/SearchFilter.h" #include "lldb/Core/STLUtils.h" @@ -51,25 +52,48 @@ //---------------------------------------------------------------------- SBTarget::SBTarget () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBTarget::SBTarget () ==> this = %p", this); } SBTarget::SBTarget (const SBTarget& rhs) : m_opaque_sp (rhs.m_opaque_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBTarget::SBTarget (const SBTarget &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", + rhs.m_opaque_sp.get(), this); } SBTarget::SBTarget(const TargetSP& target_sp) : m_opaque_sp (target_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBTarget::SBTarget (const TargetSP &target_sp) target_sp.get() = %p ==> this = %p", + target_sp.get(), this); } const SBTarget& SBTarget::Assign (const SBTarget& rhs) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::Assign (const SBTarget &rhs) rhs = %p", &rhs); + if (this != &rhs) { m_opaque_sp = rhs.m_opaque_sp; } + + if (log) + log->Printf ("SBTarget::Assign ==> SBTarget (this = %p, m_opaque_sp.get() = %p)", this, m_opaque_sp.get()); + return *this; } @@ -90,9 +114,22 @@ SBProcess SBTarget::GetProcess () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::GetProcess ()"); + SBProcess sb_process; if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->GetProcessSP()); + + if (log) + { + SBStream sstr; + sb_process.GetDescription (sstr); + log->Printf ("SBTarget::GetProcess ==> SBProcess (this = %p, '%s')", &sb_process, sstr.GetData()); + } + return sb_process; } @@ -110,11 +147,23 @@ SBProcess SBTarget::CreateProcess () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::CreateProcess ()"); + SBProcess sb_process; if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener())); + if (log) + { + SBStream sstr; + sb_process.GetDescription (sstr); + log->Printf ("SBTarget::CreateProcess ==> SBProcess (this = %p, '%s')", &sb_process, sstr.GetData()); + } + return sb_process; } @@ -129,8 +178,45 @@ bool stop_at_entry ) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + log->Printf ("SBTarget::LaunchProcess (char const **argv, char const **envp, const char *tty, " + "uint32_t launch_flags, bool stop_at_entry)"); + + if (!argv) + log->Printf ("argv: NULL"); + else + { + for (int i = 0; argv[i]; ++i) + log->Printf (" %s", argv[i]); + } + + if (!envp) + log->Printf ("envp: NULL"); + else + { + for (int i = 0; envp[i]; ++i) + log->Printf (" %s", envp[i]); + } + + log->Printf (" tty = %s, launch_flags = %d, stop_at_entry = %s", tty, launch_flags, (stop_at_entry ? + "true" : + "false")); + } + SBError sb_error; - return Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); + SBProcess sb_process = Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); + + if (log) + { + SBStream sstr; + sb_process.GetDescription (sstr); + log->Printf ("SBTarget::LaunchProcess ==> SBProcess (this = %p, '%s')", this, sstr.GetData()); + } + + return sb_process; } SBProcess @@ -144,6 +230,32 @@ SBError &error ) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + log->Printf ("SBTarget::Launch (char const **argv, char const **envp, const char *tty, uint32_t launch_flag," + "bool stop_at_entry, SBError error)"); + if (!argv) + log->Printf ("argv: NULL"); + else + { + for (int i = 0; argv[i]; ++i) + log->Printf (" %s", argv[i]); + } + + if (!envp) + log->Printf ("envp: NULL"); + else + { + for (int i = 0; envp[i]; ++i) + log->Printf (" %s", envp[i]); + } + + log->Printf (" tty = %s, launch_flags = %d, stop_at_entry = %s, error (this = %p)", tty, launch_flags, + (stop_at_entry ? "true" : "false"), &error); + } + SBProcess sb_process; if (m_opaque_sp) { @@ -193,6 +305,14 @@ { error.SetErrorString ("SBTarget is invalid"); } + + if (log) + { + SBStream sstr; + sb_process.GetDescription (sstr); + log->Printf ("SBTarget::Launch ==> SBProceess (this = %p, '%s')", &sb_process, sstr.GetData()); + } + return sb_process; } @@ -279,6 +399,11 @@ SBFileSpec SBTarget::GetExecutable () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::GetExecutable ()"); + SBFileSpec exe_file_spec; if (m_opaque_sp) { @@ -286,6 +411,20 @@ if (exe_module_sp) exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec()); } + + if (log) + { + if (exe_file_spec.Exists()) + { + SBStream sstr; + exe_file_spec.GetDescription (sstr); + log->Printf ("SBTarget::GetExecutable ==> SBFileSpec (this = %p, '%s')", &exe_file_spec, sstr.GetData()); + } + else + log->Printf ("SBTarget::GetExecutable ==> SBFileSpec (this = %p, 'Unable to find valid file')", + &exe_file_spec); + } + return exe_file_spec; } @@ -332,24 +471,59 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) file = '%s', line = %d", + file, line); + SBBreakpoint sb_bp; if (file != NULL && line != 0) sb_bp = BreakpointCreateByLocation (SBFileSpec (file), line); + + if (log) + { + SBStream sstr; + sb_bp.GetDescription (sstr); + log->Printf("SBTarget::BreakpointCreateByLocation ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + } + return sb_bp; } SBBreakpoint SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) " + "sb_file_spec (%p), line = %d)", &sb_file_spec, line); + SBBreakpoint sb_bp; if (m_opaque_sp.get() && line != 0) *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false); + + if (log) + { + SBStream sstr; + sb_bp.GetDescription (sstr); + log->Printf ("SBTarget::BreakpointCreateByLocation ==> SBBreakpoint (this = %p, '%s')", &sb_bp, + sstr.GetData()); + } + return sb_bp; } SBBreakpoint SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) " + "symbol_name = %s, module_name = %s)", symbol_name, module_name); + SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name && symbol_name[0]) { @@ -363,12 +537,26 @@ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, symbol_name, eFunctionNameTypeFull | eFunctionNameTypeBase, false); } } + + if (log) + { + SBStream sstr; + sb_bp.GetDescription (sstr); + log->Printf ("SBTarget::BreakpointCreateByName ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + } + return sb_bp; } SBBreakpoint SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) " + "symbol_name_regex = %s, module_name = %s)", symbol_name_regex, module_name); + SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0]) { @@ -385,6 +573,14 @@ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, regexp, false); } } + + if (log) + { + SBStream sstr; + sb_bp.GetDescription (sstr); + log->Printf ("SBTarget::BreakpointCreateByRegex ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + } + return sb_bp; } @@ -393,18 +589,44 @@ SBBreakpoint SBTarget::BreakpointCreateByAddress (addr_t address) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::BreakpointCreateByAddress (addr_t address) address = %p", address); + SBBreakpoint sb_bp; if (m_opaque_sp.get()) *sb_bp = m_opaque_sp->CreateBreakpoint (address, false); + + if (log) + { + SBStream sstr; + sb_bp.GetDescription (sstr); + log->Printf ("SBTarget::BreakpointCreateByAddress ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + } + return sb_bp; } SBBreakpoint SBTarget::FindBreakpointByID (break_id_t bp_id) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::FindBreakpointByID (break_id_t bp_id) bp_id = %d", bp_id); + SBBreakpoint sb_breakpoint; if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID) *sb_breakpoint = m_opaque_sp->GetBreakpointByID (bp_id); + + if (log) + { + SBStream sstr; + sb_breakpoint.GetDescription (sstr); + log->Printf ("SBTarget::FindBreakpointByID ==> SBBreakpoint (this = %p, '%s'", &bp_id, sstr.GetData()); + } + return sb_breakpoint; } @@ -428,9 +650,24 @@ bool SBTarget::BreakpointDelete (break_id_t bp_id) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::BreakpointDelete (break_id_t bp_id) bp_id = %d", bp_id); + + bool result = false; if (m_opaque_sp) - return m_opaque_sp->RemoveBreakpointByID (bp_id); - return false; + result = m_opaque_sp->RemoveBreakpointByID (bp_id); + + if (log) + { + if (result) + log->Printf ("SBTarget::BreakpointDelete ==> true"); + else + log->Printf ("SBTarget::BreakpointDelete ==> false"); + } + + return result; } bool @@ -470,14 +707,29 @@ uint32_t SBTarget::GetNumModules () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::GetNumModules ()"); + + uint32_t num = 0; if (m_opaque_sp) - return m_opaque_sp->GetImages().GetSize(); - return 0; + num = m_opaque_sp->GetImages().GetSize(); + + if (log) + log->Printf ("SBTarget::GetNumModules ==> %d", num); + + return num; } void SBTarget::Clear () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::Clear ()"); + m_opaque_sp.reset(); } @@ -494,9 +746,22 @@ SBModule SBTarget::GetModuleAtIndex (uint32_t idx) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::GetModuleAtIndex (uint32_t idx) idx = %d", idx); + SBModule sb_module; if (m_opaque_sp) sb_module.SetModule(m_opaque_sp->GetImages().GetModuleAtIndex(idx)); + + if (log) + { + SBStream sstr; + sb_module.GetDescription (sstr); + log->Printf ("SBTarget::GetModuleAtIndex ==> SBModule: this = %p, %s", &sb_module, sstr.GetData()); + } + return sb_module; } @@ -504,7 +769,16 @@ SBBroadcaster SBTarget::GetBroadcaster () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBTarget::GetBroadcaster ()"); + SBBroadcaster broadcaster(m_opaque_sp.get(), false); + + if (log) + log->Printf ("SBTarget::GetBroadcaster ==> SBBroadcaster (this = %p)", &broadcaster); + return broadcaster; } @@ -634,12 +908,26 @@ } bool -SBTarget::GetDescription (SBStream &description) +SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level) +{ + if (m_opaque_sp) + { + description.ref(); + m_opaque_sp->Dump (description.get(), description_level); + } + else + description.Printf ("No value"); + + return true; +} + +bool +SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level) const { if (m_opaque_sp) { description.ref(); - m_opaque_sp->Dump (description.get()); + m_opaque_sp->Dump (description.get(), description_level); } else description.Printf ("No value"); Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Mon Oct 25 22:11:13 2010 @@ -41,6 +41,10 @@ SBThread::SBThread () : m_opaque_sp () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBThread::SBThread () ==> this = %p", this); } //---------------------------------------------------------------------- @@ -49,10 +53,21 @@ SBThread::SBThread (const ThreadSP& lldb_object_sp) : m_opaque_sp (lldb_object_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBThread::SBThread (const ThreadSP &lldb_object_sp) lldb_object_sp.get() = %p ==> this = %p", + lldb_object_sp.get(), this); } SBThread::SBThread (const SBThread &rhs) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBThread::SBThread (const SBThread &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", + rhs.m_opaque_sp.get(), this); + m_opaque_sp = rhs.m_opaque_sp; } @@ -79,18 +94,33 @@ StopReason SBThread::GetStopReason() { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetStopReason ()"); + + StopReason reason = eStopReasonInvalid; if (m_opaque_sp) { StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo (); if (stop_info_sp) - return stop_info_sp->GetStopReason(); + reason = stop_info_sp->GetStopReason(); } - return eStopReasonInvalid; + + if (log) + log->Printf ("SBThread::GetStopReason ==> %s", Thread::StopReasonAsCString (reason)); + + return reason; } size_t SBThread::GetStopDescription (char *dst, size_t dst_len) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetStopDescription (char *dst, size_t dst_len)"); + if (m_opaque_sp) { StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo (); @@ -99,6 +129,8 @@ const char *stop_desc = stop_info_sp->GetDescription(); if (stop_desc) { + if (log) + log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc); else @@ -163,6 +195,9 @@ if (stop_desc && stop_desc[0]) { + if (log) + log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc); + if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte @@ -189,10 +224,19 @@ lldb::tid_t SBThread::GetThreadID () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetThreadID()"); + + lldb::tid_t id = LLDB_INVALID_THREAD_ID; if (m_opaque_sp) - return m_opaque_sp->GetID(); - else - return LLDB_INVALID_THREAD_ID; + id = m_opaque_sp->GetID(); + + if (log) + log->Printf ("SBThread::GetThreadID ==> %d", id); + + return id; } uint32_t @@ -205,16 +249,42 @@ const char * SBThread::GetName () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetName ()"); + if (m_opaque_sp) + { + if (log) + log->Printf ("SBThread::GetName ==> %s", m_opaque_sp->GetName()); return m_opaque_sp->GetName(); + } + + if (log) + log->Printf ("SBThread::GetName ==> NULL"); + return NULL; } const char * SBThread::GetQueueName () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetQueueName ()"); + if (m_opaque_sp) + { + if (log) + log->Printf ("SBThread::GetQueueName ==> %s", m_opaque_sp->GetQueueName()); return m_opaque_sp->GetQueueName(); + } + + if (log) + log->Printf ("SBThread::GetQueueName ==> NULL"); + return NULL; } @@ -222,6 +292,12 @@ void SBThread::StepOver (lldb::RunMode stop_other_threads) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::StepOver (lldb::RunMode stop_other_threads) stop_other_threads = %s)", + Thread::RunModeAsCString (stop_other_threads)); + if (m_opaque_sp) { bool abort_other_plans = true; @@ -265,6 +341,12 @@ void SBThread::StepInto (lldb::RunMode stop_other_threads) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::StepInto (lldb::RunMode stop_other_threads) stop_other_threads =%s", + Thread::RunModeAsCString (stop_other_threads)); + if (m_opaque_sp) { bool abort_other_plans = true; @@ -306,6 +388,11 @@ void SBThread::StepOut () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::StepOut ()"); + if (m_opaque_sp) { bool abort_other_plans = true; @@ -329,6 +416,11 @@ void SBThread::StepInstruction (bool step_over) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::StepInstruction (bool step_over) step_over = %s", (step_over ? "true" : "false")); + if (m_opaque_sp) { m_opaque_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true); @@ -348,6 +440,11 @@ void SBThread::RunToAddress (lldb::addr_t addr) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::RunToAddress (lldb:;addr_t addr) addr = %p", addr); + if (m_opaque_sp) { bool abort_other_plans = true; @@ -373,35 +470,77 @@ SBProcess SBThread::GetProcess () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetProcess ()"); + SBProcess process; if (m_opaque_sp) { // Have to go up to the target so we can get a shared pointer to our process... process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP()); } + + if (log) + { + SBStream sstr; + process.GetDescription (sstr); + log->Printf ("SBThread::GetProcess ==> SBProcess (this = %p, '%s')", &process, sstr.GetData()); + } + return process; } uint32_t SBThread::GetNumFrames () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetNumFrames ()"); + + uint32_t num_frames = 0; if (m_opaque_sp) - return m_opaque_sp->GetStackFrameCount(); - return 0; + num_frames = m_opaque_sp->GetStackFrameCount(); + + if (log) + log->Printf ("SBThread::GetNumFrames ==> %d", num_frames); + + return num_frames; } SBFrame SBThread::GetFrameAtIndex (uint32_t idx) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::GetFrameAtIndex (uint32_t idx) idx = %d", idx); + SBFrame sb_frame; if (m_opaque_sp) sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx)); + + if (log) + { + SBStream sstr; + sb_frame.GetDescription (sstr); + log->Printf ("SBThread::GetFrameAtIndex ==> SBFrame (this = %p, '%s')", &sb_frame, sstr.GetData()); + } + return sb_frame; } const lldb::SBThread & SBThread::operator = (const lldb::SBThread &rhs) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBThread::operator= (const lldb::SBThread &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", + rhs.m_opaque_sp.get(), this); + m_opaque_sp = rhs.m_opaque_sp; return *this; } @@ -461,3 +600,17 @@ return true; } + +bool +SBThread::GetDescription (SBStream &description) const +{ + if (m_opaque_sp) + { + StreamString strm; + description.Printf("SBThread: tid = 0x%4.4x", m_opaque_sp->GetID()); + } + else + description.Printf ("No value"); + + return true; +} Modified: lldb/trunk/source/API/SBType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBType.cpp (original) +++ lldb/trunk/source/API/SBType.cpp Mon Oct 25 22:11:13 2010 @@ -10,6 +10,7 @@ #include "lldb/API/SBType.h" #include "lldb/API/SBStream.h" #include "lldb/Core/ConstString.h" +#include "lldb/Core/Log.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/ClangASTType.h" @@ -20,7 +21,17 @@ bool SBType::IsPointerType (void *opaque_type) { - return ClangASTContext::IsPointerType (opaque_type); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBType::IsPointerType (%p)", opaque_type); + + bool ret_value = ClangASTContext::IsPointerType (opaque_type); + + if (log) + log->Printf ("SBType::IsPointerType ==> %s", (ret_value ? "true" : "false")); + + return ret_value; } Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Mon Oct 25 22:11:13 2010 @@ -11,6 +11,7 @@ #include "lldb/API/SBStream.h" #include "lldb/Core/DataExtractor.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" @@ -36,11 +37,24 @@ SBValue::SBValue () : m_opaque_sp () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBValue::SBValue () ==> this = %p", this); } SBValue::SBValue (const lldb::ValueObjectSP &value_sp) : m_opaque_sp (value_sp) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBValue::SBValue (const lldb::ValueObjectSP &value_sp) value_sp.get() = %p ==> this = %p (%s)", + value_sp.get(), this, sstr.GetData()); + } } SBValue::~SBValue() @@ -67,10 +81,23 @@ const char * SBValue::GetName() { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBValue::GetName ()"); + if (IsValid()) + { + if (log) + log->Printf ("SBValue::GetName ==> %s", m_opaque_sp->GetName().AsCString()); return m_opaque_sp->GetName().AsCString(); + } else + { + if (log) + log->Printf ("SBValue::GetName ==> NULL"); return NULL; + } } const char * Modified: lldb/trunk/source/API/SBValueList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/API/SBValueList.cpp (original) +++ lldb/trunk/source/API/SBValueList.cpp Mon Oct 25 22:11:13 2010 @@ -10,7 +10,10 @@ #include "lldb/API/SBValueList.h" #include "lldb/API/SBValue.h" +#include "lldb/API/SBStream.h" + +#include "lldb/Core/Log.h" #include "lldb/Core/ValueObjectList.h" using namespace lldb; @@ -19,20 +22,60 @@ SBValueList::SBValueList () : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBValueList::SBValueList () ==> this = %p", this); } SBValueList::SBValueList (const SBValueList &rhs) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBValueList::SBValueList (const SBValueList &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + if (rhs.IsValid()) m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs)); + + if (log) + { + uint32_t num_vars = GetSize(); + for (uint32_t i = 0; i < num_vars; ++i) + { + SBValue value = GetValueAtIndex (i); + SBStream sstr; + value.GetDescription (sstr); + log->Printf (" %s", sstr.GetData()); + } + } } SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) : m_opaque_ap () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) " + "lldb_object_ptr = %p ==> this = %p", lldb_object_ptr, this); + if (lldb_object_ptr) m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr)); + + if (log) + { + uint32_t num_vars = GetSize(); + for (uint32_t i = 0; i < num_vars; ++i) + { + SBValue value = GetValueAtIndex (i); + SBStream sstr; + value.GetDescription (sstr); + log->Printf (" %s", sstr.GetData()); + } + } } SBValueList::~SBValueList () @@ -106,18 +149,40 @@ SBValue SBValueList::GetValueAtIndex (uint32_t idx) const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx); + SBValue sb_value; if (m_opaque_ap.get()) *sb_value = m_opaque_ap->GetValueObjectAtIndex (idx); + + if (log) + { + SBStream sstr; + sb_value.GetDescription (sstr); + log->Printf ("SBValueList::GetValueAtIndex ==> SBValue (this = %p, '%s')", &sb_value, sstr.GetData()); + } + return sb_value; } uint32_t SBValueList::GetSize () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBValueList::GetSize ()"); + uint32_t size = 0; if (m_opaque_ap.get()) size = m_opaque_ap->GetSize(); + + if (log) + log->Printf ("SBValueList::GetSize ==> %d", size); + return size; } Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectLog.cpp Mon Oct 25 22:11:13 2010 @@ -64,18 +64,27 @@ "Enable logging for a single log channel.", NULL) { - CommandArgumentEntry arg; + + CommandArgumentEntry arg1; + CommandArgumentEntry arg2; CommandArgumentData channel_arg; + CommandArgumentData category_arg; // Define the first (and only) variant of this arg. channel_arg.arg_type = eArgTypeLogChannel; channel_arg.arg_repetition = eArgRepeatPlain; // There is only one variant this argument could be; put it into the argument entry. - arg.push_back (channel_arg); + arg1.push_back (channel_arg); + category_arg.arg_type = eArgTypeLogCategory; + category_arg.arg_repetition = eArgRepeatPlus; + + arg2.push_back (category_arg); + // Push the data for the first argument into the m_arguments vector. - m_arguments.push_back (arg); + m_arguments.push_back (arg1); + m_arguments.push_back (arg2); } virtual Modified: lldb/trunk/source/Core/Communication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/Core/Communication.cpp (original) +++ lldb/trunk/source/Core/Communication.cpp Mon Oct 25 22:11:13 2010 @@ -364,3 +364,20 @@ Disconnect (NULL); m_connection_ap.reset(connection); } + +const char * +Communication::ConnectionStatusAsCString (lldb::ConnectionStatus status) +{ + switch (status) + { + case eConnectionStatusSuccess: return "success"; + case eConnectionStatusError: return "error"; + case eConnectionStatusTimedOut: return "timed out"; + case eConnectionStatusNoConnection: return "no connection"; + case eConnectionStatusLostConnection: return "lost connection"; + } + + static char unknown_state_string[64]; + snprintf(unknown_state_string, sizeof (unknown_state_string), "ConnectionStatus = %i", status); + return unknown_state_string; +} Modified: lldb/trunk/source/Core/InputReader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/InputReader.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/Core/InputReader.cpp (original) +++ lldb/trunk/source/Core/InputReader.cpp Mon Oct 25 22:11:13 2010 @@ -338,3 +338,21 @@ { m_reader_done.WaitForValueEqualTo (true); } + +const char * +InputReader::GranularityAsCString (lldb::InputReaderGranularity granularity) +{ + switch (granularity) + { + case eInputReaderGranularityInvalid: return "invalid"; + case eInputReaderGranularityByte: return "byte"; + case eInputReaderGranularityWord: return "word"; + case eInputReaderGranularityLine: return "line"; + case eInputReaderGranularityAll: return "all"; + } + + static char unknown_state_string[64]; + snprintf(unknown_state_string, sizeof (unknown_state_string), "InputReaderGranularity = %i", granularity); + return unknown_state_string; +} + Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Mon Oct 25 22:11:13 2010 @@ -376,6 +376,20 @@ } void +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 ? ")" : ""); + +} + +void Module::Dump(Stream *s) { Mutex::Locker locker (m_mutex); Modified: lldb/trunk/source/Interpreter/CommandObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObject.cpp Mon Oct 25 22:11:13 2010 @@ -622,7 +622,8 @@ { eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, NULL, "The name of a function." }, { eArgTypeIndex, "index", CommandCompletions::eNoCompletion, NULL, "An index into a list." }, { eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, NULL, "Line number in a source file." }, - { eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, + { eArgTypeLogCategory, "log-category", CommandCompletions::eNoCompletion, NULL, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, + { eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, NULL, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." }, { eArgTypeMethod, "method", CommandCompletions::eNoCompletion, NULL, "A C++ method name." }, { eArgTypeName, "name", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, { eArgTypeNewPathPrefix, "new-path-prefix", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Mon Oct 25 22:11:13 2010 @@ -64,15 +64,27 @@ } void -Target::Dump (Stream *s) +Target::Dump (Stream *s, lldb::DescriptionLevel description_level) { // s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); - s->Indent(); - s->PutCString("Target\n"); - s->IndentMore(); - m_images.Dump(s); - m_breakpoint_list.Dump(s); - m_internal_breakpoint_list.Dump(s); + if (description_level != lldb::eDescriptionLevelBrief) + { + s->Indent(); + s->PutCString("Target\n"); + s->IndentMore(); + m_images.Dump(s); + m_breakpoint_list.Dump(s); + m_internal_breakpoint_list.Dump(s); + } + else + { + char path[PATH_MAX]; + int path_len = PATH_MAX; + if (GetExecutableModule()->GetFileSpec().GetPath (path, path_len)) + s->Printf ("Target: %s\n", path); + else + s->Printf ("Target: \n"); + } // if (m_process_sp.get()) // m_process_sp->Dump(s); s->IndentLess(); Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Mon Oct 25 22:11:13 2010 @@ -1097,3 +1097,39 @@ { return GetStackFrameList().GetStackFrameSPForStackFramePtr (stack_frame_ptr); } + +const char * +Thread::StopReasonAsCString (lldb::StopReason reason) +{ + switch (reason) + { + case eStopReasonInvalid: return "invalid"; + case eStopReasonNone: return "none"; + case eStopReasonTrace: return "trace"; + case eStopReasonBreakpoint: return "breakpoint"; + case eStopReasonWatchpoint: return "watchpoint"; + case eStopReasonSignal: return "signal"; + case eStopReasonException: return "exception"; + case eStopReasonPlanComplete: return "plan complete"; + } + + + static char unknown_state_string[64]; + snprintf(unknown_state_string, sizeof (unknown_state_string), "StopReason = %i", reason); + return unknown_state_string; +} + +const char * +Thread::RunModeAsCString (lldb::RunMode mode) +{ + switch (mode) + { + case eOnlyThisThread: return "only this thread"; + case eAllThreads: return "all threads"; + case eOnlyDuringStepping: return "only during stepping"; + } + + static char unknown_state_string[64]; + snprintf(unknown_state_string, sizeof (unknown_state_string), "RunMode = %i", mode); + return unknown_state_string; +} Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=117349&r1=117348&r2=117349&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Mon Oct 25 22:11:13 2010 @@ -136,6 +136,7 @@ const char *arg = args.GetArgumentAtIndex(i); if (strcasecmp(arg, "all") == 0 ) flag_bits |= LIBLLDB_LOG_ALL; + else if (strcasecmp(arg, "api") == 0) flag_bits |= LIBLLDB_LOG_API; else if (strcasestr(arg, "break") == arg) flag_bits |= LIBLLDB_LOG_BREAKPOINTS; else if (strcasecmp(arg, "default") == 0 ) flag_bits |= LIBLLDB_LOG_DEFAULT; else if (strcasestr(arg, "event") == arg) flag_bits |= LIBLLDB_LOG_EVENTS; @@ -177,6 +178,7 @@ { strm->Printf("Logging categories for 'lldb':\n" "\tall - turn on all available logging categories\n" + "\tapi - enable logging of API calls and return values\n" "\tdefault - enable the default set of logging categories for liblldb\n" "\tbreak - log breakpoints\n" "\tevents - log broadcaster, listener and event queue activities\n" From jmolenda at apple.com Mon Oct 25 23:14:12 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 26 Oct 2010 04:14:12 -0000 Subject: [Lldb-commits] [lldb] r117350 - in /lldb/trunk/source/Plugins/Process/Utility: RegisterContextLLDB.cpp UnwindLLDB.cpp Message-ID: <20101026041412.5704A2A6C12C@llvm.org> Author: jmolenda Date: Mon Oct 25 23:14:12 2010 New Revision: 117350 URL: http://llvm.org/viewvc/llvm-project?rev=117350&view=rev Log: Don't indent log lines by frame # spaces if the frame # exceeds 100 - the indentation gets to be a problem if you have a unbounded stack walk. Fix the CFA sanity checks. Add one to the arch default UnwindPlan run which was giving one extra stack frame on the main thread. Fix a couple of logging lines that had their argument order incorrect. Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=117350&r1=117349&r2=117350&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Mon Oct 25 23:14:12 2010 @@ -128,12 +128,12 @@ Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); // A couple of sanity checks.. - if (m_cfa == (addr_t) -1 || m_cfa == 0 || m_cfa == 1) + if (cfa_regval == LLDB_INVALID_ADDRESS || cfa_regval == 0 || cfa_regval == 1) { if (log) { log->Printf("%*sFrame %d could not find a valid cfa address", - m_frame_number, "", m_frame_number); + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNotAValidFrame; return; @@ -141,9 +141,9 @@ if (log) { - log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", - m_frame_number, "", m_frame_number, - (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); + log->Printf("%*sThread %d Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + m_frame_number < 100 ? m_frame_number : 100, "", m_thread.GetIndexID(), m_frame_number, + (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa); } } @@ -178,7 +178,7 @@ if (log) { log->Printf("%*sFrame %d could not get pc value", - m_frame_number, "", m_frame_number); + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNotAValidFrame; return; @@ -193,7 +193,7 @@ if (log) { log->Printf("%*sFrame %d using architectural default unwind method", - m_frame_number, "", m_frame_number); + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); @@ -213,17 +213,30 @@ if (log) { log->Printf("%*sFrame %d failed to get cfa value", - m_frame_number, "", m_frame_number); + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNormalFrame; return; } m_cfa = cfa_regval + cfa_offset; + + // A couple of sanity checks.. + if (cfa_regval == LLDB_INVALID_ADDRESS || cfa_regval == 0 || cfa_regval == 1) + { + if (log) + { + log->Printf("%*sFrame %d could not find a valid cfa address", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); + } + m_frame_type = eNotAValidFrame; + return; + } + if (log) { - log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", - m_frame_number, "", m_frame_number, - (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); + log->Printf("%*sFrame %d initialized frame cfa is 0x%llx", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, + (uint64_t) m_cfa); } return; } @@ -295,7 +308,7 @@ if (log) { log->Printf("%*sFrame %d failed to get cfa reg %d/%d", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, row_register_kind, active_row->GetCFARegister()); } m_frame_type = eNotAValidFrame; @@ -306,12 +319,12 @@ m_cfa = cfa_regval + cfa_offset; // A couple of sanity checks.. - if (m_cfa == (addr_t) -1 || m_cfa == 0 || m_cfa == 1) + if (cfa_regval == LLDB_INVALID_ADDRESS || cfa_regval == 0 || cfa_regval == 1) { if (log) { log->Printf("%*sFrame %d could not find a valid cfa address", - m_frame_number, "", m_frame_number); + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); } m_frame_type = eNotAValidFrame; return; @@ -320,8 +333,8 @@ if (log) { log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", - m_frame_number, "", m_frame_number, - (uint64_t) m_cfa, (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget())); + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, + (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa); } } @@ -479,7 +492,7 @@ if (m_fast_unwind_plan) has_fast = ", and has a fast UnwindPlan"; log->Printf("%*sFrame %d frame uses %s for full UnwindPlan%s", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, m_full_unwind_plan->GetSourceName().GetCString(), has_fast); } @@ -656,7 +669,7 @@ if (log) { log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } return false; @@ -666,7 +679,7 @@ if (log) { log->Printf("%*sFrame %d supplying caller's saved reg %d's location using FastUnwindPlan", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } have_unwindplan_regloc = true; @@ -681,7 +694,7 @@ if (log) { log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } return false; @@ -693,7 +706,7 @@ if (log && IsLogVerbose ()) { log->Printf("%*sFrame %d supplying caller's saved reg %d's location using %s UnwindPlan", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum, m_full_unwind_plan->GetSourceName().GetCString()); } } @@ -709,7 +722,7 @@ if (log) { log->Printf("%*sFrame %d did not supply reg location for %d because it is volatile", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } return false; @@ -732,7 +745,7 @@ if (log) { log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } return false; @@ -747,7 +760,7 @@ if (log) { log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } return false; @@ -764,7 +777,7 @@ if (log) { log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } return false; @@ -798,7 +811,7 @@ if (log) { log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } return false; @@ -812,7 +825,7 @@ if (log) { log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_regnum); } @@ -897,7 +910,7 @@ if (log && IsLogVerbose ()) { log->Printf("%*sFrame %d looking for register saved location for reg %d", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_reg); } @@ -907,7 +920,7 @@ if (log) { log->Printf("%*sFrame %d passing along to the live register context for reg %d", - m_frame_number, "", m_frame_number, + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, lldb_reg); } return m_base_reg_ctx->ReadRegisterBytes (lldb_reg, data); Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=117350&r1=117349&r2=117350&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Mon Oct 25 23:14:12 2010 @@ -72,7 +72,7 @@ if (log) { log->Printf("%*sFrame %d invalid RegisterContext for this frame, stopping stack walk", - cur_idx, "", cur_idx); + cur_idx < 100 ? cur_idx : 100, "", cur_idx); } break; } @@ -82,7 +82,7 @@ if (log) { log->Printf("%*sFrame %d did not get CFA for this frame, stopping stack walk", - cur_idx, "", cur_idx); + cur_idx < 100 ? cur_idx : 100, "", cur_idx); } break; } @@ -92,7 +92,7 @@ if (log) { log->Printf("%*sFrame %d did not get a valid CFA for this frame, stopping stack walk", - cur_idx, "", cur_idx); + cur_idx < 100 ? cur_idx : 100, "", cur_idx); } break; } @@ -102,7 +102,7 @@ if (log) { log->Printf("%*sFrame %d did not get PC for this frame, stopping stack walk", - cur_idx, "", cur_idx); + cur_idx < 100 ? cur_idx : 100, "", cur_idx); } break; } From jmolenda at apple.com Tue Oct 26 07:01:35 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 26 Oct 2010 12:01:35 -0000 Subject: [Lldb-commits] [lldb] r117361 - in /lldb/trunk/source: Plugins/Process/Utility/RegisterContextLLDB.cpp Plugins/Process/Utility/RegisterContextLLDB.h Symbol/DWARFCallFrameInfo.cpp Message-ID: <20101026120135.D369F2A6C12C@llvm.org> Author: jmolenda Date: Tue Oct 26 07:01:35 2010 New Revision: 117361 URL: http://llvm.org/viewvc/llvm-project?rev=117361&view=rev Log: Add an unwind log Printf to note when an eh_frame section is loaded/parsed. Should add timers to this eventually. Delay getting a full UnwindPlan if it's possible to unwind with just a fast UnwindPlan. This keeps us from reading the eh_frame section unless we hit something built -fomit-frame pointer or we hit a frame with no symbol (read: no start address) available. It doesn't look like it is correctly falling back to using the full UnwindPlan to provide additional registers that the fast UnwindPlan doesn't supply; e.g. go to the middle of a stack and ask for r12 and it will show you the value of r12 in frame 0. That's a bug for tomorrow. Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=117361&r1=117360&r2=117361&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Tue Oct 26 07:01:35 2010 @@ -32,11 +32,11 @@ SymbolContext& sym_ctx, int frame_number) : RegisterContext (thread), m_thread(thread), m_next_frame(next_frame), - m_zeroth_frame(false), m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(), - m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_frame_number (frame_number) + m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(), + m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_current_pc (), m_frame_number (frame_number) { m_base_reg_ctx = m_thread.GetRegisterContext(); - if (m_next_frame.get() == NULL) + if (IsFrameZero ()) { InitializeZerothFrame (); } @@ -44,6 +44,25 @@ { InitializeNonZerothFrame (); } + + // This same code exists over in the GetFullUnwindPlanForFrame() but it may not have been executed yet + bool behaves_like_zeroth_frame = false; + if (IsFrameZero()) + { + behaves_like_zeroth_frame = true; + } + if (!IsFrameZero() && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eSigtrampFrame) + { + behaves_like_zeroth_frame = true; + } + if (!IsFrameZero() && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eDebuggerFrame) + { + behaves_like_zeroth_frame = true; + } + if (behaves_like_zeroth_frame) + { + m_all_registers_available = true; + } } // Initialize a RegisterContextLLDB which is the first frame of a stack -- the zeroth frame or currently @@ -52,7 +71,6 @@ void RegisterContextLLDB::InitializeZerothFrame() { - m_zeroth_frame = true; StackFrameSP frame_sp (m_thread.GetStackFrameAtIndex (0)); if (m_base_reg_ctx == NULL) { @@ -66,7 +84,7 @@ else if (m_sym_ctx.symbol) addr_range_ptr = m_sym_ctx.symbol->GetAddressRangePtr(); - Address current_pc = frame_sp->GetFrameCodeAddress(); + m_current_pc = frame_sp->GetFrameCodeAddress(); static ConstString sigtramp_name ("_sigtramp"); if ((m_sym_ctx.function && m_sym_ctx.function->GetMangled().GetMangledName() == sigtramp_name) @@ -89,18 +107,19 @@ } else { - m_start_pc = current_pc; + m_start_pc = m_current_pc; m_current_offset = -1; } - // We've set m_frame_type, m_zeroth_frame, and m_sym_ctx before this call. - // This call sets the m_all_registers_available, m_fast_unwind_plan, and m_full_unwind_plan member variables. - GetUnwindPlansForFrame (current_pc); + // We've set m_frame_type and m_sym_ctx before these calls. + + m_fast_unwind_plan = GetFastUnwindPlanForFrame (); + m_full_unwind_plan = GetFullUnwindPlanForFrame (); const UnwindPlan::Row *active_row = NULL; int cfa_offset = 0; int row_register_kind; - if (m_full_unwind_plan && m_full_unwind_plan->PlanValidAtAddress (current_pc)) + if (m_full_unwind_plan && m_full_unwind_plan->PlanValidAtAddress (m_current_pc)) { active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); row_register_kind = m_full_unwind_plan->GetRegisterKind (); @@ -141,9 +160,10 @@ if (log) { - log->Printf("%*sThread %d Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx", + log->Printf("%*sThread %d Frame %d initialized frame current pc is 0x%llx cfa is 0x%llx using %s UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_thread.GetIndexID(), m_frame_number, - (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa); + (uint64_t) m_current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa, + m_full_unwind_plan->GetSourceName().GetCString()); } } @@ -154,7 +174,7 @@ RegisterContextLLDB::InitializeNonZerothFrame() { Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); - if (m_next_frame.get() == NULL) + if (IsFrameZero ()) { m_frame_type = eNotAValidFrame; return; @@ -170,8 +190,6 @@ return; } - m_zeroth_frame = false; - addr_t pc; if (!ReadGPRValue (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc)) { @@ -183,12 +201,11 @@ m_frame_type = eNotAValidFrame; return; } - Address current_pc; - m_thread.GetProcess().GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, current_pc); + m_thread.GetProcess().GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, m_current_pc); // If we don't have a Module for some reason, we're not going to find symbol/function information - just // stick in some reasonable defaults and hope we can unwind past this frame. - if (!current_pc.IsValid() || current_pc.GetModule() == NULL) + if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL) { if (log) { @@ -200,7 +217,7 @@ if (arch_default) { m_fast_unwind_plan = NULL; - m_full_unwind_plan = arch_default->GetArchDefaultUnwindPlan (m_thread, current_pc); + m_full_unwind_plan = arch_default->GetArchDefaultUnwindPlan (m_thread, m_current_pc); m_frame_type = eNormalFrame; m_all_registers_available = false; m_current_offset = -1; @@ -245,7 +262,7 @@ } // set up our m_sym_ctx SymbolContext - current_pc.GetModule()->ResolveSymbolContextForAddress (current_pc, eSymbolContextFunction | eSymbolContextSymbol, m_sym_ctx); + m_current_pc.GetModule()->ResolveSymbolContextForAddress (m_current_pc, eSymbolContextFunction | eSymbolContextSymbol, m_sym_ctx); const AddressRange *addr_range_ptr; if (m_sym_ctx.function) @@ -270,30 +287,37 @@ if (addr_range_ptr) { m_start_pc = addr_range_ptr->GetBaseAddress(); - m_current_offset = current_pc.GetOffset() - m_start_pc.GetOffset(); + m_current_offset = m_current_pc.GetOffset() - m_start_pc.GetOffset(); } else { - m_start_pc = current_pc; + m_start_pc = m_current_pc; m_current_offset = -1; } - // We've set m_frame_type, m_zeroth_frame, and m_sym_ctx before this call. - // This call sets the m_all_registers_available, m_fast_unwind_plan, and m_full_unwind_plan member variables. - GetUnwindPlansForFrame (current_pc); + // We've set m_frame_type and m_sym_ctx before this call. + m_fast_unwind_plan = GetFastUnwindPlanForFrame (); const UnwindPlan::Row *active_row = NULL; int cfa_offset = 0; int row_register_kind; - if (m_fast_unwind_plan && m_fast_unwind_plan->PlanValidAtAddress (current_pc)) + + // Try to get by with just the fast UnwindPlan if possible - the full UnwindPlan may be expensive to get + // (e.g. if we have to parse the entire eh_frame section of an ObjectFile for the first time.) + + if (m_fast_unwind_plan && m_fast_unwind_plan->PlanValidAtAddress (m_current_pc)) { active_row = m_fast_unwind_plan->GetRowForFunctionOffset (m_current_offset); row_register_kind = m_fast_unwind_plan->GetRegisterKind (); } - else if (m_full_unwind_plan && m_full_unwind_plan->PlanValidAtAddress (current_pc)) + else { - active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); - row_register_kind = m_full_unwind_plan->GetRegisterKind (); + m_full_unwind_plan = GetFullUnwindPlanForFrame (); + if (m_full_unwind_plan && m_full_unwind_plan->PlanValidAtAddress (m_current_pc)) + { + active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); + row_register_kind = m_full_unwind_plan->GetRegisterKind (); + } } if (active_row == NULL) @@ -334,171 +358,194 @@ { log->Printf("%*sFrame %d initialized frame current pc is 0x%llx cfa is 0x%llx", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, - (uint64_t) current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa); + (uint64_t) m_current_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget()), (uint64_t) m_cfa); } } +bool +RegisterContextLLDB::IsFrameZero () const +{ + if (m_next_frame.get () == NULL) + return true; + else + return false; +} -// On entry to this method, -// -// 1. m_frame_type should already be set to eSigtrampFrame/eDebuggerFrame -// if either of those are correct, and -// 2. m_zeroth_frame should be set to true if this is frame 0 and -// 3. m_sym_ctx should already be filled in. +// Find a fast unwind plan for this frame, if possible. // -// On exit this function will have set +// On entry to this method, // -// a. m_all_registers_available (true if we can provide any requested register, false if only a subset are provided) -// b. m_fast_unwind_plan (fast unwind plan that walks the stack while filling in only minimal registers, may be NULL) -// c. m_full_unwind_plan (full unwind plan that can provide all registers possible, will *not* be NULL) +// 1. m_frame_type should already be set to eSigtrampFrame/eDebuggerFrame if either of those are correct, +// 2. m_sym_ctx should already be filled in, and +// 3. m_current_pc should have the current pc value for this frame + +UnwindPlan * +RegisterContextLLDB::GetFastUnwindPlanForFrame () +{ + if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL || m_current_pc.GetModule()->GetObjectFile() == NULL) + { + return NULL; + } + + if (IsFrameZero ()) + { + return NULL; + } + + FuncUnwindersSP fu; + fu = m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx); + if (fu.get() == NULL) + { + return NULL; + } + + // If we're in _sigtramp(), unwinding past this frame requires special knowledge. + if (m_frame_type == eSigtrampFrame || m_frame_type == eDebuggerFrame) + { + return NULL; + } + + if (fu->GetUnwindPlanFastUnwind (m_thread) + && fu->GetUnwindPlanFastUnwind (m_thread)->PlanValidAtAddress (m_current_pc)) + { + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + if (log && IsLogVerbose()) + { + const char *has_fast = ""; + if (m_fast_unwind_plan) + has_fast = ", and has a fast UnwindPlan"; + log->Printf("%*sFrame %d frame has a fast UnwindPlan", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number); + } + m_frame_type = eNormalFrame; + return fu->GetUnwindPlanFastUnwind (m_thread); + } + + return NULL; +} + +// On entry to this method, // -// The argument current_pc should be the current pc value in the function. +// 1. m_frame_type should already be set to eSigtrampFrame/eDebuggerFrame if either of those are correct, +// 2. m_sym_ctx should already be filled in, and +// 3. m_current_pc should have the current pc value for this frame -void -RegisterContextLLDB::GetUnwindPlansForFrame (Address current_pc) +UnwindPlan * +RegisterContextLLDB::GetFullUnwindPlanForFrame () { + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + UnwindPlan *up; UnwindPlan *arch_default_up = NULL; ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture (); ArchDefaultUnwindPlan *arch_default = ArchDefaultUnwindPlan::FindPlugin (arch); if (arch_default) { - arch_default_up = arch_default->GetArchDefaultUnwindPlan (m_thread, current_pc); + arch_default_up = arch_default->GetArchDefaultUnwindPlan (m_thread, m_current_pc); } bool behaves_like_zeroth_frame = false; - - if (m_zeroth_frame) + if (IsFrameZero ()) { behaves_like_zeroth_frame = true; } - if (m_next_frame.get() && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eSigtrampFrame) + if (!IsFrameZero () && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eSigtrampFrame) { behaves_like_zeroth_frame = true; } - if (m_next_frame.get() && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eDebuggerFrame) + if (!IsFrameZero () && ((RegisterContextLLDB*) m_next_frame.get())->m_frame_type == eDebuggerFrame) { behaves_like_zeroth_frame = true; } - if (behaves_like_zeroth_frame) { m_all_registers_available = true; } - else - { -// If we need to implement gdb's decrement-pc-value-by-one-before-function-check macro, it would be here. -// current_pc.SetOffset (current_pc.GetOffset() - 1); - m_all_registers_available = false; - } // No Module for the current pc, try using the architecture default unwind. - if (current_pc.GetModule() == NULL || current_pc.GetModule()->GetObjectFile() == NULL) + if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL || m_current_pc.GetModule()->GetObjectFile() == NULL) { - m_fast_unwind_plan = NULL; - m_full_unwind_plan = arch_default_up; m_frame_type = eNormalFrame; - return; + return arch_default_up; } FuncUnwindersSP fu; - if (current_pc.GetModule() && current_pc.GetModule()->GetObjectFile()) - { - fu = current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (current_pc, m_sym_ctx); - } + fu = m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx); // No FuncUnwinders available for this pc, try using architectural default unwind. if (fu.get() == NULL) { - m_fast_unwind_plan = NULL; - m_full_unwind_plan = arch_default_up; m_frame_type = eNormalFrame; - return; + return arch_default_up; } // If we're in _sigtramp(), unwinding past this frame requires special knowledge. On Mac OS X this knowledge // is properly encoded in the eh_frame section, so prefer that if available. + // On other platforms we may need to provide a platform-specific UnwindPlan which encodes the details of + // how to unwind out of sigtramp. if (m_frame_type == eSigtrampFrame) { m_fast_unwind_plan = NULL; UnwindPlan *up = fu->GetUnwindPlanAtCallSite (); - if (up->PlanValidAtAddress (current_pc)) + if (up->PlanValidAtAddress (m_current_pc)) { - m_fast_unwind_plan = NULL; - m_full_unwind_plan = up; - return; + return up; } } - - UnwindPlan *fast, *callsite, *noncallsite; - fast = callsite = noncallsite = NULL; - - if (fu->GetUnwindPlanFastUnwind (m_thread) - && fu->GetUnwindPlanFastUnwind (m_thread)->PlanValidAtAddress (current_pc)) - { - fast = fu->GetUnwindPlanFastUnwind (m_thread); - } - - // Typically this is the unwind created by inspecting the assembly language instructions - if (fu->GetUnwindPlanAtNonCallSite (m_thread) - && fu->GetUnwindPlanAtNonCallSite (m_thread)->PlanValidAtAddress (current_pc)) + + // Typically the NonCallSite UnwindPlan is the unwind created by inspecting the assembly language instructions + up = fu->GetUnwindPlanAtNonCallSite (m_thread); + if (behaves_like_zeroth_frame && up && up->PlanValidAtAddress (m_current_pc)) { - noncallsite = fu->GetUnwindPlanAtNonCallSite (m_thread); + if (log && IsLogVerbose()) + { + log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, + up->GetSourceName().GetCString()); + } + return up; } - // Typically this is unwind info from an eh_frame section intended for exception handling; only valid at call sites - if (fu->GetUnwindPlanAtCallSite () - && fu->GetUnwindPlanAtCallSite ()->PlanValidAtAddress (current_pc)) - { - callsite = fu->GetUnwindPlanAtCallSite (); - } - - m_fast_unwind_plan = NULL; - m_full_unwind_plan = NULL; - - if (fast) - { - m_fast_unwind_plan = fast; - } - - if (behaves_like_zeroth_frame && noncallsite) - { - m_full_unwind_plan = noncallsite; - } - else + up = fu->GetUnwindPlanAtCallSite (); + if (up && up->PlanValidAtAddress (m_current_pc)) { - if (callsite) + if (log && IsLogVerbose()) { - m_full_unwind_plan = callsite; - } - else - { - m_full_unwind_plan = noncallsite; + log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, + up->GetSourceName().GetCString()); } + return up; } - - if (m_full_unwind_plan == NULL) + + // We'd prefer to use an UnwindPlan intended for call sites when we're at a call site but if we've + // struck out on that, fall back to using the non-call-site assembly inspection UnwindPlan if possible. + up = fu->GetUnwindPlanAtNonCallSite (m_thread); + if (up && up->PlanValidAtAddress (m_current_pc)) { - m_full_unwind_plan = arch_default_up; + if (log && IsLogVerbose()) + { + log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, + up->GetSourceName().GetCString()); + } + return up; } - Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + // If nothing else, use the architectural default UnwindPlan and hope that does the job. if (log && IsLogVerbose()) { - const char *has_fast = ""; - if (m_fast_unwind_plan) - has_fast = ", and has a fast UnwindPlan"; - log->Printf("%*sFrame %d frame uses %s for full UnwindPlan%s", + log->Printf("%*sFrame %d frame uses %s for full UnwindPlan", m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, - m_full_unwind_plan->GetSourceName().GetCString(), has_fast); + arch_default_up->GetSourceName().GetCString()); } - - return; + return arch_default_up; } + void RegisterContextLLDB::Invalidate () { @@ -545,7 +592,7 @@ { data.SetAddressByteSize (m_thread.GetProcess().GetAddressByteSize()); data.SetByteOrder (m_thread.GetProcess().GetByteOrder()); - if (m_next_frame.get() == NULL) + if (IsFrameZero ()) { return m_base_reg_ctx->ReadRegisterBytes (regloc.location.register_number, data); } @@ -660,11 +707,14 @@ UnwindPlan::Row::RegisterLocation unwindplan_regloc; bool have_unwindplan_regloc = false; + int unwindplan_registerkind; + if (m_fast_unwind_plan) { const UnwindPlan::Row *active_row = m_fast_unwind_plan->GetRowForFunctionOffset (m_current_offset); + unwindplan_registerkind = m_fast_unwind_plan->GetRegisterKind (); uint32_t row_regnum; - if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, m_fast_unwind_plan->GetRegisterKind(), row_regnum)) + if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, unwindplan_registerkind, row_regnum)) { if (log) { @@ -685,29 +735,38 @@ have_unwindplan_regloc = true; } } - else if (m_full_unwind_plan) + else { - const UnwindPlan::Row *active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); - uint32_t row_regnum; - if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, m_full_unwind_plan->GetRegisterKind(), row_regnum)) + // m_full_unwind_plan being NULL probably means that we haven't tried to find a full UnwindPlan yet + if (m_full_unwind_plan == NULL) { - if (log) + m_full_unwind_plan = GetFullUnwindPlanForFrame (); + } + if (m_full_unwind_plan) + { + const UnwindPlan::Row *active_row = m_full_unwind_plan->GetRowForFunctionOffset (m_current_offset); + unwindplan_registerkind = m_full_unwind_plan->GetRegisterKind (); + uint32_t row_regnum; + if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (eRegisterKindLLDB, lldb_regnum, unwindplan_registerkind, row_regnum)) { - log->Printf("%*sFrame %d could not supply caller's reg %d location", - m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, - lldb_regnum); + if (log) + { + log->Printf("%*sFrame %d could not supply caller's reg %d location", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, + lldb_regnum); + } + return false; } - return false; - } - if (active_row->GetRegisterInfo (row_regnum, unwindplan_regloc)) - { - have_unwindplan_regloc = true; - if (log && IsLogVerbose ()) - { - log->Printf("%*sFrame %d supplying caller's saved reg %d's location using %s UnwindPlan", - m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, - lldb_regnum, m_full_unwind_plan->GetSourceName().GetCString()); + if (active_row->GetRegisterInfo (row_regnum, unwindplan_regloc)) + { + have_unwindplan_regloc = true; + if (log && IsLogVerbose ()) + { + log->Printf("%*sFrame %d supplying caller's saved reg %d's location using %s UnwindPlan", + m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, + lldb_regnum, m_full_unwind_plan->GetSourceName().GetCString()); + } } } } @@ -728,7 +787,7 @@ return false; } - if (m_next_frame.get()) + if (!IsFrameZero ()) { return ((RegisterContextLLDB*)m_next_frame.get())->SavedLocationForRegister (lldb_regnum, regloc); } @@ -768,7 +827,7 @@ if (unwindplan_regloc.IsSame()) { - if (m_next_frame.get()) + if (!IsFrameZero ()) { return ((RegisterContextLLDB*)m_next_frame.get())->SavedLocationForRegister (lldb_regnum, regloc); } @@ -806,7 +865,7 @@ { uint32_t unwindplan_regnum = unwindplan_regloc.GetRegisterNumber(); uint32_t row_regnum_in_lldb; - if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (m_full_unwind_plan->GetRegisterKind(), unwindplan_regnum, eRegisterKindLLDB, row_regnum_in_lldb)) + if (!m_base_reg_ctx->ConvertBetweenRegisterKinds (unwindplan_registerkind, unwindplan_regnum, eRegisterKindLLDB, row_regnum_in_lldb)) { if (log) { @@ -870,7 +929,7 @@ data.SetByteOrder (m_thread.GetProcess().GetByteOrder()); // if this is frame 0 (currently executing frame), get the requested reg contents from the actual thread registers - if (m_next_frame.get() == NULL) + if (IsFrameZero ()) { if (m_base_reg_ctx->ReadRegisterBytes (lldb_regnum, data)) { @@ -915,7 +974,7 @@ } // If this is the 0th frame, hand this over to the live register context - if (m_next_frame.get() == NULL) + if (IsFrameZero ()) { if (log) { Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h?rev=117361&r1=117360&r2=117361&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Tue Oct 26 07:01:35 2010 @@ -106,6 +106,14 @@ }; + // Indicates whether this frame is frame zero -- the currently + // executing frame -- or not. If it is not frame zero, m_next_frame's + // shared pointer holds a pointer to the RegisterContextLLDB + // object "below" this frame, i.e. this frame called m_next_frame's + // function. + bool + IsFrameZero () const; + void InitializeZerothFrame (); @@ -139,8 +147,11 @@ bool ReadGPRValue (int register_kind, uint32_t regnum, lldb::addr_t &value); - void - GetUnwindPlansForFrame (lldb_private::Address current_pc); + lldb_private::UnwindPlan * + GetFastUnwindPlanForFrame (); + + lldb_private::UnwindPlan * + GetFullUnwindPlanForFrame (); lldb_private::Thread& m_thread; lldb::RegisterContextSP m_next_frame; @@ -154,7 +165,6 @@ lldb_private::UnwindPlan *m_fast_unwind_plan; // may be NULL lldb_private::UnwindPlan *m_full_unwind_plan; - bool m_zeroth_frame; // Is this the bottom-most, i.e. currently executing, frame? bool m_all_registers_available; // Can we retrieve all regs or just nonvolatile regs? int m_frame_type; // enum FrameType int m_current_offset; // how far into the function we've executed; -1 if unknown @@ -164,6 +174,7 @@ lldb::addr_t m_cfa; lldb_private::Address m_start_pc; + lldb_private::Address m_current_pc; std::map m_registers; // where to find reg values for this frame Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=117361&r1=117360&r2=117361&view=diff ============================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original) +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Tue Oct 26 07:01:35 2010 @@ -12,6 +12,7 @@ // C++ Includes #include +#include "lldb/Core/Log.h" #include "lldb/Core/Section.h" #include "lldb/Symbol/DWARFCallFrameInfo.h" #include "lldb/Core/ArchSpec.h" @@ -284,9 +285,15 @@ if (m_fde_index_initialized) return; + dw_offset_t offset = 0; if (m_cfi_data_initialized == false) { + Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND); + if (log) + { + log->Printf ("Reading eh_frame information for %s", m_objfile.GetFileSpec().GetFilename().GetCString()); + } m_section->ReadSectionDataFromObjectFile (&m_objfile, m_cfi_data); m_cfi_data_initialized = true; } From ctice at apple.com Tue Oct 26 13:33:57 2010 From: ctice at apple.com (Caroline Tice) Date: Tue, 26 Oct 2010 18:33:57 -0000 Subject: [Lldb-commits] [lldb] r117383 - /lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Message-ID: <20101026183357.8CCA52A6C12C@llvm.org> Author: ctice Date: Tue Oct 26 13:33:57 2010 New Revision: 117383 URL: http://llvm.org/viewvc/llvm-project?rev=117383&view=rev Log: Remove inappropriate if-clause in regex name resolution that was causing modules that haven't already been parsed from being searched. Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=117383&r1=117382&r2=117383&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Tue Oct 26 13:33:57 2010 @@ -168,8 +168,7 @@ case Breakpoint::Regexp: if (context.module_sp) { - if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) - context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list); + context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list); context.module_sp->FindFunctions (m_regex, true, func_list); } break; From gclayton at apple.com Tue Oct 26 16:04:55 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 26 Oct 2010 21:04:55 -0000 Subject: [Lldb-commits] [lldb] r117395 - /lldb/trunk/tools/debugserver/source/RNBRemote.cpp Message-ID: <20101026210455.4EE522A6C12C@llvm.org> Author: gclayton Date: Tue Oct 26 16:04:55 2010 New Revision: 117395 URL: http://llvm.org/viewvc/llvm-project?rev=117395&view=rev Log: Fixed vAttachWait by fixing a missed "else if". Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=117395&r1=117394&r2=117395&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original) +++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Tue Oct 26 16:04:55 2010 @@ -2552,7 +2552,7 @@ attach_pid = DNBProcessAttachWait(attach_name.c_str (), m_ctx.LaunchFlavor(), NULL, 1000, err_str, sizeof(err_str), RNBRemoteShouldCancelCallback); } - if (strstr (p, "vAttachName;") == p) + else if (strstr (p, "vAttachName;") == p) { p += strlen("vAttachName;"); std::string attach_name; From ctice at apple.com Tue Oct 26 18:49:37 2010 From: ctice at apple.com (Caroline Tice) Date: Tue, 26 Oct 2010 23:49:37 -0000 Subject: [Lldb-commits] [lldb] r117417 - in /lldb/trunk: include/lldb/API/ source/API/ Message-ID: <20101026234937.67D3F2A6C12C@llvm.org> Author: ctice Date: Tue Oct 26 18:49:36 2010 New Revision: 117417 URL: http://llvm.org/viewvc/llvm-project?rev=117417&view=rev Log: Clean up the API logging code: - Try to reduce logging to one line per function call instead of tw - Put all arguments & their values into log for calls - Add 'this' parameter information to function call logging, making it show the appropriate internal pointer (this.obj, this.sp, this.ap...) - Clean up some return values - Remove logging of constructors that construct empty objects - Change '==>' to '=>' for showing result values... - Fix various minor bugs - Add some protected 'get' functions to help getting the internal pointers for the 'this' arguments... Modified: lldb/trunk/include/lldb/API/SBAddress.h lldb/trunk/include/lldb/API/SBCompileUnit.h lldb/trunk/include/lldb/API/SBFunction.h lldb/trunk/include/lldb/API/SBLineEntry.h lldb/trunk/include/lldb/API/SBSymbol.h lldb/trunk/include/lldb/API/SBValueList.h lldb/trunk/source/API/SBAddress.cpp lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/API/SBBroadcaster.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBCommandReturnObject.cpp lldb/trunk/source/API/SBCommunication.cpp lldb/trunk/source/API/SBCompileUnit.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBError.cpp lldb/trunk/source/API/SBEvent.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBFunction.cpp lldb/trunk/source/API/SBHostOS.cpp lldb/trunk/source/API/SBInputReader.cpp lldb/trunk/source/API/SBLineEntry.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBSymbol.cpp lldb/trunk/source/API/SBSymbolContext.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SBType.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/API/SBValueList.cpp Modified: lldb/trunk/include/lldb/API/SBAddress.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBAddress.h (original) +++ lldb/trunk/include/lldb/API/SBAddress.h Tue Oct 26 18:49:36 2010 @@ -70,6 +70,9 @@ lldb_private::Address & operator*(); + lldb_private::Address * + get (); + #endif Modified: lldb/trunk/include/lldb/API/SBCompileUnit.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCompileUnit.h?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBCompileUnit.h (original) +++ lldb/trunk/include/lldb/API/SBCompileUnit.h Tue Oct 26 18:49:36 2010 @@ -66,6 +66,9 @@ const lldb_private::CompileUnit & operator*() const; + + const lldb_private::CompileUnit * + get () const; #endif Modified: lldb/trunk/include/lldb/API/SBFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFunction.h?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFunction.h (original) +++ lldb/trunk/include/lldb/API/SBFunction.h Tue Oct 26 18:49:36 2010 @@ -46,6 +46,11 @@ bool GetDescription (lldb::SBStream &description); +protected: + + lldb_private::Function * + get (); + private: friend class SBFrame; friend class SBSymbolContext; Modified: lldb/trunk/include/lldb/API/SBLineEntry.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLineEntry.h?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBLineEntry.h (original) +++ lldb/trunk/include/lldb/API/SBLineEntry.h Tue Oct 26 18:49:36 2010 @@ -61,6 +61,11 @@ bool GetDescription (lldb::SBStream &description); +protected: + + lldb_private::LineEntry * + get (); + private: friend class SBCompileUnit; friend class SBFrame; Modified: lldb/trunk/include/lldb/API/SBSymbol.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbol.h?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBSymbol.h (original) +++ lldb/trunk/include/lldb/API/SBSymbol.h Tue Oct 26 18:49:36 2010 @@ -48,6 +48,11 @@ bool GetDescription (lldb::SBStream &description); +protected: + + lldb_private::Symbol * + get (); + private: friend class SBFrame; friend class SBSymbolContext; Modified: lldb/trunk/include/lldb/API/SBValueList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValueList.h?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValueList.h (original) +++ lldb/trunk/include/lldb/API/SBValueList.h Tue Oct 26 18:49:36 2010 @@ -55,6 +55,10 @@ const lldb_private::ValueObjectList & operator* () const; + + lldb_private::ValueObjectList * + get (); + #endif private: Modified: lldb/trunk/source/API/SBAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBAddress.cpp (original) +++ lldb/trunk/source/API/SBAddress.cpp Tue Oct 26 18:49:36 2010 @@ -20,16 +20,12 @@ SBAddress::SBAddress () : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBAddress::SBAddress () ==> this = %p (%s)", this); } SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (lldb_object_ptr) m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr)); @@ -38,22 +34,22 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) lldb_object_ptr = %p " - "==> this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + 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 | LIBLLDB_LOG_VERBOSE); + 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 (const SBAddress &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + 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 () @@ -71,8 +67,8 @@ m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get())); } if (log) - log->Printf ("SBAddress::operator= (const SBAddress rhs) rhs = %p ==> this = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + log->Printf ("SBAddress::operator= (rhs.ap = %p) => this.ap = %p", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); return *this; } @@ -118,20 +114,20 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBAddress::GetLoadAddress"); + //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 ==> %p", addr); + log->Printf ("SBAddress::GetLoadAddress (target.sp=%p) => %p", target.get(), addr); return addr; } else { if (log) - log->Printf ("SBAddress::GetLoadAddress ==> LLDB_INVALID_ADDRESS"); + log->Printf ("SBAddress::GetLoadAddress (target.sp=%p) => LLDB_INVALID_ADDRESS", target.get()); return LLDB_INVALID_ADDRESS; } } @@ -178,6 +174,11 @@ return *m_opaque_ap; } +lldb_private::Address * +SBAddress::get () +{ + return m_opaque_ap.get(); +} bool SBAddress::GetDescription (SBStream &description) Modified: lldb/trunk/source/API/SBBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpoint.cpp (original) +++ lldb/trunk/source/API/SBBreakpoint.cpp Tue Oct 26 18:49:36 2010 @@ -67,23 +67,20 @@ SBBreakpoint::SBBreakpoint () : m_opaque_sp () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBBreakpoint::SBBreakpoint () ==> this = %p", this); } SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (sstr); - log->Printf ("SBBreakpoint::SBBreakpoint (const SBBreakpoint &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p (%s)", - rhs.m_opaque_sp.get(), this, sstr.GetData()); + log->Printf ("SBBreakpoint::SBBreakpoint (const SBBreakpoint rhs.sp=%p) " + "=> this.sp = %p (%s)", + rhs.m_opaque_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -91,14 +88,14 @@ SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) : m_opaque_sp (bp_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (sstr); - log->Printf("SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) bp_sp.get() = %p ==> this = %p (%s)", - bp_sp.get(), this, sstr.GetData()); + log->Printf("SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp=%p) => this.sp = %p (%s)", + bp_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -111,8 +108,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBBreakpoint::operator="); + //if (log) + // log->Printf ("SBBreakpoint::operator="); if (this != &rhs) { @@ -120,8 +117,8 @@ } if (log) - log->Printf ("SBBreakpoint::operator= (const SBBreakpoint &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", - rhs.m_opaque_sp.get(), this); + log->Printf ("SBBreakpoint::operator= (const SBBreakpoint &rhs.sp=%p) => this.sp = %p", + rhs.m_opaque_sp.get(), m_opaque_sp.get()); return *this; } @@ -131,19 +128,19 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBBreakpoint::GetID"); + //if (log) + // log->Printf ("SBBreakpoint::GetID"); if (m_opaque_sp) { break_id_t id = m_opaque_sp->GetID(); if (log) - log->Printf ("SBBreakpoint::GetID ==> %d", id); + log->Printf ("SBBreakpoint::GetID (this.sp=%p) => %d", m_opaque_sp.get(), id); return id; } if (log) - log->Printf ("SBBreakpoint::GetID ==> LLDB_INVALID_BREAK_ID"); + log->Printf ("SBBreakpoint::GetID (this.sp=%p) => LLDB_INVALID_BREAK_ID", m_opaque_sp.get()); return LLDB_INVALID_BREAK_ID; } @@ -235,7 +232,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetEnabled (%s)", (enable ? "true" : "false")); + log->Printf ("SBBreakpoint::SetEnabled (this.sp=%p, enable='%s')", m_opaque_sp.get(), + (enable ? "true" : "false")); if (m_opaque_sp) m_opaque_sp->SetEnabled (enable); @@ -256,7 +254,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetIgnoreCount (%d)", count); + log->Printf ("SBBreakpoint::SetIgnoreCount (this.sp=%p, count='%d')", m_opaque_sp.get(), count); if (m_opaque_sp) m_opaque_sp->SetIgnoreCount (count); @@ -279,20 +277,20 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBBreakpoint::GetHitCount"); + //if (log) + // log->Printf ("SBBreakpoint::GetHitCount"); if (m_opaque_sp) { uint32_t hit_count = m_opaque_sp->GetHitCount(); if (log) - log->Printf ("SBBreakpoint::GetHitCount ==> %d", hit_count); + log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '%d'", m_opaque_sp.get(), hit_count); return m_opaque_sp->GetHitCount(); } else { if (log) - log->Printf ("SBBreakpoint::GetHitCount ==> 0"); + log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '0'", m_opaque_sp.get()); return 0; } } @@ -463,7 +461,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetCallback :"); + log->Printf ("SBBreakpoint::SetCallback (this.sp=%p, :", m_opaque_sp.get()); if (m_opaque_sp.get()) { Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Tue Oct 26 18:49:36 2010 @@ -32,23 +32,19 @@ SBBreakpointLocation::SBBreakpointLocation () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBBreakpointLocation::SBBreakpointLocation () ==> this = %p", this); } SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) : m_opaque_sp (break_loc_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (lldb::eDescriptionLevelBrief, sstr); - log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp) " - "break_loc_sp.get() = %p ==> this = %p (%s)", break_loc_sp.get(), this, sstr.GetData()); + log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp" + "=%p) => this.sp = %p (%s)", break_loc_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -240,8 +236,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBBreakpointLocation::GetBreakpoint ()"); + //if (log) + // log->Printf ("SBBreakpointLocation::GetBreakpoint ()"); SBBreakpoint sb_bp; if (m_opaque_sp) @@ -251,7 +247,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBBreakpointLocation::GetBreakpoint ==> %s", sstr.GetData()); + log->Printf ("SBBreakpointLocation::GetBreakpoint (this.sp=%p) => SBBreakpoint: m_opaque_sp=%p, '%s'", + m_opaque_sp.get(), sb_bp.get(), sstr.GetData()); } return sb_bp; } Modified: lldb/trunk/source/API/SBBroadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBBroadcaster.cpp (original) +++ lldb/trunk/source/API/SBBroadcaster.cpp Tue Oct 26 18:49:36 2010 @@ -26,7 +26,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcastetr::SBBroadcaster () ==> this = %p", this); + log->Printf ("SBBroadcastetr::SBBroadcaster () => this = %p", this); } @@ -37,7 +37,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (const char *name) name = '%s' ==> this = %p (m_opaque = %p)", + log->Printf ("SBBroadcaster::SBBroadcaster (name='%s') => this = %p (m_opaque = %p)", name, this, m_opaque); } @@ -48,8 +48,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) " - " broadcaster = %p, owns = %s ==> this = %p", broadcaster, (owns ? "true" : "false"), this); + log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns='%s') " + " => this = %p (m_opaque = %p)", broadcaster, (owns ? "true" : "false"), this, m_opaque); } SBBroadcaster::~SBBroadcaster() Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Tue Oct 26 18:49:36 2010 @@ -33,11 +33,11 @@ SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) : m_opaque_ptr (interpreter) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) interpreter = %p" - " ==> this = %p", interpreter, this); + log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter = %p)" + " => this.obj = %p", interpreter, m_opaque_ptr); } SBCommandInterpreter::~SBCommandInterpreter () @@ -73,8 +73,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommandInterpreter::HandleCommand ('%s', result, %s)", command_line, - (add_to_history ? "true" : "false")); + log->Printf("SBCommandInterpreter::HandleCommand (this.obj=%p, command_line='%s', result=%p, " + "add_to_history='%s')", m_opaque_ptr, command_line, &result, (add_to_history ? "true" : "false")); result.Clear(); if (m_opaque_ptr) @@ -91,7 +91,8 @@ { SBStream sstr; result.GetDescription (sstr); - log->Printf ("SBCommandInterpreter::HandleCommand ==> %s", sstr.GetData()); + log->Printf ("SBCommandInterpreter::HandleCommand (...'%s'...) => SBCommandReturnObject: '%s'", + command_line, sstr.GetData()); } return result.GetStatus(); @@ -231,13 +232,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommandInterpreter::GetBroadcaster ()"); + //if (log) + // log->Printf ("SBCommandInterpreter::GetBroadcaster ()"); SBBroadcaster broadcaster (m_opaque_ptr, false); if (log) - log->Printf ("SBCommandInterpreter::GetBroadcaster ==> %p", m_opaque_ptr); + log->Printf ("SBCommandInterpreter::GetBroadcaster (this.obj=%p) => SBBroadcaster (this.m_opaque_ptr=%p)", + m_opaque_ptr, broadcaster.get()); return broadcaster; } Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandReturnObject.cpp (original) +++ lldb/trunk/source/API/SBCommandReturnObject.cpp Tue Oct 26 18:49:36 2010 @@ -19,10 +19,10 @@ SBCommandReturnObject::SBCommandReturnObject () : m_opaque_ap (new CommandReturnObject ()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommandReturnObject::SBCommandReturnObject () ==> this = %p", this); + log->Printf ("SBCommandReturnObject::SBCommandReturnObject () => this.ap = %p", m_opaque_ap.get()); } SBCommandReturnObject::~SBCommandReturnObject () @@ -42,18 +42,20 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommandReturnObject::GetOutput ()"); + //if (log) + // log->Printf ("SBCommandReturnObject::GetOutput ()"); if (m_opaque_ap.get()) { if (log) - log->Printf ("SBCommandReturnObject::GetOutput ==> %s", m_opaque_ap->GetOutputStream().GetData()); + log->Printf ("SBCommandReturnObject::GetOutput (this.ap=%p) => '%s'", m_opaque_ap.get(), + m_opaque_ap->GetOutputStream().GetData()); + return m_opaque_ap->GetOutputStream().GetData(); } if (log) - log->Printf ("SBCommandReturnObject::GetOutput ==> NULL"); + log->Printf ("SBCommandReturnObject::GetOutput (this.ap=%p) => 'NULL'", m_opaque_ap.get()); return NULL; } @@ -63,18 +65,20 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommandReturnObject::GetError ()"); + //if (log) + // log->Printf ("SBCommandReturnObject::GetError ()"); if (m_opaque_ap.get()) { if (log) - log->Printf ("SBCommandReturnObject::GetError ==> %s", m_opaque_ap->GetErrorStream().GetData()); + log->Printf ("SBCommandReturnObject::GetError (this.ap=%p) => '%s'", m_opaque_ap.get(), + m_opaque_ap->GetErrorStream().GetData()); + return m_opaque_ap->GetErrorStream().GetData(); } if (log) - log->Printf ("SBCommandReturnObject::GetError ==> NULL"); + log->Printf ("SBCommandReturnObject::GetError (this.ap=%p) => 'NULL'", m_opaque_ap.get()); return NULL; } Modified: lldb/trunk/source/API/SBCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommunication.cpp (original) +++ lldb/trunk/source/API/SBCommunication.cpp Tue Oct 26 18:49:36 2010 @@ -22,21 +22,17 @@ m_opaque (NULL), m_opaque_owned (false) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBCommunication::SBCommunication () ==> this = %p", this); } SBCommunication::SBCommunication(const char * broadcaster_name) : m_opaque (new Communication (broadcaster_name)), m_opaque_owned (true) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommunication::SBCommunication (const char *broadcaster_name) broadcaster_name = '%s' ==> " - "this = %p (m_opaque = %p)", broadcaster_name, this, m_opaque); + log->Printf ("SBCommunication::SBCommunication (broadcaster_name='%s') => " + "this.obj = %p", broadcaster_name, m_opaque); } SBCommunication::~SBCommunication() @@ -88,8 +84,9 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor (%d, %s)", fd, (owns_fd ? "true" : "false")); + //if (log) + // log->Printf ("SBCommunication::AdoptFileDescriptor (this=%p, fd='%d', owns_fd='%s')", this, fd, + // (owns_fd ? "true" : "false")); if (m_opaque) { @@ -102,19 +99,22 @@ if (m_opaque->IsConnected()) { if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusSuccess"); + log->Printf ("SBCommunication::AdoptFileDescriptor (this.obj=%p, fd=%d, ownd_fd='%s') " + "=> eConnectionStatusSuccess", m_opaque, fd, (owns_fd ? "true" : "false")); return eConnectionStatusSuccess; } else - { + { if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusLostConnection"); + log->Printf ("SBCommunication::AdoptFileDescriptor (this.obj=%p, fd=%d, ownd_fd='%s') " + "=> eConnectionStatusLostConnection", m_opaque, fd, (owns_fd ? "true" : "false")); return eConnectionStatusLostConnection; } } if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusNoConnection"); + log->Printf ("SBCommunication::AdoptFileDescriptor (this,obj=%p, fd=%d, ownd_fd='%s') " + "=> eConnectionStatusNoConnection", m_opaque, fd, (owns_fd ? "true" : "false")); return eConnectionStatusNoConnection; } @@ -125,15 +125,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommunication::Disconnect ()"); + //if (log) + // log->Printf ("SBCommunication::Disconnect ()"); ConnectionStatus status= eConnectionStatusNoConnection; if (m_opaque) status = m_opaque->Disconnect (); if (log) - log->Printf ("SBCommunication::Disconnect ==> %s", Communication::ConnectionStatusAsCString (status)); + log->Printf ("SBCommunication::Disconnect (this.obj=%p) => '%s'", m_opaque, + Communication::ConnectionStatusAsCString (status)); return status; } @@ -170,15 +171,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommunication::ReadThreadStart ()"); + //if (log) + // log->Printf ("SBCommunication::ReadThreadStart ()"); bool success = false; if (m_opaque) success = m_opaque->StartReadThread (); if (log) - log->Printf ("SBCommunication::ReadThreadStart ==> %s", (success ? "true" : "false")); + log->Printf ("SBCommunication::ReadThreadStart (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); return success; } @@ -189,15 +190,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommunication::ReadThreadStop ()"); + //if (log) + // log->Printf ("SBCommunication::ReadThreadStop ()"); bool success = false; if (m_opaque) success = m_opaque->StopReadThread (); if (log) - log->Printf ("SBCommunication::ReadThreadStop ==> %s", (success ? "true" : "false")); + log->Printf ("SBCommunication::ReadThreadStop (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); return success; } @@ -220,19 +221,19 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommunication::SetReadThreadBytesReceivedCallback (callback, baton)"); - // CAROLINE: Fixme: Fix the arguments printed out in the log message above + log->Printf ("SBCommunication::SetReadThreadBytesReceivedCallback (this.obj=%p, callback=%p, baton=%p)", + m_opaque, callback, callback_baton); if (m_opaque) { m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton); if (log) - log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> true"); + log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback (this.obj=%p...) => true", m_opaque); return true; } if (log) - log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> false"); + log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback (this.obj=%p...) => false", m_opaque); return false; } Modified: lldb/trunk/source/API/SBCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBCompileUnit.cpp (original) +++ lldb/trunk/source/API/SBCompileUnit.cpp Tue Oct 26 18:49:36 2010 @@ -22,23 +22,19 @@ SBCompileUnit::SBCompileUnit () : m_opaque_ptr (NULL) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBCompileUnit::SBCompileUnit () ==> this = %p", this); } SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (sstr); - log->Printf ("SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) lldb_object_ptr = %p" - " this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + log->Printf ("SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr=%p)" + " => this.obj = %p (%s)", lldb_object_ptr, m_opaque_ptr, sstr.GetData()); } } @@ -73,8 +69,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCompileUnit::GetLineEntryAtIndex (%d)", idx); + //if (log) + // log->Printf ("SBCompileUnit::GetLineEntryAtIndex (this.obj=%p, idx=%d)", m_opaque_ptr, idx); SBLineEntry sb_line_entry; if (m_opaque_ptr) @@ -92,7 +88,8 @@ { SBStream sstr; sb_line_entry.GetDescription (sstr); - log->Printf ("SBCompileUnit::GetLineEntryAtIndex ==> %s", sstr.GetData()); + log->Printf ("SBCompileUnit::GetLineEntryAtIndex (this.obj=%p, idx=%d) => SBLineEntry: '%s'", m_opaque_ptr, + idx, sstr.GetData()); } return sb_line_entry; @@ -103,12 +100,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - { - SBStream sstr; - inline_file_spec->GetDescription (sstr); - log->Printf ("SBCompileUnit::FindLineEntryIndex (%d, %d, %s)", start_idx, line, sstr.GetData()); - } + //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()); + //} if (m_opaque_ptr) { @@ -124,13 +122,23 @@ inline_file_spec ? inline_file_spec->get() : NULL, NULL); if (log) - log->Printf ("SBCompileUnit::FindLineEntryIndex ==> %d", ret_value); + { + 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; } if (log) - log->Printf ("SBCompileUnit::FindLineEntryIndex ==> %d", UINT32_MAX); + { + 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); + } return UINT32_MAX; } @@ -165,6 +173,12 @@ return *m_opaque_ptr; } +const lldb_private::CompileUnit * +SBCompileUnit::get () const +{ + return m_opaque_ptr; +} + bool SBCompileUnit::GetDescription (SBStream &description) { Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Tue Oct 26 18:49:36 2010 @@ -67,8 +67,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBDebugger::Create ()"); + //if (log) + // log->Printf ("SBDebugger::Create ()"); SBDebugger debugger; debugger.reset(Debugger::CreateInstance()); @@ -77,7 +77,7 @@ { SBStream sstr; debugger.GetDescription (sstr); - log->Printf ("SBDebugger::Create ==> %s", sstr.GetData()); + log->Printf ("SBDebugger::Create () => SBDebugger (this.sp = %p, '%s')", debugger.m_opaque_sp.get(), sstr.GetData()); } return debugger; @@ -121,7 +121,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::SetInputFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false")); + log->Printf ("SBDebugger::SetInputFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) m_opaque_sp->SetInputFileHandle (fh, transfer_ownership); @@ -134,7 +135,8 @@ if (log) - log->Printf ("SBDebugger::SetOutputFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false")); + log->Printf ("SBDebugger::SetOutputFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership); @@ -147,7 +149,8 @@ if (log) - log->Printf ("SBDebugger::SetErrorFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false")); + log->Printf ("SBDebugger::SetErrorFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership); @@ -182,13 +185,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBDebugger::GetCommandInterpreter ()"); - SBCommandInterpreter sb_interpreter; if (m_opaque_sp) sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter()); + if (log) + log->Printf ("SBDebugger::GetCommandInterpreter (this.sp=%p) => SBCommandInterpreter (this.obj=%p)", + m_opaque_sp.get(), sb_interpreter.get()); + return sb_interpreter; } @@ -229,13 +233,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBDebugger::GetListener ()"); - SBListener sb_listener; if (m_opaque_sp) sb_listener.reset(&m_opaque_sp->GetListener(), false); + if (log) + log->Printf ("SBDebugger::GetListener (this.sp=%p) => SBListener (this.obj=%p)", m_opaque_sp.get(), + sb_listener.get()); + return sb_listener; } @@ -412,7 +417,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::StateAsCString ==> %s", lldb_private::StateAsCString (state)); + log->Printf ("SBDebugger::StateAsCString (state=%d) => '%s'", state, + lldb_private::StateAsCString (state)); return lldb_private::StateAsCString (state); } @@ -429,7 +435,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::StateIsStoppedState ==> %s", + log->Printf ("SBDebugger::StateIsStoppedState (state=%d) => '%s'", state, (lldb_private::StateIsStoppedState (state) ? "true" : "false")); return lldb_private::StateIsStoppedState (state); @@ -458,8 +464,9 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBDebugger::CreateTargetWithFileAndArch (%s, %s)", filename, archname); + //if (log) + // log->Printf ("SBDebugger::CreateTargetWithFileAndArch (this.sp=%p, filename='%s', arcname='%s')", + // m_opaque_sp.get() filename, archname); SBTarget target; if (m_opaque_sp) @@ -503,7 +510,9 @@ { SBStream sstr; target.GetDescription (sstr, lldb::eDescriptionLevelFull); - log->Printf ("SBDebugger::CreateTargetWithFileAndArch ==> %s", sstr.GetData()); + log->Printf ("SBDebugger::CreateTargetWithFileAndArch (this.sp=%p, filename='%s', arcname='%s') " + "=> SBTarget: this.sp=%p, '%s'", m_opaque_sp.get(), filename, archname, target.get(), + sstr.GetData()); } return target; @@ -600,8 +609,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBDebugger::GetSelectedTarget ()"); + //if (log) + // log->Printf ("SBDebugger::GetSelectedTarget ()"); SBTarget sb_target; if (m_opaque_sp) @@ -611,7 +620,8 @@ { SBStream sstr; sb_target.GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBDebugger::GetSelectedTarget ==> %s", sstr.GetData()); + log->Printf ("SBDebugger::GetSelectedTarget (this.sp=%p) => SBTarget: this.sp=%p, '%s'", m_opaque_sp.get(), + sb_target.get(), sstr.GetData()); } return sb_target; @@ -623,7 +633,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::DispatchInput (%p, %s, %d)", baton, (const char *) data, (uint32_t) data_len); + log->Printf ("SBDebugger::DispatchInput (this.sp=%p, baton=%p, data='%s', size_t=%d)", m_opaque_sp.get(), + baton, (const char *) data, (uint32_t) data_len); if (m_opaque_sp) m_opaque_sp->DispatchInput ((const char *) data, data_len); @@ -635,7 +646,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::PushInputReader (%p)", &reader); + log->Printf ("SBDebugger::PushInputReader (this.sp=%p, reader=%p)", m_opaque_sp.get(), &reader); if (m_opaque_sp && reader.IsValid()) { @@ -742,7 +753,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::GetPrompt ==> '%s'", (m_opaque_sp ? m_opaque_sp->GetPrompt() : "")); + log->Printf ("SBDebugger::GetPrompt (this.sp=%p) => '%s'", m_opaque_sp.get(), + (m_opaque_sp ? m_opaque_sp->GetPrompt() : "")); if (m_opaque_sp) return m_opaque_sp->GetPrompt (); Modified: lldb/trunk/source/API/SBError.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBError.cpp (original) +++ lldb/trunk/source/API/SBError.cpp Tue Oct 26 18:49:36 2010 @@ -21,16 +21,12 @@ SBError::SBError () : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBError::SBError () ==> this = %p", this); } SBError::SBError (const SBError &rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (rhs.IsValid()) m_opaque_ap.reset (new Error(*rhs)); @@ -39,8 +35,8 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBError::SBError (const SBError &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p (%s)", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this, sstr.GetData()); + log->Printf ("SBError::SBError (const SBError rhs.ap=%p) => this.ap = %p (%s)", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get(), sstr.GetData()); } } @@ -54,14 +50,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - { - SBStream sstr; - rhs.GetDescription (sstr); - log->Printf ("SBError::operator= (const SBError &rhs) rhs.m_opaque_ap.get() = %p (%s)", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), sstr.GetData()); - } - if (rhs.IsValid()) { if (m_opaque_ap.get()) @@ -75,7 +63,12 @@ } if (log) - log->Printf ("SBError::operator= ==> this = %p", this); + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBError::operator= (this.ap=%p, rhs.ap=%p) => this (%s)", + m_opaque_ap.get(), (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), sstr.GetData()); + } return *this; } @@ -101,15 +94,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBError::Fail ()"); + //if (log) + // log->Printf ("SBError::Fail ()"); bool ret_value = false; if (m_opaque_ap.get()) ret_value = m_opaque_ap->Fail(); if (log) - log->Printf ("SBError::Fail ==> %s", (ret_value ? "true" : "false")); + log->Printf ("SBError::Fail (this.ap=%p) => '%s'", m_opaque_ap.get(), (ret_value ? "true" : "false")); return ret_value; } Modified: lldb/trunk/source/API/SBEvent.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBEvent.cpp (original) +++ lldb/trunk/source/API/SBEvent.cpp Tue Oct 26 18:49:36 2010 @@ -27,23 +27,18 @@ m_event_sp (), m_opaque (NULL) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBEvent::SBEvent () ==> this = %p", this); } 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 | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { - log->Printf ("SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len)"); - log->Printf (" event_type = %d, cstr = '%s', cstr_len = %d ==> this = %p (m_opaque = %p)", event_type, - cstr, cstr_len, this, m_opaque); + log->Printf ("SBEvent::SBEvent (event_type=%d, cstr='%s', cstr_len=%d) => this.sp = %p", event_type, + cstr, cstr_len, m_opaque); } } @@ -51,10 +46,10 @@ m_event_sp (event_sp), m_opaque (event_sp.get()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBEvent::SBEvent (EventSP &event_sp) event_sp.get() = %p ==> this = %p", event_sp.get(), this); + log->Printf ("SBEvent::SBEvent (event_sp=%p) => this.sp = %p", event_sp.get(), m_opaque); } SBEvent::~SBEvent() @@ -75,8 +70,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBEvent::GetType ()"); + //if (log) + // log->Printf ("SBEvent::GetType ()"); const Event *lldb_event = get(); uint32_t event_type = 0; @@ -84,7 +79,7 @@ event_type = lldb_event->GetType(); if (log) - log->Printf ("SBEvent::GetType ==> %d", event_type); + log->Printf ("SBEvent::GetType (this.sp=%p) => %d", m_opaque, event_type); return event_type; } @@ -125,7 +120,8 @@ success = lldb_event->BroadcasterIs (broadcaster.get()); if (log) - log->Printf ("SBEvent::BroadcasterMathesRef ==> %s", (success ? "true" : "false")); + log->Printf ("SBEvent::BroadcasterMathesRef (this.sp=%p, broadcaster.obj=%p) => %s", m_opaque, + broadcaster.get(), (success ? "true" : "false")); return success; } @@ -186,7 +182,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("GetCStringFromEvent ==> %s", + log->Printf ("GetCStringFromEvent (event.sp=%p) => %s", event.m_opaque, reinterpret_cast(EventDataBytes::GetBytesFromEvent (event.get()))); return reinterpret_cast(EventDataBytes::GetBytesFromEvent (event.get())); Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Tue Oct 26 18:49:36 2010 @@ -20,27 +20,23 @@ SBFileSpec::SBFileSpec () : m_opaque_ap() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBFileSpec::SBFileSpec () ==> this = %p", this); } SBFileSpec::SBFileSpec (const SBFileSpec &rhs) : m_opaque_ap() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (rhs.m_opaque_ap.get()) + m_opaque_ap.reset (new FileSpec (rhs.get())); if (log) { SBStream sstr; - rhs.GetDescription (sstr); - log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec &rhs) rhs.m_opaque_ap.get() = %p (%s) ==> this = %p", - rhs.m_opaque_ap.get(), sstr.GetData(), this); + GetDescription (sstr); + log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => this.ap = %p ('%s')", + rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData()); } - - if (rhs.m_opaque_ap.get()) - m_opaque_ap.reset (new FileSpec (rhs.get())); } // Deprected!!! @@ -52,12 +48,11 @@ SBFileSpec::SBFileSpec (const char *path, bool resolve) : m_opaque_ap(new FileSpec (path, resolve)) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec::SBFileSpec (const char *path, bool resolve) path = '%s', resolve = %s ==> " - "this = %p (m_opaque_ap.get() = %p)", path, (resolve ? "true" : "false"), this, - m_opaque_ap.get()); + log->Printf ("SBFileSpec::SBFileSpec (path='%s', resolve='%s') => this.ap = %p", path, + (resolve ? "true" : "false"), m_opaque_ap.get()); } SBFileSpec::~SBFileSpec () @@ -86,15 +81,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFileSpec::Exists ()"); + //if (log) + // log->Printf ("SBFileSpec::Exists (this.ap=%p)", m_opaque_ap.get()); bool result = false; if (m_opaque_ap.get()) result = m_opaque_ap->Exists(); if (log) - log->Printf ("SBFileSpec::Exists ==> %s", (result ? "true" : "false")); + log->Printf ("SBFileSpec::Exists (this.ap=%p) => %s", m_opaque_ap.get(), (result ? "true" : "false")); return result; } @@ -118,18 +113,20 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFileSpec::GetFilename ()"); + //if (log) + // log->Printf ("SBFileSpec::GetFilename (this.ap=%p)", m_opaque_ap.get()); if (m_opaque_ap.get()) { if (log) - log->Printf ("SBFileSpec::GetFilename ==> %s", m_opaque_ap->GetFilename().AsCString()); + log->Printf ("SBFileSpec::GetFilename (this.ap=%p) => %s", m_opaque_ap.get(), + m_opaque_ap->GetFilename().AsCString()); + return m_opaque_ap->GetFilename().AsCString(); } if (log) - log->Printf ("SBFileSpec::GetFilename ==> NULL"); + log->Printf ("SBFileSpec::GetFilename (this.ap=%p) => NULL", m_opaque_ap.get()); return NULL; } @@ -147,20 +144,21 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFileSpec::GetPath (dst_path, dst_len)"); + //if (log) + // log->Printf ("SBFileSpec::GetPath (dst_path, dst_len)"); uint32_t result; if (m_opaque_ap.get()) { result = m_opaque_ap->GetPath (dst_path, dst_len); if (log) - log->Printf ("SBFileSpec::GetPath ==> %s (%d)", dst_path, result); + log->Printf ("SBFileSpec::GetPath (this.ap=%p, 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::GetPath ==> NULL (0)"); + log->Printf ("SBFileSpec::GetPath (this.ap=%p, dst_path, dst_len) => NULL (0)", m_opaque_ap.get()); if (dst_path && dst_len) *dst_path = '\0'; Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Tue Oct 26 18:49:36 2010 @@ -46,23 +46,20 @@ SBFrame::SBFrame () : m_opaque_sp () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBFrame::SBFrame () ==> this = %p", this); } SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) : m_opaque_sp (lldb_object_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) lldb_object_sp.get() = %p " - " ==> this = %p (%s)", lldb_object_sp.get(), this, sstr.GetData()); + log->Printf ("SBFrame::SBFrame (lldb_object_sp=%p) => this.sp = %p (%s)", lldb_object_sp.get(), + m_opaque_sp.get(), sstr.GetData()); + } } @@ -89,15 +86,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFrame::GetSymbolContext (%d)", resolve_scope); + //if (log) + // log->Printf ("SBFrame::GetSymbolContext (this.sp=%p, resolve_scope=%d)", m_opaque_sp.get(), resolve_scope); SBSymbolContext sb_sym_ctx; if (m_opaque_sp) sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope)); if (log) - log->Printf ("SBFrame::GetSymbolContext ==> SBSymbolContext (this = %p)", &sb_sym_ctx); + log->Printf ("SBFrame::GetSymbolContext (this.sp=%p, resolve_scope=%d) => SBSymbolContext (this.ap = %p)", + m_opaque_sp.get(), resolve_scope, sb_sym_ctx.get()); return sb_sym_ctx; } @@ -114,13 +112,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFrame::GetCompileUnit()"); + //if (log) + // log->Printf ("SBFrame::GetCompileUnit()"); SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit); if (log) - log->Printf ("SBFrame::GetCompileUnit ==> SBCompileUnit (this = %p", &sb_comp_unit); + log->Printf ("SBFrame::GetCompileUnit (this.sp=%p) => SBCompileUnit (this=%p)", m_opaque_sp.get(), + sb_comp_unit.get()); return sb_comp_unit; } @@ -174,15 +173,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFrame::GetPC ()"); + //if (log) + // log->Printf ("SBFrame::GetPC (this.sp=%p)", m_opaque_sp.get()); lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget()); if (log) - log->Printf ("SBFrame::GetPC ==> %p", addr); + log->Printf ("SBFrame::GetPC (this.sp=%p) => %p", m_opaque_sp.get(), addr); return addr; } @@ -192,15 +191,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFrame::SetPC (%p)", new_pc); + //if (log) + // log->Printf ("SBFrame::SetPC (this.sp=%p, new_pc=%p)", m_opaque_sp.get(), new_pc); bool ret_val = false; if (m_opaque_sp) ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc); if (log) - log->Printf ("SBFrame::SetPC ==> %s", (ret_val ? "true" : "false")); + log->Printf ("SBFrame::SetPC (this.sp=%p, new_pc=%p) => '%s'", m_opaque_sp.get(), new_pc, + (ret_val ? "true" : "false")); return ret_val; } @@ -219,15 +219,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFrame::GetFP ()"); + //if (log) + // log->Printf ("SBFrame::GetFP ()"); lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) addr = m_opaque_sp->GetRegisterContext()->GetFP(); if (log) - log->Printf ("SBFrame::GetFP ==> %p", addr); + log->Printf ("SBFrame::GetFP (this.sp=%p) => %p", m_opaque_sp.get(), addr); return addr; } @@ -367,13 +367,18 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFrame::GetThread ()"); + //if (log) + // log->Printf ("SBFrame::GetThread ()"); SBThread sb_thread (m_opaque_sp->GetThread().GetSP()); if (log) - log->Printf ("SBFrame::GetThread ==> SBThread (this = %p)", &sb_thread); + { + SBStream sstr; + sb_thread.GetDescription (sstr); + log->Printf ("SBFrame::GetThread (this.sp=%p) => SBThread : this.sp= %p, '%s'", m_opaque_sp.get(), + sb_thread.GetLLDBObjectPtr(), sstr.GetData()); + } return sb_thread; } @@ -385,9 +390,9 @@ Log *verbose_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (verbose_log) - verbose_log->Printf ("SBFrame::Disassemble () ==> %s", m_opaque_sp->Disassemble()); + verbose_log->Printf ("SBFrame::Disassemble (this.sp=%p) => %s", m_opaque_sp.get(), m_opaque_sp->Disassemble()); else if (log) - log->Printf ("SBFrame::Disassemble ()"); + log->Printf ("SBFrame::Disassemble (this.sp=%p)", m_opaque_sp.get()); if (m_opaque_sp) return m_opaque_sp->Disassemble(); @@ -411,14 +416,12 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - { - log->Printf ("SBFrame::GetVariables (bool arguments, bool locals, bool statics, bool in_scope_only)"); - log->Printf (" arguments = %s, locals = %s, statics = %s, in_scope_only = %s", + log->Printf ("SBFrame::GetVariables (this_sp.get=%p, arguments=%s, locals=%s, statics=%s, in_scope_only=%s)", + m_opaque_sp.get(), (arguments ? "true" : "false"), (locals ? "true" : "false"), (statics ? "true" : "false"), (in_scope_only ? "true" : "false")); - } SBValueList value_list; if (m_opaque_sp) @@ -469,7 +472,8 @@ if (log) { - log->Printf ("SBFrame::GetVariables ==> SBValueList (this = %p)", &value_list); + log->Printf ("SBFrame::GetVariables (this.sp=%p,...) => SBValueList (this.ap = %p)", m_opaque_sp.get(), + value_list.get()); //uint32_t num_vars = value_list.GetSize(); //for (uint32_t i = 0; i < num_vars; ++i) //{ @@ -486,8 +490,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFrame::GetRegisters ()"); + //if (log) + // log->Printf ("SBFrame::GetRegisters ()"); SBValueList value_list; if (m_opaque_sp) @@ -505,7 +509,8 @@ if (log) { - log->Printf ("SBFrame::Registers ==> SBValueList (this = %p)", &value_list ); + log->Printf ("SBFrame::Registers (this.sp=%p) => SBValueList (this.ap = %p)", m_opaque_sp.get(), + value_list.get() ); //uint32_t num_vars = value_list.GetSize(); //for (uint32_t i = 0; i < num_vars; ++i) //{ Modified: lldb/trunk/source/API/SBFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBFunction.cpp (original) +++ lldb/trunk/source/API/SBFunction.cpp Tue Oct 26 18:49:36 2010 @@ -25,23 +25,20 @@ SBFunction::SBFunction () : m_opaque_ptr (NULL) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBFunction::SBFunction () ==> this = %p", this); } SBFunction::SBFunction (lldb_private::Function *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFunction::SBFunction (lldb_Private::Function *lldb_object_ptr) lldb_object_ptr = %p " - " ==> this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + log->Printf ("SBFunction::SBFunction (lldb_object_ptr=%p) => this.obj = %p ('%s')", lldb_object_ptr, + m_opaque_ptr, sstr.GetData()); + } } @@ -61,18 +58,19 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBFunction::GetName ()"); + //if (log) + // log->Printf ("SBFunction::GetName ()"); if (m_opaque_ptr) { if (log) - log->Printf ("SBFunction::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString()); + log->Printf ("SBFunction::GetName (this.obj=%p) => '%s'", m_opaque_ptr, + m_opaque_ptr->GetMangled().GetName().AsCString()); return m_opaque_ptr->GetMangled().GetName().AsCString(); } if (log) - log->Printf ("SBFunction::GetName ==> NULL"); + log->Printf ("SBFunction::GetName (this.obj=%p) => NULL", m_opaque_ptr); return NULL; } @@ -136,4 +134,9 @@ return sb_instructions; } +lldb_private::Function * +SBFunction::get () +{ + return m_opaque_ptr; +} Modified: lldb/trunk/source/API/SBHostOS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBHostOS.cpp (original) +++ lldb/trunk/source/API/SBHostOS.cpp Tue Oct 26 18:49:36 2010 @@ -38,7 +38,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBHostOS::ThreadCreate (%s, %p, %p, error_ptr)", name, thread_function, thread_arg); + 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? Modified: lldb/trunk/source/API/SBInputReader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBInputReader.cpp (original) +++ lldb/trunk/source/API/SBInputReader.cpp Tue Oct 26 18:49:36 2010 @@ -28,30 +28,26 @@ m_callback_baton (NULL) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBInputReader::SBInputReader () ==> this = %p", this); } SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) : m_opaque_sp (reader_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) reader_sp.get = %p" - " ==> this = %p", this); + log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => this.sp = %p", reader_sp.get(), + m_opaque_sp.get()); } SBInputReader::SBInputReader (const SBInputReader &rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf("SBInputReader::SBInputReader (const SBInputReader &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", - rhs.m_opaque_sp.get(), this); + log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => this.sp = %p", + rhs.m_opaque_sp.get(), m_opaque_sp.get()); } SBInputReader::~SBInputReader () @@ -91,13 +87,10 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - { - log->Printf("SBInputReader::Initialize (SBDebugger &debugger, Callback callback_function, void *baton, " - "lldb::InputReaderGranularity granularity, const char *end_token, const char *prompt, bool echo)"); - log->Printf(" debugger (this = %p), callback_function, callback_baton = %p, granularity = %s, " - "end_token = '%s', prompt = '%s', echo = %s", &debugger, callback_baton, - InputReader::GranularityAsCString (granularity), end_token, prompt, (echo ? "true" : "false")); - } + log->Printf("SBInputReader::Initialize (this.sp=%p, debugger.sp=%p, callback_function=%p, callback_baton=%p, " + "granularity='%s', end_token='%s', prompt='%s', echo=%s)", m_opaque_sp.get(), debugger.get(), + callback_baton, InputReader::GranularityAsCString (granularity), end_token, prompt, + (echo ? "true" : "false")); SBError sb_error; m_opaque_sp.reset (new InputReader (debugger.ref())); @@ -126,7 +119,8 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBInputReader::Initialize ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData()); + log->Printf ("SBInputReader::Initialize (this.sp=%p, ...) => SBError (this.ap=%p, '%s')", m_opaque_sp.get(), + sb_error.get(), sstr.GetData()); } return sb_error; @@ -198,15 +192,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBInputReader::IsActive ()"); + //if (log) + // log->Printf ("SBInputReader::IsActive ()"); bool ret_value = false; if (m_opaque_sp) ret_value = m_opaque_sp->IsActive(); if (log) - log->Printf ("SBInputReader::IsActive ==> %s", (ret_value ? "true" : "false")); + log->Printf ("SBInputReader::IsActive (this.sp=%p) => '%s'", m_opaque_sp.get(), + (ret_value ? "true" : "false")); return ret_value; } Modified: lldb/trunk/source/API/SBLineEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBLineEntry.cpp (original) +++ lldb/trunk/source/API/SBLineEntry.cpp Tue Oct 26 18:49:36 2010 @@ -19,16 +19,12 @@ SBLineEntry::SBLineEntry () : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBLineEntry::SBLineEntry () ==> this = %p", this); } SBLineEntry::SBLineEntry (const SBLineEntry &rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (rhs.IsValid()) { @@ -36,8 +32,8 @@ } if (log) - log->Printf ("SBLineEntry::SBLineEntry (const SBLineEntry &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p ", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + log->Printf ("SBLineEntry::SBLineEntry (rhs.ap=%p) => this.ap = %p ", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); } @@ -46,14 +42,14 @@ SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + 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 (const lldb_private::LineEntry *lldb_object_ptr) lldb_object_ptr = %p" - " ==> this = %p (m_opaque_ap.get() = %p)", lldb_object_ptr, this, m_opaque_ap.get()); + log->Printf ("SBLineEntry::SBLineEntry (lldb_object_ptr=%p) => this.ap = %p", + lldb_object_ptr, m_opaque_ap.get()); } const SBLineEntry & @@ -87,8 +83,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBLineEntry::GetStartAddress ()"); + //if (log) + // log->Printf ("SBLineEntry::GetStartAddress ()"); SBAddress sb_address; if (m_opaque_ap.get()) @@ -98,7 +94,8 @@ { SBStream sstr; sb_address.GetDescription (sstr); - log->Printf ("SBLineEntry::GetStartAddress ==> SBAddress (this = %p, (%s)", &sb_address, sstr.GetData()); + log->Printf ("SBLineEntry::GetStartAddress (this.ap=%p) => SBAddress (this.ap = %p, (%s)", m_opaque_ap.get(), + sb_address.get(), sstr.GetData()); } return sb_address; @@ -128,8 +125,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBLineEntry::GetFileSpec ()"); + //if (log) + // log->Printf ("SBLineEntry::GetFileSpec ()"); SBFileSpec sb_file_spec; if (m_opaque_ap.get() && m_opaque_ap->file) @@ -139,7 +136,8 @@ { SBStream sstr; sb_file_spec.GetDescription (sstr); - log->Printf ("SBLineEntry::GetFileSpec ==> SBFileSpec (this = %p, '%s'", &sb_file_spec, sstr.GetData()); + log->Printf ("SBLineEntry::GetFileSpec (this.ap=%p) => SBFileSpec : this.ap = %p, '%s'", m_opaque_ap.get(), + sb_file_spec.get(), sstr.GetData()); } return sb_file_spec; @@ -150,15 +148,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBLineEntry::GetLine ()"); + //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 ==> %d", line); + log->Printf ("SBLineEntry::GetLine (this.ap=%p) => %d", m_opaque_ap.get(), line); return line; } @@ -227,3 +225,9 @@ return true; } + +lldb_private::LineEntry * +SBLineEntry::get () +{ + return m_opaque_ap.get(); +} Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Tue Oct 26 18:49:36 2010 @@ -25,32 +25,28 @@ m_opaque_ptr (NULL), m_opaque_ptr_owned (false) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBListener::SBListener () ==> this = %p", this); } SBListener::SBListener (const char *name) : m_opaque_ptr (new Listener (name)), m_opaque_ptr_owned (true) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener::SBListener (const char *name) name = %s ==> this = %p (m_opaque_ptr = %p)", - name, this, m_opaque_ptr); + log->Printf ("SBListener::SBListener (name='%s') => this.obj = %p", + name, m_opaque_ptr); } SBListener::SBListener (Listener &listener) : m_opaque_ptr (&listener), m_opaque_ptr_owned (false) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener::SBListener (Listener &listener) *listener = %p ==> this = %p (m_opaque_ptr = %p)", - &listener, this, m_opaque_ptr); + log->Printf ("SBListener::SBListener (listener=%p) => this.obj = %p", + &listener, m_opaque_ptr); } SBListener::~SBListener () @@ -91,11 +87,11 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - { - log->Printf ("SBListener::StartListeningForEvents (const SBBroadcaster &broadcaster, uint32_t event_mask)" - " &broadcaster = %p, event_mask = %d", &broadcaster, event_mask); - } + //if (log) + //{ + // log->Printf ("SBListener::StartListeningForEvents (const SBBroadcaster &broadcaster, uint32_t event_mask)" + // " &broadcaster = %p, event_mask = %d", &broadcaster, event_mask); + //} uint32_t ret_value = 0; if (m_opaque_ptr && broadcaster.IsValid()) @@ -104,7 +100,8 @@ } if (log) - log->Printf ("SBListener::StartListeneingForEvents ==> %d", ret_value); + log->Printf ("SBListener::StartListeneingForEvents (this.obj=%p, broadcaster.obj=%p, event_mask=%d) => %d", + m_opaque_ptr, broadcaster.get(), event_mask, ret_value); return ret_value; } @@ -124,12 +121,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - { - SBStream sstr; - event.GetDescription (sstr); - log->Printf ("SBListener::WaitForEvent (%d, %s)", num_seconds, sstr.GetData()); - } + //if (log) + //{ + // SBStream sstr; + // event.GetDescription (sstr); + // log->Printf ("SBListener::WaitForEvent (%d, %s)", num_seconds, sstr.GetData()); + //} if (m_opaque_ptr) { @@ -145,13 +142,15 @@ { event.reset (event_sp); if (log) - log->Printf ("SBListener::WaitForEvent ==> true"); + log->Printf ("SBListener::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'true'", + m_opaque_ptr, num_seconds, event.get()); return true; } } if (log) - log->Printf ("SBListener::WaitForEvent ==> false"); + log->Printf ("SBListener::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'false'", + m_opaque_ptr, num_seconds, event.get()); event.reset (NULL); return false; Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Tue Oct 26 18:49:36 2010 @@ -23,20 +23,15 @@ SBModule::SBModule () : m_opaque_sp () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBModule::SBModule () ==> this = %p", this); } SBModule::SBModule (const lldb::ModuleSP& module_sp) : m_opaque_sp (module_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBModule::SBModule (const lldb::ModuleSP &module_sp) module_sp.get() = %p ==> this = %p", - module_sp.get(), this); + log->Printf ("SBModule::SBModule (module_sp=%p) => this.sp = %p", module_sp.get(), m_opaque_sp.get()); } SBModule::~SBModule () @@ -54,8 +49,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBModule::GetFileSpec ()"); + //if (log) + // log->Printf ("SBModule::GetFileSpec ()"); SBFileSpec file_spec; if (m_opaque_sp) @@ -65,7 +60,8 @@ { SBStream sstr; file_spec.GetDescription (sstr); - log->Printf ("SBModule::GetFileSpec ==> SBFileSpec (this = %p, 's')", &file_spec, sstr.GetData()); + log->Printf ("SBModule::GetFileSpec (this.sp=%p) => SBFileSpec : this.ap = %p, 's'", m_opaque_sp.get(), + file_spec.get(), sstr.GetData()); } return file_spec; @@ -76,8 +72,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBModule::GetUUIDBytes ()"); + //if (log) + // log->Printf ("SBModule::GetUUIDBytes ()"); if (m_opaque_sp) { @@ -85,13 +81,13 @@ { StreamString sstr; m_opaque_sp->GetUUID().Dump (&sstr); - log->Printf ("SBModule::GetUUIDBytes ==> '%s'", sstr.GetData()); + log->Printf ("SBModule::GetUUIDBytes (this.sp=%p) => '%s'", m_opaque_sp.get(), sstr.GetData()); } return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes(); } if (log) - log->Printf ("SBModule::GetUUIDBytes ==> NULL"); + log->Printf ("SBModule::GetUUIDBytes (this.sp=%p) => NULL", m_opaque_sp.get()); return NULL; } Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Tue Oct 26 18:49:36 2010 @@ -43,10 +43,6 @@ SBProcess::SBProcess () : m_opaque_sp() { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBProcess::SBProcess () ==> this = %p", this); } @@ -57,22 +53,20 @@ SBProcess::SBProcess (const SBProcess& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess::SBProcess (const SBProcess &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", - rhs.m_opaque_sp.get(), this); + log->Printf ("SBProcess::SBProcess (rhs.sp=%p) => this.sp = %p", rhs.m_opaque_sp.get(), m_opaque_sp.get()); } SBProcess::SBProcess (const lldb::ProcessSP &process_sp) : m_opaque_sp (process_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess::SBProcess (const lldb::ProcessSP &process_sp) process_sp.get() = %p ==> this = %p", - process_sp.get(), this); + log->Printf ("SBProcess::SBProcess (process_sp=%p) => this.sp = %p", process_sp.get(), m_opaque_sp.get()); } //---------------------------------------------------------------------- @@ -107,8 +101,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetNumThreads ()"); + //if (log) + // log->Printf ("SBProcess::GetNumThreads ()"); uint32_t num_threads = 0; if (m_opaque_sp) @@ -118,7 +112,7 @@ } if (log) - log->Printf ("SBProcess::GetNumThreads ==> %d", num_threads); + log->Printf ("SBProcess::GetNumThreads (this.sp=%p) => %d", m_opaque_sp.get(), num_threads); return num_threads; } @@ -128,8 +122,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetSelectedThread ()"); + //if (log) + // log->Printf ("SBProcess::GetSelectedThread ()"); SBThread sb_thread; if (m_opaque_sp) @@ -139,7 +133,8 @@ { SBStream sstr; sb_thread.GetDescription (sstr); - log->Printf ("SBProcess::GetSelectedThread ==> SBThread (this = %p, '%s')", &sb_thread, sstr.GetData()); + log->Printf ("SBProcess::GetSelectedThread (this.sp=%p) => SBThread : this = %p, '%s'", m_opaque_sp.get(), + &sb_thread, sstr.GetData()); } return sb_thread; @@ -150,15 +145,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetTarget ()"); + //if (log) + // log->Printf ("SBProcess::GetTarget ()"); SBTarget sb_target; if (m_opaque_sp) sb_target = m_opaque_sp->GetTarget().GetSP(); if (log) - log->Printf ("SBProcess::GetTarget ==> SBTarget (this = %p, m_opaque_sp.get())", &sb_target, + log->Printf ("SBProcess::GetTarget (this.sp=%p) => SBTarget (this.sp = %p)", m_opaque_sp.get(), sb_target.get()); return sb_target; @@ -170,8 +165,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::PutSTDIN (%s, %d)", src, src_len); + //if (log) + // log->Printf ("SBProcess::PutSTDIN (%s, %d)", src, src_len); size_t ret_val = 0; if (m_opaque_sp != NULL) @@ -181,7 +176,8 @@ } if (log) - log->Printf ("SBProcess::PutSTDIN ==> %d", ret_val); + log->Printf ("SBProcess::PutSTDIN (this.sp=%p, src='%s', src_len=%d) => %d", m_opaque_sp.get(), src, + (uint32_t) src_len, ret_val); return ret_val; } @@ -191,8 +187,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetSTDOUT (char *dst, size_t dst_Len)"); + //if (log) + // log->Printf ("SBProcess::GetSTDOUT (char *dst, size_t dst_Len)"); size_t ret_val = 0; if (m_opaque_sp != NULL) @@ -202,7 +198,8 @@ } if (log) - log->Printf ("SBProcess::GetSTDOUT ==> %d", ret_val); + log->Printf ("SBProcess::GetSTDOUT (this.sp=%p, dst='%s', dst_len=%d) => %d", m_opaque_sp.get(), dst, + (uint32_t) dst_len, (uint32_t) ret_val); return ret_val; } @@ -212,8 +209,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetSTDERR (char *dst, size_t dst_len)"); + //if (log) + // log->Printf ("SBProcess::GetSTDERR (char *dst, size_t dst_len)"); size_t ret_val = 0; if (m_opaque_sp != NULL) @@ -223,7 +220,8 @@ } if (log) - log->Printf ("SBProcess::GetSTDERR ==> %d", ret_val); + log->Printf ("SBProcess::GetSTDERR (this.sp=%p, dst='%s', dst_len=%d) => %d", m_opaque_sp.get(), dst, + (uint32_t) dst_len, (uint32_t) ret_val); return ret_val; } @@ -279,15 +277,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::SetSelectedThreadByID (%d)", tid); + //if (log) + // log->Printf ("SBProcess::SetSelectedThreadByID (%d)", tid); bool ret_val = false; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid); if (log) - log->Printf ("SBProcess::SetSelectedThreadByID ==> %s", (ret_val ? "true" : "false")); + log->Printf ("SBProcess::SetSelectedThreadByID (this.sp=%p, tid=%d) => '%s'", m_opaque_sp.get(), + tid, (ret_val ? "true" : "false")); return ret_val; } @@ -297,8 +296,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetThreadAtIndex (%d)"); + //if (log) + // log->Printf ("SBProcess::GetThreadAtIndex (%d)"); SBThread thread; if (m_opaque_sp) @@ -308,7 +307,8 @@ { SBStream sstr; thread.GetDescription (sstr); - log->Printf ("SBProcess::GetThreadAtIndex ==> SBThread (this = %p, '%s')", &thread, sstr.GetData()); + log->Printf ("SBProcess::GetThreadAtIndex (this.sp=%p, index=%d) => SBThread : this.sp = %p, '%s'", + m_opaque_sp.get(), (uint32_t) index, thread.GetLLDBObjectPtr(), sstr.GetData()); } return thread; @@ -319,15 +319,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetState ()"); + //if (log) + // log->Printf ("SBProcess::GetState ()"); StateType ret_val = eStateInvalid; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetState(); if (log) - log->Printf ("SBProcess::GetState ==> %s", lldb_private::StateAsCString (ret_val)); + log->Printf ("SBProcess::GetState (this.sp=%p) => '%s'", m_opaque_sp.get(), + lldb_private::StateAsCString (ret_val)); return ret_val; } @@ -356,15 +357,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetProcessID ()"); + //if (log) + // log->Printf ("SBProcess::GetProcessID ()"); lldb::pid_t ret_val = LLDB_INVALID_PROCESS_ID; if (m_opaque_sp) ret_val = m_opaque_sp->GetID(); if (log) - log->Printf ("SBProcess::GetProcessID ==> %d", ret_val); + log->Printf ("SBProcess::GetProcessID (this.sp=%p) => %d", m_opaque_sp.get(), ret_val); return ret_val; } @@ -374,15 +375,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetAddressByteSize()"); + //if (log) + // log->Printf ("SBProcess::GetAddressByteSize()"); uint32_t size = 0; if (m_opaque_sp) size = m_opaque_sp->GetAddressByteSize(); if (log) - log->Printf ("SBProcess::GetAddressByteSize ==> %d", size); + log->Printf ("SBProcess::GetAddressByteSize (this.sp=%p) => %d", m_opaque_sp.get(), size); return size; } @@ -413,8 +414,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::Continue ()"); + //if (log) + // log->Printf ("SBProcess::Continue ()"); SBError sb_error; if (IsValid()) @@ -434,7 +435,8 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Continue ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData()); + log->Printf ("SBProcess::Continue (this.sp=%p) => SBError (this.ap = %p, '%s')", m_opaque_sp.get(), + sb_error.get(), sstr.GetData()); } return sb_error; @@ -459,8 +461,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::Stop ()"); + //if (log) + // log->Printf ("SBProcess::Stop ()"); SBError sb_error; if (IsValid()) @@ -472,7 +474,8 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Stop ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData()); + log->Printf ("SBProcess::Stop (this.sp=%p) => SBError (this.ap = %p, '%s')", m_opaque_sp.get(), sb_error.get(), + sstr.GetData()); } return sb_error; @@ -483,8 +486,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::Kill ()"); + //if (log) + // log->Printf ("SBProcess::Kill ()"); SBError sb_error; if (m_opaque_sp) @@ -496,7 +499,8 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Kill ==> SBError (this = %p,'%s')", &sb_error, sstr.GetData()); + log->Printf ("SBProcess::Kill (this.sp=%p) => SBError (this.ap = %p,'%s')", m_opaque_sp.get(), sb_error.get(), + sstr.GetData()); } return sb_error; @@ -570,17 +574,18 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - { - SBStream sstr; - event.GetDescription (sstr); - log->Printf ("SBProcess::GetStateFromEvent (%s)", sstr.GetData()); - } + //if (log) + //{ + // SBStream sstr; + // event.GetDescription (sstr); + // log->Printf ("SBProcess::GetStateFromEvent (%s)", sstr.GetData()); + //} StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get()); if (log) - log->Printf ("SBProcess::GetStateFromEvent ==> %s", lldb_private::StateAsCString (ret_val)); + log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => '%s'", event.get(), + lldb_private::StateAsCString (ret_val)); return ret_val; } @@ -604,13 +609,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::GetBroadcaster ()"); + //if (log) + // log->Printf ("SBProcess::GetBroadcaster ()"); + SBBroadcaster broadcaster(m_opaque_sp.get(), false); if (log) - log->Printf ("SBProcess::GetBroadcaster ==> SBBroadcaster (this = %p, m_opaque = %p)", &broadcaster, - m_opaque_sp.get()); + log->Printf ("SBProcess::GetBroadcaster (this.sp=%p) => SBBroadcaster (this.obj = %p)", m_opaque_sp.get(), + broadcaster.get()); return broadcaster; } @@ -626,8 +632,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBProcess::ReadMemory (%p, %p, %d, sb_error)", addr, dst, dst_len); + //if (log) + // log->Printf ("SBProcess::ReadMemory (%p, %p, %d, sb_error)", addr, dst, dst_len); size_t bytes_read = 0; @@ -643,7 +649,8 @@ } if (log) - log->Printf ("SBProcess::ReadMemory ==> %d", bytes_read); + log->Printf ("SBProcess::ReadMemory (this.sp=%p, addr=%p, dst=%p, dst_len=%d, sb_error.ap=%p) => %d", + m_opaque_sp.get(), addr, dst, (uint32_t) dst_len, sb_error.get(), (uint32_t) bytes_read); return bytes_read; } Modified: lldb/trunk/source/API/SBSymbol.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbol.cpp (original) +++ lldb/trunk/source/API/SBSymbol.cpp Tue Oct 26 18:49:36 2010 @@ -22,23 +22,20 @@ SBSymbol::SBSymbol () : m_opaque_ptr (NULL) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBSymbol::SBSymbol () ==> this = %p", this); } SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) : m_opaque_ptr (lldb_object_ptr) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (sstr); - log->Printf ("SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) lldb_object_ptr = %p ==> " - "this = %p (%s)", lldb_object_ptr, this, sstr.GetData()); + log->Printf ("SBSymbol::SBSymbol (lldb_object_ptr=%p) => this.obj = %p (%s)", lldb_object_ptr, m_opaque_ptr, + sstr.GetData()); + } } @@ -58,18 +55,20 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBSymbol::GetName ()"); + //if (log) + // log->Printf ("SBSymbol::GetName ()"); if (m_opaque_ptr) { if (log) - log->Printf ("SBSymbol::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString()); + log->Printf ("SBSymbol::GetName (this.obj=%p) => '%s'", m_opaque_ptr, + m_opaque_ptr->GetMangled().GetName().AsCString()); + return m_opaque_ptr->GetMangled().GetName().AsCString(); } if (log) - log->Printf ("SBSymbol::GetName ==> NULL"); + log->Printf ("SBSymbol::GetName (this.obj=%p) => NULL", m_opaque_ptr); return NULL; } @@ -136,3 +135,8 @@ return sb_instructions; } +lldb_private::Symbol * +SBSymbol::get () +{ + return m_opaque_ptr; +} Modified: lldb/trunk/source/API/SBSymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbolContext.cpp (original) +++ lldb/trunk/source/API/SBSymbolContext.cpp Tue Oct 26 18:49:36 2010 @@ -20,16 +20,12 @@ SBSymbolContext::SBSymbolContext () : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBSymbolContext::SBSymbolContext () ==> this = %p", this); } SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (sc_ptr) m_opaque_ap.reset (new SymbolContext (*sc_ptr)); @@ -38,19 +34,16 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBSymbolContext::SBSymcolContext (const SymbolContext *sc_ptr) sc_ptr = %p ==> this = %p (%s)", - sc_ptr, this, sstr.GetData()); + log->Printf ("SBSymbolContext::SBSymcolContext (sc_ptr=%p) => this.ap = %p (%s)", + sc_ptr, m_opaque_ap.get(), sstr.GetData()); } } SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBSymbolContext::SBSymcolContext (const SBSymbolContext &rhs) rhs.m_opaque_ap.get() = %p " - "==> this = %p", (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); if (rhs.IsValid()) { @@ -60,6 +53,10 @@ ref() = *rhs.m_opaque_ap; } + if (log) + log->Printf ("SBSymbolContext::SBSymcolContext (rhs.ap=%p) => this.ap = %p", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); + } SBSymbolContext::~SBSymbolContext () @@ -107,8 +104,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBSymbolContext::GetModule ()"); + //if (log) + // log->Printf ("SBSymbolContext::GetModule ()"); SBModule sb_module; if (m_opaque_ap.get()) @@ -118,7 +115,8 @@ { SBStream sstr; sb_module.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetModule ==> SBModule (this = %p, '%s')", &sb_module, sstr.GetData()); + log->Printf ("SBSymbolContext::GetModule (this.ap=%p) => SBModule (this.sp = %p, '%s')", m_opaque_ap.get(), + sb_module.get(), sstr.GetData()); } return sb_module; @@ -135,14 +133,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBSymbolContext::GetFunction ()"); + //if (log) + // log->Printf ("SBSymbolContext::GetFunction ()"); SBFunction ret_function (m_opaque_ap.get() ? m_opaque_ap->function : NULL); if (log) - log->Printf ("SBSymbolContext::GetFunction ==> SBFunction (this = %p, '%s')", &ret_function, - ret_function.GetName()); + log->Printf ("SBSymbolContext::GetFunction (this.ap=%p) => SBFunction (this.obj = %p, '%s')", + m_opaque_ap.get(), ret_function.get(), ret_function.GetName()); return ret_function; } @@ -158,8 +156,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBSymbolContext::GetLineEntry ()"); + //if (log) + // log->Printf ("SBSymbolContext::GetLineEntry ()"); SBLineEntry sb_line_entry; if (m_opaque_ap.get()) @@ -169,8 +167,9 @@ { SBStream sstr; sb_line_entry.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetLineEntry ==> SBLineEntry (this = %p, '%s')", &sb_line_entry, - sstr.GetData()); + log->Printf ("SBSymbolContext::GetLineEntry (this.ap=%p) => SBLineEntry (this.ap = %p, '%s')", + m_opaque_ap.get(), + sb_line_entry.get(), sstr.GetData()); } return sb_line_entry; @@ -181,8 +180,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBSymbolContext::GetSymbol ()"); + //if (log) + // log->Printf ("SBSymbolContext::GetSymbol ()"); SBSymbol ret_symbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL); @@ -190,7 +189,8 @@ { SBStream sstr; ret_symbol.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetSymbol ==> SBSymbol (this = %p, '%s')", &ret_symbol, sstr.GetData()); + log->Printf ("SBSymbolContext::GetSymbol (this.ap=%p) => SBSymbol (this.ap = %p, '%s')", m_opaque_ap.get(), + ret_symbol.get(), sstr.GetData()); } return ret_symbol; Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Tue Oct 26 18:49:36 2010 @@ -52,30 +52,30 @@ //---------------------------------------------------------------------- SBTarget::SBTarget () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBTarget::SBTarget () ==> this = %p", this); } SBTarget::SBTarget (const SBTarget& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::SBTarget (const SBTarget &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", - rhs.m_opaque_sp.get(), this); + log->Printf ("SBTarget::SBTarget (rhs.sp=%p) => this.sp = %p", + rhs.m_opaque_sp.get(), m_opaque_sp.get()); } SBTarget::SBTarget(const TargetSP& target_sp) : m_opaque_sp (target_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::SBTarget (const TargetSP &target_sp) target_sp.get() = %p ==> this = %p", - target_sp.get(), this); + { + SBStream sstr; + GetDescription (sstr, lldb::eDescriptionLevelBrief); + log->Printf ("SBTarget::SBTarget (target_sp=%p) => this.sp = %p ('%s')", + target_sp.get(), m_opaque_sp.get(), sstr.GetData()); + } } const SBTarget& @@ -84,15 +84,15 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Assign (const SBTarget &rhs) rhs = %p", &rhs); + log->Printf ("SBTarget::Assign (this.sp=%p, rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); if (this != &rhs) { m_opaque_sp = rhs.m_opaque_sp; } - if (log) - log->Printf ("SBTarget::Assign ==> SBTarget (this = %p, m_opaque_sp.get() = %p)", this, m_opaque_sp.get()); + //if (log) + // log->Printf ("SBTarget::Assign => SBTarget (this = %p, m_opaque_sp.get() = %p)", this, m_opaque_sp.get()); return *this; } @@ -116,8 +116,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::GetProcess ()"); + //if (log) + // log->Printf ("SBTarget::GetProcess ()"); SBProcess sb_process; if (m_opaque_sp) @@ -127,7 +127,8 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::GetProcess ==> SBProcess (this = %p, '%s')", &sb_process, sstr.GetData()); + log->Printf ("SBTarget::GetProcess (this.sp=%p) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), + sb_process.get(), sstr.GetData()); } return sb_process; @@ -149,8 +150,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::CreateProcess ()"); + //if (log) + // log->Printf ("SBTarget::CreateProcess ()"); SBProcess sb_process; @@ -161,7 +162,8 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::CreateProcess ==> SBProcess (this = %p, '%s')", &sb_process, sstr.GetData()); + log->Printf ("SBTarget::CreateProcess (this.sp=%p) => SBProcess this.sp = %p, '%s'", m_opaque_sp.get(), + sb_process.get(), sstr.GetData()); } return sb_process; @@ -181,30 +183,9 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - { - log->Printf ("SBTarget::LaunchProcess (char const **argv, char const **envp, const char *tty, " - "uint32_t launch_flags, bool stop_at_entry)"); - - if (!argv) - log->Printf ("argv: NULL"); - else - { - for (int i = 0; argv[i]; ++i) - log->Printf (" %s", argv[i]); - } - - if (!envp) - log->Printf ("envp: NULL"); - else - { - for (int i = 0; envp[i]; ++i) - log->Printf (" %s", envp[i]); - } - - log->Printf (" tty = %s, launch_flags = %d, stop_at_entry = %s", tty, launch_flags, (stop_at_entry ? - "true" : - "false")); - } + log->Printf ("SBTarget::LaunchProcess (this.sp=%p, argv=%p, envp=%p, tty='%s', launch_flags=%d, " + "stop_at_entry='%s')", + m_opaque_sp.get(), argv, envp, tty, launch_flags, (stop_at_entry ? "true" : "false")); SBError sb_error; SBProcess sb_process = Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); @@ -213,7 +194,8 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::LaunchProcess ==> SBProcess (this = %p, '%s')", this, sstr.GetData()); + log->Printf ("SBTarget::LaunchProcess (this.sp=%p, ...) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), + sb_process.get(), sstr.GetData()); } return sb_process; @@ -233,28 +215,10 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - { - log->Printf ("SBTarget::Launch (char const **argv, char const **envp, const char *tty, uint32_t launch_flag," - "bool stop_at_entry, SBError error)"); - if (!argv) - log->Printf ("argv: NULL"); - else - { - for (int i = 0; argv[i]; ++i) - log->Printf (" %s", argv[i]); - } - - if (!envp) - log->Printf ("envp: NULL"); - else - { - for (int i = 0; envp[i]; ++i) - log->Printf (" %s", envp[i]); - } - - log->Printf (" tty = %s, launch_flags = %d, stop_at_entry = %s, error (this = %p)", tty, launch_flags, - (stop_at_entry ? "true" : "false"), &error); - } + log->Printf ("SBTarget::Launch (this.sp=%p, argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%s, " + "error.ap=%p)", + m_opaque_sp.get(), argv, envp, tty, launch_flags, (stop_at_entry ? "true" : "false"), + error.get()); SBProcess sb_process; if (m_opaque_sp) @@ -310,7 +274,8 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::Launch ==> SBProceess (this = %p, '%s')", &sb_process, sstr.GetData()); + log->Printf ("SBTarget::Launch (this.sp=%p, ...) => SBProceess : this.sp = %p, '%s'", m_opaque_sp.get(), + sb_process.get(), sstr.GetData()); } return sb_process; @@ -401,8 +366,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::GetExecutable ()"); + //if (log) + // log->Printf ("SBTarget::GetExecutable ()"); SBFileSpec exe_file_spec; if (m_opaque_sp) @@ -418,11 +383,12 @@ { SBStream sstr; exe_file_spec.GetDescription (sstr); - log->Printf ("SBTarget::GetExecutable ==> SBFileSpec (this = %p, '%s')", &exe_file_spec, sstr.GetData()); + log->Printf ("SBTarget::GetExecutable (this.sp=%p) => SBFileSpec (this.ap = %p, '%s')", m_opaque_sp.get(), + exe_file_spec.get(), sstr.GetData()); } else - log->Printf ("SBTarget::GetExecutable ==> SBFileSpec (this = %p, 'Unable to find valid file')", - &exe_file_spec); + log->Printf ("SBTarget::GetExecutable (this.sp=%p) => SBFileSpec (this.ap = %p, 'Unable to find valid file')", + m_opaque_sp.get(), exe_file_spec.get()); } return exe_file_spec; @@ -473,9 +439,9 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) file = '%s', line = %d", - file, line); + //if (log) + // log->Printf ("SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) file = '%s', line = %d", + // file, line); SBBreakpoint sb_bp; if (file != NULL && line != 0) @@ -485,7 +451,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf("SBTarget::BreakpointCreateByLocation ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + log->Printf("SBTarget::BreakpointCreateByLocation (this.sp=%p, file='%s', line=%d) => " + "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), file, line, sb_bp.get(), sstr.GetData()); } return sb_bp; @@ -496,9 +463,9 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) " - "sb_file_spec (%p), line = %d)", &sb_file_spec, line); + //if (log) + // log->Printf ("SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) " + // "sb_file_spec (%p), line = %d)", &sb_file_spec, line); SBBreakpoint sb_bp; if (m_opaque_sp.get() && line != 0) @@ -508,7 +475,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByLocation ==> SBBreakpoint (this = %p, '%s')", &sb_bp, + log->Printf ("SBTarget::BreakpointCreateByLocation (this.sp=%p, sb_file_spec.ap=%p, line=%d) => " + "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), sb_file_spec.get(), line, sb_bp.get(), sstr.GetData()); } @@ -520,9 +488,9 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) " - "symbol_name = %s, module_name = %s)", symbol_name, module_name); + //if (log) + // log->Printf ("SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) " + // "symbol_name = %s, module_name = %s)", symbol_name, module_name); SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name && symbol_name[0]) @@ -542,7 +510,9 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByName ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + log->Printf ("SBTarget::BreakpointCreateByName (this.sp=%p, symbol_name='%s', module_name='%s') => " + "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), symbol_name, module_name, sb_bp.get(), + sstr.GetData()); } return sb_bp; @@ -553,9 +523,9 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) " - "symbol_name_regex = %s, module_name = %s)", symbol_name_regex, module_name); + //if (log) + // log->Printf ("SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) " + // "symbol_name_regex = %s, module_name = %s)", symbol_name_regex, module_name); SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0]) @@ -578,7 +548,9 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByRegex ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + log->Printf ("SBTarget::BreakpointCreateByRegex (this.sp=%p, symbol_name_regex='%s', module_name='%s') " + "=> SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), symbol_name_regex, module_name, + sb_bp.get(), sstr.GetData()); } return sb_bp; @@ -591,8 +563,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::BreakpointCreateByAddress (addr_t address) address = %p", address); + //if (log) + // log->Printf ("SBTarget::BreakpointCreateByAddress (addr_t address) address = %p", address); SBBreakpoint sb_bp; if (m_opaque_sp.get()) @@ -602,7 +574,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByAddress ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData()); + log->Printf ("SBTarget::BreakpointCreateByAddress (this.sp=%p, address=%p) => " + "SBBreakpoint : this.sp = %p, '%s')", m_opaque_sp.get(), address, sb_bp.get(), sstr.GetData()); } return sb_bp; @@ -613,8 +586,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::FindBreakpointByID (break_id_t bp_id) bp_id = %d", bp_id); + //if (log) + // log->Printf ("SBTarget::FindBreakpointByID (break_id_t bp_id) bp_id = %d", bp_id); SBBreakpoint sb_breakpoint; if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID) @@ -624,7 +597,8 @@ { SBStream sstr; sb_breakpoint.GetDescription (sstr); - log->Printf ("SBTarget::FindBreakpointByID ==> SBBreakpoint (this = %p, '%s'", &bp_id, sstr.GetData()); + log->Printf ("SBTarget::FindBreakpointByID (this.sp=%p, bp_id=%d) => SBBreakpoint : this.sp = %p, '%s'", + m_opaque_sp.get(), (uint32_t) bp_id, sb_breakpoint.get(), sstr.GetData()); } return sb_breakpoint; @@ -652,8 +626,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::BreakpointDelete (break_id_t bp_id) bp_id = %d", bp_id); + //if (log) + // log->Printf ("SBTarget::BreakpointDelete (break_id_t bp_id) bp_id = %d", bp_id); bool result = false; if (m_opaque_sp) @@ -662,9 +636,11 @@ if (log) { if (result) - log->Printf ("SBTarget::BreakpointDelete ==> true"); + log->Printf ("SBTarget::BreakpointDelete (this.sp=%p, bp_id=%d) => 'true'", m_opaque_sp.get(), + (uint32_t) bp_id); else - log->Printf ("SBTarget::BreakpointDelete ==> false"); + log->Printf ("SBTarget::BreakpointDelete (this.sp=%p, bp_id=%d) => 'false'", m_opaque_sp.get(), + (uint32_t) bp_id); } return result; @@ -709,15 +685,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::GetNumModules ()"); + //if (log) + // log->Printf ("SBTarget::GetNumModules ()"); uint32_t num = 0; if (m_opaque_sp) num = m_opaque_sp->GetImages().GetSize(); if (log) - log->Printf ("SBTarget::GetNumModules ==> %d", num); + log->Printf ("SBTarget::GetNumModules (this.sp=%p) => %d", m_opaque_sp.get(), num); return num; } @@ -728,7 +704,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Clear ()"); + log->Printf ("SBTarget::Clear (this.sp=%p)", m_opaque_sp.get()); m_opaque_sp.reset(); } @@ -748,8 +724,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::GetModuleAtIndex (uint32_t idx) idx = %d", idx); + //if (log) + // log->Printf ("SBTarget::GetModuleAtIndex (uint32_t idx) idx = %d", idx); SBModule sb_module; if (m_opaque_sp) @@ -759,7 +735,8 @@ { SBStream sstr; sb_module.GetDescription (sstr); - log->Printf ("SBTarget::GetModuleAtIndex ==> SBModule: this = %p, %s", &sb_module, sstr.GetData()); + log->Printf ("SBTarget::GetModuleAtIndex (this.sp=%p, idx=%d) => SBModule: this = %p, '%s'", + m_opaque_sp.get(), idx, sb_module.get(), sstr.GetData()); } return sb_module; @@ -771,13 +748,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBTarget::GetBroadcaster ()"); + //if (log) + // log->Printf ("SBTarget::GetBroadcaster ()"); SBBroadcaster broadcaster(m_opaque_sp.get(), false); if (log) - log->Printf ("SBTarget::GetBroadcaster ==> SBBroadcaster (this = %p)", &broadcaster); + log->Printf ("SBTarget::GetBroadcaster (this.sp=%p) => SBBroadcaster (this.obj = %p)", + m_opaque_sp.get(), broadcaster.get()); return broadcaster; } Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Tue Oct 26 18:49:36 2010 @@ -41,10 +41,6 @@ SBThread::SBThread () : m_opaque_sp () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBThread::SBThread () ==> this = %p", this); } //---------------------------------------------------------------------- @@ -53,22 +49,27 @@ SBThread::SBThread (const ThreadSP& lldb_object_sp) : m_opaque_sp (lldb_object_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::SBThread (const ThreadSP &lldb_object_sp) lldb_object_sp.get() = %p ==> this = %p", - lldb_object_sp.get(), this); + { + SBStream sstr; + GetDescription (sstr); + log->Printf ("SBThread::SBThread (lldb_object_sp=%p) => this.sp = %p (%s)", + lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData()); + } } SBThread::SBThread (const SBThread &rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + m_opaque_sp = rhs.m_opaque_sp; if (log) - log->Printf ("SBThread::SBThread (const SBThread &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", - rhs.m_opaque_sp.get(), this); + log->Printf ("SBThread::SBThread (rhs.sp=%p) => this.sp = %p", + rhs.m_opaque_sp.get(), m_opaque_sp.get()); - m_opaque_sp = rhs.m_opaque_sp; } //---------------------------------------------------------------------- @@ -96,8 +97,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetStopReason ()"); + //if (log) + // log->Printf ("SBThread::GetStopReason ()"); StopReason reason = eStopReasonInvalid; if (m_opaque_sp) @@ -108,7 +109,8 @@ } if (log) - log->Printf ("SBThread::GetStopReason ==> %s", Thread::StopReasonAsCString (reason)); + log->Printf ("SBThread::GetStopReason (this.sp=%p) => '%s'", m_opaque_sp.get(), + Thread::StopReasonAsCString (reason)); return reason; } @@ -118,8 +120,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetStopDescription (char *dst, size_t dst_len)"); + //if (log) + // log->Printf ("SBThread::GetStopDescription (char *dst, size_t dst_len)"); if (m_opaque_sp) { @@ -130,7 +132,8 @@ if (stop_desc) { if (log) - log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc); + log->Printf ("SBThread::GetStopDescription (this.sp=%p, dst, dst_len) => '%s'", + m_opaque_sp.get(), stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc); else @@ -196,7 +199,8 @@ if (stop_desc && stop_desc[0]) { if (log) - log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc); + log->Printf ("SBThread::GetStopDescription (this.sp=%p, dst, dst_len) => '%s'", + m_opaque_sp.get(), stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte @@ -226,15 +230,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetThreadID()"); + //if (log) + // log->Printf ("SBThread::GetThreadID()"); lldb::tid_t id = LLDB_INVALID_THREAD_ID; if (m_opaque_sp) id = m_opaque_sp->GetID(); if (log) - log->Printf ("SBThread::GetThreadID ==> %d", id); + log->Printf ("SBThread::GetThreadID (this.sp=%p) => %d", m_opaque_sp.get(), (uint32_t) id); return id; } @@ -251,18 +255,18 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetName ()"); + //if (log) + // log->Printf ("SBThread::GetName ()"); if (m_opaque_sp) { if (log) - log->Printf ("SBThread::GetName ==> %s", m_opaque_sp->GetName()); + log->Printf ("SBThread::GetName (this.sp=%p) => '%s'", m_opaque_sp.get(), m_opaque_sp->GetName()); return m_opaque_sp->GetName(); } if (log) - log->Printf ("SBThread::GetName ==> NULL"); + log->Printf ("SBThread::GetName (this.sp=%p) => NULL", m_opaque_sp.get()); return NULL; } @@ -272,18 +276,19 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetQueueName ()"); + //if (log) + // log->Printf ("SBThread::GetQueueName ()"); if (m_opaque_sp) { if (log) - log->Printf ("SBThread::GetQueueName ==> %s", m_opaque_sp->GetQueueName()); + log->Printf ("SBThread::GetQueueName (this.sp=%p) => '%s'", m_opaque_sp.get(), + m_opaque_sp->GetQueueName()); return m_opaque_sp->GetQueueName(); } if (log) - log->Printf ("SBThread::GetQueueName ==> NULL"); + log->Printf ("SBThread::GetQueueName (this.sp=%p) => NULL", m_opaque_sp.get()); return NULL; } @@ -295,7 +300,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepOver (lldb::RunMode stop_other_threads) stop_other_threads = %s)", + log->Printf ("SBThread::StepOver (this.sp=%p, stop_other_threads='%s')", m_opaque_sp.get(), Thread::RunModeAsCString (stop_other_threads)); if (m_opaque_sp) @@ -344,7 +349,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepInto (lldb::RunMode stop_other_threads) stop_other_threads =%s", + log->Printf ("SBThread::StepInto (this.sp=%p, stop_other_threads='%s')", m_opaque_sp.get(), Thread::RunModeAsCString (stop_other_threads)); if (m_opaque_sp) @@ -391,7 +396,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepOut ()"); + log->Printf ("SBThread::StepOut (this.sp=%p)", m_opaque_sp.get()); if (m_opaque_sp) { @@ -419,7 +424,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepInstruction (bool step_over) step_over = %s", (step_over ? "true" : "false")); + log->Printf ("SBThread::StepInstruction (this.sp=%p, step_over=%s)", m_opaque_sp.get(), + (step_over ? "true" : "false")); if (m_opaque_sp) { @@ -443,7 +449,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::RunToAddress (lldb:;addr_t addr) addr = %p", addr); + log->Printf ("SBThread::RunToAddress (this.sp=%p, addr=%p)", m_opaque_sp.get(), addr); if (m_opaque_sp) { @@ -472,8 +478,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetProcess ()"); + //if (log) + // log->Printf ("SBThread::GetProcess ()"); SBProcess process; if (m_opaque_sp) @@ -486,7 +492,8 @@ { SBStream sstr; process.GetDescription (sstr); - log->Printf ("SBThread::GetProcess ==> SBProcess (this = %p, '%s')", &process, sstr.GetData()); + log->Printf ("SBThread::GetProcess (this.sp=%p) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), + process.get(), sstr.GetData()); } return process; @@ -497,15 +504,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetNumFrames ()"); + //if (log) + // log->Printf ("SBThread::GetNumFrames ()"); uint32_t num_frames = 0; if (m_opaque_sp) num_frames = m_opaque_sp->GetStackFrameCount(); if (log) - log->Printf ("SBThread::GetNumFrames ==> %d", num_frames); + log->Printf ("SBThread::GetNumFrames (this.sp=%p) => %d", m_opaque_sp.get(), num_frames); return num_frames; } @@ -515,8 +522,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBThread::GetFrameAtIndex (uint32_t idx) idx = %d", idx); + //if (log) + // log->Printf ("SBThread::GetFrameAtIndex (uint32_t idx) idx = %d", idx); SBFrame sb_frame; if (m_opaque_sp) @@ -526,7 +533,8 @@ { SBStream sstr; sb_frame.GetDescription (sstr); - log->Printf ("SBThread::GetFrameAtIndex ==> SBFrame (this = %p, '%s')", &sb_frame, sstr.GetData()); + log->Printf ("SBThread::GetFrameAtIndex (this.sp=%p, idx=%d) => SBFrame.sp : this = %p, '%s'", + m_opaque_sp.get(), idx, sb_frame.get(), sstr.GetData()); } return sb_frame; @@ -538,9 +546,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::operator= (const lldb::SBThread &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p", - rhs.m_opaque_sp.get(), this); - + log->Printf ("SBThread::operator= (this.sp=%p, rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); + m_opaque_sp = rhs.m_opaque_sp; return *this; } Modified: lldb/trunk/source/API/SBType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBType.cpp (original) +++ lldb/trunk/source/API/SBType.cpp Tue Oct 26 18:49:36 2010 @@ -23,13 +23,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBType::IsPointerType (%p)", opaque_type); + //if (log) + // log->Printf ("SBType::IsPointerType (%p)", opaque_type); bool ret_value = ClangASTContext::IsPointerType (opaque_type); if (log) - log->Printf ("SBType::IsPointerType ==> %s", (ret_value ? "true" : "false")); + log->Printf ("SBType::IsPointerType (opaque_type=%p) ==> '%s'", opaque_type, (ret_value ? "true" : "false")); return ret_value; } Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Tue Oct 26 18:49:36 2010 @@ -37,23 +37,19 @@ SBValue::SBValue () : m_opaque_sp () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBValue::SBValue () ==> this = %p", this); } SBValue::SBValue (const lldb::ValueObjectSP &value_sp) : m_opaque_sp (value_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; GetDescription (sstr); - log->Printf ("SBValue::SBValue (const lldb::ValueObjectSP &value_sp) value_sp.get() = %p ==> this = %p (%s)", - value_sp.get(), this, sstr.GetData()); + log->Printf ("SBValue::SBValue (value_sp=%p) => this.sp = %p (%s)", + value_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -83,19 +79,21 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBValue::GetName ()"); + //if (log) + // log->Printf ("SBValue::GetName ()"); if (IsValid()) { if (log) - log->Printf ("SBValue::GetName ==> %s", m_opaque_sp->GetName().AsCString()); + log->Printf ("SBValue::GetName (this.sp=%p) => '%s'", m_opaque_sp.get(), + m_opaque_sp->GetName().AsCString()); + return m_opaque_sp->GetName().AsCString(); } else { if (log) - log->Printf ("SBValue::GetName ==> NULL"); + log->Printf ("SBValue::GetName (this.sp=%p) ==> NULL", m_opaque_sp.get()); return NULL; } } Modified: lldb/trunk/source/API/SBValueList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=117417&r1=117416&r2=117417&view=diff ============================================================================== --- lldb/trunk/source/API/SBValueList.cpp (original) +++ lldb/trunk/source/API/SBValueList.cpp Tue Oct 26 18:49:36 2010 @@ -22,26 +22,21 @@ SBValueList::SBValueList () : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBValueList::SBValueList () ==> this = %p", this); } SBValueList::SBValueList (const SBValueList &rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBValueList::SBValueList (const SBValueList &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (rhs.IsValid()) m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs)); if (log) { + log->Printf ("SBValueList::SBValueList (rhs.ap=%p) => this.ap = %p", + (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); + uint32_t num_vars = GetSize(); for (uint32_t i = 0; i < num_vars; ++i) { @@ -56,17 +51,17 @@ SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - - if (log) - log->Printf ("SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) " - "lldb_object_ptr = %p ==> this = %p", lldb_object_ptr, this); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (lldb_object_ptr) m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr)); if (log) { + log->Printf ("SBValueList::SBValueList (lldb_object_ptr=%p) => this.ap = %p", lldb_object_ptr, + m_opaque_ap.get()); + + uint32_t num_vars = GetSize(); for (uint32_t i = 0; i < num_vars; ++i) { @@ -151,8 +146,8 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx); + //if (log) + // log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx); SBValue sb_value; if (m_opaque_ap.get()) @@ -162,7 +157,8 @@ { SBStream sstr; sb_value.GetDescription (sstr); - log->Printf ("SBValueList::GetValueAtIndex ==> SBValue (this = %p, '%s')", &sb_value, sstr.GetData()); + log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')", + m_opaque_ap.get(), sb_value.get(), sstr.GetData()); } return sb_value; @@ -173,15 +169,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBValueList::GetSize ()"); + //if (log) + // log->Printf ("SBValueList::GetSize ()"); uint32_t size = 0; if (m_opaque_ap.get()) size = m_opaque_ap->GetSize(); if (log) - log->Printf ("SBValueList::GetSize ==> %d", size); + log->Printf ("SBValueList::GetSize (this.ap=%p) => %d", m_opaque_ap.get(), size); return size; } @@ -203,3 +199,9 @@ return sb_value; } +lldb_private::ValueObjectList * +SBValueList::get () +{ + return m_opaque_ap.get(); +} + From scallanan at apple.com Tue Oct 26 20:36:51 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 27 Oct 2010 01:36:51 -0000 Subject: [Lldb-commits] [lldb] r117430 - in /lldb/trunk/source/Symbol: SymbolContext.cpp Type.cpp Message-ID: <20101027013651.8C4C32A6C12C@llvm.org> Author: spyffe Date: Tue Oct 26 20:36:51 2010 New Revision: 117430 URL: http://llvm.org/viewvc/llvm-project?rev=117430&view=rev Log: Removed an inappropriate function lookup path. Also made type lookup lazy for types that are hidden behind pointers. Modified: lldb/trunk/source/Symbol/SymbolContext.cpp lldb/trunk/source/Symbol/Type.cpp Modified: lldb/trunk/source/Symbol/SymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=117430&r1=117429&r2=117430&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp (original) +++ lldb/trunk/source/Symbol/SymbolContext.cpp Tue Oct 26 20:36:51 2010 @@ -413,26 +413,6 @@ // for methods matching name. } - if (comp_unit != NULL) - { - // Make sure we've read in all the functions. We should be able to check and see - // if there's one by this name present before we do this... - module_sp->GetSymbolVendor()->ParseCompileUnitFunctions(*this); - uint32_t func_idx; - lldb::FunctionSP func_sp; - for (func_idx = 0; (func_sp = comp_unit->GetFunctionAtIndex(func_idx)) != NULL; ++func_idx) - { - if (func_sp->GetMangled().GetName() == name) - { - SymbolContext sym_ctx(target_sp, - module_sp, - comp_unit, - func_sp.get()); - sc_list.Append(sym_ctx); - } - } - } - if (module_sp != NULL) module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, true, sc_list); Modified: lldb/trunk/source/Symbol/Type.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=117430&r1=117429&r2=117430&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Type.cpp (original) +++ lldb/trunk/source/Symbol/Type.cpp Tue Oct 26 20:36:51 2010 @@ -428,7 +428,6 @@ { TypeList *type_list = GetTypeList(); Type *encoding_type = GetEncodingType(); - if (encoding_type) { switch (m_encoding_uid_type) @@ -542,7 +541,19 @@ Type *encoding_type = GetEncodingType (); if (encoding_type != NULL) { - if (encoding_type->ResolveClangType (forward_decl_is_ok)) + bool forward_decl_is_ok_for_encoding = forward_decl_is_ok; + switch (m_encoding_uid_type) + { + case eEncodingIsPointerUID: + case eEncodingIsLValueReferenceUID: + case eEncodingIsRValueReferenceUID: + forward_decl_is_ok_for_encoding = true; + break; + default: + break; + } + + if (encoding_type->ResolveClangType (forward_decl_is_ok_for_encoding)) { // We have at least resolve the forward declaration for our // encoding type... @@ -550,7 +561,7 @@ // Check if we fully resolved our encoding type, and if so // mark it as having been completely resolved. - if (forward_decl_is_ok == false) + if (forward_decl_is_ok_for_encoding == false) m_encoding_type_decl_resolved = true; } } From gclayton at apple.com Tue Oct 26 21:06:37 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 27 Oct 2010 02:06:37 -0000 Subject: [Lldb-commits] [lldb] r117432 - /lldb/trunk/source/Target/Target.cpp Message-ID: <20101027020637.AD0322A6C12C@llvm.org> Author: gclayton Date: Tue Oct 26 21:06:37 2010 New Revision: 117432 URL: http://llvm.org/viewvc/llvm-project?rev=117432&view=rev Log: After a recent fix to not set the default architecture to "x86_64", the string value for the default arch was coming out as a value that shouldn't be user visible. Now we don't show any value when it isn't set. Modified: lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117432&r1=117431&r2=117432&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Tue Oct 26 21:06:37 2010 @@ -845,10 +845,11 @@ ModuleSP module_sp = GetExecutableModule(); if (module_sp) { - sstr.Printf ("%s_%s", module_sp->GetFileSpec().GetFilename().AsCString(), + sstr.Printf ("%s_%s", + module_sp->GetFileSpec().GetFilename().AsCString(), module_sp->GetArchitecture().AsCString()); - Target::GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), - sstr.GetData()); + Target::GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), + sstr.GetData()); } } @@ -912,7 +913,9 @@ { if (var_name == DefArchVarName()) { - value.AppendString (m_default_architecture.AsCString()); + // If the arch is invalid (the default), don't show a string for it + if (m_default_architecture.IsValid()) + value.AppendString (m_default_architecture.AsCString()); return true; } else From gclayton at apple.com Tue Oct 26 22:32:59 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 27 Oct 2010 03:32:59 -0000 Subject: [Lldb-commits] [lldb] r117437 - in /lldb/trunk: include/lldb/API/ include/lldb/Core/ include/lldb/Symbol/ lldb.xcodeproj/ source/ source/API/ source/Core/ source/Expression/ source/Interpreter/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ source/Symbol/ source/Target/ tools/debugserver/debugserver.xcodeproj/ Message-ID: <20101027033300.0A8AE2A6C12C@llvm.org> Author: gclayton Date: Tue Oct 26 22:32:59 2010 New Revision: 117437 URL: http://llvm.org/viewvc/llvm-project?rev=117437&view=rev Log: Updated the lldb_private::Flags class to have better method names and made all of the calls inlined in the header file for better performance. Fixed the summary for C string types (array of chars (with any combo if modifiers), and pointers to chars) work in all cases. Fixed an issue where a forward declaration to a clang type could cause itself to resolve itself more than once if, during the resolving of the type itself it caused something to try and resolve itself again. We now remove the clang type from the forward declaration map in the DWARF parser when we start to resolve it and avoid this additional call. This should stop any duplicate members from appearing and throwing all the alignment of structs, unions and classes. Removed: lldb/trunk/source/Core/Flags.cpp Modified: lldb/trunk/include/lldb/API/SBValue.h lldb/trunk/include/lldb/Core/Flags.h lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/Core/Log.cpp lldb/trunk/source/Core/Section.cpp lldb/trunk/source/Core/Stream.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp lldb/trunk/source/Interpreter/CommandObject.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/Type.cpp lldb/trunk/source/Target/StackFrame.cpp lldb/trunk/source/Target/ThreadPlanStepInRange.cpp lldb/trunk/source/lldb-log.cpp lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/include/lldb/API/SBValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValue.h (original) +++ lldb/trunk/include/lldb/API/SBValue.h Tue Oct 26 22:32:59 2010 @@ -44,6 +44,9 @@ const char * GetValue (const lldb::SBFrame &frame); + ValueType + GetValueType (); + bool GetValueDidChange (const lldb::SBFrame &frame); Modified: lldb/trunk/include/lldb/Core/Flags.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Flags.h?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Flags.h (original) +++ lldb/trunk/include/lldb/Core/Flags.h Tue Oct 26 22:32:59 2010 @@ -19,38 +19,45 @@ //---------------------------------------------------------------------- /// @class Flags Flags.h "lldb/Core/Flags.h" -/// @brief A class to manage flag bits. +/// @brief A class to manage flags. /// -/// The Flags class does bits. +/// The Flags class managed flag bits and allows testing and +/// modification of individual or multiple flag bits. //---------------------------------------------------------------------- class Flags { public: //---------------------------------------------------------------------- - /// The value type for flag bits is a 32 bit unsigned integer type. + /// The value type for flags is a 32 bit unsigned integer type. //---------------------------------------------------------------------- typedef uint32_t ValueType; //---------------------------------------------------------------------- /// Construct with initial flag bit values. /// - /// Constructs this object with \a bits as the initial value for all - /// of the flag bits. + /// Constructs this object with \a mask as the initial value for all + /// of the flags. /// - /// @param[in] bits - /// The initial value for all flag bits. + /// @param[in] mask + /// The initial value for all flags. //---------------------------------------------------------------------- - Flags (ValueType bits = 0); + Flags (ValueType flags = 0) : + m_flags (flags) + { + } //---------------------------------------------------------------------- /// Copy constructor. /// - /// Construct and copy the flag bits from \a rhs. + /// Construct and copy the flags from \a rhs. /// /// @param[in] rhs /// A const Flags object reference to copy. //---------------------------------------------------------------------- - Flags (const Flags& rhs); + Flags (const Flags& rhs) : + m_flags(rhs.m_flags) + { + } //---------------------------------------------------------------------- /// Destructor. @@ -58,72 +65,150 @@ /// The destructor is virtual in case this class is subclassed. //---------------------------------------------------------------------- virtual - ~Flags (); + ~Flags () + { + } //---------------------------------------------------------------------- - /// Get accessor for all flag bits. + /// Get accessor for all flags. /// /// @return - /// Returns all of the flag bits as a Flags::ValueType. + /// Returns all of the flags as a Flags::ValueType. //---------------------------------------------------------------------- ValueType - GetAllFlagBits () const; + Get () const + { + return m_flags; + } + //---------------------------------------------------------------------- + /// Return the number of flags that can be represented in this + /// object. + /// + /// @return + /// The maximum number bits in this flag object. + //---------------------------------------------------------------------- size_t - GetBitSize() const; + GetBitSize() const + { + return sizeof (ValueType) * 8; + } //---------------------------------------------------------------------- - /// Set accessor for all flag bits. + /// Set accessor for all flags. /// - /// @param[in] bits - /// The bits with which to replace all of the current flag bits. + /// @param[in] flags + /// The bits with which to replace all of the current flags. //---------------------------------------------------------------------- void - SetAllFlagBits (ValueType bits); + Reset (ValueType flags) + { + m_flags = flags; + } //---------------------------------------------------------------------- - /// Clear one or more flag bits. + /// Clear one or more flags. /// - /// @param[in] bits - /// A bitfield containing one or more flag bits. + /// @param[in] mask + /// A bitfield containing one or more flags. /// /// @return - /// The new flag bits after clearing all bits from \a bits. + /// The new flags after clearing all bits from \a mask. //---------------------------------------------------------------------- ValueType - Clear (ValueType bits); + Clear (ValueType mask = ~(ValueType)0) + { + m_flags &= ~mask; + return m_flags; + } + //---------------------------------------------------------------------- - /// Set one or more flag bits. + /// Set one or more flags by logical OR'ing \a mask with the current + /// flags. /// - /// @param[in] bits - /// A bitfield containing one or more flag bits. + /// @param[in] mask + /// A bitfield containing one or more flags. /// /// @return - /// The new flag bits after setting all bits from \a bits. + /// The new flags after setting all bits from \a mask. //---------------------------------------------------------------------- ValueType - Set (ValueType bits); + Set (ValueType mask) + { + m_flags |= mask; + return m_flags; + } + //---------------------------------------------------------------------- - /// Test one or more flag bits. + /// Test if all bits in \a mask are 1 in the current flags /// /// @return - /// \b true if \b any flag bits in \a bits are set, \b false + /// \b true if all flags in \a mask are 1, \b false /// otherwise. //---------------------------------------------------------------------- bool - IsSet (ValueType bits) const; + AllSet (ValueType mask) const + { + return (m_flags & mask) == mask; + } //---------------------------------------------------------------------- - /// Test one or more flag bits. + /// Test one or more flags. /// /// @return - /// \b true if \b all flag bits in \a bits are clear, \b false + /// \b true if any flags in \a mask are 1, \b false /// otherwise. //---------------------------------------------------------------------- bool - IsClear (ValueType bits) const; + AnySet (ValueType mask) const + { + return (m_flags & mask) != 0; + } + + //---------------------------------------------------------------------- + /// Test a single flag bit. + /// + /// @return + /// \b true if \a bit is set, \b false otherwise. + //---------------------------------------------------------------------- + bool + Test (ValueType bit) const + { + return (m_flags & bit) != 0; + } + + //---------------------------------------------------------------------- + /// Test if all bits in \a mask are clear. + /// + /// @return + /// \b true if \b all flags in \a mask are clear, \b false + /// otherwise. + //---------------------------------------------------------------------- + bool + AllClear (ValueType mask) const + { + return (m_flags & mask) == 0; + } + + bool + AnyClear (ValueType mask) const + { + return (m_flags & mask) != mask; + } + + //---------------------------------------------------------------------- + /// Test a single flag bit to see if it is clear (zero). + /// + /// @return + /// \b true if \a bit is 0, \b false otherwise. + //---------------------------------------------------------------------- + bool + IsClear (ValueType bit) const + { + return (m_flags & bit) == 0; + } //---------------------------------------------------------------------- /// Get the number of zero bits in \a m_flags. @@ -132,7 +217,16 @@ /// The number of bits that are set to 0 in the current flags. //---------------------------------------------------------------------- size_t - ClearCount () const; + ClearCount () const + { + size_t count = 0; + for (ValueType shift = 0; shift < sizeof(ValueType)*8; ++shift) + { + if ((m_flags & (1u << shift)) == 0) + ++count; + } + return count; + } //---------------------------------------------------------------------- /// Get the number of one bits in \a m_flags. @@ -141,10 +235,19 @@ /// The number of bits that are set to 1 in the current flags. //---------------------------------------------------------------------- size_t - SetCount () const; + SetCount () const + { + size_t count = 0; + for (ValueType mask = m_flags; mask; mask >>= 1) + { + if (mask & 1u) + ++count; + } + return count; + } protected: - ValueType m_flags; ///< The flag bits. + ValueType m_flags; ///< The flags. }; } // namespace lldb_private Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Oct 26 22:32:59 2010 @@ -300,6 +300,10 @@ lldb::addr_t GetPointerValue (lldb::AddressType &address_type, bool scalar_is_load_address); + + lldb::addr_t + GetAddressOf (lldb::AddressType &address_type, + bool scalar_is_load_address); private: //------------------------------------------------------------------ // For ValueObject only Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Oct 26 22:32:59 2010 @@ -326,7 +326,9 @@ // Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations static uint32_t - GetTypeInfoMask (lldb::clang_type_t clang_type); + GetTypeInfo (lldb::clang_type_t clang_type, + clang::ASTContext *ast_context, // The AST for clang_type (can be NULL) + lldb::clang_type_t *pointee_or_element_type); // (can be NULL) static uint32_t GetNumChildren (lldb::clang_type_t clang_type, @@ -564,6 +566,12 @@ static bool IsObjCClassType (lldb::clang_type_t clang_type); + static bool + IsCharType (lldb::clang_type_t clang_type); + + static size_t + GetArraySize (lldb::clang_type_t clang_type); + //static bool //ConvertFloatValueToString (clang::ASTContext *ast_context, // lldb::clang_type_t clang_type, Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Oct 26 22:32:59 2010 @@ -127,7 +127,6 @@ 26D5B09E11B07550009A862E /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7910F1B85900F91463 /* Event.cpp */; }; 26D5B09F11B07550009A862E /* FileSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7A10F1B85900F91463 /* FileSpec.cpp */; }; 26D5B0A011B07550009A862E /* FileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */; }; - 26D5B0A111B07550009A862E /* Flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7C10F1B85900F91463 /* Flags.cpp */; }; 26D5B0A211B07550009A862E /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7D10F1B85900F91463 /* Language.cpp */; }; 26D5B0A311B07550009A862E /* Listener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7E10F1B85900F91463 /* Listener.cpp */; }; 26D5B0A411B07550009A862E /* Log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7F10F1B85900F91463 /* Log.cpp */; }; @@ -812,7 +811,6 @@ 26BC7E7910F1B85900F91463 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Event.cpp; path = source/Core/Event.cpp; sourceTree = ""; }; 26BC7E7A10F1B85900F91463 /* FileSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileSpec.cpp; path = source/Core/FileSpec.cpp; sourceTree = ""; }; 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileSpecList.cpp; path = source/Core/FileSpecList.cpp; sourceTree = ""; }; - 26BC7E7C10F1B85900F91463 /* Flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Flags.cpp; path = source/Core/Flags.cpp; sourceTree = ""; }; 26BC7E7D10F1B85900F91463 /* Language.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Language.cpp; path = source/Core/Language.cpp; sourceTree = ""; }; 26BC7E7E10F1B85900F91463 /* Listener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Listener.cpp; path = source/Core/Listener.cpp; sourceTree = ""; }; 26BC7E7F10F1B85900F91463 /* Log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Log.cpp; path = source/Core/Log.cpp; sourceTree = ""; }; @@ -1731,7 +1729,6 @@ 26BC7D6310F1B77400F91463 /* FileSpecList.h */, 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */, 26BC7D6410F1B77400F91463 /* Flags.h */, - 26BC7E7C10F1B85900F91463 /* Flags.cpp */, 9AA69DBB118A029E00D753A0 /* InputReader.h */, 9AA69DB5118A027A00D753A0 /* InputReader.cpp */, 26BC7D6510F1B77400F91463 /* IOStreamMacros.h */, @@ -2680,7 +2677,6 @@ 26D5B09E11B07550009A862E /* Event.cpp in Sources */, 26D5B09F11B07550009A862E /* FileSpec.cpp in Sources */, 26D5B0A011B07550009A862E /* FileSpecList.cpp in Sources */, - 26D5B0A111B07550009A862E /* Flags.cpp in Sources */, 26D5B0A211B07550009A862E /* Language.cpp in Sources */, 26D5B0A311B07550009A862E /* Listener.cpp in Sources */, 26D5B0A411B07550009A862E /* Log.cpp in Sources */, Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Tue Oct 26 22:32:59 2010 @@ -138,6 +138,14 @@ return value_string; } +ValueType +SBValue::GetValueType () +{ + if (m_opaque_sp) + return m_opaque_sp->GetValueType(); + return eValueTypeInvalid; +} + const char * SBValue::GetObjectDescription (const SBFrame &frame) { Removed: lldb/trunk/source/Core/Flags.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Flags.cpp?rev=117436&view=auto ============================================================================== --- lldb/trunk/source/Core/Flags.cpp (original) +++ lldb/trunk/source/Core/Flags.cpp (removed) @@ -1,122 +0,0 @@ -//===-- Flags.cpp -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Core/Flags.h" - -using namespace lldb_private; - -//---------------------------------------------------------------------- -// Default Constructor -//---------------------------------------------------------------------- -Flags::Flags (ValueType flags) : - m_flags(flags) -{ -} - -//---------------------------------------------------------------------- -// Copy Constructor -//---------------------------------------------------------------------- -Flags::Flags (const Flags& rhs) : - m_flags(rhs.m_flags) -{ -} - -//---------------------------------------------------------------------- -// Virtual destructor in case anyone inherits from this class. -//---------------------------------------------------------------------- -Flags::~Flags () -{ -} - -//---------------------------------------------------------------------- -// Get accessor for all of the current flag bits. -//---------------------------------------------------------------------- -Flags::ValueType -Flags::GetAllFlagBits () const -{ - return m_flags; -} - -size_t -Flags::GetBitSize() const -{ - return sizeof (ValueType) * 8; -} - -//---------------------------------------------------------------------- -// Set accessor for all of the current flag bits. -//---------------------------------------------------------------------- -void -Flags::SetAllFlagBits (ValueType flags) -{ - m_flags = flags; -} - -//---------------------------------------------------------------------- -// Clear one or more bits in our flag bits -//---------------------------------------------------------------------- -Flags::ValueType -Flags::Clear (ValueType bits) -{ - m_flags &= ~bits; - return m_flags; -} - -//---------------------------------------------------------------------- -// Set one or more bits in our flag bits -//---------------------------------------------------------------------- -Flags::ValueType -Flags::Set (ValueType bits) -{ - m_flags |= bits; - return m_flags; -} - -//---------------------------------------------------------------------- -// Returns true if any flag bits in "bits" are set -//---------------------------------------------------------------------- -bool -Flags::IsSet (ValueType bits) const -{ - return (m_flags & bits) != 0; -} - -//---------------------------------------------------------------------- -// Returns true if all flag bits in "bits" are clear -//---------------------------------------------------------------------- -bool -Flags::IsClear (ValueType bits) const -{ - return (m_flags & bits) == 0; -} - - -size_t -Flags::SetCount () const -{ - size_t count = 0; - for (ValueType mask = m_flags; mask; mask >>= 1) - { - if (mask & 1) - ++count; - } - return count; -} - -size_t -Flags::ClearCount () const -{ - size_t count = 0; - for (ValueType shift = 0; shift < sizeof(ValueType)*8; ++shift) - { - if ((m_flags & (1u << shift)) == 0) - ++count; - } - return count; -} Modified: lldb/trunk/source/Core/Log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Core/Log.cpp (original) +++ lldb/trunk/source/Core/Log.cpp Tue Oct 26 22:32:59 2010 @@ -91,29 +91,27 @@ Mutex::Locker locker; - uint32_t log_options = m_options.GetAllFlagBits(); - // Lock the threaded logging mutex if we are doing thread safe logging - if (log_options & LLDB_LOG_OPTION_THREADSAFE) + if (m_options.Test (LLDB_LOG_OPTION_THREADSAFE)) locker.Reset(g_LogThreadedMutex.GetMutex()); // Add a sequence ID if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_SEQUENCE) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_SEQUENCE)) header.Printf ("%u ", ++g_sequence_id); // Timestamp if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_TIMESTAMP) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_TIMESTAMP)) { struct timeval tv = TimeValue::Now().GetAsTimeVal(); header.Printf ("%9llu.%6.6llu ", tv.tv_sec, tv.tv_usec); } // Add the process and thread if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD)) header.Printf ("[%4.4x/%4.4x]: ", getpid(), Host::GetCurrentThreadID()); // Add the process and thread if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_THREAD_NAME) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) { const char *thread_name_str = Host::GetThreadName (getpid(), Host::GetCurrentThreadID()); if (thread_name_str) @@ -171,7 +169,7 @@ void Log::Debug (const char *format, ...) { - if (GetOptions().IsSet(LLDB_LOG_OPTION_DEBUG)) + if (GetOptions().Test(LLDB_LOG_OPTION_DEBUG)) { va_list args; va_start (args, format); @@ -188,7 +186,7 @@ void Log::DebugVerbose (const char *format, ...) { - if (GetOptions().IsSet(LLDB_LOG_OPTION_DEBUG) && GetOptions().IsSet(LLDB_LOG_OPTION_VERBOSE)) + if (GetOptions().AllSet (LLDB_LOG_OPTION_DEBUG | LLDB_LOG_OPTION_VERBOSE)) { va_list args; va_start (args, format); @@ -204,7 +202,7 @@ void Log::LogIf (uint32_t bits, const char *format, ...) { - if ((bits & m_options.GetAllFlagBits()) == bits) + if (m_options.AllSet (bits)) { va_list args; va_start (args, format); @@ -262,7 +260,7 @@ void Log::Verbose (const char *format, ...) { - if (m_options.IsSet(LLDB_LOG_OPTION_VERBOSE)) + if (m_options.Test(LLDB_LOG_OPTION_VERBOSE)) { va_list args; va_start (args, format); @@ -278,7 +276,7 @@ void Log::WarningVerbose (const char *format, ...) { - if (m_options.IsSet(LLDB_LOG_OPTION_VERBOSE)) + if (m_options.Test(LLDB_LOG_OPTION_VERBOSE)) { char *arg_msg = NULL; va_list args; Modified: lldb/trunk/source/Core/Section.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Core/Section.cpp (original) +++ lldb/trunk/source/Core/Section.cpp Tue Oct 26 22:32:59 2010 @@ -248,7 +248,7 @@ range.Dump (s, 0); } - s->Printf("%c 0x%8.8llx 0x%8.8llx 0x%8.8x ", resolved ? ' ' : '*', m_file_offset, m_file_size, GetAllFlagBits()); + s->Printf("%c 0x%8.8llx 0x%8.8llx 0x%8.8x ", resolved ? ' ' : '*', m_file_offset, m_file_size, Get()); DumpName (s); Modified: lldb/trunk/source/Core/Stream.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Stream.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Core/Stream.cpp (original) +++ lldb/trunk/source/Core/Stream.cpp Tue Oct 26 22:32:59 2010 @@ -64,7 +64,7 @@ Stream::PutSLEB128 (int64_t sval) { int bytes_written = 0; - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) { bool more = true; while (more) @@ -98,7 +98,7 @@ Stream::PutULEB128 (uint64_t uval) { int bytes_written = 0; - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) { do { @@ -129,7 +129,7 @@ { int cstr_len = strlen(cstr); // when in binary mode, emit the NULL terminator - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) ++cstr_len; return Write (cstr, cstr_len); } @@ -212,7 +212,7 @@ { va_end (args); // Include the NULL termination byte for binary output - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) length += 1; // The formatted string fit into our stack based buffer, so we can just // append that to our packet @@ -227,7 +227,7 @@ if (str_ptr) { // Include the NULL termination byte for binary output - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) length += 1; bytes_written = Write (str_ptr, length); ::free (str_ptr); @@ -429,7 +429,7 @@ bool Stream::GetVerbose() const { - return m_flags.IsSet(eVerbose); + return m_flags.Test(eVerbose); } //------------------------------------------------------------------ @@ -438,7 +438,7 @@ bool Stream::GetDebug() const { - return m_flags.IsSet(eDebug); + return m_flags.Test(eDebug); } //------------------------------------------------------------------ @@ -512,7 +512,7 @@ { int bytes_written = 0; for (size_t i=0; iCalculateProcess(); if (process != NULL) { + lldb::addr_t cstr_address = LLDB_INVALID_ADDRESS; lldb::AddressType cstr_address_type = eAddressTypeInvalid; - lldb::addr_t cstr_address = GetPointerValue (cstr_address_type, true); + size_t cstr_len = 0; + if (type_flags.Test (ClangASTContext::eTypeIsArray)) + { + // We have an array + cstr_len = ClangASTContext::GetArraySize (clang_type); + cstr_address = GetAddressOf (cstr_address_type, true); + } + else + { + // We have a pointer + cstr_address = GetPointerValue (cstr_address_type, true); + } if (cstr_address != LLDB_INVALID_ADDRESS) { DataExtractor data; @@ -425,14 +441,14 @@ std::vector cstr_buffer; size_t cstr_length; Error error; - if (fixed_length > 0) + if (cstr_len > 0) { - data_buffer.resize(fixed_length); + data_buffer.resize(cstr_len); // Resize the formatted buffer in case every character // uses the "\xXX" format and one extra byte for a NULL cstr_buffer.resize(data_buffer.size() * 4 + 1); data.SetData (&data_buffer.front(), data_buffer.size(), eByteOrderHost); - bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), fixed_length, error); + bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), cstr_len, error); if (bytes_read > 0) { sstr << '"'; @@ -590,7 +606,7 @@ case Value::eContextTypeDCType: case Value::eContextTypeDCVariable: { - void *clang_type = GetClangType (); + clang_type_t clang_type = GetClangType (); if (clang_type) { StreamString sstr; @@ -644,11 +660,37 @@ } addr_t +ValueObject::GetAddressOf (lldb::AddressType &address_type, bool scalar_is_load_address) +{ + switch (m_value.GetValueType()) + { + case Value::eValueTypeScalar: + if (scalar_is_load_address) + { + address_type = eAddressTypeLoad; + return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); + } + break; + + case Value::eValueTypeLoadAddress: + case Value::eValueTypeFileAddress: + case Value::eValueTypeHostAddress: + { + address_type = m_value.GetValueAddressType (); + return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); + } + break; + } + address_type = eAddressTypeInvalid; + return LLDB_INVALID_ADDRESS; +} + +addr_t ValueObject::GetPointerValue (lldb::AddressType &address_type, bool scalar_is_load_address) { lldb::addr_t address = LLDB_INVALID_ADDRESS; address_type = eAddressTypeInvalid; - switch (GetValue().GetValueType()) + switch (m_value.GetValueType()) { case Value::eValueTypeScalar: if (scalar_is_load_address) @@ -773,7 +815,7 @@ lldb::LanguageType ValueObject::GetObjectRuntimeLanguage () { - void *opaque_qual_type = GetClangType(); + clang_type_t opaque_qual_type = GetClangType(); if (opaque_qual_type == NULL) return lldb::eLanguageTypeC; @@ -825,6 +867,8 @@ return ClangASTContext::IsPointerType (GetClangType()); } + + bool ValueObject::IsPointerOrReferenceType () { @@ -909,7 +953,6 @@ } } - void ValueObject::DumpValueObject ( @@ -929,13 +972,12 @@ { if (valobj) { - //const char *loc_cstr = valobj->GetLocationAsCString(); clang_type_t clang_type = valobj->GetClangType(); - const Flags type_info_flags (ClangASTContext::GetTypeInfoMask (clang_type)); + const Flags type_flags (ClangASTContext::GetTypeInfo (clang_type, NULL, NULL)); const char *err_cstr = NULL; - const bool has_children = type_info_flags.IsSet (ClangASTContext::eTypeHasChildren); - const bool has_value = type_info_flags.IsSet (ClangASTContext::eTypeHasValue); + const bool has_children = type_flags.Test (ClangASTContext::eTypeHasChildren); + const bool has_value = type_flags.Test (ClangASTContext::eTypeHasValue); const bool print_valobj = flat_output == false || has_value; @@ -983,6 +1025,7 @@ } else { + const bool is_ref = type_flags.Test (ClangASTContext::eTypeIsReference); if (print_valobj) { const char *sum_cstr = valobj->GetSummaryAsCString(exe_scope); @@ -1006,9 +1049,39 @@ if (curr_depth < max_depth) { - bool is_ptr_or_ref = type_info_flags.IsSet (ClangASTContext::eTypeIsPointer | ClangASTContext::eTypeIsReference); + // We will show children for all concrete types. We won't show + // pointer contents unless a pointer depth has been specified. + // We won't reference contents unless the reference is the + // root object (depth of zero). + bool print_children = true; + + // Use a new temporary pointer depth in case we override the + // current pointer depth below... + uint32_t curr_ptr_depth = ptr_depth; + + const bool is_ptr = type_flags.Test (ClangASTContext::eTypeIsPointer); + if (is_ptr || is_ref) + { + // We have a pointer or reference whose value is an address. + // Make sure that address is not NULL + lldb::AddressType ptr_address_type; + if (valobj->GetPointerValue (ptr_address_type, true) == 0) + print_children = false; + + else if (is_ref && curr_depth == 0) + { + // If this is the root object (depth is zero) that we are showing + // and it is a reference, and no pointer depth has been supplied + // print out what it references. Don't do this at deeper depths + // otherwise we can end up with infinite recursion... + curr_ptr_depth = 1; + } + + if (curr_ptr_depth == 0) + print_children = false; + } - if (!is_ptr_or_ref || ptr_depth > 0) + if (print_children) { const uint32_t num_children = valobj->GetNumChildren(); if (num_children) @@ -1034,7 +1107,7 @@ exe_scope, child_sp.get(), NULL, - is_ptr_or_ref ? ptr_depth - 1 : ptr_depth, + (is_ptr || is_ref) ? curr_ptr_depth - 1 : curr_ptr_depth, curr_depth + 1, max_depth, show_types, @@ -1055,7 +1128,7 @@ { // Aggregate, no children... if (print_valobj) - s.PutCString("{}\n"); + s.PutCString(" {}\n"); } else { @@ -1066,8 +1139,6 @@ } else { - // We printed a pointer, but we are stopping and not printing - // and children of this pointer... s.EOL(); } } Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Tue Oct 26 22:32:59 2010 @@ -125,11 +125,12 @@ // ApplyObjcCastHack(m_expr_text); - ApplyUnicharHack(m_expr_text); + //ApplyUnicharHack(m_expr_text); if (m_cplusplus) { - m_transformed_stream.Printf("void \n" + m_transformed_stream.Printf("typedef unsigned short unichar; \n" + "void \n" "$__lldb_class::%s(void *$__lldb_arg) \n" "{ \n" " %s; \n" @@ -141,7 +142,8 @@ } else { - m_transformed_stream.Printf("void \n" + m_transformed_stream.Printf("typedef unsigned short unichar;\n" + "void \n" "%s(void *$__lldb_arg) \n" "{ \n" " %s; \n" Modified: lldb/trunk/source/Interpreter/CommandObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue Oct 26 22:32:59 2010 @@ -220,7 +220,7 @@ Process *process = m_interpreter.GetDebugger().GetExecutionContext().process; if (process == NULL) { - if (GetFlags().IsSet(CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused)) + if (GetFlags().AnySet (CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused)) { result.AppendError ("Process must exist."); result.SetStatus (eReturnStatusFailed); @@ -244,7 +244,7 @@ case eStateDetached: case eStateExited: case eStateUnloaded: - if (GetFlags().IsSet(CommandObject::eFlagProcessMustBeLaunched)) + if (GetFlags().Test(CommandObject::eFlagProcessMustBeLaunched)) { result.AppendError ("Process must be launched."); result.SetStatus (eReturnStatusFailed); @@ -254,7 +254,7 @@ case eStateRunning: case eStateStepping: - if (GetFlags().IsSet(CommandObject::eFlagProcessMustBePaused)) + if (GetFlags().Test(CommandObject::eFlagProcessMustBePaused)) { result.AppendError ("Process is running. Use 'process interrupt' to pause execution."); result.SetStatus (eReturnStatusFailed); Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp Tue Oct 26 22:32:59 2010 @@ -44,7 +44,7 @@ Log *log = LogAccessor (true, NULL); if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Oct 26 22:32:59 2010 @@ -1049,7 +1049,7 @@ } else { - uint32_t section_type = symbol_section->GetAllFlagBits() & SectionFlagMaskSectionType; + uint32_t section_type = symbol_section->Get() & SectionFlagMaskSectionType; switch (section_type) { Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp Tue Oct 26 22:32:59 2010 @@ -367,7 +367,7 @@ else err.Clear(); - if (log && log->GetMask().IsSet(PD_LOG_EXCEPTIONS) || err.Fail()) + if (log && log->GetMask().Test(PD_LOG_EXCEPTIONS) || err.Fail()) err.PutToLog(log, "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal); } @@ -490,7 +490,7 @@ MachException::PortInfo::Restore (task_t task) { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf("MachException::PortInfo::Restore (task = 0x%4.4x)", task); uint32_t i = 0; Error err; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp Tue Oct 26 22:32:59 2010 @@ -163,7 +163,7 @@ if (log) { log->Printf ("MachTask::ReadMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes read", (uint64_t)addr, size, buf, n); - if (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) + if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) { DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4); data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8); @@ -189,7 +189,7 @@ if (log) { log->Printf ("MachTask::WriteMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes written", (uint64_t)addr, size, buf, n); - if (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) + if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) { DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4); data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8); @@ -329,7 +329,7 @@ Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK); if (log || err.Fail()) err.PutToLog(log, "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE) && err.Success()) + if (log && log->GetMask().Test(PD_LOG_VERBOSE) && err.Success()) { float user = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f; float system = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp Tue Oct 26 22:32:59 2010 @@ -142,7 +142,7 @@ // rflags.Clear(trace_bit); // } // -// rflags_scalar = rflags.GetAllFlagBits(); +// rflags_scalar = rflags.Get(); // // If the code makes it here we have changes to the GPRs which // // we need to write back out, so lets do that. // if (reg_ctx->WriteRegisterValue(m_flags_reg, rflags_scalar)) Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp Tue Oct 26 22:32:59 2010 @@ -141,7 +141,7 @@ // rflags.Clear(trace_bit); // } // -// rflags_scalar = rflags.GetAllFlagBits(); +// rflags_scalar = rflags.Get(); // // If the code makes it here we have changes to the GPRs which // // we need to write back out, so lets do that. // if (reg_ctx->WriteRegisterValue(m_flags_reg, rflags_scalar)) Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp Tue Oct 26 22:32:59 2010 @@ -146,7 +146,7 @@ } else { - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) { log->Printf("info = { prot = %u, " "max_prot = %u, " Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Tue Oct 26 22:32:59 2010 @@ -584,7 +584,7 @@ { // locker will keep a mutex locked until it goes out of scope Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ProcessMacOSX::%s (pid = %4.4x)", __FUNCTION__, GetID()); const uint32_t stop_id = GetStopID(); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h Tue Oct 26 22:32:59 2010 @@ -417,7 +417,7 @@ bool ProcessUsingSpringBoard() const { - return m_flags.IsSet(eFlagsUsingSBS); + return m_flags.Test (eFlagsUsingSBS); } lldb_private::ArchSpec& Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Tue Oct 26 22:32:59 2010 @@ -27,7 +27,7 @@ Log *log = g_log; if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } @@ -84,8 +84,8 @@ } if (flag_bits == 0) flag_bits = PD_LOG_DEFAULT; - g_log->GetMask().SetAllFlagBits(flag_bits); - g_log->GetOptions().SetAllFlagBits(log_options); + g_log->GetMask().Reset(flag_bits); + g_log->GetOptions().Reset(log_options); } return g_log; } Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Tue Oct 26 22:32:59 2010 @@ -249,7 +249,7 @@ ThreadMacOSX::Suspend() { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__); lldb::tid_t tid = GetID (); if (ThreadIDIsValid(tid)) @@ -267,7 +267,7 @@ ThreadMacOSX::Resume() { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ()", __FUNCTION__); lldb::tid_t tid = GetID (); if (ThreadIDIsValid(tid)) @@ -288,7 +288,7 @@ ThreadMacOSX::RestoreSuspendCount() { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__); Error err; lldb::tid_t tid = GetID (); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Tue Oct 26 22:32:59 2010 @@ -397,6 +397,9 @@ bool GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) { + if (!data_sp || data_sp->GetBytes() == NULL || data_sp->GetByteSize() == 0) + return false; + GDBRemoteCommunication &gdb_comm = GetGDBProcess().GetGDBRemote(); StringExtractorGDBRemote response; Mutex::Locker locker; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Oct 26 22:32:59 2010 @@ -949,7 +949,7 @@ { // locker will keep a mutex locked until it goes out of scope Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD); - if (log && log->GetMask().IsSet(GDBR_LOG_VERBOSE)) + if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) log->Printf ("ProcessGDBRemote::%s (pid = %i)", __FUNCTION__, GetID()); Mutex::Locker locker (m_thread_list.GetMutex ()); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Tue Oct 26 22:32:59 2010 @@ -27,7 +27,7 @@ Log *log = g_log; if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } @@ -84,8 +84,8 @@ } if (flag_bits == 0) flag_bits = GDBR_LOG_DEFAULT; - g_log->GetMask().SetAllFlagBits(flag_bits); - g_log->GetOptions().SetAllFlagBits(log_options); + g_log->GetMask().Reset(flag_bits); + g_log->GetOptions().Reset(log_options); } return g_log; } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Tue Oct 26 22:32:59 2010 @@ -908,7 +908,7 @@ const DWARFCompileUnit* cu = cu_sp.get(); Stream *s = dumpInfo->strm; - bool show_parents = s->GetFlags().IsSet(DWARFDebugInfo::eDumpFlag_ShowAncestors); + bool show_parents = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowAncestors); if (die) { Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue Oct 26 22:32:59 2010 @@ -1098,7 +1098,7 @@ { const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data(); uint32_t offset = m_offset; - bool english = s->GetFlags().IsSet (DWARFDebugInfo::eDumpFlag_EnglishyNames); + bool english = s->GetFlags().Test (DWARFDebugInfo::eDumpFlag_EnglishyNames); if (debug_info_data.ValidOffset(offset)) { @@ -1171,8 +1171,8 @@ ) { bool verbose = s->GetVerbose(); - bool show_form = s->GetFlags().IsSet(DWARFDebugInfo::eDumpFlag_ShowForm); - bool english = s->GetFlags().IsSet(DWARFDebugInfo::eDumpFlag_EnglishyNames); + bool show_form = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm); + bool english = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_EnglishyNames); const DataExtractor* debug_str_data = dwarf2Data ? &dwarf2Data->get_debug_str_data() : NULL; if (verbose) s->Offset(*offset_ptr); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Tue Oct 26 22:32:59 2010 @@ -156,8 +156,8 @@ } if (flag_bits == 0) flag_bits = DWARF_LOG_DEFAULT; - m_log_sp->GetMask().SetAllFlagBits(flag_bits); - m_log_sp->GetOptions().SetAllFlagBits(log_options); + m_log_sp->GetMask().Reset(flag_bits); + m_log_sp->GetOptions().Reset(log_options); return m_log_sp.get() != NULL; } @@ -187,8 +187,10 @@ { Log *log = GetLog(); if (log) - if (log->GetMask().IsSet(mask)) + { + if (log->GetMask().AllSet(mask)) return log; + } return NULL; } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Oct 26 22:32:59 2010 @@ -1075,12 +1075,12 @@ if (num_attributes > 0) { Declaration decl; - DWARFExpression location; + //DWARFExpression location; const char *name = NULL; bool is_artificial = false; lldb::user_id_t encoding_uid = LLDB_INVALID_UID; AccessType accessibility = eAccessNone; - off_t member_offset = 0; + //off_t member_offset = 0; size_t byte_size = 0; size_t bit_offset = 0; size_t bit_size = 0; @@ -1102,18 +1102,18 @@ case DW_AT_bit_size: bit_size = form_value.Unsigned(); break; case DW_AT_byte_size: byte_size = form_value.Unsigned(); break; case DW_AT_data_member_location: - if (form_value.BlockData()) - { - Value initialValue(0); - Value memberOffset(0); - const DataExtractor& debug_info_data = get_debug_info_data(); - uint32_t block_length = form_value.Unsigned(); - uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); - if (DWARFExpression::Evaluate(NULL, NULL, debug_info_data, NULL, NULL, block_offset, block_length, eRegisterKindDWARF, &initialValue, memberOffset, NULL)) - { - member_offset = memberOffset.ResolveValue(NULL, NULL).UInt(); - } - } +// if (form_value.BlockData()) +// { +// Value initialValue(0); +// Value memberOffset(0); +// const DataExtractor& debug_info_data = get_debug_info_data(); +// uint32_t block_length = form_value.Unsigned(); +// uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); +// if (DWARFExpression::Evaluate(NULL, NULL, debug_info_data, NULL, NULL, block_offset, block_length, eRegisterKindDWARF, &initialValue, memberOffset, NULL)) +// { +// member_offset = memberOffset.ResolveValue(NULL, NULL).UInt(); +// } +// } break; case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType (form_value.Unsigned()); break; @@ -1262,9 +1262,17 @@ { // We have a struct/union/class/enum that needs to be fully resolved. const DWARFDebugInfoEntry* die = m_forward_decl_clang_type_to_die.lookup (ClangASTType::RemoveFastQualifiers(clang_type)); - assert (die); if (die == NULL) - return NULL; + { + // We have already resolved this type... + return clang_type; + } + // Once we start resolving this type, remove it from the forward declaration + // map in case anyone child members or other types require this type to get resolved. + // The type will get resolved when all of the calls to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition + // are done. + m_forward_decl_clang_type_to_die.erase (ClangASTType::RemoveFastQualifiers(clang_type)); + DWARFDebugInfo* debug_info = DebugInfo(); Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct 26 22:32:59 2010 @@ -31,6 +31,7 @@ #undef NDEBUG #include "lldb/Core/dwarf.h" +#include "lldb/Core/Flags.h" #include @@ -1652,10 +1653,18 @@ uint32_t -ClangASTContext::GetTypeInfoMask (clang_type_t clang_type) +ClangASTContext::GetTypeInfo +( + clang_type_t clang_type, + clang::ASTContext *ast_context, + clang_type_t *pointee_or_element_clang_type +) { if (clang_type == NULL) - return false; + return 0; + + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = NULL; QualType qual_type (QualType::getFromOpaquePtr(clang_type)); @@ -1665,51 +1674,87 @@ case clang::Type::Builtin: switch (cast(qual_type)->getKind()) { - default: - break; case clang::BuiltinType::ObjCId: case clang::BuiltinType::ObjCClass: - case clang::BuiltinType::ObjCSel: + if (ast_context && pointee_or_element_clang_type) + *pointee_or_element_clang_type = ast_context->ObjCBuiltinClassTy.getAsOpaquePtr(); return eTypeIsBuiltIn | eTypeIsPointer | eTypeHasValue; + + default: + break; } return eTypeIsBuiltIn | eTypeHasValue; - case clang::Type::BlockPointer: return eTypeIsPointer | eTypeHasChildren | eTypeIsBlock; + + case clang::Type::BlockPointer: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = qual_type->getPointeeType().getAsOpaquePtr(); + return eTypeIsPointer | eTypeHasChildren | eTypeIsBlock; + case clang::Type::Complex: return eTypeHasChildren | eTypeIsBuiltIn | eTypeHasValue; - case clang::Type::ConstantArray: return eTypeHasChildren | eTypeIsArray; + + case clang::Type::ConstantArray: + case clang::Type::DependentSizedArray: + case clang::Type::IncompleteArray: + case clang::Type::VariableArray: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = cast(qual_type.getTypePtr())->getElementType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsArray; + case clang::Type::DependentName: return 0; - case clang::Type::DependentSizedArray: return eTypeHasChildren | eTypeIsArray; case clang::Type::DependentSizedExtVector: return eTypeHasChildren | eTypeIsVector; case clang::Type::DependentTemplateSpecialization: return eTypeIsTemplate; case clang::Type::Decltype: return 0; - case clang::Type::Enum: return eTypeIsEnumeration | eTypeHasValue; + + case clang::Type::Enum: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = cast(qual_type)->getDecl()->getIntegerType().getAsOpaquePtr(); + return eTypeIsEnumeration | eTypeHasValue; + case clang::Type::Elaborated: return 0; case clang::Type::ExtVector: return eTypeHasChildren | eTypeIsVector; case clang::Type::FunctionProto: return eTypeIsFuncPrototype | eTypeHasValue; case clang::Type::FunctionNoProto: return eTypeIsFuncPrototype | eTypeHasValue; - case clang::Type::IncompleteArray: return eTypeHasChildren | eTypeIsArray; case clang::Type::InjectedClassName: return 0; - case clang::Type::LValueReference: return eTypeHasChildren | eTypeIsReference | eTypeHasValue; + + case clang::Type::LValueReference: + case clang::Type::RValueReference: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = cast(qual_type.getTypePtr())->getPointeeType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsReference | eTypeHasValue; + case clang::Type::MemberPointer: return eTypeIsPointer | eTypeIsMember | eTypeHasValue; - case clang::Type::ObjCObjectPointer: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass | eTypeIsPointer | eTypeHasValue; + + case clang::Type::ObjCObjectPointer: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = qual_type->getPointeeType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsObjC | eTypeIsClass | eTypeIsPointer | eTypeHasValue; + case clang::Type::ObjCObject: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass; case clang::Type::ObjCInterface: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass; - case clang::Type::Pointer: return eTypeHasChildren | eTypeIsPointer | eTypeHasValue; + + case clang::Type::Pointer: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = qual_type->getPointeeType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsPointer | eTypeHasValue; + case clang::Type::Record: if (qual_type->getAsCXXRecordDecl()) return eTypeHasChildren | eTypeIsClass | eTypeIsCPlusPlus; else return eTypeHasChildren | eTypeIsStructUnion; break; - case clang::Type::RValueReference: return eTypeHasChildren | eTypeIsReference | eTypeHasValue; case clang::Type::SubstTemplateTypeParm: return eTypeIsTemplate; case clang::Type::TemplateTypeParm: return eTypeIsTemplate; case clang::Type::TemplateSpecialization: return eTypeIsTemplate; - case clang::Type::Typedef: return eTypeIsTypedef | - ClangASTContext::GetTypeInfoMask (cast(qual_type)->LookThroughTypedefs().getAsOpaquePtr()); + + case clang::Type::Typedef: + return eTypeIsTypedef | ClangASTContext::GetTypeInfo (cast(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), + ast_context, + pointee_or_element_clang_type); + case clang::Type::TypeOfExpr: return 0; case clang::Type::TypeOf: return 0; case clang::Type::UnresolvedUsing: return 0; - case clang::Type::VariableArray: return eTypeHasChildren | eTypeIsArray; case clang::Type::Vector: return eTypeHasChildren | eTypeIsVector; default: return 0; } @@ -1767,10 +1812,10 @@ case clang::Type::Builtin: switch (cast(qual_type)->getKind()) { - case clang::BuiltinType::ObjCId: // Child is Class + case clang::BuiltinType::ObjCId: // child is Class case clang::BuiltinType::ObjCClass: // child is Class - case clang::BuiltinType::ObjCSel: // child is const char * num_children = 1; + break; default: break; @@ -1880,6 +1925,22 @@ } break; + case clang::Type::LValueReference: + case clang::Type::RValueReference: + { + ReferenceType *reference_type = cast(qual_type.getTypePtr()); + QualType pointee_type = reference_type->getPointeeType(); + uint32_t num_pointee_children = ClangASTContext::GetNumChildren (pointee_type.getAsOpaquePtr(), + omit_empty_base_classes); + // If this type points to a simple type, then it has 1 child + if (num_pointee_children == 0) + num_children = 1; + else + num_children = num_pointee_children; + } + break; + + case clang::Type::Typedef: num_children = ClangASTContext::GetNumChildren (cast(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), omit_empty_base_classes); break; @@ -1963,15 +2024,6 @@ child_byte_size = ast_context->getTypeSize(ast_context->ObjCBuiltinClassTy) / CHAR_BIT; return ast_context->ObjCBuiltinClassTy.getAsOpaquePtr(); - case clang::BuiltinType::ObjCSel: - { - QualType char_type(ast_context->CharTy); - char_type.addConst(); - child_byte_size = ast_context->getTypeSize(char_type); - return char_type.getAsOpaquePtr(); - } - break; - default: break; } @@ -2247,6 +2299,48 @@ } break; + case clang::Type::LValueReference: + case clang::Type::RValueReference: + { + ReferenceType *reference_type = cast(parent_qual_type.getTypePtr()); + QualType pointee_type(reference_type->getPointeeType()); + clang_type_t pointee_clang_type = pointee_type.getAsOpaquePtr(); + if (transparent_pointers && ClangASTContext::IsAggregateType (pointee_clang_type)) + { + return GetChildClangTypeAtIndex (ast_context, + parent_name, + pointee_clang_type, + idx, + transparent_pointers, + omit_empty_base_classes, + child_name, + child_byte_size, + child_byte_offset, + child_bitfield_bit_size, + child_bitfield_bit_offset, + child_is_base_class); + } + else + { + if (parent_name) + { + child_name.assign(1, '&'); + child_name += parent_name; + } + + // We have a pointer to an simple type + if (idx == 0) + { + std::pair clang_type_info = ast_context->getTypeInfo(pointee_type); + assert(clang_type_info.first % 8 == 0); + child_byte_size = clang_type_info.first / 8; + child_byte_offset = 0; + return pointee_type.getAsOpaquePtr(); + } + } + } + break; + case clang::Type::Typedef: return GetChildClangTypeAtIndex (ast_context, parent_name, @@ -3379,7 +3473,6 @@ break; case clang::BuiltinType::ObjCId: case clang::BuiltinType::ObjCClass: - case clang::BuiltinType::ObjCSel: return true; } return false; @@ -3451,7 +3544,6 @@ break; case clang::BuiltinType::ObjCId: case clang::BuiltinType::ObjCClass: - case clang::BuiltinType::ObjCSel: return true; } return false; @@ -3564,67 +3656,43 @@ } - +bool +ClangASTContext::IsCharType (clang_type_t clang_type) +{ + if (clang_type) + return QualType::getFromOpaquePtr(clang_type)->isCharType(); + return false; +} bool ClangASTContext::IsCStringType (clang_type_t clang_type, uint32_t &length) { - if (clang_type) + clang_type_t pointee_or_element_clang_type = NULL; + Flags type_flags (ClangASTContext::GetTypeInfo (clang_type, NULL, &pointee_or_element_clang_type)); + + if (pointee_or_element_clang_type == NULL) + return false; + + if (type_flags.AnySet (eTypeIsArray | eTypeIsPointer)) { - QualType qual_type (QualType::getFromOpaquePtr(clang_type)); - const clang::Type::TypeClass type_class = qual_type->getTypeClass(); - switch (type_class) + QualType pointee_or_element_qual_type (QualType::getFromOpaquePtr (pointee_or_element_clang_type)); + + if (pointee_or_element_qual_type.getUnqualifiedType()->isCharType()) { - case clang::Type::ConstantArray: + QualType qual_type (QualType::getFromOpaquePtr(clang_type)); + if (type_flags.Test (eTypeIsArray)) { - ConstantArrayType *array = cast(qual_type.getTypePtr()); - QualType element_qual_type = array->getElementType(); - clang::Type *canonical_type = element_qual_type->getCanonicalTypeInternal().getTypePtr(); - if (canonical_type && canonical_type->isCharType()) - { - // We know the size of the array and it could be a C string - // since it is an array of characters - length = array->getSize().getLimitedValue(); - return true; - } + // We know the size of the array and it could be a C string + // since it is an array of characters + length = cast(qual_type.getTypePtr())->getSize().getLimitedValue(); + return true; } - break; - - case clang::Type::Pointer: + else { - PointerType *pointer_type = cast(qual_type.getTypePtr()); - clang::Type *pointee_type_ptr = pointer_type->getPointeeType().getTypePtr(); - if (pointee_type_ptr) - { - clang::Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr(); - length = 0; // No length info, read until a NULL terminator is received - if (canonical_type_ptr) - return canonical_type_ptr->isCharType(); - else - return pointee_type_ptr->isCharType(); - } + length = 0; + return true; } - break; - case clang::Type::Typedef: - return ClangASTContext::IsCStringType (cast(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), length); - - case clang::Type::LValueReference: - case clang::Type::RValueReference: - { - ReferenceType *reference_type = cast(qual_type.getTypePtr()); - clang::Type *pointee_type_ptr = reference_type->getPointeeType().getTypePtr(); - if (pointee_type_ptr) - { - clang::Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr(); - length = 0; // No length info, read until a NULL terminator is received - if (canonical_type_ptr) - return canonical_type_ptr->isCharType(); - else - return pointee_type_ptr->isCharType(); - } - } - break; } } return false; @@ -3659,8 +3727,17 @@ return false; } - - +size_t +ClangASTContext::GetArraySize (clang_type_t clang_type) +{ + if (clang_type) + { + ConstantArrayType *array = cast(QualType::getFromOpaquePtr(clang_type).getTypePtr()); + if (array) + return array->getSize().getLimitedValue(); + } + return 0; +} bool ClangASTContext::IsArrayType (clang_type_t clang_type, clang_type_t*member_type, uint64_t *size) Modified: lldb/trunk/source/Symbol/Type.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Type.cpp (original) +++ lldb/trunk/source/Symbol/Type.cpp Tue Oct 26 22:32:59 2010 @@ -542,16 +542,16 @@ if (encoding_type != NULL) { bool forward_decl_is_ok_for_encoding = forward_decl_is_ok; - switch (m_encoding_uid_type) - { - case eEncodingIsPointerUID: - case eEncodingIsLValueReferenceUID: - case eEncodingIsRValueReferenceUID: - forward_decl_is_ok_for_encoding = true; - break; - default: - break; - } +// switch (m_encoding_uid_type) +// { +// case eEncodingIsPointerUID: +// case eEncodingIsLValueReferenceUID: +// case eEncodingIsRValueReferenceUID: +// forward_decl_is_ok_for_encoding = true; +// break; +// default: +// break; +// } if (encoding_type->ResolveClangType (forward_decl_is_ok_for_encoding)) { Modified: lldb/trunk/source/Target/StackFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Target/StackFrame.cpp (original) +++ lldb/trunk/source/Target/StackFrame.cpp Tue Oct 26 22:32:59 2010 @@ -239,7 +239,7 @@ m_frame_code_addr.SetOffset(pc); m_frame_code_addr.SetSection(NULL); m_sc.Clear(); - m_flags.SetAllFlagBits(0); + m_flags.Reset(0); m_thread.ClearStackFrames (); } @@ -299,7 +299,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope) { // Copy our internal symbol context into "sc". - if ((m_flags.GetAllFlagBits() & resolve_scope) != resolve_scope) + if ((m_flags.Get() & resolve_scope) != resolve_scope) { // Resolve our PC to section offset if we haven't alreday done so // and if we don't have a module. The resolved address section will Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Tue Oct 26 22:32:59 2010 @@ -231,7 +231,7 @@ StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); - if (flags.IsSet(eAvoidNoDebug)) + if (flags.Test(eAvoidNoDebug)) { if (!frame->HasDebugInformation()) { Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Tue Oct 26 22:32:59 2010 @@ -47,7 +47,7 @@ { Log *log = LogAccessor (true, NULL); if (log) - return log->GetMask().GetAllFlagBits(); + return log->GetMask().Get(); return 0; } @@ -64,7 +64,7 @@ Log *log = LogAccessor (true, NULL); if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } @@ -101,7 +101,7 @@ lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask) { Log *log = LogAccessor (true, NULL); - if (log && mask && (mask & log->GetMask().GetAllFlagBits())) + if (log && mask && (mask & log->GetMask().Get())) return log; return NULL; } @@ -121,7 +121,7 @@ uint32_t flag_bits; Log* log = LogAccessor (true, NULL); if (log) - flag_bits = log->GetMask().GetAllFlagBits(); + flag_bits = log->GetMask().Get(); else flag_bits = 0; @@ -166,8 +166,8 @@ } } - log->GetMask().SetAllFlagBits(flag_bits); - log->GetOptions().SetAllFlagBits(log_options); + log->GetMask().Reset(flag_bits); + log->GetOptions().Reset(log_options); } return log; } Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=117437&r1=117436&r2=117437&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Tue Oct 26 22:32:59 2010 @@ -369,6 +369,7 @@ isa = PBXProject; buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, From gclayton at apple.com Tue Oct 26 23:01:15 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 27 Oct 2010 04:01:15 -0000 Subject: [Lldb-commits] [lldb] r117438 - /lldb/trunk/source/Symbol/ClangASTContext.cpp Message-ID: <20101027040115.171032A6C12C@llvm.org> Author: gclayton Date: Tue Oct 26 23:01:14 2010 New Revision: 117438 URL: http://llvm.org/viewvc/llvm-project?rev=117438&view=rev Log: Don't include the ":" character when building the selector identifiers when making objective C classes from the DWARF. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=117438&r1=117437&r2=117438&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct 26 23:01:14 2010 @@ -1570,13 +1570,13 @@ start += len) { len = ::strcspn(start, ":]"); - if (start[len] == ':') - { + bool has_arg = (start[len] == ':'); + if (has_arg) ++num_selectors_with_args; - len += 1; - } - //printf ("@selector[%zu] = '%.*s'\n", selector_idents.size(), (int)len, start); + printf ("@selector[%zu] = '%.*s'\n", selector_idents.size(), (int)len, start); selector_idents.push_back (&identifier_table->get (StringRef (start, len))); + if (has_arg) + len += 1; } From ctice at apple.com Wed Oct 27 13:34:43 2010 From: ctice at apple.com (Caroline Tice) Date: Wed, 27 Oct 2010 18:34:43 -0000 Subject: [Lldb-commits] [lldb] r117470 - in /lldb/trunk/source: Commands/CommandObjectBreakpointCommand.cpp Interpreter/ScriptInterpreterPython.cpp Message-ID: <20101027183443.0D1F12A6C130@llvm.org> Author: ctice Date: Wed Oct 27 13:34:42 2010 New Revision: 117470 URL: http://llvm.org/viewvc/llvm-project?rev=117470&view=rev Log: Flush the prompts immediately in the breakpoint command input readers, to make sure they come out at the correct times. Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=117470&r1=117469&r2=117470&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Wed Oct 27 13:34:42 2010 @@ -435,6 +435,7 @@ ::fprintf (out_fh, "%s\n", g_reader_instructions); if (reader.GetPrompt()) ::fprintf (out_fh, "%s", reader.GetPrompt()); + ::fflush (out_fh); } break; @@ -443,7 +444,10 @@ case eInputReaderReactivate: if (out_fh && reader.GetPrompt()) + { ::fprintf (out_fh, "%s", reader.GetPrompt()); + ::fflush (out_fh); + } break; case eInputReaderGotToken: @@ -458,7 +462,10 @@ } } if (out_fh && !reader.IsDone() && reader.GetPrompt()) + { ::fprintf (out_fh, "%s", reader.GetPrompt()); + ::fflush (out_fh); + } break; case eInputReaderDone: Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=117470&r1=117469&r2=117470&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original) +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Wed Oct 27 13:34:42 2010 @@ -638,6 +638,7 @@ ::fprintf (out_fh, "%s\n", g_reader_instructions); if (reader.GetPrompt()) ::fprintf (out_fh, "%s", reader.GetPrompt()); + ::fflush (out_fh); } } break; @@ -647,7 +648,10 @@ case eInputReaderReactivate: if (reader.GetPrompt() && out_fh) + { ::fprintf (out_fh, "%s", reader.GetPrompt()); + ::fflush (out_fh); + } break; case eInputReaderGotToken: @@ -655,7 +659,10 @@ std::string temp_string (bytes, bytes_len); commands_in_progress.AppendString (temp_string.c_str()); if (out_fh && !reader.IsDone() && reader.GetPrompt()) + { ::fprintf (out_fh, "%s", reader.GetPrompt()); + ::fflush (out_fh); + } } break; From ctice at apple.com Wed Oct 27 16:23:37 2010 From: ctice at apple.com (Caroline Tice) Date: Wed, 27 Oct 2010 21:23:37 -0000 Subject: [Lldb-commits] [lldb] r117493 - in /lldb/trunk/source/API: SBCommandInterpreter.cpp SBListener.cpp Message-ID: <20101027212337.86C632A6C139@llvm.org> Author: ctice Date: Wed Oct 27 16:23:37 2010 New Revision: 117493 URL: http://llvm.org/viewvc/llvm-project?rev=117493&view=rev Log: Fix bugs attempting to write to API log after it has been disabled. Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBListener.cpp Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=117493&r1=117492&r2=117493&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Wed Oct 27 16:23:37 2010 @@ -87,6 +87,8 @@ result->SetStatus (eReturnStatusFailed); } + // We need to get the value again, in case the command disabled the log! + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117493&r1=117492&r2=117493&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Wed Oct 27 16:23:37 2010 @@ -119,7 +119,6 @@ bool SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); //if (log) //{ @@ -141,6 +140,7 @@ 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::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'true'", m_opaque_ptr, num_seconds, event.get()); @@ -148,6 +148,7 @@ } } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBListener::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'false'", m_opaque_ptr, num_seconds, event.get()); From ctice at apple.com Wed Oct 27 17:07:28 2010 From: ctice at apple.com (Caroline Tice) Date: Wed, 27 Oct 2010 22:07:28 -0000 Subject: [Lldb-commits] [lldb] r117497 - /lldb/trunk/source/API/SBFrame.cpp Message-ID: <20101027220728.89E1F2A6C144@llvm.org> Author: ctice Date: Wed Oct 27 17:07:28 2010 New Revision: 117497 URL: http://llvm.org/viewvc/llvm-project?rev=117497&view=rev Log: Make SBFrame::GetDescription a little more descriptive. Modified: lldb/trunk/source/API/SBFrame.cpp Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=117497&r1=117496&r2=117497&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Wed Oct 27 17:07:28 2010 @@ -527,7 +527,11 @@ { if (m_opaque_sp) { - description.Printf("SBFrame: idx = %u", m_opaque_sp->GetFrameIndex()); + 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); } else description.Printf ("No value"); From jingham at apple.com Wed Oct 27 17:58:34 2010 From: jingham at apple.com (Jim Ingham) Date: Wed, 27 Oct 2010 22:58:34 -0000 Subject: [Lldb-commits] [lldb] r117503 - /lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Message-ID: <20101027225834.C18AC2A6C14A@llvm.org> Author: jingham Date: Wed Oct 27 17:58:34 2010 New Revision: 117503 URL: http://llvm.org/viewvc/llvm-project?rev=117503&view=rev Log: Replace unnecessary dynamic_cast with static_cast. Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=117503&r1=117502&r2=117503&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Wed Oct 27 17:58:34 2010 @@ -352,7 +352,7 @@ { s->EOL(); s->Indent("compile unit = "); - dynamic_cast(sc.comp_unit)->GetFilename().Dump (s); + static_cast(sc.comp_unit)->GetFilename().Dump (s); if (sc.function != NULL) { From gclayton at apple.com Wed Oct 27 19:56:12 2010 From: gclayton at apple.com (Greg Clayton) Date: Thu, 28 Oct 2010 00:56:12 -0000 Subject: [Lldb-commits] [lldb] r117516 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Commands/CommandObjectFrame.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20101028005612.2B0BB2A6C12D@llvm.org> Author: gclayton Date: Wed Oct 27 19:56:11 2010 New Revision: 117516 URL: http://llvm.org/viewvc/llvm-project?rev=117516&view=rev Log: Fixed the "frame variable -G NAME" that would print global variables by name. It was accidentally getting all the globals for the compile unit that contained the global variable named NAME. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117516&r1=117515&r2=117516&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Oct 27 19:56:11 2010 @@ -2501,7 +2501,6 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=117516&r1=117515&r2=117516&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Oct 27 19:56:11 2010 @@ -847,7 +847,7 @@ { LLDB_OPT_SET_1, false, "show-types", 't', no_argument, NULL, 0, eArgTypeNone, "Show variable types when dumping values."}, { LLDB_OPT_SET_1, false, "no-summary", 'y', no_argument, NULL, 0, eArgTypeNone, "Omit summary information."}, { LLDB_OPT_SET_1, false, "scope", 's', no_argument, NULL, 0, eArgTypeNone, "Show variable scope (argument, local, global, static)."}, -{ LLDB_OPT_SET_1, false, "objc", 'o', no_argument, NULL, 0, eArgTypeNone, "When looking up a variable by name (--name), print as an Objective-C object."}, +{ LLDB_OPT_SET_1, false, "objc", 'o', no_argument, NULL, 0, eArgTypeNone, "When looking up a variable by name, print as an Objective-C object."}, { LLDB_OPT_SET_1, false, "ptr-depth", 'p', required_argument, NULL, 0, eArgTypeCount, "The number of pointers to be traversed when dumping values (default is zero)."}, { LLDB_OPT_SET_1, false, "regex", 'r', no_argument, NULL, 0, eArgTypeRegularExpression, "The argument for name lookups are regular expressions."}, { LLDB_OPT_SET_1, false, "flat", 'f', no_argument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."}, Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=117516&r1=117515&r2=117516&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 27 19:56:11 2010 @@ -3709,7 +3709,12 @@ dw_tag_t tag = die->Tag(); // Check to see if we have already parsed this variable or constant? - if (m_die_to_variable_sp[die].get() == NULL) + if (m_die_to_variable_sp[die]) + { + if (cc_variable_list) + cc_variable_list->AddVariable (m_die_to_variable_sp[die]); + } + else { // We haven't already parsed it, lets do that now. if ((tag == DW_TAG_variable) || @@ -3720,6 +3725,8 @@ if (var_sp) { variables->AddVariable(var_sp); + if (cc_variable_list) + cc_variable_list->AddVariable (var_sp); ++vars_added; } } @@ -3729,8 +3736,7 @@ if (!skip_children && parse_children && die->HasChildren()) { - vars_added += ParseVariables(sc, dwarf_cu, func_low_pc, die->GetFirstChild(), true, true); - //vars_added += ParseVariables(sc, dwarf_cu, die->GetFirstChild(), parse_siblings, parse_children); + vars_added += ParseVariables(sc, dwarf_cu, func_low_pc, die->GetFirstChild(), true, true, cc_variable_list); } if (parse_siblings) @@ -3739,11 +3745,6 @@ die = NULL; } - if (cc_variable_list) - { - cc_variable_list->AddVariables(variables.get()); - } - return vars_added; } From bugzilla-daemon at llvm.org Thu Oct 28 07:29:22 2010 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Thu, 28 Oct 2010 07:29:22 -0500 (CDT) Subject: [Lldb-commits] [Bug 8493] New: File name "2010-10-19-14:10:49.059609" is non-portable Message-ID: http://llvm.org/bugs/show_bug.cgi?id=8493 Summary: File name "2010-10-19-14:10:49.059609" is non-portable Product: lldb Version: unspecified Platform: PC OS/Version: Windows NT Status: NEW Severity: normal Priority: P Component: All Bugs AssignedTo: lldb-commits at cs.uiuc.edu ReportedBy: chengang31 at gmail.com There is a file with a non-portable name: docs\testsuite\2010-10-19-14:10:49.059609 Using colon in file name is not permitted in MS Windows, svn will throw a error and can not checkout it. Please change it to a portable name. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From johnny.chen at apple.com Thu Oct 28 11:24:26 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 28 Oct 2010 16:24:26 -0000 Subject: [Lldb-commits] [lldb] r117554 - in /lldb/trunk/docs/testsuite: 2010-10-19-14:10:49.059609/ 2010-10-19-14_10_49.059609/ a-detailed-walkthrough.txt Message-ID: <20101028162426.C63922A6C12C@llvm.org> Author: johnny Date: Thu Oct 28 11:24:26 2010 New Revision: 117554 URL: http://llvm.org/viewvc/llvm-project?rev=117554&view=rev Log: Fix http://llvm.org/bugs/show_bug.cgi?id=8493 File name "2010-10-19-14:10:49.059609" is non-portable. Added: lldb/trunk/docs/testsuite/2010-10-19-14_10_49.059609/ - copied from r117514, lldb/trunk/docs/testsuite/2010-10-19-14:10:49.059609/ Removed: lldb/trunk/docs/testsuite/2010-10-19-14:10:49.059609/ Modified: lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt Modified: lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt?rev=117554&r1=117553&r2=117554&view=diff ============================================================================== --- lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt (original) +++ lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt Thu Oct 28 11:24:26 2010 @@ -296,6 +296,11 @@ FAILED (failures=1) /Volumes/data/lldb/svn/trunk/test $ ls 2010-10-19-14:10:49.059609 + +NOTE: This directory name has been changed to not contain the ':' character + which is not allowed in windows platforms. We'll change the ':' to '_' + and get rid of the microsecond resolution by modifying the test driver. + TestSettings.SettingsCommandTestCase.test_set_output_path.log /Volumes/data/lldb/svn/trunk/test $ From ctice at apple.com Thu Oct 28 11:28:56 2010 From: ctice at apple.com (Caroline Tice) Date: Thu, 28 Oct 2010 16:28:56 -0000 Subject: [Lldb-commits] [lldb] r117555 - /lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Message-ID: <20101028162857.0B0142A6C12C@llvm.org> Author: ctice Date: Thu Oct 28 11:28:56 2010 New Revision: 117555 URL: http://llvm.org/viewvc/llvm-project?rev=117555&view=rev Log: Add warning if no actual locations were resolved when attempting to set a breakpoint. Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=117555&r1=117554&r2=117555&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Thu Oct 28 11:28:56 2010 @@ -372,6 +372,9 @@ output_stream.Printf ("Breakpoint created: "); bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief); output_stream.EOL(); + if (bp->GetNumLocations() == 0) + output_stream.Printf ("WARNING: Unable to resolve breakpoint to any actual" + " locations.\n"); result.SetStatus (eReturnStatusSuccessFinishResult); } else @@ -416,6 +419,9 @@ output_stream.Printf ("Breakpoint created: "); bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief); output_stream.EOL(); + if (bp->GetNumLocations() == 0) + output_stream.Printf ("WARNING: Unable to resolve breakpoint to any actual" + " locations.\n"); result.SetStatus (eReturnStatusSuccessFinishResult); } else @@ -446,6 +452,9 @@ output_stream.Printf ("Breakpoint created: "); bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief); output_stream.EOL(); + if (bp->GetNumLocations() == 0) + output_stream.Printf ("WARNING: Unable to resolve breakpoint to any actual" + " locations.\n"); result.SetStatus (eReturnStatusSuccessFinishResult); } else @@ -490,6 +499,8 @@ output_stream.Printf ("Breakpoint created: "); bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief); output_stream.EOL(); + if (bp->GetNumLocations() == 0) + output_stream.Printf ("WARNING: Unable to resolve breakpoint to any actual locations.\n"); result.SetStatus (eReturnStatusSuccessFinishResult); } else if (!bp) From johnny.chen at apple.com Thu Oct 28 11:32:13 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 28 Oct 2010 16:32:13 -0000 Subject: [Lldb-commits] [lldb] r117556 - /lldb/trunk/test/dotest.py Message-ID: <20101028163213.553D12A6C12C@llvm.org> Author: johnny Date: Thu Oct 28 11:32:13 2010 New Revision: 117556 URL: http://llvm.org/viewvc/llvm-project?rev=117556&view=rev Log: Fix the test driver as part of the fix for http://llvm.org/bugs/show_bug.cgi?id=8493 File name "2010-10-19-14:10:49.059609" is non-portable. Do not use ':' in the pathname as it is not permitted on windows platforms. Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=117556&r1=117555&r2=117556&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Thu Oct 28 11:32:13 2010 @@ -565,7 +565,7 @@ # See also TestBase.dumpSessionInfo() in lldbtest.py. if not sdir_name: import datetime - timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S") + timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") sdir_name = timestamp os.environ["LLDB_SESSION_DIRNAME"] = sdir_name sys.stderr.write("\nSession info for test failures/errors will go into directory '%s'\n" % sdir_name) From bugzilla-daemon at llvm.org Thu Oct 28 11:36:29 2010 From: bugzilla-daemon at llvm.org (bugzilla-daemon at llvm.org) Date: Thu, 28 Oct 2010 11:36:29 -0500 (CDT) Subject: [Lldb-commits] [Bug 8493] File name "2010-10-19-14:10:49.059609" is non-portable In-Reply-To: References: Message-ID: <20101028163629.280382A6C12D@llvm.org> http://llvm.org/bugs/show_bug.cgi?id=8493 johnny.chen at apple.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |johnny.chen at apple.com Resolution| |FIXED --- Comment #1 from johnny.chen at apple.com 2010-10-28 11:36:28 CDT --- Fix the offending directory name under docs/testsuite as r117554. And fix the test driver as r117556. -- Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. From johnny.chen at apple.com Thu Oct 28 12:27:46 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 28 Oct 2010 17:27:46 -0000 Subject: [Lldb-commits] [lldb] r117562 - in /lldb/trunk: include/lldb/Breakpoint/ source/Breakpoint/ source/Commands/ Message-ID: <20101028172746.B31102A6C12C@llvm.org> Author: johnny Date: Thu Oct 28 12:27:46 2010 New Revision: 117562 URL: http://llvm.org/viewvc/llvm-project?rev=117562&view=rev Log: Check in an initial implementation of the "breakpoint clear" command, whose purpose is clear the breakpoint associated with the (filename, line_number) combo when an arrow is pointing to a source position using Emacs Grand Unified Debugger library to interact with lldb. The current implmentation is insufficient in that it only asks the breakpoint whether it is associated with a breakpoint resolver with FileLine type and whether it matches the (filename, line_number) combo. There are other breakpoint resolver types whose breakpoint locations can potentially match the (filename, line_number) combo. The BreakpointResolver, BreakpointResolverName, BreakpointResolverAddress, and BreakpointResolverFileLine classes have extra static classof methods to support LLVM style type inquiry through isa, cast, and dyn_cast. The Breakpoint class has an API method bool GetMatchingFileLine(...) which is invoked from CommandObjectBreak.cpp to implement the "breakpoint clear" command. Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointResolver.cpp lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.h Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original) +++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Thu Oct 28 12:27:46 2010 @@ -458,6 +458,21 @@ void GetResolverDescription (Stream *s); + //------------------------------------------------------------------ + /// Find breakpoint locations which match the (filename, line_number) description. + /// The breakpoint location collection is to be filled with the matching locations. + /// It should be initialized with 0 size by the API client. + /// + /// @return + /// True if there is a match + /// + /// The locations which match the filename and line_number in loc_coll. If its + /// size is 0 and true is returned, it means the breakpoint fully matches the + /// description. + //------------------------------------------------------------------ + bool GetMatchingFileLine(const ConstString &filename, uint32_t line_number, + BreakpointLocationCollection &loc_coll); + void GetFilterDescription (Stream *s); Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h Thu Oct 28 12:27:46 2010 @@ -52,11 +52,13 @@ /// /// @param[in] bkpt /// The breakpoint that owns this resolver. + /// @param[in] resolverType + /// The concrete breakpoint resolver type for this breakpoint. /// /// @result /// Returns breakpoint location id. //------------------------------------------------------------------ - BreakpointResolver (Breakpoint *bkpt); + BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType); //------------------------------------------------------------------ /// The Destructor is virtual, all significant breakpoint resolvers derive @@ -110,11 +112,32 @@ virtual void Dump (Stream *s) const = 0; + //------------------------------------------------------------------ + /// An enumeration for keeping track of the concrete subclass that + /// is actually instantiated. Values of this enumeration are kept in the + /// BreakpointResolver's SubclassID field. They are used for concrete type + /// identification. + enum ResolverTy { + FileLineResolver, // This is an instance of BreakpointResolverFileLine + AddressResolver, // This is an instance of BreakpointResolverAddress + NameResolver // This is an instance of BreakpointResolverName + }; + + //------------------------------------------------------------------ + /// getResolverID - Return an ID for the concrete type of this object. This + /// is used to implement the LLVM classof checks. This should not be used + /// for any other purpose, as the values may change as LLDB evolves. + unsigned getResolverID() const { + return SubclassID; + } + protected: Target *m_target; // Every resolver has a target. Breakpoint *m_breakpoint; // This is the breakpoint we add locations to. private: + // Subclass identifier (for llvm isa/dyn_cast) + const unsigned char SubclassID; DISALLOW_COPY_AND_ASSIGN(BreakpointResolver); }; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h Thu Oct 28 12:27:46 2010 @@ -56,6 +56,12 @@ virtual void Dump (Stream *s) const; + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const BreakpointResolverAddress *) { return true; } + static inline bool classof(const BreakpointResolver *V) { + return V->getResolverID() == BreakpointResolver::AddressResolver; + } + protected: Address m_addr; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h Thu Oct 28 12:27:46 2010 @@ -51,7 +51,14 @@ virtual void Dump (Stream *s) const; + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const BreakpointResolverFileLine *) { return true; } + static inline bool classof(const BreakpointResolver *V) { + return V->getResolverID() == BreakpointResolver::FileLineResolver; + } + protected: + friend class Breakpoint; FileSpec m_file_spec; // This is the file spec we are looking for. uint32_t m_line_number; // This is the line number that we are looking for. bool m_inlines; // This determines whether the resolver looks for inlined functions or not. Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h Thu Oct 28 12:27:46 2010 @@ -61,6 +61,12 @@ virtual void Dump (Stream *s) const; + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const BreakpointResolverName *) { return true; } + static inline bool classof(const BreakpointResolver *V) { + return V->getResolverID() == BreakpointResolver::NameResolver; + } + protected: ConstString m_func_name; // "m_basename_filter" is used to filter results after searching for Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Thu Oct 28 12:27:46 2010 @@ -16,7 +16,9 @@ #include "lldb/Core/Address.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Breakpoint/BreakpointLocationCollection.h" #include "lldb/Breakpoint/BreakpointResolver.h" +#include "lldb/Breakpoint/BreakpointResolverFileLine.h" #include "lldb/Core/Log.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/SearchFilter.h" @@ -26,9 +28,11 @@ #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" #include "lldb/lldb-private-log.h" +#include "llvm/Support/Casting.h" using namespace lldb; using namespace lldb_private; +using namespace llvm; const ConstString & Breakpoint::GetEventIdentifier () @@ -533,6 +537,27 @@ m_resolver_sp->GetDescription (s); } + +bool +Breakpoint::GetMatchingFileLine (const ConstString &filename, uint32_t line_number, BreakpointLocationCollection &loc_coll) +{ + // TODO: To be correct, this method needs to fill the breakpoint location collection + // with the location IDs which match the filename and line_number. + // + + if (m_resolver_sp) + { + BreakpointResolverFileLine *resolverFileLine = dyn_cast(m_resolver_sp.get()); + if (resolverFileLine && + resolverFileLine->m_file_spec.GetFilename() == filename && + resolverFileLine->m_line_number == line_number) + { + return true; + } + } + return false; +} + void Breakpoint::GetFilterDescription (Stream *s) { Modified: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolver.cpp?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp Thu Oct 28 12:27:46 2010 @@ -30,8 +30,9 @@ //---------------------------------------------------------------------- // BreakpointResolver: //---------------------------------------------------------------------- -BreakpointResolver::BreakpointResolver (Breakpoint *bkpt) : - m_breakpoint (bkpt) +BreakpointResolver::BreakpointResolver (Breakpoint *bkpt, const unsigned char resolverTy) : + m_breakpoint (bkpt), + SubclassID (resolverTy) { } Modified: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp Thu Oct 28 12:27:46 2010 @@ -31,7 +31,7 @@ Breakpoint *bkpt, const Address &addr ) : - BreakpointResolver (bkpt), + BreakpointResolver (bkpt, BreakpointResolver::AddressResolver), m_addr (addr) { } Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Thu Oct 28 12:27:46 2010 @@ -31,7 +31,7 @@ uint32_t line_no, bool check_inlines ) : - BreakpointResolver (bkpt), + BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver), m_file_spec (file_spec), m_line_number (line_no), m_inlines (check_inlines) Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Thu Oct 28 12:27:46 2010 @@ -28,7 +28,7 @@ uint32_t func_name_type_mask, Breakpoint::MatchType type ) : - BreakpointResolver (bkpt), + BreakpointResolver (bkpt, BreakpointResolver::NameResolver), m_func_name (), m_basename_filter (), m_func_name_type_mask (func_name_type_mask), @@ -94,7 +94,7 @@ Breakpoint *bkpt, RegularExpression &func_regex ) : - BreakpointResolver (bkpt), + BreakpointResolver (bkpt, BreakpointResolver::NameResolver), m_func_name (NULL), m_class_name (NULL), m_regex (func_regex), @@ -110,7 +110,7 @@ const char *method, Breakpoint::MatchType type ) : - BreakpointResolver (bkpt), + BreakpointResolver (bkpt, BreakpointResolver::NameResolver), m_func_name (method), m_class_name (class_name), m_regex (), Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Thu Oct 28 12:27:46 2010 @@ -28,6 +28,8 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadSpec.h" +#include + using namespace lldb; using namespace lldb_private; @@ -526,23 +528,27 @@ bool status; CommandObjectSP list_command_object (new CommandObjectBreakpointList (interpreter)); - CommandObjectSP delete_command_object (new CommandObjectBreakpointDelete (interpreter)); CommandObjectSP enable_command_object (new CommandObjectBreakpointEnable (interpreter)); CommandObjectSP disable_command_object (new CommandObjectBreakpointDisable (interpreter)); + CommandObjectSP clear_command_object (new CommandObjectBreakpointClear (interpreter)); + CommandObjectSP delete_command_object (new CommandObjectBreakpointDelete (interpreter)); CommandObjectSP set_command_object (new CommandObjectBreakpointSet (interpreter)); CommandObjectSP command_command_object (new CommandObjectBreakpointCommand (interpreter)); CommandObjectSP modify_command_object (new CommandObjectBreakpointModify(interpreter)); - command_command_object->SetCommandName ("breakpoint command"); + list_command_object->SetCommandName ("breakpoint list"); enable_command_object->SetCommandName("breakpoint enable"); disable_command_object->SetCommandName("breakpoint disable"); - list_command_object->SetCommandName ("breakpoint list"); - modify_command_object->SetCommandName ("breakpoint modify"); + clear_command_object->SetCommandName("breakpoint clear"); + delete_command_object->SetCommandName("breakpoint delete"); set_command_object->SetCommandName("breakpoint set"); + command_command_object->SetCommandName ("breakpoint command"); + modify_command_object->SetCommandName ("breakpoint modify"); status = LoadSubCommand ("list", list_command_object); status = LoadSubCommand ("enable", enable_command_object); status = LoadSubCommand ("disable", disable_command_object); + status = LoadSubCommand ("clear", clear_command_object); status = LoadSubCommand ("delete", delete_command_object); status = LoadSubCommand ("set", set_command_object); status = LoadSubCommand ("command", command_command_object); @@ -1039,6 +1045,189 @@ } //------------------------------------------------------------------------- +// CommandObjectBreakpointClear::CommandOptions +//------------------------------------------------------------------------- +#pragma mark Clear::CommandOptions + +CommandObjectBreakpointClear::CommandOptions::CommandOptions() : + Options (), + m_filename (), + m_line_num (0) +{ +} + +CommandObjectBreakpointClear::CommandOptions::~CommandOptions () +{ +} + +lldb::OptionDefinition +CommandObjectBreakpointClear::CommandOptions::g_option_table[] = +{ + { LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, + "Specify the breakpoint by source location in this particular file."}, + + { LLDB_OPT_SET_1, true, "line", 'l', required_argument, NULL, 0, eArgTypeLineNum, + "Specify the breakpoint by source location at this particular line."}, + + { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } +}; + +const lldb::OptionDefinition* +CommandObjectBreakpointClear::CommandOptions::GetDefinitions () +{ + return g_option_table; +} + +Error +CommandObjectBreakpointClear::CommandOptions::SetOptionValue (int option_idx, const char *option_arg) +{ + Error error; + char short_option = (char) m_getopt_table[option_idx].val; + + switch (short_option) + { + case 'f': + m_filename = option_arg; + break; + + case 'l': + m_line_num = Args::StringToUInt32 (option_arg, 0); + break; + + default: + error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + break; + } + + return error; +} + +void +CommandObjectBreakpointClear::CommandOptions::ResetOptionValues () +{ + Options::ResetOptionValues(); + + m_filename.clear(); + m_line_num = 0; +} + +//------------------------------------------------------------------------- +// CommandObjectBreakpointClear +//------------------------------------------------------------------------- +#pragma mark Clear + +CommandObjectBreakpointClear::CommandObjectBreakpointClear (CommandInterpreter &interpreter) : + CommandObject (interpreter, + "breakpoint clear", + "Clears a breakpoint or set of breakpoints in the executable.", + "breakpoint clear ") +{ +} + +CommandObjectBreakpointClear::~CommandObjectBreakpointClear () +{ +} + +Options * +CommandObjectBreakpointClear::GetOptions () +{ + return &m_options; +} + +bool +CommandObjectBreakpointClear::Execute +( + Args& command, + CommandReturnObject &result +) +{ + Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + if (target == NULL) + { + result.AppendError ("Invalid target. No existing target or breakpoints."); + result.SetStatus (eReturnStatusFailed); + return false; + } + + // The following are the various types of breakpoints that could be cleared: + // 1). -f -l (clearing breakpoint by source location) + + BreakpointClearType break_type = eClearTypeInvalid; + + if (m_options.m_line_num != 0) + break_type = eClearTypeFileAndLine; + + Mutex::Locker locker; + target->GetBreakpointList().GetListMutex(locker); + + BreakpointList &breakpoints = target->GetBreakpointList(); + size_t num_breakpoints = breakpoints.GetSize(); + + // Early return if there's no breakpoint at all. + if (num_breakpoints == 0) + { + result.AppendError ("Breakpoint clear: No breakpoint cleared."); + result.SetStatus (eReturnStatusFailed); + return result.Succeeded(); + } + + // Find matching breakpoints and delete them. + + // First create a copy of all the IDs. + std::vector BreakIDs; + for (size_t i = 0; i < num_breakpoints; ++i) + BreakIDs.push_back(breakpoints.GetBreakpointAtIndex(i).get()->GetID()); + + int num_cleared = 0; + StreamString ss; + switch (break_type) + { + case eClearTypeFileAndLine: // Breakpoint by source position + { + const ConstString filename(m_options.m_filename.c_str()); + BreakpointLocationCollection loc_coll; + + for (size_t i = 0; i < num_breakpoints; ++i) + { + Breakpoint *bp = breakpoints.FindBreakpointByID(BreakIDs[i]).get(); + + if (bp->GetMatchingFileLine(filename, m_options.m_line_num, loc_coll)) + { + // If the collection size is 0, it's a full match and we can just remove the breakpoint. + if (loc_coll.GetSize() == 0) + { + bp->GetDescription(&ss, lldb::eDescriptionLevelBrief); + ss.EOL(); + target->RemoveBreakpointByID (bp->GetID()); + ++num_cleared; + } + } + } + } + break; + + default: + break; + } + + if (num_cleared > 0) + { + StreamString &output_stream = result.GetOutputStream(); + output_stream.Printf ("%d breakpoints cleared:\n", num_cleared); + output_stream << ss.GetData(); + output_stream.EOL(); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } + else + { + result.AppendError ("Breakpoint clear: No breakpoint cleared."); + result.SetStatus (eReturnStatusFailed); + } + + return result.Succeeded(); +} + +//------------------------------------------------------------------------- // CommandObjectBreakpointDelete //------------------------------------------------------------------------- #pragma mark Delete Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=117562&r1=117561&r2=117562&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Thu Oct 28 12:27:46 2010 @@ -43,7 +43,7 @@ }; //------------------------------------------------------------------------- -// CommandObjectMultiwordBreakpointSet +// CommandObjectdBreakpointSet //------------------------------------------------------------------------- @@ -271,6 +271,66 @@ }; //------------------------------------------------------------------------- +// CommandObjectBreakpointClear +//------------------------------------------------------------------------- + + +class CommandObjectBreakpointClear : public CommandObject +{ +public: + + typedef enum BreakpointClearType + { + eClearTypeInvalid, + eClearTypeFileAndLine, + } BreakpointClearType; + + CommandObjectBreakpointClear (CommandInterpreter &interpreter); + + virtual + ~CommandObjectBreakpointClear (); + + virtual bool + Execute (Args& command, + CommandReturnObject &result); + + virtual Options * + GetOptions (); + + class CommandOptions : public Options + { + public: + + CommandOptions (); + + virtual + ~CommandOptions (); + + virtual Error + SetOptionValue (int option_idx, const char *option_arg); + + void + ResetOptionValues (); + + const lldb::OptionDefinition* + GetDefinitions (); + + // Options table: Required for subclasses of Options. + + static lldb::OptionDefinition g_option_table[]; + + // Instance variables to hold the values for command options. + + std::string m_filename; + uint32_t m_line_num; + + }; + +private: + CommandOptions m_options; +}; + +//------------------------------------------------------------------------- // CommandObjectBreakpointDelete //------------------------------------------------------------------------- From scallanan at apple.com Thu Oct 28 13:19:36 2010 From: scallanan at apple.com (Sean Callanan) Date: Thu, 28 Oct 2010 18:19:36 -0000 Subject: [Lldb-commits] [lldb] r117568 - /lldb/trunk/source/Symbol/ClangASTContext.cpp Message-ID: <20101028181936.D40552A6C12C@llvm.org> Author: spyffe Date: Thu Oct 28 13:19:36 2010 New Revision: 117568 URL: http://llvm.org/viewvc/llvm-project?rev=117568&view=rev Log: Logging fixes. Added a simple class to handle logging for type importing, making errors much easier to diagnose. Also removed some Objective-C related logging. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=117568&r1=117567&r2=117568&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Oct 28 13:19:36 2010 @@ -32,6 +32,7 @@ #include "lldb/Core/dwarf.h" #include "lldb/Core/Flags.h" +#include "lldb/Core/Log.h" #include @@ -710,12 +711,35 @@ return void_ptr_type.getAsOpaquePtr(); } +class NullDiagnosticClient : public DiagnosticClient +{ +public: + NullDiagnosticClient () + { + m_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS); + } + + void HandleDiagnostic (Diagnostic::Level DiagLevel, const DiagnosticInfo &info) + { + if (m_log) + { + llvm::SmallVectorImpl diag_str(10); + info.FormatDiagnostic(diag_str); + diag_str.push_back('\0'); + m_log->Printf("Compiler diagnostic: %s\n", diag_str.data()); + } + } +private: + Log *m_log; +}; + clang_type_t ClangASTContext::CopyType (ASTContext *dest_context, ASTContext *source_context, clang_type_t clang_type) { - Diagnostic diagnostics; + NullDiagnosticClient *null_client = new NullDiagnosticClient; + Diagnostic diagnostics(null_client); FileManager file_manager; ASTImporter importer(diagnostics, *dest_context, file_manager, @@ -1573,7 +1597,6 @@ bool has_arg = (start[len] == ':'); if (has_arg) ++num_selectors_with_args; - printf ("@selector[%zu] = '%.*s'\n", selector_idents.size(), (int)len, start); selector_idents.push_back (&identifier_table->get (StringRef (start, len))); if (has_arg) len += 1; From johnny.chen at apple.com Thu Oct 28 13:24:22 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 28 Oct 2010 18:24:22 -0000 Subject: [Lldb-commits] [lldb] r117569 - /lldb/trunk/test/lldbtest.py Message-ID: <20101028182422.B991D2A6C12C@llvm.org> Author: johnny Date: Thu Oct 28 13:24:22 2010 New Revision: 117569 URL: http://llvm.org/viewvc/llvm-project?rev=117569&view=rev Log: If TestBase.expect() is passed an assert message, pass it along when delegating to TestBase.runCmd() to execute the debugger command. This will result in a more semantic assert message than just the command failed message like before: AssertionError: False is not True : Command 'thread list' returns successfully And now, we will have: AssertionError: False is not True : Process state is stopped due to breakpoint Modified: lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=117569&r1=117568&r2=117569&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Thu Oct 28 13:24:22 2010 @@ -646,7 +646,7 @@ if exe: # First run the command. If we are expecting error, set check=False. - self.runCmd(str, trace = (True if trace else False), check = not error) + self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error) # Then compare the output against expected strings. output = self.res.GetError() if error else self.res.GetOutput() From scallanan at apple.com Thu Oct 28 13:43:33 2010 From: scallanan at apple.com (Sean Callanan) Date: Thu, 28 Oct 2010 18:43:33 -0000 Subject: [Lldb-commits] [lldb] r117573 - /lldb/trunk/source/Symbol/ClangASTContext.cpp Message-ID: <20101028184333.4D75B2A6C12C@llvm.org> Author: spyffe Date: Thu Oct 28 13:43:33 2010 New Revision: 117573 URL: http://llvm.org/viewvc/llvm-project?rev=117573&view=rev Log: Explicatory comment for folks that may not be familiar with the ownership relationships involving Diagnostic. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=117573&r1=117572&r2=117573&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Oct 28 13:43:33 2010 @@ -738,6 +738,7 @@ ASTContext *source_context, clang_type_t clang_type) { + // null_client's ownership is transferred to diagnostics NullDiagnosticClient *null_client = new NullDiagnosticClient; Diagnostic diagnostics(null_client); FileManager file_manager; From johnny.chen at apple.com Thu Oct 28 16:10:32 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 28 Oct 2010 21:10:32 -0000 Subject: [Lldb-commits] [lldb] r117604 - /lldb/trunk/test/lldbtest.py Message-ID: <20101028211032.5B70B2A6C12C@llvm.org> Author: johnny Date: Thu Oct 28 16:10:32 2010 New Revision: 117604 URL: http://llvm.org/viewvc/llvm-project?rev=117604&view=rev Log: Add comment on passing the assert message to self.runCmd(). Modified: lldb/trunk/test/lldbtest.py Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=117604&r1=117603&r2=117604&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Thu Oct 28 16:10:32 2010 @@ -646,6 +646,7 @@ if exe: # First run the command. If we are expecting error, set check=False. + # Pass the assert message along since it provides more semantic info. self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error) # Then compare the output against expected strings. From ctice at apple.com Thu Oct 28 16:51:20 2010 From: ctice at apple.com (Caroline Tice) Date: Thu, 28 Oct 2010 21:51:20 -0000 Subject: [Lldb-commits] [lldb] r117612 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj scripts/Python/build-swig-Python.sh scripts/Python/edit-swig-python-wrapper-file.py source/API/SBBreakpointLocation.cpp source/Interpreter/ScriptInterpreterPython.cpp Message-ID: <20101028215120.9194E2A6C12C@llvm.org> Author: ctice Date: Thu Oct 28 16:51:20 2010 New Revision: 117612 URL: http://llvm.org/viewvc/llvm-project?rev=117612&view=rev Log: Remove references to particular Python version (use the system default version); change include statements to use Python.h in the Python framework on Mac OS X systems; leave it using regular Python.h on other systems. Note: I think this *ought* to work properly on Linux systems, but I don't have a system to test it on... Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Python/build-swig-Python.sh lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117612&r1=117611&r2=117612&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Oct 28 16:51:20 2010 @@ -50,7 +50,7 @@ 2668022F115FD19D008E1FE4 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* CoreFoundation.framework */; }; 26680230115FD19E008E1FE4 /* DebugSymbols.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 265ABF6210F42EE900531910 /* DebugSymbols.framework */; }; 26680231115FD1A0008E1FE4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260C876910F538E700BB2B04 /* Foundation.framework */; }; - 26680232115FD1A4008E1FE4 /* libpython2.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */; }; + 26680232115FD1A4008E1FE4 /* libpython.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython.dylib */; }; 26680233115FD1A7008E1FE4 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C37410F3F61B009D5894 /* libobjc.dylib */; }; 26680324116005D9008E1FE4 /* SBThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9831091125FC5800A56CB0 /* SBThread.cpp */; }; 26680326116005DB008E1FE4 /* SBTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9831071125FC5800A56CB0 /* SBTarget.cpp */; }; @@ -319,7 +319,7 @@ 26DE20651161904E00A093E2 /* SBSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DE20641161904E00A093E2 /* SBSymbol.cpp */; }; 26F5C27710F3D9E4009D5894 /* Driver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F5C27310F3D9E4009D5894 /* Driver.cpp */; }; 26F5C27810F3D9E4009D5894 /* IOChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F5C27510F3D9E4009D5894 /* IOChannel.cpp */; }; - 26F5C32510F3DF23009D5894 /* libpython2.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */; }; + 26F5C32510F3DF23009D5894 /* libpython.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython.dylib */; }; 26F5C32C10F3DFDD009D5894 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32A10F3DFDD009D5894 /* libedit.dylib */; }; 26F5C32D10F3DFDD009D5894 /* libtermcap.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */; }; 26F5C37510F3F61B009D5894 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C37410F3F61B009D5894 /* libobjc.dylib */; }; @@ -938,7 +938,7 @@ 26F5C27410F3D9E4009D5894 /* Driver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Driver.h; path = tools/driver/Driver.h; sourceTree = ""; }; 26F5C27510F3D9E4009D5894 /* IOChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOChannel.cpp; path = tools/driver/IOChannel.cpp; sourceTree = ""; }; 26F5C27610F3D9E4009D5894 /* IOChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOChannel.h; path = tools/driver/IOChannel.h; sourceTree = ""; }; - 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpython2.6.dylib; path = /usr/lib/libpython2.6.dylib; sourceTree = ""; }; + 26F5C32410F3DF23009D5894 /* libpython.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpython.dylib; path = /usr/lib/libpython.dylib; sourceTree = ""; }; 26F5C32A10F3DFDD009D5894 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = ""; }; 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libtermcap.dylib; path = /usr/lib/libtermcap.dylib; sourceTree = ""; }; 26F5C37410F3F61B009D5894 /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = ""; }; @@ -1154,7 +1154,7 @@ 2668022F115FD19D008E1FE4 /* CoreFoundation.framework in Frameworks */, 26680230115FD19E008E1FE4 /* DebugSymbols.framework in Frameworks */, 26680231115FD1A0008E1FE4 /* Foundation.framework in Frameworks */, - 26680232115FD1A4008E1FE4 /* libpython2.6.dylib in Frameworks */, + 26680232115FD1A4008E1FE4 /* libpython.dylib in Frameworks */, 26680233115FD1A7008E1FE4 /* libobjc.dylib in Frameworks */, 4C74CB6312288704006A8171 /* Carbon.framework in Frameworks */, ); @@ -1164,7 +1164,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 26F5C32510F3DF23009D5894 /* libpython2.6.dylib in Frameworks */, + 26F5C32510F3DF23009D5894 /* libpython.dylib in Frameworks */, 26F5C32C10F3DFDD009D5894 /* libedit.dylib in Frameworks */, 26F5C32D10F3DFDD009D5894 /* libtermcap.dylib in Frameworks */, 26F5C37510F3F61B009D5894 /* libobjc.dylib in Frameworks */, @@ -2176,7 +2176,7 @@ 260C876910F538E700BB2B04 /* Foundation.framework */, 26F5C32A10F3DFDD009D5894 /* libedit.dylib */, 26F5C37410F3F61B009D5894 /* libobjc.dylib */, - 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */, + 26F5C32410F3DF23009D5894 /* libpython.dylib */, 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */, 4C74CB6212288704006A8171 /* Carbon.framework */, ); @@ -3076,7 +3076,7 @@ GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB"; @@ -3129,7 +3129,7 @@ GCC_ENABLE_OBJC_GC = supported; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB"; @@ -3201,7 +3201,7 @@ GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -3240,7 +3240,7 @@ GCC_ENABLE_OBJC_GC = supported; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB"; @@ -3291,7 +3291,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -3331,7 +3331,7 @@ GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; Modified: lldb/trunk/scripts/Python/build-swig-Python.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=117612&r1=117611&r2=117612&view=diff ============================================================================== --- lldb/trunk/scripts/Python/build-swig-Python.sh (original) +++ lldb/trunk/scripts/Python/build-swig-Python.sh Thu Oct 28 16:51:20 2010 @@ -179,3 +179,14 @@ then python ${current_dir}/append-debugger-id.py ${CONFIG_BUILD_DIR} fi + +# Fix the "#include" statement in the swig output file + +if [ -f "${current_dir}/edit-swig-python-wrapper-file.py" ] +then + python ${current_dir}/edit-swig-python-wrapper-file.py + if [ -f "${swig_output_file}.edited" ] + then + mv "${swig_output_file}.edited" ${swig_output_file} + fi +fi Modified: lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py?rev=117612&r1=117611&r2=117612&view=diff ============================================================================== --- lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py (original) +++ lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py Thu Oct 28 16:51:20 2010 @@ -3,17 +3,28 @@ # # This script performs some post-processing editing on the C++ file that # SWIG generates for python, after running on 'lldb.swig'. In -# particular, the types SWIGTYPE_p_SBThread and SWIGTYPE_p_SBTarget are -# being used, when the types that *should* be used are -# SWIGTYPE_p_lldb__SBThread and SWIGTYPE_p_lldb__SBTarget. -# This script goes through the C++ file SWIG generated, reading it in line -# by line and doing a search-and-replace for these strings. +# particular, on Apple systems we want to include the Python.h file that +# is used in the /System/Library/Frameworks/Python.framework, but on other +# systems we want to include plain . So we need to replace: +# +# #include +# +# with: +# +# #if defined (__APPLE__) +# #include +# #else +# #include +# #endif +# +# That's what this python script does. # import os -full_input_name = os.environ["SCRIPT_INPUT_FILE_1"]; +input_dir_name = os.environ["SRCROOT"] +full_input_name = input_dir_name + "/source/LLDBWrapPython.cpp" full_output_name = full_input_name + ".edited" try: @@ -26,8 +37,7 @@ except IOError: print "Error: Unable to open file for writing: " + full_output_name else: - target_typedef_found = False - thread_typedef_found = False + include_line_found = False try: line = f_in.readline() @@ -37,15 +47,18 @@ while line: # # - if (line.find ("SWIGTYPE_p_SBTarget")): - if (line.find ("define") < 0): - line = line.replace ("SWIGTYPE_p_SBTarget", - "SWIGTYPE_p_lldb__SBTarget") - if (line.find ("SWIGTYPE_p_SBThread")): - if (line.find ("define") < 0): - line = line.replace ("SWIGTYPE_p_SBThread", - "SWIGTYPE_p_lldb__SBThread") - f_out.write (line) + if not include_line_found: + if (line.find ("#include ") == 0): + f_out.write ("#if defined (__APPLE__)\n"); + f_out.write ("#include \n"); + f_out.write ("#else\n"); + f_out.write (line); + f_out.write ("#endif\n"); + include_line_found = True + else: + f_out.write (line) + else: + f_out.write (line) try: line = f_in.readline() except IOError: Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=117612&r1=117611&r2=117612&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Thu Oct 28 16:51:20 2010 @@ -7,11 +7,6 @@ // //===----------------------------------------------------------------------===// -// In order to guarantee correct working with Python, Python.h *MUST* be -// the *FIRST* header file included: - -#include - #include "lldb/API/SBBreakpointLocation.h" #include "lldb/API/SBDefines.h" #include "lldb/API/SBDebugger.h" Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=117612&r1=117611&r2=117612&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original) +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Thu Oct 28 16:51:20 2010 @@ -10,7 +10,11 @@ // In order to guarantee correct working with Python, Python.h *MUST* be // the *FIRST* header file included: +#if defined (__APPLE__) +#include +#else #include +#endif #include "lldb/Interpreter/ScriptInterpreterPython.h" From ctice at apple.com Thu Oct 28 17:19:36 2010 From: ctice at apple.com (Caroline Tice) Date: Thu, 28 Oct 2010 22:19:36 -0000 Subject: [Lldb-commits] [lldb] r117616 - /lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Message-ID: <20101028221936.C46662A6C12C@llvm.org> Author: ctice Date: Thu Oct 28 17:19:36 2010 New Revision: 117616 URL: http://llvm.org/viewvc/llvm-project?rev=117616&view=rev Log: Comment out uninmplemented command option (-f) for disassemble command. Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=117616&r1=117615&r2=117616&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Thu Oct 28 17:19:36 2010 @@ -130,7 +130,7 @@ { LLDB_OPT_SET_2, true, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Disassemble entire contents of the given function name."}, -{ LLDB_OPT_SET_3, false, "current-frame", 'f', no_argument, NULL, 0, eArgTypeNone, "Disassemble entire contents of the current frame's function."}, +//{ LLDB_OPT_SET_3, false, "current-frame", 'f', no_argument, NULL, 0, eArgTypeNone, "Disassemble entire contents of the current frame's function."}, { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } }; From ctice at apple.com Thu Oct 28 18:17:48 2010 From: ctice at apple.com (Caroline Tice) Date: Thu, 28 Oct 2010 23:17:48 -0000 Subject: [Lldb-commits] [lldb] r117617 - in /lldb/trunk/source/Commands: CommandObjectCommands.cpp CommandObjectHelp.cpp Message-ID: <20101028231748.3C5B82A6C12C@llvm.org> Author: ctice Date: Thu Oct 28 18:17:48 2010 New Revision: 117617 URL: http://llvm.org/viewvc/llvm-project?rev=117617&view=rev Log: Add alias information, including aliased command options & arguments, to help text for alias commands. Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp lldb/trunk/source/Commands/CommandObjectHelp.cpp Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=117617&r1=117616&r2=117617&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Thu Oct 28 18:17:48 2010 @@ -339,6 +339,7 @@ if (!result.Succeeded() && result.GetStatus() != lldb::eReturnStatusStarted) { result.AppendError ("Unable to create requested command alias.\n"); + return false; } } @@ -378,6 +379,7 @@ { result.AppendErrorWithFormat ("'%s' is not an existing command.\n", actual_command.c_str()); result.SetStatus (eReturnStatusFailed); + return false; } } Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=117617&r1=117616&r2=117617&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Thu Oct 28 18:17:48 2010 @@ -69,6 +69,8 @@ // Get command object for the first command argument. Only search built-in command dictionary. StringList matches; cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches); + bool is_alias_command = m_interpreter.AliasExists (command.GetArgumentAtIndex (0)); + std::string alias_name = command.GetArgumentAtIndex(0); if (cmd_obj != NULL) { @@ -155,6 +157,13 @@ result.SetStatus (eReturnStatusSuccessFinishNoResult); } } + + if (is_alias_command) + { + StreamString sstr; + m_interpreter.GetAliasHelp (alias_name.c_str(), cmd_obj->GetCommandName(), sstr); + result.GetOutputStream().Printf ("\n'%s' is an abbreviation for %s\n", alias_name.c_str(), sstr.GetData()); + } } else if (matches.GetSize() > 0) { From scallanan at apple.com Thu Oct 28 19:29:03 2010 From: scallanan at apple.com (Sean Callanan) Date: Fri, 29 Oct 2010 00:29:03 -0000 Subject: [Lldb-commits] [lldb] r117627 - in /lldb/trunk: include/lldb/Expression/ClangUserExpression.h include/lldb/Target/Target.h source/API/SBFrame.cpp source/Breakpoint/BreakpointOptions.cpp source/Commands/CommandObjectExpression.cpp source/Expression/ClangUserExpression.cpp source/Target/Target.cpp Message-ID: <20101029002904.0CC7D2A6C12C@llvm.org> Author: spyffe Date: Thu Oct 28 19:29:03 2010 New Revision: 117627 URL: http://llvm.org/viewvc/llvm-project?rev=117627&view=rev Log: Added a user-settable variable, 'target.expr-prefix', which holds the name of a file whose contents are prefixed to each expression. For example, if the file ~/lldb.prefix.header contains: typedef unsigned short my_type; then you can do this: (lldb) settings set target.expr-prefix '~/lldb.prefix.header' (lldb) expr sizeof(my_type) (unsigned long) $0 = 2 When the variable is changed, the corresponding file is loaded and its contents are fetched into a string that is stored along with the target. This string is then passed to each expression and inserted into it during parsing, like this: typedef unsigned short my_type; void $__lldb_expr(void *$__lldb_arg) { sizeof(my_type); } Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/Breakpoint/BreakpointOptions.cpp lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=117627&r1=117626&r2=117627&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original) +++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Thu Oct 28 19:29:03 2010 @@ -45,8 +45,16 @@ public: //------------------------------------------------------------------ /// Constructor + /// + /// @param[in] expr + /// The expression to parse. + /// + /// @param[in] expr_prefix + /// If non-NULL, a C string containing translation-unit level + /// definitions to be included when the expression is parsed. //------------------------------------------------------------------ - ClangUserExpression (const char *expr); + ClangUserExpression (const char *expr, + const char *expr_prefix); //------------------------------------------------------------------ /// Destructor @@ -189,9 +197,23 @@ return true; } - + //------------------------------------------------------------------ + /// Evaluate one expression and return its result. + /// + /// @param[in] exe_ctx + /// The execution context to use when evaluating the expression. + /// + /// @param[in] expr_cstr + /// A C string containing the expression to be evaluated. + /// + /// @param[in] expr_prefix + /// If non-NULL, a C string containing translation-unit level + /// definitions to be included when the expression is parsed. + //------------------------------------------------------------------ static lldb::ValueObjectSP - Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr); + Evaluate (ExecutionContext &exe_ctx, + const char *expr_cstr, + const char *expr_prefix); private: //------------------------------------------------------------------ @@ -202,11 +224,12 @@ bool PrepareToExecuteJITExpression (Stream &error_stream, - ExecutionContext &exe_ctx, - lldb::addr_t &struct_address, - lldb::addr_t &object_ptr); + ExecutionContext &exe_ctx, + lldb::addr_t &struct_address, + lldb::addr_t &object_ptr); std::string m_expr_text; ///< The text of the expression, as typed by the user + std::string m_expr_prefix; ///< The text of the translation-level definitions, as provided by the user std::string m_transformed_text; ///< The text of the expression, as send to the parser std::auto_ptr m_expr_decl_map; ///< The map to use when parsing and materializing the expression. Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=117627&r1=117626&r2=117627&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Target.h (original) +++ lldb/trunk/include/lldb/Target/Target.h Thu Oct 28 19:29:03 2010 @@ -70,9 +70,9 @@ const ConstString CreateInstanceName (); - -private: - + + std::string m_expr_prefix_path; + std::string m_expr_prefix_contents; }; class Target : @@ -437,6 +437,9 @@ ClangASTContext * GetScratchClangASTContext(); + const char * + GetExpressionPrefixContentsAsCString (); + protected: friend class lldb::SBTarget; Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=117627&r1=117626&r2=117627&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Thu Oct 28 19:29:03 2010 @@ -547,7 +547,13 @@ { ExecutionContext exe_ctx; m_opaque_sp->CalculateExecutionContext (exe_ctx); - *expr_result_value = ClangUserExpression::Evaluate (exe_ctx, expr); + + const char *prefix = NULL; + + if (exe_ctx.target) + prefix = exe_ctx.target->GetExpressionPrefixContentsAsCString(); + + *expr_result_value = ClangUserExpression::Evaluate (exe_ctx, expr, prefix); } return expr_result_value; } Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=117627&r1=117626&r2=117627&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Thu Oct 28 19:29:03 2010 @@ -59,7 +59,7 @@ if (rhs.m_thread_spec_ap.get() != NULL) m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get())); if (rhs.m_condition_ap.get()) - m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText())); + m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL)); } //---------------------------------------------------------------------- @@ -76,7 +76,7 @@ if (rhs.m_thread_spec_ap.get() != NULL) m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get())); if (rhs.m_condition_ap.get()) - m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText())); + m_condition_ap.reset (new ClangUserExpression (rhs.m_condition_ap->GetUserText(), NULL)); return *this; } @@ -165,7 +165,7 @@ } else { - m_condition_ap.reset(new ClangUserExpression (condition)); + m_condition_ap.reset(new ClangUserExpression (condition, NULL)); } } Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=117627&r1=117626&r2=117627&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Thu Oct 28 19:29:03 2010 @@ -233,7 +233,12 @@ m_exe_ctx.process->SetDynamicCheckers(dynamic_checkers); } - lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, expr)); + const char *prefix = NULL; + + if (m_exe_ctx.target) + prefix = m_exe_ctx.target->GetExpressionPrefixContentsAsCString(); + + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, expr, prefix)); assert (result_valobj_sp.get()); if (result_valobj_sp->GetError().Success()) { Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=117627&r1=117626&r2=117627&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Thu Oct 28 19:29:03 2010 @@ -35,8 +35,10 @@ using namespace lldb_private; -ClangUserExpression::ClangUserExpression (const char *expr) : +ClangUserExpression::ClangUserExpression (const char *expr, + const char *expr_prefix) : m_expr_text(expr), + m_expr_prefix(expr_prefix), m_transformed_text(), m_jit_addr(LLDB_INVALID_ADDRESS), m_cplusplus(false), @@ -129,12 +131,14 @@ if (m_cplusplus) { - m_transformed_stream.Printf("typedef unsigned short unichar; \n" + m_transformed_stream.Printf("%s \n" + "typedef unsigned short unichar; \n" "void \n" "$__lldb_class::%s(void *$__lldb_arg) \n" "{ \n" " %s; \n" "} \n", + m_expr_prefix.c_str(), FunctionName(), m_expr_text.c_str()); @@ -142,12 +146,14 @@ } else { - m_transformed_stream.Printf("typedef unsigned short unichar;\n" + m_transformed_stream.Printf("%s \n" + "typedef unsigned short unichar;\n" "void \n" "%s(void *$__lldb_arg) \n" "{ \n" " %s; \n" "} \n", + m_expr_prefix.c_str(), FunctionName(), m_expr_text.c_str()); } @@ -425,11 +431,13 @@ lldb::ValueObjectSP -ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr) +ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, + const char *expr_cstr, + const char *expr_prefix) { Error error; lldb::ValueObjectSP result_valobj_sp; - ClangUserExpression user_expression (expr_cstr); + ClangUserExpression user_expression (expr_cstr, expr_prefix); StreamString error_stream; Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117627&r1=117626&r2=117627&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Thu Oct 28 19:29:03 2010 @@ -17,6 +17,7 @@ #include "lldb/Breakpoint/BreakpointResolverAddress.h" #include "lldb/Breakpoint/BreakpointResolverFileLine.h" #include "lldb/Breakpoint/BreakpointResolverName.h" +#include "lldb/Core/DataBufferMemoryMap.h" #include "lldb/Core/Event.h" #include "lldb/Core/Log.h" #include "lldb/Core/Timer.h" @@ -853,6 +854,12 @@ } } +const char * +Target::GetExpressionPrefixContentsAsCString () +{ + return m_expr_prefix_contents.c_str(); +} + //-------------------------------------------------------------- // class Target::SettingsController //-------------------------------------------------------------- @@ -976,6 +983,7 @@ return *this; } +#define EXPR_PREFIX_STRING "expr-prefix" void TargetInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name, @@ -987,14 +995,64 @@ Error &err, bool pending) { - // Currently 'target' does not have any instance settings. + static ConstString expr_prefix_str (EXPR_PREFIX_STRING); + + if (var_name == expr_prefix_str) + { + switch (op) + { + default: + err.SetErrorToGenericError (); + err.SetErrorString ("Unrecognized operation. Cannot update value.\n"); + return; + case lldb::eVarSetOperationAssign: + { + FileSpec file_spec(value, true); + + if (!file_spec.Exists()) + { + err.SetErrorToGenericError (); + err.SetErrorStringWithFormat ("%s does not exist.\n", value); + return; + } + + DataBufferMemoryMap buf; + + if (!buf.MemoryMapFromFileSpec(&file_spec) && + buf.GetError().Fail()) + { + err.SetErrorToGenericError (); + err.SetErrorStringWithFormat ("Couldn't read from %s: %s\n", value, buf.GetError().AsCString()); + return; + } + + m_expr_prefix_path = value; + m_expr_prefix_contents.assign(reinterpret_cast(buf.GetBytes()), buf.GetByteSize()); + } + return; + case lldb::eVarSetOperationAppend: + err.SetErrorToGenericError (); + err.SetErrorString ("Cannot append to a path.\n"); + return; + case lldb::eVarSetOperationClear: + m_expr_prefix_path.clear (); + m_expr_prefix_contents.clear (); + return; + } + } } void TargetInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings, - bool pending) + bool pending) { - // Currently 'target' does not have any instance settings. + TargetInstanceSettings *new_settings_ptr = static_cast (new_settings.get()); + + if (!new_settings_ptr) + return; + + m_expr_prefix_path = new_settings_ptr->m_expr_prefix_path; + m_expr_prefix_contents = new_settings_ptr->m_expr_prefix_contents; } bool @@ -1003,9 +1061,20 @@ StringList &value, Error *err) { - if (err) - err->SetErrorString ("'target' does not have any instance settings"); - return false; + static ConstString expr_prefix_str (EXPR_PREFIX_STRING); + + if (var_name == expr_prefix_str) + { + value.AppendString (m_expr_prefix_path.c_str(), m_expr_prefix_path.size()); + } + else + { + if (err) + err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString()); + return false; + } + + return true; } const ConstString @@ -1028,14 +1097,15 @@ SettingEntry Target::SettingsController::global_settings_table[] = { - //{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"}, - { "default-arch", eSetVarTypeString, NULL, NULL, false, false, "Default architecture to choose, when there's a choice." }, + //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"}, + { "default-arch", eSetVarTypeString, NULL, NULL, false, false, "Default architecture to choose, when there's a choice." }, { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL } }; SettingEntry Target::SettingsController::instance_settings_table[] = { - //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"}, + //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"}, + { EXPR_PREFIX_STRING, eSetVarTypeString, NULL, NULL, false, false, "Path to a file containing expressions to be prepended to all expressions." }, { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL } }; From gclayton at apple.com Thu Oct 28 23:59:35 2010 From: gclayton at apple.com (Greg Clayton) Date: Fri, 29 Oct 2010 04:59:35 -0000 Subject: [Lldb-commits] [lldb] r117641 - in /lldb/trunk: include/lldb/API/ include/lldb/Symbol/ lldb.xcodeproj/ source/API/ source/Core/ source/Plugins/SymbolFile/DWARF/ source/Symbol/ source/Target/ Message-ID: <20101029045935.770362A6C12C@llvm.org> Author: gclayton Date: Thu Oct 28 23:59:35 2010 New Revision: 117641 URL: http://llvm.org/viewvc/llvm-project?rev=117641&view=rev Log: Modified the lldb_private::TypeList to use a std::multimap for quicker lookup by type ID (the most common type of type lookup). Changed the API logging a bit to always show the objects in the OBJECT(POINTER) format so it will be easy to locate all instances of an object or references to it when looking at logs. Modified: lldb/trunk/include/lldb/API/SBFileSpec.h lldb/trunk/include/lldb/API/SBListener.h lldb/trunk/include/lldb/Symbol/TypeList.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBBroadcaster.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBEvent.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/API/SBValueList.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/TypeList.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/API/SBFileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFileSpec.h (original) +++ lldb/trunk/include/lldb/API/SBFileSpec.h Thu Oct 28 23:59:35 2010 @@ -54,9 +54,6 @@ ResolvePath (const char *src_path, char *dst_path, size_t dst_len); bool - GetDescription (lldb::SBStream &description); - - bool GetDescription (lldb::SBStream &description) const; private: Modified: lldb/trunk/include/lldb/API/SBListener.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBListener.h?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBListener.h (original) +++ lldb/trunk/include/lldb/API/SBListener.h Thu Oct 28 23:59:35 2010 @@ -17,11 +17,6 @@ class SBListener { public: - friend class SBBroadcaster; - friend class SBCommandInterpreter; - friend class SBDebugger; - friend class SBTarget; - SBListener (const char *name); SBListener (lldb_private::Listener &listener); @@ -91,6 +86,10 @@ HandleBroadcastEvent (const lldb::SBEvent &event); private: + friend class SBBroadcaster; + friend class SBCommandInterpreter; + friend class SBDebugger; + friend class SBTarget; #ifndef SWIG Modified: lldb/trunk/include/lldb/Symbol/TypeList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeList.h?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/TypeList.h (original) +++ lldb/trunk/include/lldb/Symbol/TypeList.h Thu Oct 28 23:59:35 2010 @@ -13,7 +13,7 @@ #include "lldb/lldb-private.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/Type.h" -#include +#include namespace lldb_private { @@ -40,8 +40,11 @@ TypeList FindTypes(const ConstString &name); - lldb::TypeSP - InsertUnique(lldb::TypeSP& type); + void + Insert (lldb::TypeSP& type); + + bool + InsertUnique (lldb::TypeSP& type); uint32_t GetSize() const; @@ -70,7 +73,7 @@ CreateClangRValueReferenceType (Type *type); private: - typedef std::vector collection; + typedef std::multimap collection; typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; ClangASTContext m_ast; ///< The type abtract syntax tree. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Oct 28 23:59:35 2010 @@ -2501,6 +2501,7 @@ isa = PBXProject; buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( en, Modified: lldb/trunk/source/API/SBBroadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBBroadcaster.cpp (original) +++ lldb/trunk/source/API/SBBroadcaster.cpp Thu Oct 28 23:59:35 2010 @@ -26,7 +26,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcastetr::SBBroadcaster () => this = %p", this); + log->Printf ("SBBroadcastetr::SBBroadcaster () => SBBroadcaster(%p)", this); } @@ -37,8 +37,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (name='%s') => this = %p (m_opaque = %p)", - name, this, m_opaque); + log->Printf ("SBBroadcaster::SBBroadcaster (name='%s') => SBBroadcaster(%p)", + name, m_opaque); } SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) : @@ -48,8 +48,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); if (log) - log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns='%s') " - " => this = %p (m_opaque = %p)", broadcaster, (owns ? "true" : "false"), this, m_opaque); + log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) " + " => SBBroadcaster(%p)", broadcaster, owns, m_opaque); } SBBroadcaster::~SBBroadcaster() @@ -63,7 +63,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBroadcaster::BroadcastEventByType (%d, %s)", event_type, (unique ? "true" : "false")); + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque, event_type, unique); if (m_opaque == NULL) return; @@ -77,6 +77,11 @@ void SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque, event.get(), unique); + if (m_opaque == NULL) return; @@ -90,6 +95,9 @@ void SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t requested_events) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque, listener.get(), requested_events); if (m_opaque) m_opaque->AddInitialEventsToListener (listener.get(), requested_events); } Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Thu Oct 28 23:59:35 2010 @@ -93,7 +93,7 @@ { SBStream sstr; result.GetDescription (sstr); - log->Printf ("SBCommandInterpreter::HandleCommand (...'%s'...) => SBCommandReturnObject: '%s'", + log->Printf ("SBCommandInterpreter::HandleCommand ('%s') => SBCommandReturnObject: '%s'", command_line, sstr.GetData()); } Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Thu Oct 28 23:59:35 2010 @@ -57,7 +57,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::Clear ()"); + log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get()); m_opaque_sp.reset(); } @@ -67,9 +67,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBDebugger::Create ()"); - SBDebugger debugger; debugger.reset(Debugger::CreateInstance()); @@ -77,7 +74,7 @@ { SBStream sstr; debugger.GetDescription (sstr); - log->Printf ("SBDebugger::Create () => SBDebugger (this.sp = %p, '%s')", debugger.m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData()); } return debugger; @@ -121,7 +118,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::SetInputFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) @@ -135,7 +132,7 @@ if (log) - log->Printf ("SBDebugger::SetOutputFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) @@ -149,7 +146,7 @@ if (log) - log->Printf ("SBDebugger::SetErrorFileHandle (this.sp=%p, fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership='%s')", m_opaque_sp.get(), fh, (transfer_ownership ? "true" : "false")); if (m_opaque_sp) @@ -190,7 +187,7 @@ sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter()); if (log) - log->Printf ("SBDebugger::GetCommandInterpreter (this.sp=%p) => SBCommandInterpreter (this.obj=%p)", + log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)", m_opaque_sp.get(), sb_interpreter.get()); return sb_interpreter; @@ -238,7 +235,7 @@ sb_listener.reset(&m_opaque_sp->GetListener(), false); if (log) - log->Printf ("SBDebugger::GetListener (this.sp=%p) => SBListener (this.obj=%p)", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)", m_opaque_sp.get(), sb_listener.get()); return sb_listener; @@ -464,10 +461,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBDebugger::CreateTargetWithFileAndArch (this.sp=%p, filename='%s', arcname='%s')", - // m_opaque_sp.get() filename, archname); - SBTarget target; if (m_opaque_sp) { @@ -510,8 +503,8 @@ { SBStream sstr; target.GetDescription (sstr, lldb::eDescriptionLevelFull); - log->Printf ("SBDebugger::CreateTargetWithFileAndArch (this.sp=%p, filename='%s', arcname='%s') " - "=> SBTarget: this.sp=%p, '%s'", m_opaque_sp.get(), filename, archname, target.get(), + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename='%s', arcname='%s') " + "=> SBTarget(%p): %s", m_opaque_sp.get(), filename, archname, target.get(), sstr.GetData()); } @@ -609,9 +602,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBDebugger::GetSelectedTarget ()"); - SBTarget sb_target; if (m_opaque_sp) sb_target.reset(m_opaque_sp->GetTargetList().GetSelectedTarget ()); @@ -620,7 +610,7 @@ { SBStream sstr; sb_target.GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBDebugger::GetSelectedTarget (this.sp=%p) => SBTarget: this.sp=%p, '%s'", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(), sb_target.get(), sstr.GetData()); } @@ -633,7 +623,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::DispatchInput (this.sp=%p, baton=%p, data='%s', size_t=%d)", m_opaque_sp.get(), + log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data='%s', size_t=%d)", m_opaque_sp.get(), baton, (const char *) data, (uint32_t) data_len); if (m_opaque_sp) @@ -646,7 +636,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::PushInputReader (this.sp=%p, reader=%p)", m_opaque_sp.get(), &reader); + log->Printf ("SBDebugger(%p)::PushInputReader (SBInputReader(%p))", m_opaque_sp.get(), &reader); if (m_opaque_sp && reader.IsValid()) { @@ -753,7 +743,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBDebugger::GetPrompt (this.sp=%p) => '%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) Modified: lldb/trunk/source/API/SBEvent.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBEvent.cpp (original) +++ lldb/trunk/source/API/SBEvent.cpp Thu Oct 28 23:59:35 2010 @@ -37,8 +37,11 @@ if (log) { - log->Printf ("SBEvent::SBEvent (event_type=%d, cstr='%s', cstr_len=%d) => this.sp = %p", event_type, - cstr, cstr_len, m_opaque); + log->Printf ("SBEvent::SBEvent (event_type=0x%8.8x, cstr='%s', cstr_len=%d) => SBEvent(%p)", + event_type, + cstr, + cstr_len, + m_opaque); } } @@ -49,7 +52,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBEvent::SBEvent (event_sp=%p) => this.sp = %p", event_sp.get(), m_opaque); + log->Printf ("SBEvent::SBEvent (event_sp=%p) => SBEvent(%p)", event_sp.get(), m_opaque); } SBEvent::~SBEvent() @@ -70,16 +73,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBEvent::GetType ()"); - const Event *lldb_event = get(); uint32_t event_type = 0; if (lldb_event) event_type = lldb_event->GetType(); if (log) - log->Printf ("SBEvent::GetType (this.sp=%p) => %d", m_opaque, event_type); + log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", get(), event_type); return event_type; } @@ -111,17 +111,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBEvent::BroadcasterMatchesRef (broacaster) broadcaster = %p", &broadcaster); - Event *lldb_event = get(); bool success = false; if (lldb_event) success = lldb_event->BroadcasterIs (broadcaster.get()); if (log) - log->Printf ("SBEvent::BroadcasterMathesRef (this.sp=%p, broadcaster.obj=%p) => %s", m_opaque, - broadcaster.get(), (success ? "true" : "false")); + log->Printf ("SBEvent(%p)::BroadcasterMathesRef (broadcaster.ptr=%p) => %s", + get(), + broadcaster.get(), + success ? "true" : "false"); return success; } @@ -182,7 +181,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("GetCStringFromEvent (event.sp=%p) => %s", event.m_opaque, + log->Printf ("SBEvent(%p)::GetCStringFromEvent () => '%s'", + event.get(), reinterpret_cast(EventDataBytes::GetBytesFromEvent (event.get()))); return reinterpret_cast(EventDataBytes::GetBytesFromEvent (event.get())); @@ -192,7 +192,7 @@ bool SBEvent::GetDescription (SBStream &description) { - if (m_opaque) + if (get()) { description.ref(); m_opaque->Dump (description.get()); @@ -206,7 +206,7 @@ bool SBEvent::GetDescription (SBStream &description) const { - if (m_opaque) + if (get()) { description.ref(); m_opaque->Dump (description.get()); Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Thu Oct 28 23:59:35 2010 @@ -34,7 +34,7 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec rhs.ap=%p) => this.ap = %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,8 +51,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec::SBFileSpec (path='%s', resolve='%s') => this.ap = %p", path, - (resolve ? "true" : "false"), m_opaque_ap.get()); + log->Printf ("SBFileSpec::SBFileSpec (path='%s', resolve=%i) => SBFileSpec(%p)", path, + resolve, m_opaque_ap.get()); } SBFileSpec::~SBFileSpec () @@ -81,15 +81,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFileSpec::Exists (this.ap=%p)", m_opaque_ap.get()); - bool result = false; if (m_opaque_ap.get()) result = m_opaque_ap->Exists(); if (log) - log->Printf ("SBFileSpec::Exists (this.ap=%p) => %s", m_opaque_ap.get(), (result ? "true" : "false")); + log->Printf ("SBFileSpec(%p)::Exists () => %s", m_opaque_ap.get(), (result ? "true" : "false")); return result; } @@ -113,20 +110,17 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFileSpec::GetFilename (this.ap=%p)", m_opaque_ap.get()); - if (m_opaque_ap.get()) { if (log) - log->Printf ("SBFileSpec::GetFilename (this.ap=%p) => %s", m_opaque_ap.get(), + log->Printf ("SBFileSpec(%p)::GetFilename () => %s", m_opaque_ap.get(), m_opaque_ap->GetFilename().AsCString()); return m_opaque_ap->GetFilename().AsCString(); } if (log) - log->Printf ("SBFileSpec::GetFilename (this.ap=%p) => NULL", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get()); return NULL; } @@ -144,21 +138,18 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFileSpec::GetPath (dst_path, dst_len)"); - uint32_t result; if (m_opaque_ap.get()) { result = m_opaque_ap->GetPath (dst_path, dst_len); if (log) - log->Printf ("SBFileSpec::GetPath (this.ap=%p, dst_path, dst_len) => dst_path='%s', dst_len='%d', " + 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::GetPath (this.ap=%p, dst_path, dst_len) => NULL (0)", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetPath (dst_path, dst_len) => NULL (0)", m_opaque_ap.get()); if (dst_path && dst_len) *dst_path = '\0'; @@ -202,26 +193,6 @@ } bool -SBFileSpec::GetDescription (SBStream &description) -{ - 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); - } - else - description.Printf ("No value"); - - return true; -} - -bool SBFileSpec::GetDescription (SBStream &description) const { if (m_opaque_ap.get()) Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Thu Oct 28 23:59:35 2010 @@ -87,12 +87,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - //{ - // log->Printf ("SBListener::StartListeningForEvents (const SBBroadcaster &broadcaster, uint32_t event_mask)" - // " &broadcaster = %p, event_mask = %d", &broadcaster, event_mask); - //} - uint32_t ret_value = 0; if (m_opaque_ptr && broadcaster.IsValid()) { @@ -100,7 +94,7 @@ } if (log) - log->Printf ("SBListener::StartListeneingForEvents (this.obj=%p, broadcaster.obj=%p, event_mask=%d) => %d", + log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => %d", m_opaque_ptr, broadcaster.get(), event_mask, ret_value); return ret_value; @@ -142,7 +136,7 @@ event.reset (event_sp); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'true'", + log->Printf ("SBListener(%p)::WaitForEvent (num_seconds=%d, SBEvent(%p)) => 1", m_opaque_ptr, num_seconds, event.get()); return true; } @@ -150,7 +144,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBListener::WaitForEvent (this.obj=%p, num_seconds=%d, event.sp=%p) => 'false'", + log->Printf ("SBListener(%p)::WaitForEvent (num_seconds=%d, SBEvent(%p)) => 0", m_opaque_ptr, num_seconds, event.get()); event.reset (NULL); Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Thu Oct 28 23:59:35 2010 @@ -56,7 +56,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess::SBProcess (rhs.sp=%p) => this.sp = %p", rhs.m_opaque_sp.get(), m_opaque_sp.get()); + log->Printf ("SBProcess::SBProcess(%p)", rhs.m_opaque_sp.get()); } @@ -66,7 +66,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBProcess::SBProcess (process_sp=%p) => this.sp = %p", process_sp.get(), m_opaque_sp.get()); + log->Printf ("SBProcess::SBProcess(%p)", process_sp.get()); } //---------------------------------------------------------------------- @@ -101,9 +101,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetNumThreads ()"); - uint32_t num_threads = 0; if (m_opaque_sp) { @@ -112,7 +109,7 @@ } if (log) - log->Printf ("SBProcess::GetNumThreads (this.sp=%p) => %d", m_opaque_sp.get(), num_threads); + log->Printf ("SBProcess(%p)::GetNumThreads () => %d", m_opaque_sp.get(), num_threads); return num_threads; } @@ -122,19 +119,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetSelectedThread ()"); - SBThread sb_thread; if (m_opaque_sp) sb_thread.SetThread (m_opaque_sp->GetThreadList().GetSelectedThread()); if (log) { - SBStream sstr; - sb_thread.GetDescription (sstr); - log->Printf ("SBProcess::GetSelectedThread (this.sp=%p) => SBThread : this = %p, '%s'", m_opaque_sp.get(), - &sb_thread, sstr.GetData()); + log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), sb_thread.GetLLDBObjectPtr()); } return sb_thread; @@ -145,16 +136,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetTarget ()"); - SBTarget sb_target; if (m_opaque_sp) sb_target = m_opaque_sp->GetTarget().GetSP(); if (log) - log->Printf ("SBProcess::GetTarget (this.sp=%p) => SBTarget (this.sp = %p)", m_opaque_sp.get(), - sb_target.get()); + log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", m_opaque_sp.get(), sb_target.get()); return sb_target; } @@ -165,9 +152,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::PutSTDIN (%s, %d)", src, src_len); - size_t ret_val = 0; if (m_opaque_sp != NULL) { @@ -176,8 +160,11 @@ } if (log) - log->Printf ("SBProcess::PutSTDIN (this.sp=%p, src='%s', src_len=%d) => %d", m_opaque_sp.get(), src, - (uint32_t) src_len, ret_val); + log->Printf ("SBProcess(%p)::PutSTDIN (src='%s', src_len=%d) => %d", + m_opaque_sp.get(), + src, + (uint32_t) src_len, + ret_val); return ret_val; } @@ -187,9 +174,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetSTDOUT (char *dst, size_t dst_Len)"); - size_t ret_val = 0; if (m_opaque_sp != NULL) { @@ -198,8 +182,12 @@ } if (log) - log->Printf ("SBProcess::GetSTDOUT (this.sp=%p, dst='%s', dst_len=%d) => %d", m_opaque_sp.get(), dst, - (uint32_t) dst_len, (uint32_t) ret_val); + 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); return ret_val; } @@ -209,9 +197,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetSTDERR (char *dst, size_t dst_len)"); - size_t ret_val = 0; if (m_opaque_sp != NULL) { @@ -220,8 +205,12 @@ } if (log) - log->Printf ("SBProcess::GetSTDERR (this.sp=%p, dst='%s', dst_len=%d) => %d", m_opaque_sp.get(), dst, - (uint32_t) dst_len, (uint32_t) ret_val); + 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); return ret_val; } @@ -277,16 +266,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::SetSelectedThreadByID (%d)", tid); - bool ret_val = false; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid); if (log) - log->Printf ("SBProcess::SetSelectedThreadByID (this.sp=%p, tid=%d) => '%s'", m_opaque_sp.get(), - tid, (ret_val ? "true" : "false")); + log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=%d) => '%s'", + m_opaque_sp.get(), tid, (ret_val ? "true" : "false")); return ret_val; } @@ -296,19 +282,14 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetThreadAtIndex (%d)"); - SBThread thread; if (m_opaque_sp) thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index)); if (log) { - SBStream sstr; - thread.GetDescription (sstr); - log->Printf ("SBProcess::GetThreadAtIndex (this.sp=%p, index=%d) => SBThread : this.sp = %p, '%s'", - m_opaque_sp.get(), (uint32_t) index, thread.GetLLDBObjectPtr(), sstr.GetData()); + log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)", + m_opaque_sp.get(), (uint32_t) index, thread.GetLLDBObjectPtr()); } return thread; @@ -319,15 +300,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetState ()"); - StateType ret_val = eStateInvalid; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetState(); if (log) - log->Printf ("SBProcess::GetState (this.sp=%p) => '%s'", m_opaque_sp.get(), + log->Printf ("SBProcess(%p)::GetState () => '%s'", + m_opaque_sp.get(), lldb_private::StateAsCString (ret_val)); return ret_val; @@ -357,15 +336,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetProcessID ()"); - lldb::pid_t ret_val = LLDB_INVALID_PROCESS_ID; if (m_opaque_sp) ret_val = m_opaque_sp->GetID(); if (log) - log->Printf ("SBProcess::GetProcessID (this.sp=%p) => %d", m_opaque_sp.get(), ret_val); + log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val); return ret_val; } @@ -375,15 +351,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetAddressByteSize()"); - uint32_t size = 0; if (m_opaque_sp) size = m_opaque_sp->GetAddressByteSize(); if (log) - log->Printf ("SBProcess::GetAddressByteSize (this.sp=%p) => %d", m_opaque_sp.get(), size); + log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", m_opaque_sp.get(), size); return size; } @@ -414,9 +387,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::Continue ()"); - SBError sb_error; if (IsValid()) { @@ -435,8 +405,7 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Continue (this.sp=%p) => SBError (this.ap = %p, '%s')", m_opaque_sp.get(), - sb_error.get(), sstr.GetData()); + log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s", m_opaque_sp.get(), sb_error.get(), sstr.GetData()); } return sb_error; @@ -461,9 +430,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::Stop ()"); - SBError sb_error; if (IsValid()) sb_error.SetError (m_opaque_sp->Halt()); @@ -474,7 +440,9 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Stop (this.sp=%p) => SBError (this.ap = %p, '%s')", m_opaque_sp.get(), sb_error.get(), + log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s", + m_opaque_sp.get(), + sb_error.get(), sstr.GetData()); } @@ -486,9 +454,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::Kill ()"); - SBError sb_error; if (m_opaque_sp) sb_error.SetError (m_opaque_sp->Destroy()); @@ -499,7 +464,9 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess::Kill (this.sp=%p) => SBError (this.ap = %p,'%s')", m_opaque_sp.get(), sb_error.get(), + log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s", + m_opaque_sp.get(), + sb_error.get(), sstr.GetData()); } @@ -574,13 +541,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - //{ - // SBStream sstr; - // event.GetDescription (sstr); - // log->Printf ("SBProcess::GetStateFromEvent (%s)", sstr.GetData()); - //} - StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get()); if (log) @@ -609,13 +569,10 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::GetBroadcaster ()"); - SBBroadcaster broadcaster(m_opaque_sp.get(), false); if (log) - log->Printf ("SBProcess::GetBroadcaster (this.sp=%p) => SBBroadcaster (this.obj = %p)", m_opaque_sp.get(), + log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)", m_opaque_sp.get(), broadcaster.get()); return broadcaster; @@ -632,9 +589,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBProcess::ReadMemory (%p, %p, %d, sb_error)", addr, dst, dst_len); - size_t bytes_read = 0; if (IsValid()) @@ -649,8 +603,18 @@ } if (log) - log->Printf ("SBProcess::ReadMemory (this.sp=%p, addr=%p, dst=%p, dst_len=%d, sb_error.ap=%p) => %d", - m_opaque_sp.get(), addr, dst, (uint32_t) dst_len, sb_error.get(), (uint32_t) bytes_read); + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::ReadMemory (addr=%llx, dst=%p, dst_len=%d, SBError (%p): %s) => %d", + m_opaque_sp.get(), + addr, + dst, + (uint32_t) dst_len, + sb_error.get(), + sstr.GetData(), + (uint32_t) bytes_read); + } return bytes_read; } Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Thu Oct 28 23:59:35 2010 @@ -60,8 +60,12 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::SBTarget (rhs.sp=%p) => this.sp = %p", - rhs.m_opaque_sp.get(), m_opaque_sp.get()); + { + 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) : @@ -73,7 +77,7 @@ { SBStream sstr; GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBTarget::SBTarget (target_sp=%p) => this.sp = %p ('%s')", + log->Printf ("SBTarget::SBTarget (target_sp=%p) => SBTarget(%p): '%s'", target_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -84,16 +88,13 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Assign (this.sp=%p, rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); + log->Printf ("SBTarget(%p)::Assign (rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); if (this != &rhs) { m_opaque_sp = rhs.m_opaque_sp; } - //if (log) - // log->Printf ("SBTarget::Assign => SBTarget (this = %p, m_opaque_sp.get() = %p)", this, m_opaque_sp.get()); - return *this; } @@ -116,9 +117,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetProcess ()"); - SBProcess sb_process; if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->GetProcessSP()); @@ -127,7 +125,7 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::GetProcess (this.sp=%p) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), + log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p): %s", m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } @@ -150,9 +148,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::CreateProcess ()"); - SBProcess sb_process; if (m_opaque_sp) @@ -162,7 +157,7 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::CreateProcess (this.sp=%p) => SBProcess this.sp = %p, '%s'", m_opaque_sp.get(), + log->Printf ("SBTarget(%p)::CreateProcess () => SBProcess(%p): %s", m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } @@ -183,9 +178,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::LaunchProcess (this.sp=%p, argv=%p, envp=%p, tty='%s', launch_flags=%d, " - "stop_at_entry='%s')", - m_opaque_sp.get(), argv, envp, tty, launch_flags, (stop_at_entry ? "true" : "false")); + log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%i)", + m_opaque_sp.get(), argv, envp, tty, launch_flags, stop_at_entry); SBError sb_error; SBProcess sb_process = Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); @@ -194,8 +188,8 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::LaunchProcess (this.sp=%p, ...) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), - sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::LaunchProcess (...) => SBProcess(%p): %s", + m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } return sb_process; @@ -215,11 +209,10 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Launch (this.sp=%p, argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%s, " - "error.ap=%p)", - m_opaque_sp.get(), argv, envp, tty, launch_flags, (stop_at_entry ? "true" : "false"), - error.get()); - + { + log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%i, &error (%p))...", + m_opaque_sp.get(), argv, envp, tty, launch_flags, stop_at_entry, error.get()); + } SBProcess sb_process; if (m_opaque_sp) { @@ -274,8 +267,8 @@ { SBStream sstr; sb_process.GetDescription (sstr); - log->Printf ("SBTarget::Launch (this.sp=%p, ...) => SBProceess : this.sp = %p, '%s'", m_opaque_sp.get(), - sb_process.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::Launch (...) => SBProceess(%p): %s", + m_opaque_sp.get(), sb_process.get(), sstr.GetData()); } return sb_process; @@ -366,9 +359,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetExecutable ()"); - SBFileSpec exe_file_spec; if (m_opaque_sp) { @@ -383,11 +373,11 @@ { SBStream sstr; exe_file_spec.GetDescription (sstr); - log->Printf ("SBTarget::GetExecutable (this.sp=%p) => SBFileSpec (this.ap = %p, '%s')", m_opaque_sp.get(), + log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p): %s", m_opaque_sp.get(), exe_file_spec.get(), sstr.GetData()); } else - log->Printf ("SBTarget::GetExecutable (this.sp=%p) => SBFileSpec (this.ap = %p, 'Unable to find valid file')", + log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec (%p): Unable to find valid file", m_opaque_sp.get(), exe_file_spec.get()); } @@ -439,10 +429,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) file = '%s', line = %d", - // file, line); - SBBreakpoint sb_bp; if (file != NULL && line != 0) sb_bp = BreakpointCreateByLocation (SBFileSpec (file), line); @@ -451,8 +437,7 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf("SBTarget::BreakpointCreateByLocation (this.sp=%p, file='%s', line=%d) => " - "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), file, line, sb_bp.get(), sstr.GetData()); + log->Printf("SBTarget(%p)::BreakpointCreateByLocation (file='%s', line=%d) => SBBreakpoint(%p): %s", m_opaque_sp.get(), file, line, sb_bp.get(), sstr.GetData()); } return sb_bp; @@ -463,10 +448,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) " - // "sb_file_spec (%p), line = %d)", &sb_file_spec, line); - SBBreakpoint sb_bp; if (m_opaque_sp.get() && line != 0) *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false); @@ -475,8 +456,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByLocation (this.sp=%p, sb_file_spec.ap=%p, line=%d) => " - "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), sb_file_spec.get(), line, sb_bp.get(), + log->Printf ("SBTarget(%p)::BreakpointCreateByLocation (sb_file_spec.ap=%p, line=%d) => " + "SBBreakpoint(%p): %s", m_opaque_sp.get(), sb_file_spec.get(), line, sb_bp.get(), sstr.GetData()); } @@ -488,10 +469,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) " - // "symbol_name = %s, module_name = %s)", symbol_name, module_name); - SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name && symbol_name[0]) { @@ -510,8 +487,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByName (this.sp=%p, symbol_name='%s', module_name='%s') => " - "SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), symbol_name, module_name, sb_bp.get(), + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol_name='%s', module_name='%s') => " + "SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name, module_name, sb_bp.get(), sstr.GetData()); } @@ -523,10 +500,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) " - // "symbol_name_regex = %s, module_name = %s)", symbol_name_regex, module_name); - SBBreakpoint sb_bp; if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0]) { @@ -548,8 +521,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByRegex (this.sp=%p, symbol_name_regex='%s', module_name='%s') " - "=> SBBreakpoint : this.sp = %p, '%s'", m_opaque_sp.get(), symbol_name_regex, module_name, + log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_name_regex='%s', module_name='%s') " + "=> SBBreakpoint(%p): %s", m_opaque_sp.get(), symbol_name_regex, module_name, sb_bp.get(), sstr.GetData()); } @@ -563,9 +536,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointCreateByAddress (addr_t address) address = %p", address); - SBBreakpoint sb_bp; if (m_opaque_sp.get()) *sb_bp = m_opaque_sp->CreateBreakpoint (address, false); @@ -574,8 +544,8 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget::BreakpointCreateByAddress (this.sp=%p, address=%p) => " - "SBBreakpoint : this.sp = %p, '%s')", m_opaque_sp.get(), address, sb_bp.get(), sstr.GetData()); + log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (%p, address=%p) => " + "SBBreakpoint(%p): %s", m_opaque_sp.get(), address, sb_bp.get(), sstr.GetData()); } return sb_bp; @@ -586,9 +556,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::FindBreakpointByID (break_id_t bp_id) bp_id = %d", bp_id); - SBBreakpoint sb_breakpoint; if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID) *sb_breakpoint = m_opaque_sp->GetBreakpointByID (bp_id); @@ -597,7 +564,7 @@ { SBStream sstr; sb_breakpoint.GetDescription (sstr); - log->Printf ("SBTarget::FindBreakpointByID (this.sp=%p, bp_id=%d) => SBBreakpoint : this.sp = %p, '%s'", + log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p): %s", m_opaque_sp.get(), (uint32_t) bp_id, sb_breakpoint.get(), sstr.GetData()); } @@ -626,21 +593,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::BreakpointDelete (break_id_t bp_id) bp_id = %d", bp_id); - bool result = false; if (m_opaque_sp) result = m_opaque_sp->RemoveBreakpointByID (bp_id); if (log) { - if (result) - log->Printf ("SBTarget::BreakpointDelete (this.sp=%p, bp_id=%d) => 'true'", m_opaque_sp.get(), - (uint32_t) bp_id); - else - log->Printf ("SBTarget::BreakpointDelete (this.sp=%p, bp_id=%d) => 'false'", m_opaque_sp.get(), - (uint32_t) bp_id); + log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) bp_id, result); } return result; @@ -685,15 +644,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetNumModules ()"); - uint32_t num = 0; if (m_opaque_sp) num = m_opaque_sp->GetImages().GetSize(); if (log) - log->Printf ("SBTarget::GetNumModules (this.sp=%p) => %d", m_opaque_sp.get(), num); + log->Printf ("SBTarget(%p)::GetNumModules () => %d", m_opaque_sp.get(), num); return num; } @@ -704,7 +660,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget::Clear (this.sp=%p)", m_opaque_sp.get()); + log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get()); m_opaque_sp.reset(); } @@ -724,9 +680,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetModuleAtIndex (uint32_t idx) idx = %d", idx); - SBModule sb_module; if (m_opaque_sp) sb_module.SetModule(m_opaque_sp->GetImages().GetModuleAtIndex(idx)); @@ -735,7 +688,7 @@ { SBStream sstr; sb_module.GetDescription (sstr); - log->Printf ("SBTarget::GetModuleAtIndex (this.sp=%p, idx=%d) => SBModule: this = %p, '%s'", + log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p): %s", m_opaque_sp.get(), idx, sb_module.get(), sstr.GetData()); } @@ -748,13 +701,10 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBTarget::GetBroadcaster ()"); - SBBroadcaster broadcaster(m_opaque_sp.get(), false); if (log) - log->Printf ("SBTarget::GetBroadcaster (this.sp=%p) => SBBroadcaster (this.obj = %p)", + log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)", m_opaque_sp.get(), broadcaster.get()); return broadcaster; Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Thu Oct 28 23:59:35 2010 @@ -55,7 +55,7 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBThread::SBThread (lldb_object_sp=%p) => this.sp = %p (%s)", + log->Printf ("SBThread::SBThread (lldb_object_sp=%p) => SBThread(%p) :%s", lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -67,7 +67,7 @@ m_opaque_sp = rhs.m_opaque_sp; if (log) - log->Printf ("SBThread::SBThread (rhs.sp=%p) => this.sp = %p", + log->Printf ("SBThread::SBThread (rhs.sp=%p) => SBThread(%p)", rhs.m_opaque_sp.get(), m_opaque_sp.get()); } @@ -97,9 +97,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetStopReason ()"); - StopReason reason = eStopReasonInvalid; if (m_opaque_sp) { @@ -109,7 +106,7 @@ } if (log) - log->Printf ("SBThread::GetStopReason (this.sp=%p) => '%s'", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::GetStopReason () => '%s'", m_opaque_sp.get(), Thread::StopReasonAsCString (reason)); return reason; @@ -120,9 +117,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetStopDescription (char *dst, size_t dst_len)"); - if (m_opaque_sp) { StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo (); @@ -132,7 +126,7 @@ if (stop_desc) { if (log) - log->Printf ("SBThread::GetStopDescription (this.sp=%p, dst, dst_len) => '%s'", + log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", m_opaque_sp.get(), stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc); @@ -199,7 +193,7 @@ if (stop_desc && stop_desc[0]) { if (log) - log->Printf ("SBThread::GetStopDescription (this.sp=%p, dst, dst_len) => '%s'", + log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", m_opaque_sp.get(), stop_desc); if (dst) @@ -300,7 +294,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepOver (this.sp=%p, stop_other_threads='%s')", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", m_opaque_sp.get(), Thread::RunModeAsCString (stop_other_threads)); if (m_opaque_sp) @@ -349,7 +343,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepInto (this.sp=%p, stop_other_threads='%s')", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", m_opaque_sp.get(), Thread::RunModeAsCString (stop_other_threads)); if (m_opaque_sp) @@ -424,8 +418,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepInstruction (this.sp=%p, step_over=%s)", m_opaque_sp.get(), - (step_over ? "true" : "false")); + log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", m_opaque_sp.get(), step_over); if (m_opaque_sp) { @@ -449,7 +442,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::RunToAddress (this.sp=%p, addr=%p)", m_opaque_sp.get(), addr); + log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", m_opaque_sp.get(), addr); if (m_opaque_sp) { @@ -478,9 +471,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetProcess ()"); - SBProcess process; if (m_opaque_sp) { @@ -504,9 +494,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetNumFrames ()"); - uint32_t num_frames = 0; if (m_opaque_sp) num_frames = m_opaque_sp->GetStackFrameCount(); @@ -522,9 +509,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetFrameAtIndex (uint32_t idx) idx = %d", idx); - SBFrame sb_frame; if (m_opaque_sp) sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx)); @@ -533,7 +517,7 @@ { SBStream sstr; sb_frame.GetDescription (sstr); - log->Printf ("SBThread::GetFrameAtIndex (this.sp=%p, idx=%d) => SBFrame.sp : this = %p, '%s'", + log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame.sp : this = %p, '%s'", m_opaque_sp.get(), idx, sb_frame.get(), sstr.GetData()); } @@ -546,7 +530,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::operator= (this.sp=%p, rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); + log->Printf ("SBThread(%p)::operator= (rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); m_opaque_sp = rhs.m_opaque_sp; return *this; Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Thu Oct 28 23:59:35 2010 @@ -48,8 +48,7 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBValue::SBValue (value_sp=%p) => this.sp = %p (%s)", - value_sp.get(), m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBValue::SBValue (%p) => (%s)", m_opaque_sp.get(), sstr.GetData()); } } @@ -79,23 +78,15 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBValue::GetName ()"); + if (log) + log->Printf ("SBValue::GetName () ptr=%p => '%s'", + m_opaque_sp.get(), + m_opaque_sp ? m_opaque_sp->GetName().AsCString() : ""); if (IsValid()) - { - if (log) - log->Printf ("SBValue::GetName (this.sp=%p) => '%s'", m_opaque_sp.get(), - m_opaque_sp->GetName().AsCString()); + return m_opaque_sp->GetName().GetCString(); - return m_opaque_sp->GetName().AsCString(); - } - else - { - if (log) - log->Printf ("SBValue::GetName (this.sp=%p) ==> NULL", m_opaque_sp.get()); - return NULL; - } + return NULL; } const char * @@ -319,18 +310,21 @@ { if (m_opaque_sp) { - const char *name = GetName(); - const char *type_name = GetTypeName (); - size_t byte_size = GetByteSize (); - uint32_t num_children = GetNumChildren (); - bool is_stale = ValueIsStale (); - description.Printf ("name: '%s', type: %s, size: %d", (name != NULL ? name : ""), - (type_name != NULL ? type_name : ""), (int) byte_size); - if (num_children > 0) - description.Printf (", num_children: %d", num_children); - - if (is_stale) - description.Printf (" [value is stale]"); + // Don't call all these APIs and cause more logging! +// const char *name = GetName(); +// const char *type_name = GetTypeName (); +// size_t byte_size = GetByteSize (); +// uint32_t num_children = GetNumChildren (); +// bool is_stale = ValueIsStale (); +// description.Printf ("name: '%s', type: %s, size: %d", (name != NULL ? name : ""), +// (type_name != NULL ? type_name : ""), (int) byte_size); +// if (num_children > 0) +// description.Printf (", num_children: %d", num_children); +// +// if (is_stale) +// description.Printf (" [value is stale]"); + + description.Printf ("name: '%s'", m_opaque_sp->GetName().GetCString()); } else description.Printf ("No value"); Modified: lldb/trunk/source/API/SBValueList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/API/SBValueList.cpp (original) +++ lldb/trunk/source/API/SBValueList.cpp Thu Oct 28 23:59:35 2010 @@ -158,7 +158,7 @@ SBStream sstr; sb_value.GetDescription (sstr); log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')", - m_opaque_ap.get(), sb_value.get(), sstr.GetData()); + m_opaque_ap.get(), idx, sb_value.get(), sstr.GetData()); } return sb_value; Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Thu Oct 28 23:59:35 2010 @@ -1094,7 +1094,7 @@ else { if (print_valobj) - s.PutCString(" {\n"); + s.PutCString(is_ref ? ": {\n" : " {\n"); s.IndentMore(); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Oct 28 23:59:35 2010 @@ -3327,12 +3327,11 @@ if (type_sp.unique()) { // We are ready to put this type into the uniqued list up at the module level - TypeSP uniqued_type_sp(m_obj_file->GetModule()->GetTypeList()->InsertUnique(type_sp)); + m_obj_file->GetModule()->GetTypeList()->Insert (type_sp); if (m_debug_map_symfile) - m_debug_map_symfile->GetObjectFile()->GetModule()->GetTypeList()->InsertUnique (uniqued_type_sp); + m_debug_map_symfile->GetObjectFile()->GetModule()->GetTypeList()->Insert (type_sp); - type_sp = uniqued_type_sp; m_die_to_type[die] = type_sp.get(); } } Modified: lldb/trunk/source/Symbol/TypeList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeList.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/Symbol/TypeList.cpp (original) +++ lldb/trunk/source/Symbol/TypeList.cpp Thu Oct 28 23:59:35 2010 @@ -52,82 +52,31 @@ { } -//---------------------------------------------------------------------- -// Add a base type to the type list -//---------------------------------------------------------------------- +void +TypeList::Insert (TypeSP& type_sp) +{ + // Just push each type on the back for now. We will worry about uniquing later + if (type_sp) + m_types.insert(std::make_pair(type_sp->GetID(), type_sp)); +} -//struct CampareDCTypeBaton -//{ -// CampareDCTypeBaton(const std::vector& _types, const Type* _search_type) : -// types(_types), -// search_type(_search_type) -// { -// } -// const std::vector& types; -// const Type* search_type; -//}; -// -//static int -//compare_dc_type (const void *key, const void *arrmem) -//{ -// const Type* search_type = ((CampareDCTypeBaton*) key)->search_type; -// uint32_t curr_index = *(uint32_t *)arrmem; -// const Type* curr_type = ((CampareDCTypeBaton*) key)->types[curr_index].get(); -// Type::CompareState state; -// return Type::Compare(*search_type, *curr_type, state); -//} -// -//struct LessThanBinaryPredicate -//{ -// LessThanBinaryPredicate(const CampareDCTypeBaton& _compare_baton) : -// compare_baton(_compare_baton) -// { -// } -// -// bool operator() (uint32_t a, uint32_t b) const -// { -// Type::CompareState state; -// return Type::Compare(*compare_baton.search_type, *compare_baton.types[b].get(), state) < 0; -// } -// const CampareDCTypeBaton& compare_baton; -//}; -TypeSP -TypeList::InsertUnique(TypeSP& type_sp) +bool +TypeList::InsertUnique (TypeSP& type_sp) { -#if 0 -// Stream s(stdout); -// s << "TypeList::InsertUnique for type "; -// type_sp->Dump(s); -// s << "Current list:\n"; -// Dump(s); - - CampareDCTypeBaton compare_baton(m_types, type_sp.get()); - uint32_t* match_index_ptr = (uint32_t*)bsearch(&compare_baton, &m_sorted_indexes[0], m_sorted_indexes.size(), sizeof(uint32_t), compare_dc_type); - if (match_index_ptr) + if (type_sp) { -// s << "returning existing type: " << (void *)m_types[*match_index_ptr].get() << "\n"; - return m_types[*match_index_ptr]; + user_id_t type_uid = type_sp->GetID(); + iterator pos, end = m_types.end(); + + for (pos = m_types.find(type_uid); pos != end && pos->second->GetID() == type_uid; ++pos) + { + if (pos->second.get() == type_sp.get()) + return false; + } } - - // Get the new index within the m_types array before we add the new type - uint32_t uniqued_type_index = m_types.size(); - // Add the new shared pointer to our type by appending it to the end of the types array - m_types.push_back(type_sp); - // Figure out what the sorted index of this new type should be - uint32_t fake_index = 0; - LessThanBinaryPredicate compare_func_obj(compare_baton); - std::vector::iterator insert_pos = std::upper_bound(m_sorted_indexes.begin(), m_sorted_indexes.end(), fake_index, compare_func_obj); - // Insert the sorted index into our sorted index array - m_sorted_indexes.insert(insert_pos, uniqued_type_index); -#else - // Just push each type on the back for now. We will worry about uniquing later - m_types.push_back (type_sp); -#endif -// s << "New list:\n"; -// Dump(s); - - return type_sp; + Insert (type_sp); + return true; } //---------------------------------------------------------------------- @@ -136,26 +85,25 @@ TypeSP TypeList::FindType(lldb::user_id_t uid) { - TypeSP type_sp; - iterator pos, end; - for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) - if ((*pos)->GetID() == uid) - return *pos; - - return type_sp; + iterator pos = m_types.find(uid); + if (pos != m_types.end()) + return pos->second; + return TypeSP(); } //---------------------------------------------------------------------- // Find a type by name. //---------------------------------------------------------------------- TypeList -TypeList::FindTypes(const ConstString &name) +TypeList::FindTypes (const ConstString &name) { + // Do we ever need to make a lookup by name map? Here we are doing + // a linear search which isn't going to be fast. TypeList types(m_ast.getTargetInfo()->getTriple().getTriple().c_str()); iterator pos, end; for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) - if ((*pos)->GetName() == name) - types.InsertUnique(*pos); + if (pos->second->GetName() == name) + types.Insert (pos->second); return types; } @@ -171,33 +119,31 @@ return m_types.size(); } +// GetTypeAtIndex isn't used a lot for large type lists, currently only for +// type lists that are returned for "image dump -t TYPENAME" commands and other +// simple symbol queries that grab the first result... + TypeSP TypeList::GetTypeAtIndex(uint32_t idx) { - TypeSP type_sp; - if (idx < m_types.size()) - type_sp = m_types[idx]; - return type_sp; + iterator pos, end; + uint32_t i = idx; + for (pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) + { + if (i == 0) + return pos->second; + --i; + } + return TypeSP(); } void TypeList::Dump(Stream *s, bool show_context) { -// std::vector::const_iterator pos, end; -// for (pos = end = m_sorted_indexes.begin(), end = m_sorted_indexes.end(); pos != end; ++pos) -// { -// m_types[*pos]->Dump(s, show_context); -// } - - m_ast.getASTContext()->getTranslationUnitDecl()->print(llvm::fouts(), 0); - const size_t num_types = m_types.size(); - for (size_t i=0; iDump(s, show_context); + pos->second->Dump(s, show_context); } -// ASTContext *ast_context = GetClangASTContext ().getASTContext(); -// if (ast_context) -// ast_context->PrintStats(); } Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117641&r1=117640&r2=117641&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Thu Oct 28 23:59:35 2010 @@ -73,22 +73,15 @@ s->Indent(); s->PutCString("Target\n"); s->IndentMore(); - m_images.Dump(s); - m_breakpoint_list.Dump(s); - m_internal_breakpoint_list.Dump(s); + m_images.Dump(s); + m_breakpoint_list.Dump(s); + m_internal_breakpoint_list.Dump(s); + s->IndentLess(); } else { - char path[PATH_MAX]; - int path_len = PATH_MAX; - if (GetExecutableModule()->GetFileSpec().GetPath (path, path_len)) - s->Printf ("Target: %s\n", path); - else - s->Printf ("Target: \n"); + s->Printf ("%s", GetExecutableModule()->GetFileSpec().GetFilename().GetCString()); } -// if (m_process_sp.get()) -// m_process_sp->Dump(s); - s->IndentLess(); } void From johnny.chen at apple.com Fri Oct 29 12:31:47 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 29 Oct 2010 17:31:47 -0000 Subject: [Lldb-commits] [lldb] r117668 - /lldb/trunk/test/array_types/TestArrayTypes.py Message-ID: <20101029173147.50D3C2A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 12:31:47 2010 New Revision: 117668 URL: http://llvm.org/viewvc/llvm-project?rev=117668&view=rev Log: The r117641 check in removed the SBValue's print description of type and size. Change the test case to not check it for an SBVariable's print description. Modified: lldb/trunk/test/array_types/TestArrayTypes.py Modified: lldb/trunk/test/array_types/TestArrayTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=117668&r1=117667&r2=117668&view=diff ============================================================================== --- lldb/trunk/test/array_types/TestArrayTypes.py (original) +++ lldb/trunk/test/array_types/TestArrayTypes.py Fri Oct 29 12:31:47 2010 @@ -151,10 +151,8 @@ # representation. variable = frame.LookupVar("strings") var = repr(variable) - self.expect(var, "Variable for 'strings' looks good with correct type and size", exe=False, - substrs = ["name: '%s'" % variable.GetName(), - "type: %s" % variable.GetTypeName(), - "size: %d" % variable.GetByteSize()]) + self.expect(var, "Variable for 'strings' looks good with correct name", exe=False, + substrs = ["name: '%s'" % variable.GetName()]) self.DebugSBValue(frame, variable) self.assertTrue(variable.GetNumChildren() == 4, "Variable 'strings' should have 4 children") From scallanan at apple.com Fri Oct 29 13:38:40 2010 From: scallanan at apple.com (Sean Callanan) Date: Fri, 29 Oct 2010 18:38:40 -0000 Subject: [Lldb-commits] [lldb] r117680 - in /lldb/trunk: include/lldb/Expression/ClangASTSource.h llvm.zip scripts/build-llvm.pl source/Expression/ClangASTSource.cpp source/Symbol/ClangASTContext.cpp Message-ID: <20101029183840.953D22A6C12C@llvm.org> Author: spyffe Date: Fri Oct 29 13:38:40 2010 New Revision: 117680 URL: http://llvm.org/viewvc/llvm-project?rev=117680&view=rev Log: Updated LLVM to latest version as of 10/28 at 7pm, and made minor integration fixes. Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h lldb/trunk/llvm.zip lldb/trunk/scripts/build-llvm.pl lldb/trunk/source/Expression/ClangASTSource.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=117680&r1=117679&r2=117680&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original) +++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Fri Oct 29 13:38:40 2010 @@ -103,6 +103,7 @@ /// Interface stub that returns true. //------------------------------------------------------------------ bool FindExternalLexicalDecls(const clang::DeclContext *DC, + bool (*isKindWeWant)(clang::Decl::Kind), llvm::SmallVectorImpl &Decls); //------------------------------------------------------------------ Modified: lldb/trunk/llvm.zip URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=117680&r1=117679&r2=117680&view=diff ============================================================================== Binary files - no diff available. Modified: lldb/trunk/scripts/build-llvm.pl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=117680&r1=117679&r2=117680&view=diff ============================================================================== --- lldb/trunk/scripts/build-llvm.pl (original) +++ lldb/trunk/scripts/build-llvm.pl Fri Oct 29 13:38:40 2010 @@ -25,7 +25,7 @@ our $llvm_configuration = $ENV{LLVM_CONFIGURATION}; -our $llvm_revision = "'{2010-10-01T17:00}'"; +our $llvm_revision = "'{2010-10-28T19:00}'"; our $llvm_source_dir = "$ENV{SRCROOT}"; our $cc = "$ENV{DEVELOPER_BIN_DIR}/gcc-4.2"; our $cxx = "$ENV{DEVELOPER_BIN_DIR}/g++-4.2"; Modified: lldb/trunk/source/Expression/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=117680&r1=117679&r2=117680&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangASTSource.cpp (original) +++ lldb/trunk/source/Expression/ClangASTSource.cpp Fri Oct 29 13:38:40 2010 @@ -105,7 +105,9 @@ // This is used to support iterating through an entire lexical context, // which isn't something the debugger should ever need to do. -bool ClangASTSource::FindExternalLexicalDecls(const DeclContext *DC, llvm::SmallVectorImpl &Decls) { +bool ClangASTSource::FindExternalLexicalDecls(const DeclContext *DC, + bool (*isKindWeWant)(Decl::Kind), + llvm::SmallVectorImpl &Decls) { // true is for error, that's good enough for me return true; } Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=117680&r1=117679&r2=117680&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Oct 29 13:38:40 2010 @@ -161,7 +161,7 @@ // llvm::StringRef Vis = getLastArgValue(Args, OPT_fvisibility, // "default"); // if (Vis == "default") - Opts.setVisibilityMode(LangOptions::Default); + Opts.setVisibilityMode(DefaultVisibility); // else if (Vis == "hidden") // Opts.setVisibilityMode(LangOptions::Hidden); // else if (Vis == "protected") @@ -1091,6 +1091,7 @@ cxx_record_decl, DeclarationNameInfo (ast_context->DeclarationNames.getCXXDestructorName (ast_context->getCanonicalType (record_qual_type)), SourceLocation()), method_qual_type, + NULL, is_inline, is_implicitly_declared); } @@ -3346,7 +3347,7 @@ SourceLocation(), name && name[0] ? &ast_context->Idents.get(name) : NULL, SourceLocation(), - NULL); //IsScoped, IsFixed); + NULL, false, false); //IsScoped, IsFixed); if (enum_decl) { // TODO: check if we should be setting the promotion type too? From johnny.chen at apple.com Fri Oct 29 14:33:41 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 29 Oct 2010 19:33:41 -0000 Subject: [Lldb-commits] [lldb] r117688 - in /lldb/trunk: source/Commands/CommandObjectDisassemble.cpp test/foundation/TestFoundationDisassembly.py Message-ID: <20101029193341.165B52A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 14:33:40 2010 New Revision: 117688 URL: http://llvm.org/viewvc/llvm-project?rev=117688&view=rev Log: The r117616 check in broken these two test cases: 1. FoundationDisassembleTestCase.test_simple_disasm_with_dsym; and 2. FoundationDisassembleTestCase.test_simple_disasm_with_dwarf the reason being the test was issuing 'disassemble' command to disassemble the current frame function when stopped. The 'disassemble' command worked previously but it was a result of bad option specification. Fix the disassemble command so that it will require 'disassemble -f' for disassembly of the current frame function. Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp lldb/trunk/test/foundation/TestFoundationDisassembly.py Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=117688&r1=117687&r2=117688&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Fri Oct 29 14:33:40 2010 @@ -90,6 +90,11 @@ raw = true; break; + case 'f': + // The default action is to disassemble the function for the current frame. + // There's no need to set any flag. + break; + default: error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option); break; @@ -130,7 +135,7 @@ { LLDB_OPT_SET_2, true, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Disassemble entire contents of the given function name."}, -//{ LLDB_OPT_SET_3, false, "current-frame", 'f', no_argument, NULL, 0, eArgTypeNone, "Disassemble entire contents of the current frame's function."}, +{ LLDB_OPT_SET_3, true, "current-frame", 'f', no_argument, NULL, 0, eArgTypeNone, "Disassemble entire contents of the current frame's function."}, { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } }; @@ -244,6 +249,7 @@ } else { + // The default action is to disassemble the current frame function. if (exe_ctx.frame) { SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol)); Modified: lldb/trunk/test/foundation/TestFoundationDisassembly.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/foundation/TestFoundationDisassembly.py?rev=117688&r1=117687&r2=117688&view=diff ============================================================================== --- lldb/trunk/test/foundation/TestFoundationDisassembly.py (original) +++ lldb/trunk/test/foundation/TestFoundationDisassembly.py Fri Oct 29 14:33:40 2010 @@ -92,7 +92,7 @@ substrs = ["Foundation`+[NSString stringWithFormat:]"]) # Do the disassemble for the currently stopped function. - self.runCmd("disassemble") + self.runCmd("disassemble -f") self.runCmd("process continue") @@ -101,7 +101,7 @@ substrs = ["a.out`-[MyString initWithNSString:]"]) # Do the disassemble for the currently stopped function. - self.runCmd("disassemble") + self.runCmd("disassemble -f") self.runCmd("process continue") @@ -110,7 +110,7 @@ substrs = ["a.out`-[MyString description]"]) # Do the disassemble for the currently stopped function. - self.runCmd("disassemble") + self.runCmd("disassemble -f") self.runCmd("process continue") @@ -119,7 +119,7 @@ substrs = ["Foundation`-[NSAutoreleasePool release]"]) # Do the disassemble for the currently stopped function. - self.runCmd("disassemble") + self.runCmd("disassemble -f") if __name__ == '__main__': From johnny.chen at apple.com Fri Oct 29 15:19:44 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 29 Oct 2010 20:19:44 -0000 Subject: [Lldb-commits] [lldb] r117700 - /lldb/trunk/source/Expression/ClangUserExpression.cpp Message-ID: <20101029201944.E32612A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 15:19:44 2010 New Revision: 117700 URL: http://llvm.org/viewvc/llvm-project?rev=117700&view=rev Log: ClangUserExpression ctor should not crash if given a null expr_prefix char*. Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=117700&r1=117699&r2=117700&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Oct 29 15:19:44 2010 @@ -38,7 +38,7 @@ ClangUserExpression::ClangUserExpression (const char *expr, const char *expr_prefix) : m_expr_text(expr), - m_expr_prefix(expr_prefix), + m_expr_prefix(expr_prefix ? expr_prefix : ""), m_transformed_text(), m_jit_addr(LLDB_INVALID_ADDRESS), m_cplusplus(false), @@ -483,4 +483,4 @@ result_valobj_sp.reset (new ValueObjectConstResult (error)); return result_valobj_sp; -} \ No newline at end of file +} From johnny.chen at apple.com Fri Oct 29 15:28:28 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 29 Oct 2010 20:28:28 -0000 Subject: [Lldb-commits] [lldb] r117705 - /lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py Message-ID: <20101029202828.BF86F2A6C12D@llvm.org> Author: johnny Date: Fri Oct 29 15:28:28 2010 New Revision: 117705 URL: http://llvm.org/viewvc/llvm-project?rev=117705&view=rev Log: Remove the @expectedFailure as the following bug is fixed with newer clang bits with lldb r117700: rdar://problem/8584431 Assert in clang while evaluating expression Modified: lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py Modified: lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py?rev=117705&r1=117704&r2=117705&view=diff ============================================================================== --- lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py (original) +++ lldb/trunk/test/breakpoint_conditions/TestBreakpointConditions.py Fri Oct 29 15:28:28 2010 @@ -8,7 +8,6 @@ import lldb, lldbutil from lldbtest import * - at unittest2.skip("rdar://problem/8584431 Assert in clang while evaluating expression") class BreakpointConditionsTestCase(TestBase): mydir = "breakpoint_conditions" From scallanan at apple.com Fri Oct 29 15:30:27 2010 From: scallanan at apple.com (Sean Callanan) Date: Fri, 29 Oct 2010 20:30:27 -0000 Subject: [Lldb-commits] [lldb] r117706 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20101029203027.342F92A6C12D@llvm.org> Author: spyffe Date: Fri Oct 29 15:30:26 2010 New Revision: 117706 URL: http://llvm.org/viewvc/llvm-project?rev=117706&view=rev Log: Overloading is not broken any more. No need for an #ifndef. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117706&r1=117705&r2=117706&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Oct 29 15:30:26 2010 @@ -3087,6 +3087,7 @@ ); LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_CONFIGURATION = "Debug+Asserts"; + ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=117706&r1=117705&r2=117706&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Oct 29 15:30:26 2010 @@ -1288,9 +1288,6 @@ if (fun) { -#define BROKEN_OVERLOADING - // Awaiting a fix on the Clang side -#ifndef BROKEN_OVERLOADING Type *fun_type = fun->GetType(); if (!fun_type) @@ -1316,11 +1313,6 @@ void *copied_type = ClangASTContext::CopyType(context.GetASTContext(), fun_ast_context, fun_opaque_type); fun_decl = context.AddFunDecl(copied_type); -#else - fun_address = &fun->GetAddressRange().GetBaseAddress(); - - fun_decl = context.AddGenericFunDecl(); -#endif } else if (symbol) { From ctice at apple.com Fri Oct 29 16:48:37 2010 From: ctice at apple.com (Caroline Tice) Date: Fri, 29 Oct 2010 21:48:37 -0000 Subject: [Lldb-commits] [lldb] r117715 - in /lldb/trunk: include/lldb/ include/lldb/Core/ source/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Host/common/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ source/Target/ Message-ID: <20101029214837.C2BA52A6C12C@llvm.org> Author: ctice Date: Fri Oct 29 16:48:37 2010 New Revision: 117715 URL: http://llvm.org/viewvc/llvm-project?rev=117715&view=rev Log: Add the ability to disable individual log categories, rather than just the entire log channel. Add checks, where appropriate, to make sure a log channel/category has not been disabled before attempting to write to it. Modified: lldb/trunk/include/lldb/Core/Log.h lldb/trunk/include/lldb/lldb-private-log.h lldb/trunk/source/API/SBCommunication.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Commands/CommandObjectLog.cpp lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Core/Listener.cpp lldb/trunk/source/Core/Log.cpp lldb/trunk/source/Expression/ClangFunction.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/ThreadPlanStepInRange.cpp lldb/trunk/source/Target/ThreadPlanTestCondition.cpp lldb/trunk/source/lldb-log.cpp Modified: lldb/trunk/include/lldb/Core/Log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Log.h (original) +++ lldb/trunk/include/lldb/Core/Log.h Fri Oct 29 16:48:37 2010 @@ -59,7 +59,7 @@ //------------------------------------------------------------------ // Callback definitions for abstracted plug-in log access. //------------------------------------------------------------------ - typedef void (*DisableCallback) (); + typedef void (*DisableCallback) (Args &args, Stream *feedback_strm); typedef Log* (*EnableCallback) (lldb::StreamSP &log_stream_sp, uint32_t log_options, Args &args, @@ -95,7 +95,7 @@ Stream *feedback_strm); static void - DisableAllLogChannels (); + DisableAllLogChannels (Stream *feedback_strm); static void ListAllLogChannels (Stream *strm); @@ -194,7 +194,7 @@ FindPlugin (const char *plugin_name); virtual void - Disable () = 0; + Disable (Args &args, Stream *feedback_strm) = 0; virtual bool Enable (lldb::StreamSP &log_stream_sp, Modified: lldb/trunk/include/lldb/lldb-private-log.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-log.h (original) +++ lldb/trunk/include/lldb/lldb-private-log.h Fri Oct 29 16:48:37 2010 @@ -69,7 +69,7 @@ IsLogVerbose (); void -DisableLog (); +DisableLog (Args &args, Stream *feedback_strm); Log * EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm); Modified: lldb/trunk/source/API/SBCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommunication.cpp (original) +++ lldb/trunk/source/API/SBCommunication.cpp Fri Oct 29 16:48:37 2010 @@ -178,6 +178,7 @@ if (m_opaque) success = m_opaque->StartReadThread (); + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBCommunication::ReadThreadStart (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); @@ -188,7 +189,6 @@ bool SBCommunication::ReadThreadStop () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); //if (log) // log->Printf ("SBCommunication::ReadThreadStop ()"); @@ -197,6 +197,7 @@ if (m_opaque) success = m_opaque->StopReadThread (); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBCommunication::ReadThreadStop (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Fri Oct 29 16:48:37 2010 @@ -93,6 +93,7 @@ ret_value = 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) => %d", m_opaque_ptr, broadcaster.get(), event_mask, ret_value); Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Fri Oct 29 16:48:37 2010 @@ -385,7 +385,6 @@ SBError SBProcess::Continue () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBError sb_error; if (IsValid()) @@ -401,6 +400,7 @@ else sb_error.SetErrorString ("SBProcess is invalid"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; @@ -428,7 +428,6 @@ SBError SBProcess::Stop () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBError sb_error; if (IsValid()) @@ -436,6 +435,7 @@ else sb_error.SetErrorString ("SBProcess is invalid"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; @@ -452,7 +452,6 @@ SBError SBProcess::Kill () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBError sb_error; if (m_opaque_sp) @@ -460,6 +459,7 @@ else sb_error.SetErrorString ("SBProcess is invalid"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Fri Oct 29 16:48:37 2010 @@ -115,12 +115,12 @@ SBProcess SBTarget::GetProcess () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBProcess sb_process; if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->GetProcessSP()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; @@ -146,13 +146,13 @@ SBProcess SBTarget::CreateProcess () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBProcess sb_process; if (m_opaque_sp) sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener())); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; @@ -184,6 +184,7 @@ SBError sb_error; SBProcess sb_process = Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; @@ -263,6 +264,7 @@ error.SetErrorString ("SBTarget is invalid"); } + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Oct 29 16:48:37 2010 @@ -469,7 +469,6 @@ SBProcess SBThread::GetProcess () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBProcess process; if (m_opaque_sp) @@ -478,6 +477,7 @@ process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP()); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Oct 29 16:48:37 2010 @@ -231,6 +231,7 @@ if (should_stop) { ThreadPlanSP condition_plan_sp(GetThreadPlanToTestCondition(context->exe_ctx, errors)); + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); if (log && errors.GetSize() > 0) { log->Printf("Error evaluating condition: \"%s\".\n", errors.GetData()); @@ -244,6 +245,7 @@ if (should_stop) { + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); if (log) { StreamString s; Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectLog.cpp Fri Oct 29 16:48:37 2010 @@ -291,31 +291,29 @@ } else { - for (size_t i=0; iDisable(args, &result.GetErrorStream()); result.SetStatus(eReturnStatusSuccessFinishNoResult); } - else if (channel == "all") - { - Log::DisableAllLogChannels(); - } else - { - LogChannelSP log_channel_sp (GetLogChannelPluginForChannel(channel.c_str())); - if (log_channel_sp) - { - log_channel_sp->Disable(); - result.SetStatus(eReturnStatusSuccessFinishNoResult); - } - else - result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0)); - } + result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0)); } } return result.Succeeded(); Modified: lldb/trunk/source/Core/Communication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Core/Communication.cpp (original) +++ lldb/trunk/source/Core/Communication.cpp Fri Oct 29 16:48:37 2010 @@ -338,6 +338,7 @@ break; } } + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION); if (log) log->Printf ("%p Communication::ReadThread () thread exiting...", p); Modified: lldb/trunk/source/Core/Listener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Core/Listener.cpp (original) +++ lldb/trunk/source/Core/Listener.cpp Fri Oct 29 16:48:37 2010 @@ -388,12 +388,14 @@ else if (timed_out) { + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); if (log) log->Printf ("%p Listener::WaitForEvents() timed out for %s", this, m_name.c_str()); break; } else { + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS); if (log) log->Printf ("%p Listener::WaitForEvents() unknown error for %s", this, m_name.c_str()); break; Modified: lldb/trunk/source/Core/Log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Core/Log.cpp (original) +++ lldb/trunk/source/Core/Log.cpp Fri Oct 29 16:48:37 2010 @@ -28,7 +28,7 @@ #include "lldb/Host/Host.h" #include "lldb/Host/TimeValue.h" #include "lldb/Host/Mutex.h" - +#include "lldb/Interpreter/Args.h" using namespace lldb; using namespace lldb_private; @@ -384,18 +384,19 @@ } void -Log::DisableAllLogChannels () +Log::DisableAllLogChannels (Stream *feedback_strm) { CallbackMap &callback_map = GetCallbackMap (); CallbackMapIter pos, end = callback_map.end(); + Args args ("all"); for (pos = callback_map.begin(); pos != end; ++pos) - pos->second.disable (); + pos->second.disable (args, feedback_strm); LogChannelMap &channel_map = GetChannelMap (); LogChannelMapIter channel_pos, channel_end = channel_map.end(); for (channel_pos = channel_map.begin(); channel_pos != channel_end; ++channel_pos) - channel_pos->second->Disable (); + channel_pos->second->Disable (args, feedback_strm); } void Modified: lldb/trunk/source/Expression/ClangFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangFunction.cpp (original) +++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Oct 29 16:48:37 2010 @@ -543,6 +543,7 @@ // Right now this is the only way to tell we've timed out... // We should interrupt the process here... // Not really sure what to do if Halt fails here... + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) if (try_all_threads) log->Printf ("Running function with timeout: %d timed out, trying with all threads enabled.", @@ -609,6 +610,7 @@ } else { + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) { StreamString s; @@ -675,7 +677,9 @@ event_explanation = ts.GetData(); } while (0); - log->Printf("Execution interrupted: %s %s", s.GetData(), event_explanation); + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); + if (log) + log->Printf("Execution interrupted: %s %s", s.GetData(), event_explanation); } return_value = eExecutionInterrupted; Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Fri Oct 29 16:48:37 2010 @@ -122,6 +122,7 @@ struct rusage *rusage = NULL; while (1) { + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); if (log) log->Printf("%s ::wait4 (pid = %i, &status, options = %i, rusage = %p)...", function, pid, options, rusage); @@ -170,6 +171,7 @@ { ScopedPThreadCancelDisabler pthread_cancel_disabler; + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); if (log) log->Printf ("%s ::wait4 (pid = %i, &status, options = %i, rusage = %p) => pid = %i, status = 0x%8.8x (%s), signal = %i, exit_state = %i", function, @@ -198,6 +200,7 @@ } } + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); if (log) log->Printf ("%s (arg = %p) thread exiting...", __FUNCTION__, arg); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp Fri Oct 29 16:48:37 2010 @@ -265,6 +265,7 @@ notify_port); // Dump any errors we get + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS); if (log && err.GetError() != MACH_RCV_TIMED_OUT) { log->Error("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = %u, rcv_size = %u, rcv_name = %#x, timeout = %u, notify = %#x)", Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp Fri Oct 29 16:48:37 2010 @@ -547,6 +547,7 @@ if (err.GetError() == MACH_RCV_INTERRUPTED) { + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); // If we have no task port we should exit this thread if (!mach_task->ExceptionPortIsValid()) { @@ -576,6 +577,8 @@ { if (num_exceptions_received > 0) { + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); + // We were receiving all current exceptions with a timeout of zero // it is time to go back to our normal looping mode num_exceptions_received = 0; @@ -619,6 +622,7 @@ } else if (err.GetError() != KERN_SUCCESS) { + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); if (log) log->Printf ("got some other error, do something about it??? nah, continuing for now..."); // TODO: notify of error? @@ -645,6 +649,7 @@ } #endif // #if defined (__arm__) + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); if (log) log->Printf ("MachTask::%s (arg = %p) thread exiting...", __FUNCTION__, arg); return NULL; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Fri Oct 29 16:48:37 2010 @@ -742,6 +742,7 @@ if (!StateIsStoppedState (state)) { + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); if (log) log->Printf("ProcessMacOSX::DoSIGSTOP() failed to stop after sending SIGSTOP"); return error; @@ -778,6 +779,7 @@ else error.SetErrorToErrno(); + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); if (log || error.Fail()) error.PutToLog(log, "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid); @@ -791,6 +793,7 @@ // Make sure the process resumed if (StateIsStoppedState (state)) { + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); if (log) log->Printf ("ProcessMacOSX::DoSIGSTOP() couldn't resume process, state = %s", StateAsCString(state)); error.SetErrorStringWithFormat("ProcessMacOSX::DoSIGSTOP() couldn't resume process, state = %s", StateAsCString(state)); @@ -803,6 +806,7 @@ state = WaitForStateChangedEventsPrivate (&timeout_time, event_sp); if (!StateIsStoppedState (state)) { + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS); if (log) log->Printf("ProcessMacOSX::DoSIGSTOP() failed to stop after sending SIGSTOP"); error.SetErrorString("ProcessMacOSX::DoSIGSTOP() failed to stop after sending SIGSTOP"); @@ -1256,6 +1260,7 @@ int nfds = std::max(stdout_fd, stderr_fd) + 1; int num_set_fds = select (nfds, &read_fds, NULL, NULL, NULL); + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); if (log) log->Printf("select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds); @@ -1343,6 +1348,7 @@ } } + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); if (log) log->Printf("ProcessMacOSX::%s (%p): thread exiting...", __FUNCTION__, arg); @@ -1647,6 +1653,7 @@ else launch_err.SetErrorToErrno(); + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS); if (launch_err.Fail() || log) launch_err.PutToLog(log, "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Fri Oct 29 16:48:37 2010 @@ -35,7 +35,44 @@ } void -ProcessMacOSXLog::DisableLog () +ProcessMacOSXLog::DisableLog (Args &args, Stream *feedback_strm) +{ + if (g_log) + { + uint32_t flag_bits = g_log->GetMask().Get(); + const size_t argc = args.GetArgumentCount (); + for (size_t i = 0; i < argc; ++i) + { + const char *arg = args.GetArgumentAtIndex (i); + + if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~PD_LOG_ALL; + else if (::strcasestr (arg, "break") == arg ) flag_bits &= ~PD_LOG_BREAKPOINTS; + else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~PD_LOG_DEFAULT; + else if (::strcasestr (arg, "exc") == arg ) flag_bits &= ~PD_LOG_EXCEPTIONS; + else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~PD_LOG_MEMORY; + else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~PD_LOG_MEMORY_DATA_SHORT; + else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~PD_LOG_MEMORY_DATA_LONG; + else if (::strcasecmp (arg, "protections")== 0 ) flag_bits &= ~PD_LOG_PROCESS; + else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~PD_LOG_STEP; + else if (::strcasecmp (arg, "task") == 0 ) flag_bits &= ~PD_LOG_TASK; + else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~PD_LOG_THREAD; + else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~PD_LOG_VERBOSE; + else if (::strcasestr (arg, "watch") == arg ) flag_bits &= ~PD_LOG_WATCHPOINTS; + else + { + feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); + ListLogCategories (feedback_strm); + } + } + if (flag_bits == 0) + DeleteLog (); + else + g_log->GetMask().Reset (flag_bits); + } +} + +void +ProcessMacOSXLog::DeleteLog () { if (g_log) { @@ -47,7 +84,7 @@ Log * ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) { - DisableLog (); + DeleteLog (); g_log = new Log (log_stream_sp); if (g_log) { Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h Fri Oct 29 16:48:37 2010 @@ -47,7 +47,10 @@ GetLogIfAllCategoriesSet(uint32_t mask = 0); static void - DisableLog (); + DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm); + + static void + DeleteLog (); static lldb_private::Log * EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Fri Oct 29 16:48:37 2010 @@ -257,6 +257,7 @@ Error err(::thread_suspend (tid), eErrorTypeMachKernel); if (err.Success()) m_suspend_count++; + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) err.PutToLog(log, "::thread_suspend (%4.4x)", tid); } @@ -277,6 +278,7 @@ Error err(::thread_resume (tid), eErrorTypeMachKernel); if (err.Success()) m_suspend_count--; + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) err.PutToLog(log, "::thread_resume (%4.4x)", tid); } @@ -301,6 +303,7 @@ err = ::thread_resume (tid); if (err.Success()) --m_suspend_count; + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) err.PutToLog(log, "::thread_resume (%4.4x)", tid); } @@ -312,6 +315,7 @@ err = ::thread_suspend (tid); if (err.Success()) --m_suspend_count; + log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); if (log || err.Fail()) err.PutToLog(log, "::thread_suspend (%4.4x)", tid); } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Oct 29 16:48:37 2010 @@ -209,11 +209,14 @@ while (state == eStateRunning) { + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...)", __FUNCTION__); if (WaitForPacket (response, (TimeValue*)NULL)) { + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); + async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC); if (response.Empty()) state = eStateInvalid; else @@ -344,11 +347,13 @@ } else { + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...) => false", __FUNCTION__); state = eStateInvalid; } } + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("GDBRemoteCommunication::%s () => %s", __FUNCTION__, StateAsCString(state)); response.SetFilePos(0); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Oct 29 16:48:37 2010 @@ -1212,6 +1212,7 @@ StringExtractorGDBRemote response; if (m_gdb_comm.SendPacketAndWaitForResponse("k", response, 2, false)) { + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS); if (log) { if (response.IsOKPacket()) @@ -2101,6 +2102,7 @@ bool done = false; while (!done) { + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID()); if (listener.WaitForEvent (NULL, event_sp)) @@ -2116,6 +2118,7 @@ { const char *continue_cstr = (const char *)continue_packet->GetBytes (); const size_t continue_cstr_len = continue_packet->GetByteSize (); + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr); @@ -2153,12 +2156,14 @@ break; case eBroadcastBitAsyncThreadShouldExit: + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID()); done = true; break; default: + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type); done = true; @@ -2167,6 +2172,7 @@ } else { + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID()); done = true; @@ -2174,6 +2180,7 @@ } } + log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS); if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, arg, process->GetID()); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Fri Oct 29 16:48:37 2010 @@ -35,7 +35,7 @@ } void -ProcessGDBRemoteLog::DisableLog () +ProcessGDBRemoteLog::DeleteLog () { if (g_log) { @@ -44,10 +44,53 @@ } } +void +ProcessGDBRemoteLog::DisableLog (Args &args, Stream *feedback_strm) +{ + if (g_log) + { + uint32_t flag_bits = g_log->GetMask().Get(); + const size_t argc = args.GetArgumentCount (); + for (size_t i = 0; i < argc; ++i) + { + const char *arg = args.GetArgumentAtIndex (i); + + + if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~GDBR_LOG_ALL; + else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~GDBR_LOG_ASYNC; + else if (::strcasestr (arg, "break") == arg ) flag_bits &= ~GDBR_LOG_BREAKPOINTS; + else if (::strcasestr (arg, "comm") == arg ) flag_bits &= ~GDBR_LOG_COMM; + else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~GDBR_LOG_DEFAULT; + else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~GDBR_LOG_PACKETS; + else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY; + else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_SHORT; + else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_LONG; + else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~GDBR_LOG_PROCESS; + else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~GDBR_LOG_STEP; + else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~GDBR_LOG_THREAD; + else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~GDBR_LOG_VERBOSE; + else if (::strcasestr (arg, "watch") == arg ) flag_bits &= ~GDBR_LOG_WATCHPOINTS; + else + { + feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); + ListLogCategories (feedback_strm); + } + + } + + if (flag_bits == 0) + DeleteLog(); + else + g_log->GetMask().Reset (flag_bits); + } + + return; +} + Log * ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) { - DisableLog (); + DeleteLog (); g_log = new Log (log_stream_sp); if (g_log) { Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h Fri Oct 29 16:48:37 2010 @@ -39,8 +39,11 @@ GetLogIfAllCategoriesSet(uint32_t mask = 0); static void - DisableLog (); + DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm); + static void + DeleteLog (); + static lldb_private::Log * EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Fri Oct 29 16:48:37 2010 @@ -112,12 +112,44 @@ void -LogChannelDWARF::Disable () +LogChannelDWARF::Delete () { g_log_channel = NULL; m_log_sp.reset(); } + +void +LogChannelDWARF::Disable (Args &categories, Stream *feedback_strm) +{ + g_log_channel = this; + uint32_t flag_bits = m_log_sp->GetMask().Get(); + const size_t argc = categories.GetArgumentCount(); + for (size_t i = 0; i < argc; ++i) + { + const char *arg = categories.GetArgumentAtIndex(i); + + if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~DWARF_LOG_ALL; + else if (::strcasecmp (arg, "info") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_INFO; + else if (::strcasecmp (arg, "line") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_LINE; + else if (::strcasecmp (arg, "pubnames") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_PUBNAMES; + else if (::strcasecmp (arg, "pubtypes") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_PUBTYPES; + else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~DWARF_LOG_DEFAULT; + else + { + feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); + ListCategories (feedback_strm); + } + } + + if (flag_bits == 0) + Delete (); + else + m_log_sp->GetMask().Reset (flag_bits); + + return; +} + bool LogChannelDWARF::Enable ( @@ -127,7 +159,7 @@ const Args &categories // The categories to enable within this logging stream, if empty, enable default set ) { - Disable (); + Delete (); m_log_sp.reset(new Log (log_stream_sp)); g_log_channel = this; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h Fri Oct 29 16:48:37 2010 @@ -67,7 +67,10 @@ EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); virtual void - Disable (); + Disable (lldb_private::Args &args, lldb_private::Stream *feedback_strm); + + void + Delete (); virtual bool Enable (lldb::StreamSP &log_stream_sp, Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Oct 29 16:48:37 2010 @@ -249,6 +249,7 @@ event_sp)) state = Process::ProcessEventData::GetStateFromEvent(event_sp.get()); + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); if (log) log->Printf ("Process::%s (timeout = %p, event_sp) => %s", __FUNCTION__, @@ -268,6 +269,7 @@ Event *event_ptr; event_ptr = m_listener.PeekAtNextEventForBroadcasterWithType (this, eBroadcastBitStateChanged); + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); if (log) { if (event_ptr) @@ -1640,6 +1642,8 @@ break; } + // Verify log is still enabled before attempting to write to it... + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); if (log) log->Printf ("Process::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, this, GetID()); Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Oct 29 16:48:37 2010 @@ -156,6 +156,7 @@ if (bytes_to_skip != 0) { func_start_address.Slide (bytes_to_skip); + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) log->Printf ("Pushing past prologue "); Modified: lldb/trunk/source/Target/ThreadPlanTestCondition.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTestCondition.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanTestCondition.cpp Fri Oct 29 16:48:37 2010 @@ -89,11 +89,13 @@ else m_did_stop = true; } + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) log->Printf("Condition successfully evaluated, result is %s.\n", m_did_stop ? "true" : "false"); } else { + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) log->Printf("Failed to get a result from the expression, error: \"%s\"\n", error_stream.GetData()); m_did_stop = true; @@ -101,6 +103,7 @@ } else if (m_exe_ctx.thread->WasThreadPlanDiscarded (m_expression_plan_sp.get())) { + log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) log->Printf("ExecuteExpression thread plan was discarded.\n"); m_did_stop = true; Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=117715&r1=117714&r2=117715&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Fri Oct 29 16:48:37 2010 @@ -107,11 +107,54 @@ } void -lldb_private::DisableLog () +lldb_private::DisableLog (Args &args, Stream *feedback_strm) { - LogAccessor (false, NULL); -} + Log *log = LogAccessor (true, NULL); + uint32_t flag_bits; + + if (log) + { + flag_bits = log->GetMask().Get(); + const size_t argc = args.GetArgumentCount (); + for (size_t i = 0; i < argc; ++i) + { + const char *arg = args.GetArgumentAtIndex (i); + if (strcasecmp(arg, "all") == 0 ) flag_bits &= ~LIBLLDB_LOG_ALL; + else if (strcasecmp(arg, "api") == 0) flag_bits &= ~LIBLLDB_LOG_API; + else if (strcasestr(arg, "break") == arg) flag_bits &= ~LIBLLDB_LOG_BREAKPOINTS; + else if (strcasecmp(arg, "default") == 0 ) flag_bits &= ~LIBLLDB_LOG_DEFAULT; + else if (strcasestr(arg, "event") == arg) flag_bits &= ~LIBLLDB_LOG_EVENTS; + else if (strcasestr(arg, "expr") == arg) flag_bits &= ~LIBLLDB_LOG_EXPRESSIONS; + else if (strcasestr(arg, "object") == arg) flag_bits &= ~LIBLLDB_LOG_OBJECT; + else if (strcasecmp(arg, "process") == 0 ) flag_bits &= ~LIBLLDB_LOG_PROCESS; + else if (strcasecmp(arg, "shlib") == 0 ) flag_bits &= ~LIBLLDB_LOG_SHLIB; + else if (strcasecmp(arg, "state") == 0 ) flag_bits &= ~LIBLLDB_LOG_STATE; + else if (strcasecmp(arg, "step") == 0 ) flag_bits &= ~LIBLLDB_LOG_STEP; + else if (strcasecmp(arg, "thread") == 0 ) flag_bits &= ~LIBLLDB_LOG_THREAD; + else if (strcasecmp(arg, "verbose") == 0 ) flag_bits &= ~LIBLLDB_LOG_VERBOSE; + else if (strcasestr(arg, "watch") == arg) flag_bits &= ~LIBLLDB_LOG_WATCHPOINTS; + else if (strcasestr(arg, "temp") == arg) flag_bits &= ~LIBLLDB_LOG_TEMPORARY; + else if (strcasestr(arg, "comm") == arg) flag_bits &= ~LIBLLDB_LOG_COMMUNICATION; + else if (strcasestr(arg, "conn") == arg) flag_bits &= ~LIBLLDB_LOG_CONNECTION; + else if (strcasestr(arg, "host") == arg) flag_bits &= ~LIBLLDB_LOG_HOST; + else if (strcasestr(arg, "unwind") == arg) flag_bits &= ~LIBLLDB_LOG_UNWIND; + else + { + feedback_strm->Printf ("error: unrecognized log category '%s'\n", arg); + ListLogCategories (feedback_strm); + return; + } + + } + if (flag_bits == 0) + LogAccessor (false, NULL); + else + log->GetMask().Reset (flag_bits); + } + + return; +} Log * lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) From ctice at apple.com Fri Oct 29 16:49:29 2010 From: ctice at apple.com (Caroline Tice) Date: Fri, 29 Oct 2010 21:49:29 -0000 Subject: [Lldb-commits] [lldb] r117716 - /lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Message-ID: <20101029214929.3FABB2A6C12C@llvm.org> Author: ctice Date: Fri Oct 29 16:49:29 2010 New Revision: 117716 URL: http://llvm.org/viewvc/llvm-project?rev=117716&view=rev Log: Missed a file in my last commit. Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=117716&r1=117715&r2=117716&view=diff ============================================================================== --- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original) +++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Fri Oct 29 16:49:29 2010 @@ -325,6 +325,7 @@ Error error; + log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION); if (log) log->Printf("%p ConnectionFileDescriptor::Write() ::select (nfds = %i, fd = %i, NULL, NULL, timeout = %p)...", this, nfds, m_fd, tv_ptr); @@ -335,6 +336,7 @@ else error.Clear(); + log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION); if (log) log->Printf("%p ConnectionFileDescriptor::Write() ::select (nfds = %i, fd = %i, NULL, NULL, timeout = %p) => %d, error = %s", this, nfds, m_fd, tv_ptr, num_set_fds, error.AsCString()); From ctice at apple.com Fri Oct 29 16:56:41 2010 From: ctice at apple.com (Caroline Tice) Date: Fri, 29 Oct 2010 21:56:41 -0000 Subject: [Lldb-commits] [lldb] r117717 - /lldb/trunk/source/Commands/CommandObjectLog.cpp Message-ID: <20101029215641.85C5B2A6C12C@llvm.org> Author: ctice Date: Fri Oct 29 16:56:41 2010 New Revision: 117717 URL: http://llvm.org/viewvc/llvm-project?rev=117717&view=rev Log: Update arguments & help information for "log disable" command. Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=117717&r1=117716&r2=117717&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectLog.cpp Fri Oct 29 16:56:41 2010 @@ -258,21 +258,29 @@ CommandObjectLogDisable(CommandInterpreter &interpreter) : CommandObject (interpreter, "log disable", - "Disable one or more log channels.", + "Disable one or more log channel categories.", NULL) { - CommandArgumentEntry arg; + CommandArgumentEntry arg1; + CommandArgumentEntry arg2; CommandArgumentData channel_arg; + CommandArgumentData category_arg; // Define the first (and only) variant of this arg. channel_arg.arg_type = eArgTypeLogChannel; - channel_arg.arg_repetition = eArgRepeatPlus; + channel_arg.arg_repetition = eArgRepeatPlain; // There is only one variant this argument could be; put it into the argument entry. - arg.push_back (channel_arg); + arg1.push_back (channel_arg); + category_arg.arg_type = eArgTypeLogCategory; + category_arg.arg_repetition = eArgRepeatPlus; + + arg2.push_back (category_arg); + // Push the data for the first argument into the m_arguments vector. - m_arguments.push_back (arg); + m_arguments.push_back (arg1); + m_arguments.push_back (arg2); } virtual From johnny.chen at apple.com Fri Oct 29 17:18:43 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 29 Oct 2010 22:18:43 -0000 Subject: [Lldb-commits] [lldb] r117725 - in /lldb/trunk/source: Commands/CommandObjectImage.cpp Symbol/SymbolContext.cpp Message-ID: <20101029221843.419D12A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 17:18:43 2010 New Revision: 117725 URL: http://llvm.org/viewvc/llvm-project?rev=117725&view=rev Log: These two casts are up casts, no need to use dynamic_cast. Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp lldb/trunk/source/Symbol/SymbolContext.cpp Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=117725&r1=117724&r2=117725&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectImage.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectImage.cpp Fri Oct 29 17:18:43 2010 @@ -82,7 +82,7 @@ if (i > 0) strm << "\n\n"; - strm << "Line table for " << *dynamic_cast (sc.comp_unit) << " in `" + strm << "Line table for " << *static_cast (sc.comp_unit) << " in `" << module->GetFileSpec().GetFilename() << "\n"; LineTable *line_table = sc.comp_unit->GetLineTable(); if (line_table) Modified: lldb/trunk/source/Symbol/SymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=117725&r1=117724&r2=117725&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp (original) +++ lldb/trunk/source/Symbol/SymbolContext.cpp Fri Oct 29 17:18:43 2010 @@ -303,7 +303,7 @@ s->Indent(); *s << "CompileUnit = " << (void *)comp_unit; if (comp_unit != NULL) - *s << " {0x" << comp_unit->GetID() << "} " << *(dynamic_cast (comp_unit)); + *s << " {0x" << comp_unit->GetID() << "} " << *(static_cast (comp_unit)); s->EOL(); s->Indent(); *s << "Function = " << (void *)function; From johnny.chen at apple.com Fri Oct 29 17:20:36 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 29 Oct 2010 22:20:36 -0000 Subject: [Lldb-commits] [lldb] r117726 - /lldb/trunk/test/dotest.py Message-ID: <20101029222036.6CDA72A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 17:20:36 2010 New Revision: 117726 URL: http://llvm.org/viewvc/llvm-project?rev=117726&view=rev Log: The informational message for where to find the session logs for failed/errored tests should be near the test summary message, instead of way up in the beginning. Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=117726&r1=117725&r2=117726&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Fri Oct 29 17:20:36 2010 @@ -80,6 +80,9 @@ # run. Use '-s session-dir-name' to specify a specific dir name. sdir_name = None +# Set this flag if there is any session info dumped during the test run. +sdir_has_content = False + # Default verbosity is 0. verbose = 0 @@ -568,7 +571,6 @@ timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") sdir_name = timestamp os.environ["LLDB_SESSION_DIRNAME"] = sdir_name -sys.stderr.write("\nSession info for test failures/errors will go into directory '%s'\n" % sdir_name) # # Invoke the default TextTestRunner to run the test suite, possibly iterating @@ -680,12 +682,16 @@ lldb.test_result = self def addError(self, test, err): + global sdir_has_content + sdir_has_content = True super(LLDBTestResult, self).addError(test, err) method = getattr(test, "markError", None) if method: method() def addFailure(self, test, err): + global sdir_has_content + sdir_has_content = True super(LLDBTestResult, self).addFailure(test, err) method = getattr(test, "markFailure", None) if method: @@ -695,6 +701,9 @@ resultclass=LLDBTestResult).run(suite) +if sdir_has_content: + sys.stderr.write("\nSession logs for test failures/errors can be found in directory '%s'\n" % sdir_name) + # Terminate the test suite if ${LLDB_TESTSUITE_FORCE_FINISH} is defined. # This should not be necessary now. if ("LLDB_TESTSUITE_FORCE_FINISH" in os.environ): From johnny.chen at apple.com Fri Oct 29 17:26:38 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 29 Oct 2010 22:26:38 -0000 Subject: [Lldb-commits] [lldb] r117730 - /lldb/trunk/test/dotest.py Message-ID: <20101029222638.D549B2A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 17:26:38 2010 New Revision: 117730 URL: http://llvm.org/viewvc/llvm-project?rev=117730&view=rev Log: Add some comment about the default session dir name which is a timestamp. Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=117730&r1=117729&r2=117730&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Fri Oct 29 17:26:38 2010 @@ -568,6 +568,7 @@ # See also TestBase.dumpSessionInfo() in lldbtest.py. if not sdir_name: import datetime + # The windows platforms don't like ':' in the pathname. timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") sdir_name = timestamp os.environ["LLDB_SESSION_DIRNAME"] = sdir_name From johnny.chen at apple.com Fri Oct 29 19:30:24 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 30 Oct 2010 00:30:24 -0000 Subject: [Lldb-commits] [lldb] r117751 - /lldb/trunk/utils/ Message-ID: <20101030003024.518D32A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 19:30:24 2010 New Revision: 117751 URL: http://llvm.org/viewvc/llvm-project?rev=117751&view=rev Log: Delete the directory, will try to resubmit later. Removed: lldb/trunk/utils/ From johnny.chen at apple.com Fri Oct 29 19:34:37 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 30 Oct 2010 00:34:37 -0000 Subject: [Lldb-commits] [lldb] r117752 - in /lldb/trunk/utils: ./ emacs/ emacs/README emacs/gud-diffs.txt emacs/gud.el Message-ID: <20101030003437.BD4A22A6C12C@llvm.org> Author: johnny Date: Fri Oct 29 19:34:37 2010 New Revision: 117752 URL: http://llvm.org/viewvc/llvm-project?rev=117752&view=rev Log: Initial port of lldb debugging mode to run under Emacs's Grand Unified Debugger (gud.el). The gud.el is modified from 22.3.1 version to add lldb stuffs, the gud-diffs.txt is the diff file. lldb-gud-window.tiff is a screen capture of Aquamacs 2.1 (which has 23.2.50.1) after loading this modified gud.el, changing directory to test/conditional_break, and then 'M-x lldb' with the a.out file. The lldb-gud-window.tiff will be submitted in another check in. Added: lldb/trunk/utils/ lldb/trunk/utils/emacs/ lldb/trunk/utils/emacs/README lldb/trunk/utils/emacs/gud-diffs.txt lldb/trunk/utils/emacs/gud.el Added: lldb/trunk/utils/emacs/README URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/README?rev=117752&view=auto ============================================================================== --- lldb/trunk/utils/emacs/README (added) +++ lldb/trunk/utils/emacs/README Fri Oct 29 19:34:37 2010 @@ -0,0 +1,10 @@ +The lldb-enhanced gud.el is based on the emacs 22.3.1 version from Aquamacs 1.8c +distribution. + +The gud-diffs.txt is the diff from the gud.el file from emacs 22.3.1. + +To use it, load the file from within emacs and type 'M-x lldb' to invoke lldb. + +The lldb-gud-window.tiff is a screen capture of the gud (with lldb) at work on +Aquamacs distribution 2.1 by loading the gud.el in this directory and 'M-x lldb' +on the ../../test/condition_break directory. Added: lldb/trunk/utils/emacs/gud-diffs.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/gud-diffs.txt?rev=117752&view=auto ============================================================================== --- lldb/trunk/utils/emacs/gud-diffs.txt (added) +++ lldb/trunk/utils/emacs/gud-diffs.txt Fri Oct 29 19:34:37 2010 @@ -0,0 +1,250 @@ +--- /tmp/gud.el 2009-05-06 05:16:32.000000000 -0700 ++++ utils/emacs/gud.el 2010-10-29 16:41:53.000000000 -0700 +@@ -144,12 +144,12 @@ + (display-graphic-p) + (fboundp 'x-show-tip)) + :visible (memq gud-minor-mode +- '(gdbmi gdba dbx sdb xdb pdb)) ++ '(lldb gdbmi gdba dbx sdb xdb pdb)) + :button (:toggle . gud-tooltip-mode)) + ([refresh] "Refresh" . gud-refresh) + ([run] menu-item "Run" gud-run + :enable (not gud-running) +- :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) ++ :visible (memq gud-minor-mode '(lldb gdbmi gdb dbx jdb))) + ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go + :visible (and (not gud-running) + (eq gud-minor-mode 'gdba))) +@@ -167,18 +167,18 @@ + ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak + :enable (not gud-running) + :visible (memq gud-minor-mode +- '(gdbmi gdba gdb sdb xdb))) ++ '(lldb gdbmi gdba gdb sdb xdb))) + ([break] menu-item "Set Breakpoint" gud-break + :enable (not gud-running) + :visible (gud-tool-bar-item-visible-no-fringe)) + ([up] menu-item "Up Stack" gud-up + :enable (not gud-running) + :visible (memq gud-minor-mode +- '(gdbmi gdba gdb dbx xdb jdb pdb))) ++ '(lldb gdbmi gdba gdb dbx xdb jdb pdb))) + ([down] menu-item "Down Stack" gud-down + :enable (not gud-running) + :visible (memq gud-minor-mode +- '(gdbmi gdba gdb dbx xdb jdb pdb))) ++ '(lldb gdbmi gdba gdb dbx xdb jdb pdb))) + ([pp] menu-item "Print S-expression" gud-pp + :enable (and (not gud-running) + gdb-active-process) +@@ -188,7 +188,7 @@ + (eq gud-minor-mode 'gdba))) + ([print*] menu-item "Print Dereference" gud-pstar + :enable (not gud-running) +- :visible (memq gud-minor-mode '(gdbmi gdba gdb))) ++ :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb))) + ([print] menu-item "Print Expression" gud-print + :enable (not gud-running)) + ([watch] menu-item "Watch Expression" gud-watch +@@ -197,13 +197,13 @@ + ([finish] menu-item "Finish Function" gud-finish + :enable (not gud-running) + :visible (memq gud-minor-mode +- '(gdbmi gdba gdb xdb jdb pdb))) ++ '(lldb gdbmi gdba gdb xdb jdb pdb))) + ([stepi] menu-item "Step Instruction" gud-stepi + :enable (not gud-running) +- :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx))) ++ :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb dbx))) + ([nexti] menu-item "Next Instruction" gud-nexti + :enable (not gud-running) +- :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx))) ++ :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb dbx))) + ([step] menu-item "Step Line" gud-step + :enable (not gud-running)) + ([next] menu-item "Next Line" gud-next +@@ -350,6 +350,7 @@ + %l -- Number of current source line. + %e -- Text of the C lvalue or function-call expression surrounding point. + %a -- Text of the hexadecimal address surrounding point. ++ %b -- Text of the most recently created breakpoint id. + %p -- Prefix argument to the command (if any) as a number. + %c -- Fully qualified class name derived from the expression + surrounding point (jdb only). +@@ -930,6 +931,126 @@ + + + ;; ====================================================================== ++;; lldb functions ++ ++;; History of argument lists passed to lldb. ++(defvar gud-lldb-history nil) ++ ++;; Keeps track of breakpoint created. In the following case, the id is "1". ++;; It is used to implement temporary breakpoint. ++;; (lldb) b main.c:39 ++;; breakpoint set --file 'main.c' --line 39 ++;; Breakpoint created: 1: file ='main.c', line = 39, locations = 1 ++(defvar gud-breakpoint-id nil) ++ ++(defun lldb-extract-breakpoint-id (string) ++ ;; Search for "Breakpoint created: \\([^:\n]*\\):" pattern. ++ (if (string-match "Breakpoint created: \\([^:\n]*\\):" string) ++ (progn ++ (setq gud-breakpoint-id (match-string 1 string)) ++ (message "breakpoint id: %s" gud-breakpoint-id))) ++) ++ ++(defun gud-lldb-marker-filter (string) ++ (setq gud-marker-acc ++ (if gud-marker-acc (concat gud-marker-acc string) string)) ++ (lldb-extract-breakpoint-id gud-marker-acc) ++ (let (start) ++ ;; Process all complete markers in this chunk ++ (while (or ++ ;; (lldb) r ++ ;; Process 15408 launched: '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out' (x86_64) ++ ;; (lldb) Process 15408 stopped ++ ;; * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread ++ (string-match " at \\([^:\n]*\\):\\([0-9]*\\), stop reason = .*\n" ++ gud-marker-acc start) ++ ;; (lldb) frame select -r 1 ++ ;; frame #1: 0x0000000100000e09 a.out`main + 25 at main.c:44 ++ (string-match "\nframe.* at \\([^:\n]*\\):\\([0-9]*\\)\n" ++ gud-marker-acc start)) ++ (setq gud-last-frame ++ (cons (match-string 1 gud-marker-acc) ++ (string-to-number (match-string 2 gud-marker-acc))) ++ start (match-end 0))) ++ ++ ;; Search for the last incomplete line in this chunk ++ (while (string-match "\n" gud-marker-acc start) ++ (setq start (match-end 0))) ++ ++ ;; If we have an incomplete line, store it in gud-marker-acc. ++ (setq gud-marker-acc (substring gud-marker-acc (or start 0)))) ++ string) ++ ++;; Keeps track of whether the Python lldb_oneshot_break function definition has ++;; been exec'ed. ++(defvar lldb-oneshot-break-defined nil) ++ ++;;;###autoload ++(defun lldb (command-line) ++ "Run lldb on program FILE in buffer *gud-FILE*. ++The directory containing FILE becomes the initial working directory ++and source-file directory for your debugger." ++ (interactive (list (gud-query-cmdline 'lldb))) ++ ++ (gud-common-init command-line nil 'gud-lldb-marker-filter) ++ (set (make-local-variable 'gud-minor-mode) 'lldb) ++ (setq lldb-oneshot-break-defined nil) ++ ++ (gud-def gud-lbreak "breakpoint list" ++ "l" "List all breakpoints.") ++ (gud-def gud-break "breakpoint set -f %f -l %l" ++ "\C-b" "Set breakpoint at current line.") ++ (gud-def gud-tbreak ++ (progn (gud-call "breakpoint set -f %f -l %l") ++ (sit-for 1) ++ (if (not lldb-oneshot-break-defined) ++ (progn ++ ;; The "\\n"'s are required to escape the newline chars ++ ;; passed to the lldb process. ++ (gud-call (concat "script exec \"def lldb_oneshot_break(frame, bp_loc):\\n" ++ " target=frame.GetThread().GetProcess().GetTarget()\\n" ++ " bp=bp_loc.GetBreakpoint()\\n" ++ " print 'Deleting oneshot breakpoint:', bp\\n" ++ " target.BreakpointDelete(bp.GetID())\"")) ++ (sit-for 1) ++ ;; Set the flag since Python knows about the function def now. ++ (setq lldb-oneshot-break-defined t))) ++ (gud-call "breakpoint command add -p %b -o 'lldb_oneshot_break(frame, bp_loc)'")) ++ "\C-t" "Set temporary breakpoint at current line.") ++ (gud-def gud-remove "breakpoint clear -f %f -l %l" ++ "\C-d" "Remove breakpoint at current line") ++ (gud-def gud-step "thread step-in" ++ "\C-s" "Step one source line with display.") ++ (gud-def gud-stepi "thread step-inst" ++ "\C-i" "Step one instruction with display.") ++ (gud-def gud-next "thread step-over" ++ "\C-n" "Step one line (skip functions).") ++ (gud-def gud-nexti "thread step-inst-over" ++ nil "Step one instruction (skip functions).") ++ (gud-def gud-cont "process continue" ++ "\C-r" "Continue with display.") ++ (gud-def gud-finish "thread step-out" ++ "\C-f" "Finish executing current function.") ++ (gud-def gud-up "frame select -r %p" ++ "<" "Up 1 stack frame.") ++ (gud-def gud-down "frame select -r -%p" ++ ">" "Down 1 stack frame.") ++ (gud-def gud-print "expression -- %e" ++ "\C-p" "Evaluate C expression at point.") ++ (gud-def gud-pstar "expression -- *%e" ++ nil "Evaluate C dereferenced pointer expression at point.") ++ (gud-def gud-run "run" ++ nil "Run the program.") ++ (gud-def gud-stop-subjob "process kill" ++ nil "Stop the program.") ++ ++ (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") ++ (setq paragraph-start comint-prompt-regexp) ++ (run-hooks 'lldb-mode-hook) ++ ) ++ ++ ++;; ====================================================================== + ;; sdb functions + + ;; History of argument lists passed to sdb. +@@ -2372,9 +2493,10 @@ + "Major mode for interacting with an inferior debugger process. + + You start it up with one of the commands M-x gdb, M-x sdb, M-x dbx, +-M-x perldb, M-x xdb, or M-x jdb. Each entry point finishes by executing a +-hook; `gdb-mode-hook', `sdb-mode-hook', `dbx-mode-hook', +-`perldb-mode-hook', `xdb-mode-hook', or `jdb-mode-hook' respectively. ++M-x perldb, M-x xdb, M-x jdb, or M-x lldb. Each entry point finishes by ++executing a hook; `gdb-mode-hook', `sdb-mode-hook', `dbx-mode-hook', ++`perldb-mode-hook', `xdb-mode-hook', `jdb-mode-hook', or `lldb-mode-hook' ++respectively. + + After startup, the following commands are available in both the GUD + interaction buffer and any source buffer GUD visits due to a breakpoint stop +@@ -2404,7 +2526,7 @@ + except that the breakpoint is temporary; that is, it is removed when + execution stops on it. + +-Under gdb, dbx, and xdb, \\[gud-up] pops up through an enclosing stack ++Under gdb, dbx, xdb, and lldb, \\[gud-up] pops up through an enclosing stack + frame. \\[gud-down] drops back down through one. + + If you are using gdb or xdb, \\[gud-finish] runs execution to the return from +@@ -2724,7 +2846,7 @@ + result) + (while (and str + (let ((case-fold-search nil)) +- (string-match "\\([^%]*\\)%\\([adefFlpc]\\)" str))) ++ (string-match "\\([^%]*\\)%\\([abdefFlpc]\\)" str))) + (let ((key (string-to-char (match-string 2 str))) + subst) + (cond +@@ -2753,6 +2875,8 @@ + (setq subst (gud-find-expr))) + ((eq key ?a) + (setq subst (gud-read-address))) ++ ((eq key ?b) ++ (setq subst gud-breakpoint-id)) + ((eq key ?c) + (setq subst + (gud-find-class +@@ -3372,6 +3496,8 @@ + (defun gud-tooltip-print-command (expr) + "Return a suitable command to print the expression EXPR." + (case gud-minor-mode ++ ; '-o' to print the objc object description if available ++ (lldb (concat "expression -o -- " expr)) + (gdba (concat "server print " expr)) + ((dbx gdbmi) (concat "print " expr)) + ((xdb pdb) (concat "p " expr)) Added: lldb/trunk/utils/emacs/gud.el URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/gud.el?rev=117752&view=auto ============================================================================== --- lldb/trunk/utils/emacs/gud.el (added) +++ lldb/trunk/utils/emacs/gud.el Fri Oct 29 19:34:37 2010 @@ -0,0 +1,3562 @@ +;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers + +;; Author: Eric S. Raymond +;; Maintainer: FSF +;; Keywords: unix, tools + +;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003, +;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; The ancestral gdb.el was by W. Schelter It was +;; later rewritten by rms. Some ideas were due to Masanobu. Grand +;; Unification (sdb/dbx support) by Eric S. Raymond Barry +;; Warsaw hacked the mode to use comint.el. Shane Hartman +;; added support for xdb (HPUX debugger). Rick Sladkey +;; wrote the GDB command completion code. Dave Love +;; added the IRIX kluge, re-implemented the Mips-ish variant +;; and added a menu. Brian D. Carlstrom combined the IRIX +;; kluge with the gud-xdb-directories hack producing gud-dbx-directories. +;; Derek L. Davies added support for jdb (Java +;; debugger.) + +;;; Code: + +(eval-when-compile (require 'cl)) ; for case macro + +(require 'comint) + +(defvar gdb-active-process) +(defvar gdb-define-alist) +(defvar gdb-macro-info) +(defvar gdb-server-prefix) +(defvar gdb-show-changed-values) +(defvar gdb-var-list) +(defvar gdb-speedbar-auto-raise) +(defvar tool-bar-map) + +;; ====================================================================== +;; GUD commands must be visible in C buffers visited by GUD + +(defgroup gud nil + "Grand Unified Debugger mode for gdb and other debuggers under Emacs. +Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python) and jdb." + :group 'unix + :group 'tools) + + +(defcustom gud-key-prefix "\C-x\C-a" + "Prefix of all GUD commands valid in C buffers." + :type 'string + :group 'gud) + +(global-set-key (concat gud-key-prefix "\C-l") 'gud-refresh) +(define-key ctl-x-map " " 'gud-break) ;; backward compatibility hack + +(defvar gud-marker-filter nil) +(put 'gud-marker-filter 'permanent-local t) +(defvar gud-find-file nil) +(put 'gud-find-file 'permanent-local t) + +(defun gud-marker-filter (&rest args) + (apply gud-marker-filter args)) + +(defvar gud-minor-mode nil) +(put 'gud-minor-mode 'permanent-local t) + +(defvar gud-comint-buffer nil) + +(defvar gud-keep-buffer nil) + +(defun gud-symbol (sym &optional soft minor-mode) + "Return the symbol used for SYM in MINOR-MODE. +MINOR-MODE defaults to `gud-minor-mode'. +The symbol returned is `gud--'. +If SOFT is non-nil, returns nil if the symbol doesn't already exist." + (unless (or minor-mode gud-minor-mode) (error "Gud internal error")) + (funcall (if soft 'intern-soft 'intern) + (format "gud-%s-%s" (or minor-mode gud-minor-mode) sym))) + +(defun gud-val (sym &optional minor-mode) + "Return the value of `gud-symbol' SYM. Default to nil." + (let ((sym (gud-symbol sym t minor-mode))) + (if (boundp sym) (symbol-value sym)))) + +(defvar gud-running nil + "Non-nil if debugged program is running. +Used to grey out relevant toolbar icons.") + +(defvar gdb-ready nil) + +;; Use existing Info buffer, if possible. +(defun gud-goto-info () + "Go to relevant Emacs info node." + (interactive) + (let ((same-window-regexps same-window-regexps) + (display-buffer-reuse-frames t)) + (catch 'info-found + (walk-windows + '(lambda (window) + (if (eq (window-buffer window) (get-buffer "*info*")) + (progn + (setq same-window-regexps nil) + (throw 'info-found nil)))) + nil 0) + (select-frame (make-frame))) + (if (memq gud-minor-mode '(gdbmi gdba)) + (info "(emacs)GDB Graphical Interface") + (info "(emacs)Debuggers")))) + +(defun gud-tool-bar-item-visible-no-fringe () + (not (or (eq (buffer-local-value 'major-mode (window-buffer)) 'speedbar-mode) + (and (memq gud-minor-mode '(gdbmi gdba)) + (> (car (window-fringes)) 0))))) + +(defun gud-stop-subjob () + (interactive) + (with-current-buffer gud-comint-buffer + (if (string-equal gud-target-name "emacs") + (comint-stop-subjob) + (comint-interrupt-subjob)))) + +(easy-mmode-defmap gud-menu-map + '(([help] "Info" . gud-goto-info) + ([tooltips] menu-item "Show GUD tooltips" gud-tooltip-mode + :enable (and (not emacs-basic-display) + (display-graphic-p) + (fboundp 'x-show-tip)) + :visible (memq gud-minor-mode + '(lldb gdbmi gdba dbx sdb xdb pdb)) + :button (:toggle . gud-tooltip-mode)) + ([refresh] "Refresh" . gud-refresh) + ([run] menu-item "Run" gud-run + :enable (not gud-running) + :visible (memq gud-minor-mode '(lldb gdbmi gdb dbx jdb))) + ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go + :visible (and (not gud-running) + (eq gud-minor-mode 'gdba))) + ([stop] menu-item "Stop" gud-stop-subjob + :visible (or (not (memq gud-minor-mode '(gdba pdb))) + (and gud-running + (eq gud-minor-mode 'gdba)))) + ([until] menu-item "Continue to selection" gud-until + :enable (not gud-running) + :visible (and (memq gud-minor-mode '(gdbmi gdba gdb perldb)) + (gud-tool-bar-item-visible-no-fringe))) + ([remove] menu-item "Remove Breakpoint" gud-remove + :enable (not gud-running) + :visible (gud-tool-bar-item-visible-no-fringe)) + ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak + :enable (not gud-running) + :visible (memq gud-minor-mode + '(lldb gdbmi gdba gdb sdb xdb))) + ([break] menu-item "Set Breakpoint" gud-break + :enable (not gud-running) + :visible (gud-tool-bar-item-visible-no-fringe)) + ([up] menu-item "Up Stack" gud-up + :enable (not gud-running) + :visible (memq gud-minor-mode + '(lldb gdbmi gdba gdb dbx xdb jdb pdb))) + ([down] menu-item "Down Stack" gud-down + :enable (not gud-running) + :visible (memq gud-minor-mode + '(lldb gdbmi gdba gdb dbx xdb jdb pdb))) + ([pp] menu-item "Print S-expression" gud-pp + :enable (and (not gud-running) + gdb-active-process) + :visible (and (string-equal + (buffer-local-value + 'gud-target-name gud-comint-buffer) "emacs") + (eq gud-minor-mode 'gdba))) + ([print*] menu-item "Print Dereference" gud-pstar + :enable (not gud-running) + :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb))) + ([print] menu-item "Print Expression" gud-print + :enable (not gud-running)) + ([watch] menu-item "Watch Expression" gud-watch + :enable (not gud-running) + :visible (memq gud-minor-mode '(gdbmi gdba))) + ([finish] menu-item "Finish Function" gud-finish + :enable (not gud-running) + :visible (memq gud-minor-mode + '(lldb gdbmi gdba gdb xdb jdb pdb))) + ([stepi] menu-item "Step Instruction" gud-stepi + :enable (not gud-running) + :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb dbx))) + ([nexti] menu-item "Next Instruction" gud-nexti + :enable (not gud-running) + :visible (memq gud-minor-mode '(lldb gdbmi gdba gdb dbx))) + ([step] menu-item "Step Line" gud-step + :enable (not gud-running)) + ([next] menu-item "Next Line" gud-next + :enable (not gud-running)) + ([cont] menu-item "Continue" gud-cont + :enable (not gud-running) + :visible (not (eq gud-minor-mode 'gdba)))) + "Menu for `gud-mode'." + :name "Gud") + +(easy-mmode-defmap gud-minor-mode-map + (append + `(([menu-bar debug] . ("Gud" . ,gud-menu-map))) + ;; Get tool bar like functionality from the menu bar on a text only + ;; terminal. + (unless window-system + `(([menu-bar down] + . (,(propertize "down" 'face 'font-lock-doc-face) . gud-down)) + ([menu-bar up] + . (,(propertize "up" 'face 'font-lock-doc-face) . gud-up)) + ([menu-bar finish] + . (,(propertize "finish" 'face 'font-lock-doc-face) . gud-finish)) + ([menu-bar step] + . (,(propertize "step" 'face 'font-lock-doc-face) . gud-step)) + ([menu-bar next] + . (,(propertize "next" 'face 'font-lock-doc-face) . gud-next)) + ([menu-bar until] menu-item + ,(propertize "until" 'face 'font-lock-doc-face) gud-until + :visible (memq gud-minor-mode '(gdbmi gdba gdb perldb))) + ([menu-bar cont] menu-item + ,(propertize "cont" 'face 'font-lock-doc-face) gud-cont + :visible (not (eq gud-minor-mode 'gdba))) + ([menu-bar run] menu-item + ,(propertize "run" 'face 'font-lock-doc-face) gud-run + :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) + ([menu-bar go] menu-item + ,(propertize " go " 'face 'font-lock-doc-face) gud-go + :visible (and (not gud-running) + (eq gud-minor-mode 'gdba))) + ([menu-bar stop] menu-item + ,(propertize "stop" 'face 'font-lock-doc-face) gud-stop-subjob + :visible (or gud-running + (not (eq gud-minor-mode 'gdba)))) + ([menu-bar print] + . (,(propertize "print" 'face 'font-lock-doc-face) . gud-print)) + ([menu-bar tools] . undefined) + ([menu-bar buffer] . undefined) + ([menu-bar options] . undefined) + ([menu-bar edit] . undefined) + ([menu-bar file] . undefined)))) + "Map used in visited files.") + +(let ((m (assq 'gud-minor-mode minor-mode-map-alist))) + (if m (setcdr m gud-minor-mode-map) + (push (cons 'gud-minor-mode gud-minor-mode-map) minor-mode-map-alist))) + +(defvar gud-mode-map + ;; Will inherit from comint-mode via define-derived-mode. + (make-sparse-keymap) + "`gud-mode' keymap.") + +(defvar gud-tool-bar-map + (if (display-graphic-p) + (let ((map (make-sparse-keymap))) + (dolist (x '((gud-break . "gud/break") + (gud-remove . "gud/remove") + (gud-print . "gud/print") + (gud-pstar . "gud/pstar") + (gud-pp . "gud/pp") + (gud-watch . "gud/watch") + (gud-run . "gud/run") + (gud-go . "gud/go") + (gud-stop-subjob . "gud/stop") + (gud-cont . "gud/cont") + (gud-until . "gud/until") + (gud-next . "gud/next") + (gud-step . "gud/step") + (gud-finish . "gud/finish") + (gud-nexti . "gud/nexti") + (gud-stepi . "gud/stepi") + (gud-up . "gud/up") + (gud-down . "gud/down") + (gud-goto-info . "info")) + map) + (tool-bar-local-item-from-menu + (car x) (cdr x) map gud-minor-mode-map))))) + +(defun gud-file-name (f) + "Transform a relative file name to an absolute file name. +Uses `gud--directories' to find the source files." + (if (file-exists-p f) (expand-file-name f) + (let ((directories (gud-val 'directories)) + (result nil)) + (while directories + (let ((path (expand-file-name f (car directories)))) + (if (file-exists-p path) + (setq result path + directories nil))) + (setq directories (cdr directories))) + result))) + +(defun gud-find-file (file) + ;; Don't get confused by double slashes in the name that comes from GDB. + (while (string-match "//+" file) + (setq file (replace-match "/" t t file))) + (let ((minor-mode gud-minor-mode) + (buf (funcall (or gud-find-file 'gud-file-name) file))) + (when (stringp buf) + (setq buf (and (file-readable-p buf) (find-file-noselect buf 'nowarn)))) + (when buf + ;; Copy `gud-minor-mode' to the found buffer to turn on the menu. + (with-current-buffer buf + (set (make-local-variable 'gud-minor-mode) minor-mode) + (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) + (when (and gud-tooltip-mode + (memq gud-minor-mode '(gdbmi gdba))) + (make-local-variable 'gdb-define-alist) + (unless gdb-define-alist (gdb-create-define-alist)) + (add-hook 'after-save-hook 'gdb-create-define-alist nil t)) + (make-local-variable 'gud-keep-buffer)) + buf))) + +;; ====================================================================== +;; command definition + +;; This macro is used below to define some basic debugger interface commands. +;; Of course you may use `gud-def' with any other debugger command, including +;; user defined ones. + +;; A macro call like (gud-def FUNC CMD KEY DOC) expands to a form +;; which defines FUNC to send the command CMD to the debugger, gives +;; it the docstring DOC, and binds that function to KEY in the GUD +;; major mode. The function is also bound in the global keymap with the +;; GUD prefix. + +(defmacro gud-def (func cmd key &optional doc) + "Define FUNC to be a command sending CMD and bound to KEY, with +optional doc string DOC. Certain %-escapes in the string arguments +are interpreted specially if present. These are: + + %f -- Name (without directory) of current source file. + %F -- Name (without directory or extension) of current source file. + %d -- Directory of current source file. + %l -- Number of current source line. + %e -- Text of the C lvalue or function-call expression surrounding point. + %a -- Text of the hexadecimal address surrounding point. + %b -- Text of the most recently created breakpoint id. + %p -- Prefix argument to the command (if any) as a number. + %c -- Fully qualified class name derived from the expression + surrounding point (jdb only). + + The `current' source file is the file of the current buffer (if +we're in a C file) or the source file current at the last break or +step (if we're in the GUD buffer). + The `current' line is that of the current buffer (if we're in a +source file) or the source line number at the last break or step (if +we're in the GUD buffer)." + `(progn + (defun ,func (arg) + ,@(if doc (list doc)) + (interactive "p") + (if (not gud-running) + ,(if (stringp cmd) + `(gud-call ,cmd arg) + cmd))) + ,(if key `(local-set-key ,(concat "\C-c" key) ',func)) + ,(if key `(global-set-key (vconcat gud-key-prefix ,key) ',func)))) + +;; Where gud-display-frame should put the debugging arrow; a cons of +;; (filename . line-number). This is set by the marker-filter, which scans +;; the debugger's output for indications of the current program counter. +(defvar gud-last-frame nil) + +;; Used by gud-refresh, which should cause gud-display-frame to redisplay +;; the last frame, even if it's been called before and gud-last-frame has +;; been set to nil. +(defvar gud-last-last-frame nil) + +;; All debugger-specific information is collected here. +;; Here's how it works, in case you ever need to add a debugger to the mode. +;; +;; Each entry must define the following at startup: +;; +;; +;; comint-prompt-regexp +;; gud--massage-args +;; gud--marker-filter +;; gud--find-file +;; +;; The job of the massage-args method is to modify the given list of +;; debugger arguments before running the debugger. +;; +;; The job of the marker-filter method is to detect file/line markers in +;; strings and set the global gud-last-frame to indicate what display +;; action (if any) should be triggered by the marker. Note that only +;; whatever the method *returns* is displayed in the buffer; thus, you +;; can filter the debugger's output, interpreting some and passing on +;; the rest. +;; +;; The job of the find-file method is to visit and return the buffer indicated +;; by the car of gud-tag-frame. This may be a file name, a tag name, or +;; something else. + +;; ====================================================================== +;; speedbar support functions and variables. +(eval-when-compile (require 'speedbar)) ;For speedbar-with-attached-buffer. + +(defvar gud-last-speedbar-stackframe nil + "Description of the currently displayed GUD stack. +The value t means that there is no stack, and we are in display-file mode.") + +(defvar gud-speedbar-key-map nil + "Keymap used when in the buffers display mode.") + +(defun gud-speedbar-item-info () + "Display the data type of the watch expression element." + (let ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))) + (if (nth 6 var) + (speedbar-message "%s: %s" (nth 6 var) (nth 3 var)) + (speedbar-message "%s" (nth 3 var))))) + +(defun gud-install-speedbar-variables () + "Install those variables used by speedbar to enhance gud/gdb." + (if gud-speedbar-key-map + nil + (setq gud-speedbar-key-map (speedbar-make-specialized-keymap)) + + (define-key gud-speedbar-key-map "j" 'speedbar-edit-line) + (define-key gud-speedbar-key-map "e" 'speedbar-edit-line) + (define-key gud-speedbar-key-map "\C-m" 'speedbar-edit-line) + (define-key gud-speedbar-key-map " " 'speedbar-toggle-line-expansion) + (define-key gud-speedbar-key-map "D" 'gdb-var-delete) + (define-key gud-speedbar-key-map "p" 'gud-pp)) + + (speedbar-add-expansion-list '("GUD" gud-speedbar-menu-items + gud-speedbar-key-map + gud-expansion-speedbar-buttons)) + + (add-to-list + 'speedbar-mode-functions-list + '("GUD" (speedbar-item-info . gud-speedbar-item-info) + (speedbar-line-directory . ignore)))) + +(defvar gud-speedbar-menu-items + '(["Jump to stack frame" speedbar-edit-line + :visible (not (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdbmi gdba)))] + ["Edit value" speedbar-edit-line + :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdbmi gdba))] + ["Delete expression" gdb-var-delete + :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdbmi gdba))] + ["Auto raise frame" gdb-speedbar-auto-raise + :style toggle :selected gdb-speedbar-auto-raise + :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdbmi gdba))] + ("Output Format" + :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdbmi gdba)) + ["Binary" (gdb-var-set-format "binary") t] + ["Natural" (gdb-var-set-format "natural") t] + ["Hexadecimal" (gdb-var-set-format "hexadecimal") t])) + "Additional menu items to add to the speedbar frame.") + +;; Make sure our special speedbar mode is loaded +(if (featurep 'speedbar) + (gud-install-speedbar-variables) + (add-hook 'speedbar-load-hook 'gud-install-speedbar-variables)) + +(defun gud-expansion-speedbar-buttons (directory zero) + "Wrapper for call to `speedbar-add-expansion-list'. +DIRECTORY and ZERO are not used, but are required by the caller." + (gud-speedbar-buttons gud-comint-buffer)) + +(defun gud-speedbar-buttons (buffer) + "Create a speedbar display based on the current state of GUD. +If the GUD BUFFER is not running a supported debugger, then turn +off the specialized speedbar mode. BUFFER is not used, but is +required by the caller." + (when (and gud-comint-buffer + ;; gud-comint-buffer might be killed + (buffer-name gud-comint-buffer)) + (let* ((minor-mode (with-current-buffer buffer gud-minor-mode)) + (window (get-buffer-window (current-buffer) 0)) + (start (window-start window)) + (p (window-point window))) + (cond + ((memq minor-mode '(gdbmi gdba)) + (erase-buffer) + (insert "Watch Expressions:\n") + (if gdb-speedbar-auto-raise + (raise-frame speedbar-frame)) + (let ((var-list gdb-var-list) parent) + (while var-list + (let* (char (depth 0) (start 0) (var (car var-list)) + (varnum (car var)) (expr (nth 1 var)) + (type (if (nth 3 var) (nth 3 var) " ")) + (value (nth 4 var)) (status (nth 5 var))) + (put-text-property + 0 (length expr) 'face font-lock-variable-name-face expr) + (put-text-property + 0 (length type) 'face font-lock-type-face type) + (while (string-match "\\." varnum start) + (setq depth (1+ depth) + start (1+ (match-beginning 0)))) + (if (eq depth 0) (setq parent nil)) + (if (or (equal (nth 2 var) "0") + (and (equal (nth 2 var) "1") + (string-match "char \\*$" type))) + (speedbar-make-tag-line + 'bracket ?? nil nil + (concat expr "\t" value) + (if (or parent (eq status 'out-of-scope)) + nil 'gdb-edit-value) + nil + (if gdb-show-changed-values + (or parent (case status + (changed 'font-lock-warning-face) + (out-of-scope 'shadow) + (t t))) + t) + depth) + (if (eq status 'out-of-scope) (setq parent 'shadow)) + (if (and (nth 1 var-list) + (string-match (concat varnum "\\.") + (car (nth 1 var-list)))) + (setq char ?-) + (setq char ?+)) + (if (string-match "\\*$\\|\\*&$" type) + (speedbar-make-tag-line + 'bracket char + 'gdb-speedbar-expand-node varnum + (concat expr "\t" type "\t" value) + (if (or parent (eq status 'out-of-scope)) + nil 'gdb-edit-value) + nil + (if gdb-show-changed-values + (or parent (case status + (changed 'font-lock-warning-face) + (out-of-scope 'shadow) + (t t))) + t) + depth) + (speedbar-make-tag-line + 'bracket char + 'gdb-speedbar-expand-node varnum + (concat expr "\t" type) + nil nil + (if (and (or parent status) gdb-show-changed-values) + 'shadow t) + depth)))) + (setq var-list (cdr var-list))))) + (t (unless (and (save-excursion + (goto-char (point-min)) + (looking-at "Current Stack:")) + (equal gud-last-last-frame gud-last-speedbar-stackframe)) + (let ((gud-frame-list + (cond ((eq minor-mode 'gdb) + (gud-gdb-get-stackframe buffer)) + ;; Add more debuggers here! + (t (speedbar-remove-localized-speedbar-support buffer) + nil)))) + (erase-buffer) + (if (not gud-frame-list) + (insert "No Stack frames\n") + (insert "Current Stack:\n")) + (dolist (frame gud-frame-list) + (insert (nth 1 frame) ":\n") + (if (= (length frame) 2) + (progn + (speedbar-insert-button (car frame) + 'speedbar-directory-face + nil nil nil t)) + (speedbar-insert-button + (car frame) + 'speedbar-file-face + 'speedbar-highlight-face + (cond ((memq minor-mode '(gdbmi gdba gdb)) + 'gud-gdb-goto-stackframe) + (t (error "Should never be here"))) + frame t)))) + (setq gud-last-speedbar-stackframe gud-last-last-frame)))) + (set-window-start window start) + (set-window-point window p)))) + + +;; ====================================================================== +;; gdb functions + +;; History of argument lists passed to gdb. +(defvar gud-gdb-history nil) + +(defcustom gud-gud-gdb-command-name "gdb --fullname" + "Default command to run an executable under GDB in text command mode. +The option \"--fullname\" must be included in this value." + :type 'string + :group 'gud) + +(defvar gud-gdb-marker-regexp + ;; This used to use path-separator instead of ":"; + ;; however, we found that on both Windows 32 and MSDOS + ;; a colon is correct here. + (concat "\032\032\\(.:?[^" ":" "\n]*\\)" ":" + "\\([0-9]*\\)" ":" ".*\n")) + +;; There's no guarantee that Emacs will hand the filter the entire +;; marker at once; it could be broken up across several strings. We +;; might even receive a big chunk with several markers in it. If we +;; receive a chunk of text which looks like it might contain the +;; beginning of a marker, we save it here between calls to the +;; filter. +(defvar gud-marker-acc "") +(make-variable-buffer-local 'gud-marker-acc) + +(defun gud-gdb-marker-filter (string) + (setq gud-marker-acc (concat gud-marker-acc string)) + (let ((output "")) + + ;; Process all the complete markers in this chunk. + (while (string-match gud-gdb-marker-regexp gud-marker-acc) + (setq + + ;; Extract the frame position from the marker. + gud-last-frame (cons (match-string 1 gud-marker-acc) + (string-to-number (match-string 2 gud-marker-acc))) + + ;; Append any text before the marker to the output we're going + ;; to return - we don't include the marker in this text. + output (concat output + (substring gud-marker-acc 0 (match-beginning 0))) + + ;; Set the accumulator to the remaining text. + gud-marker-acc (substring gud-marker-acc (match-end 0)))) + + ;; Check for annotations and change gud-minor-mode to 'gdba if + ;; they are found. + (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc) + (let ((match (match-string 1 gud-marker-acc))) + + (setq + ;; Append any text before the marker to the output we're going + ;; to return - we don't include the marker in this text. + output (concat output + (substring gud-marker-acc 0 (match-beginning 0))) + + ;; Set the accumulator to the remaining text. + + gud-marker-acc (substring gud-marker-acc (match-end 0))))) + + ;; Does the remaining text look like it might end with the + ;; beginning of another marker? If it does, then keep it in + ;; gud-marker-acc until we receive the rest of it. Since we + ;; know the full marker regexp above failed, it's pretty simple to + ;; test for marker starts. + (if (string-match "\n\\(\032.*\\)?\\'" gud-marker-acc) + (progn + ;; Everything before the potential marker start can be output. + (setq output (concat output (substring gud-marker-acc + 0 (match-beginning 0)))) + + ;; Everything after, we save, to combine with later input. + (setq gud-marker-acc + (substring gud-marker-acc (match-beginning 0)))) + + (setq output (concat output gud-marker-acc) + gud-marker-acc "")) + + output)) + +(easy-mmode-defmap gud-minibuffer-local-map + '(("\C-i" . comint-dynamic-complete-filename)) + "Keymap for minibuffer prompting of gud startup command." + :inherit minibuffer-local-map) + +(defun gud-query-cmdline (minor-mode &optional init) + (let* ((hist-sym (gud-symbol 'history nil minor-mode)) + (cmd-name (gud-val 'command-name minor-mode))) + (unless (boundp hist-sym) (set hist-sym nil)) + (read-from-minibuffer + (format "Run %s (like this): " minor-mode) + (or (car-safe (symbol-value hist-sym)) + (concat (or cmd-name (symbol-name minor-mode)) + " " + (or init + (let ((file nil)) + (dolist (f (directory-files default-directory) file) + (if (and (file-executable-p f) + (not (file-directory-p f)) + (or (not file) + (file-newer-than-file-p f file))) + (setq file f))))))) + gud-minibuffer-local-map nil + hist-sym))) + +(defvar gdb-first-prompt t) + +(defvar gud-filter-pending-text nil + "Non-nil means this is text that has been saved for later in `gud-filter'.") + +;; The old gdb command (text command mode). The new one is in gdb-ui.el. +;;;###autoload +(defun gud-gdb (command-line) + "Run gdb on program FILE in buffer *gud-FILE*. +The directory containing FILE becomes the initial working +directory and source-file directory for your debugger." + (interactive (list (gud-query-cmdline 'gud-gdb))) + + (when (and gud-comint-buffer + (buffer-name gud-comint-buffer) + (get-buffer-process gud-comint-buffer) + (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))) + (gdb-restore-windows) + (error + "Multiple debugging requires restarting in text command mode")) + + (gud-common-init command-line nil 'gud-gdb-marker-filter) + (set (make-local-variable 'gud-minor-mode) 'gdb) + + (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") + (gud-def gud-tbreak "tbreak %f:%l" "\C-t" + "Set temporary breakpoint at current line.") + (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "step %p" "\C-s" "Step one source line with display.") + (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.") + (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).") + (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).") + (gud-def gud-cont "cont" "\C-r" "Continue with display.") + (gud-def gud-finish "finish" "\C-f" "Finish executing current function.") + (gud-def gud-jump + (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l")) + "\C-j" "Set execution address to current line.") + + (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).") + (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).") + (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") + (gud-def gud-pstar "print* %e" nil + "Evaluate C dereferenced pointer expression at point.") + + ;; For debugging Emacs only. + (gud-def gud-pv "pv1 %e" "\C-v" "Print the value of the lisp variable.") + + (gud-def gud-until "until %l" "\C-u" "Continue to current line.") + (gud-def gud-run "run" nil "Run the program.") + + (local-set-key "\C-i" 'gud-gdb-complete-command) + (setq comint-prompt-regexp "^(.*gdb[+]?) *") + (setq paragraph-start comint-prompt-regexp) + (setq gdb-first-prompt t) + (setq gud-running nil) + (setq gdb-ready nil) + (setq gud-filter-pending-text nil) + (run-hooks 'gud-gdb-mode-hook)) + +;; One of the nice features of GDB is its impressive support for +;; context-sensitive command completion. We preserve that feature +;; in the GUD buffer by using a GDB command designed just for Emacs. + +;; The completion process filter indicates when it is finished. +(defvar gud-gdb-fetch-lines-in-progress) + +;; Since output may arrive in fragments we accumulate partials strings here. +(defvar gud-gdb-fetch-lines-string) + +;; We need to know how much of the completion to chop off. +(defvar gud-gdb-fetch-lines-break) + +;; The completion list is constructed by the process filter. +(defvar gud-gdb-fetched-lines) + +(defun gud-gdb-complete-command (&optional command a b) + "Perform completion on the GDB command preceding point. +This is implemented using the GDB `complete' command which isn't +available with older versions of GDB." + (interactive) + (if command + ;; Used by gud-watch in mini-buffer. + (setq command (concat "p " command)) + ;; Used in GUD buffer. + (let ((end (point))) + (setq command (buffer-substring (comint-line-beginning-position) end)))) + (let* ((command-word + ;; Find the word break. This match will always succeed. + (and (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command) + (substring command (match-beginning 2)))) + (complete-list + (gud-gdb-run-command-fetch-lines (concat "complete " command) + (current-buffer) + ;; From string-match above. + (match-beginning 2)))) + ;; Protect against old versions of GDB. + (and complete-list + (string-match "^Undefined command: \"complete\"" (car complete-list)) + (error "This version of GDB doesn't support the `complete' command")) + ;; Sort the list like readline. + (setq complete-list (sort complete-list (function string-lessp))) + ;; Remove duplicates. + (let ((first complete-list) + (second (cdr complete-list))) + (while second + (if (string-equal (car first) (car second)) + (setcdr first (setq second (cdr second))) + (setq first second + second (cdr second))))) + ;; Add a trailing single quote if there is a unique completion + ;; and it contains an odd number of unquoted single quotes. + (and (= (length complete-list) 1) + (let ((str (car complete-list)) + (pos 0) + (count 0)) + (while (string-match "\\([^'\\]\\|\\\\'\\)*'" str pos) + (setq count (1+ count) + pos (match-end 0))) + (and (= (mod count 2) 1) + (setq complete-list (list (concat str "'")))))) + ;; Let comint handle the rest. + (comint-dynamic-simple-complete command-word complete-list))) + +;; The completion process filter is installed temporarily to slurp the +;; output of GDB up to the next prompt and build the completion list. +(defun gud-gdb-fetch-lines-filter (string filter) + "Filter used to read the list of lines output by a command. +STRING is the output to filter. +It is passed through FILTER before we look at it." + (setq string (funcall filter string)) + (setq string (concat gud-gdb-fetch-lines-string string)) + (while (string-match "\n" string) + (push (substring string gud-gdb-fetch-lines-break (match-beginning 0)) + gud-gdb-fetched-lines) + (setq string (substring string (match-end 0)))) + (if (string-match comint-prompt-regexp string) + (progn + (setq gud-gdb-fetch-lines-in-progress nil) + string) + (progn + (setq gud-gdb-fetch-lines-string string) + ""))) + +;; gdb speedbar functions + +(defun gud-gdb-goto-stackframe (text token indent) + "Goto the stackframe described by TEXT, TOKEN, and INDENT." + (speedbar-with-attached-buffer + (gud-basic-call (concat "server frame " (nth 1 token))) + (sit-for 1))) + +(defvar gud-gdb-fetched-stack-frame nil + "Stack frames we are fetching from GDB.") + +;(defun gud-gdb-get-scope-data (text token indent) +; ;; checkdoc-params: (indent) +; "Fetch data associated with a stack frame, and expand/contract it. +;Data to do this is retrieved from TEXT and TOKEN." +; (let ((args nil) (scope nil)) +; (gud-gdb-run-command-fetch-lines "info args") +; +; (gud-gdb-run-command-fetch-lines "info local") +; +; )) + +(defun gud-gdb-get-stackframe (buffer) + "Extract the current stack frame out of the GUD GDB BUFFER." + (let ((newlst nil) + (fetched-stack-frame-list + (gud-gdb-run-command-fetch-lines "server backtrace" buffer))) + (if (and (car fetched-stack-frame-list) + (string-match "No stack" (car fetched-stack-frame-list))) + ;; Go into some other mode??? + nil + (dolist (e fetched-stack-frame-list) + (let ((name nil) (num nil)) + (if (not (or + (string-match "^#\\([0-9]+\\) +[0-9a-fx]+ in \\([:0-9a-zA-Z_]+\\) (" e) + (string-match "^#\\([0-9]+\\) +\\([:0-9a-zA-Z_]+\\) (" e))) + (if (not (string-match + "at \\([-0-9a-zA-Z_.]+\\):\\([0-9]+\\)$" e)) + nil + (setcar newlst + (list (nth 0 (car newlst)) + (nth 1 (car newlst)) + (match-string 1 e) + (match-string 2 e)))) + (setq num (match-string 1 e) + name (match-string 2 e)) + (setq newlst + (cons + (if (string-match + "at \\([-0-9a-zA-Z_.]+\\):\\([0-9]+\\)$" e) + (list name num (match-string 1 e) + (match-string 2 e)) + (list name num)) + newlst))))) + (nreverse newlst)))) + +;(defun gud-gdb-selected-frame-info (buffer) +; "Learn GDB information for the currently selected stack frame in BUFFER." +; ) + +(defun gud-gdb-run-command-fetch-lines (command buffer &optional skip) + "Run COMMAND, and return the list of lines it outputs. +BUFFER is the current buffer which may be the GUD buffer in which to run. +SKIP is the number of chars to skip on each line, it defaults to 0." + (with-current-buffer gud-comint-buffer + (if (and (eq gud-comint-buffer buffer) + (save-excursion + (goto-char (point-max)) + (forward-line 0) + (not (looking-at comint-prompt-regexp)))) + nil + ;; Much of this copied from GDB complete, but I'm grabbing the stack + ;; frame instead. + (let ((gud-gdb-fetch-lines-in-progress t) + (gud-gdb-fetched-lines nil) + (gud-gdb-fetch-lines-string nil) + (gud-gdb-fetch-lines-break (or skip 0)) + (gud-marker-filter + `(lambda (string) + (gud-gdb-fetch-lines-filter string ',gud-marker-filter)))) + ;; Issue the command to GDB. + (gud-basic-call command) + ;; Slurp the output. + (while gud-gdb-fetch-lines-in-progress + (accept-process-output (get-buffer-process gud-comint-buffer))) + (nreverse gud-gdb-fetched-lines))))) + + +;; ====================================================================== +;; lldb functions + +;; History of argument lists passed to lldb. +(defvar gud-lldb-history nil) + +;; Keeps track of breakpoint created. In the following case, the id is "1". +;; It is used to implement temporary breakpoint. +;; (lldb) b main.c:39 +;; breakpoint set --file 'main.c' --line 39 +;; Breakpoint created: 1: file ='main.c', line = 39, locations = 1 +(defvar gud-breakpoint-id nil) + +(defun lldb-extract-breakpoint-id (string) + ;; Search for "Breakpoint created: \\([^:\n]*\\):" pattern. + (if (string-match "Breakpoint created: \\([^:\n]*\\):" string) + (progn + (setq gud-breakpoint-id (match-string 1 string)) + (message "breakpoint id: %s" gud-breakpoint-id))) +) + +(defun gud-lldb-marker-filter (string) + (setq gud-marker-acc + (if gud-marker-acc (concat gud-marker-acc string) string)) + (lldb-extract-breakpoint-id gud-marker-acc) + (let (start) + ;; Process all complete markers in this chunk + (while (or + ;; (lldb) r + ;; Process 15408 launched: '/Volumes/data/lldb/svn/trunk/test/conditional_break/a.out' (x86_64) + ;; (lldb) Process 15408 stopped + ;; * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread + (string-match " at \\([^:\n]*\\):\\([0-9]*\\), stop reason = .*\n" + gud-marker-acc start) + ;; (lldb) frame select -r 1 + ;; frame #1: 0x0000000100000e09 a.out`main + 25 at main.c:44 + (string-match "\nframe.* at \\([^:\n]*\\):\\([0-9]*\\)\n" + gud-marker-acc start)) + (setq gud-last-frame + (cons (match-string 1 gud-marker-acc) + (string-to-number (match-string 2 gud-marker-acc))) + start (match-end 0))) + + ;; Search for the last incomplete line in this chunk + (while (string-match "\n" gud-marker-acc start) + (setq start (match-end 0))) + + ;; If we have an incomplete line, store it in gud-marker-acc. + (setq gud-marker-acc (substring gud-marker-acc (or start 0)))) + string) + +;; Keeps track of whether the Python lldb_oneshot_break function definition has +;; been exec'ed. +(defvar lldb-oneshot-break-defined nil) + +;;;###autoload +(defun lldb (command-line) + "Run lldb on program FILE in buffer *gud-FILE*. +The directory containing FILE becomes the initial working directory +and source-file directory for your debugger." + (interactive (list (gud-query-cmdline 'lldb))) + + (gud-common-init command-line nil 'gud-lldb-marker-filter) + (set (make-local-variable 'gud-minor-mode) 'lldb) + (setq lldb-oneshot-break-defined nil) + + (gud-def gud-lbreak "breakpoint list" + "l" "List all breakpoints.") + (gud-def gud-break "breakpoint set -f %f -l %l" + "\C-b" "Set breakpoint at current line.") + (gud-def gud-tbreak + (progn (gud-call "breakpoint set -f %f -l %l") + (sit-for 1) + (if (not lldb-oneshot-break-defined) + (progn + ;; The "\\n"'s are required to escape the newline chars + ;; passed to the lldb process. + (gud-call (concat "script exec \"def lldb_oneshot_break(frame, bp_loc):\\n" + " target=frame.GetThread().GetProcess().GetTarget()\\n" + " bp=bp_loc.GetBreakpoint()\\n" + " print 'Deleting oneshot breakpoint:', bp\\n" + " target.BreakpointDelete(bp.GetID())\"")) + (sit-for 1) + ;; Set the flag since Python knows about the function def now. + (setq lldb-oneshot-break-defined t))) + (gud-call "breakpoint command add -p %b -o 'lldb_oneshot_break(frame, bp_loc)'")) + "\C-t" "Set temporary breakpoint at current line.") + (gud-def gud-remove "breakpoint clear -f %f -l %l" + "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "thread step-in" + "\C-s" "Step one source line with display.") + (gud-def gud-stepi "thread step-inst" + "\C-i" "Step one instruction with display.") + (gud-def gud-next "thread step-over" + "\C-n" "Step one line (skip functions).") + (gud-def gud-nexti "thread step-inst-over" + nil "Step one instruction (skip functions).") + (gud-def gud-cont "process continue" + "\C-r" "Continue with display.") + (gud-def gud-finish "thread step-out" + "\C-f" "Finish executing current function.") + (gud-def gud-up "frame select -r %p" + "<" "Up 1 stack frame.") + (gud-def gud-down "frame select -r -%p" + ">" "Down 1 stack frame.") + (gud-def gud-print "expression -- %e" + "\C-p" "Evaluate C expression at point.") + (gud-def gud-pstar "expression -- *%e" + nil "Evaluate C dereferenced pointer expression at point.") + (gud-def gud-run "run" + nil "Run the program.") + (gud-def gud-stop-subjob "process kill" + nil "Stop the program.") + + (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'lldb-mode-hook) + ) + + +;; ====================================================================== +;; sdb functions + +;; History of argument lists passed to sdb. +(defvar gud-sdb-history nil) + +(defvar gud-sdb-needs-tags (not (file-exists-p "/var")) + "If nil, we're on a System V Release 4 and don't need the tags hack.") + +(defvar gud-sdb-lastfile nil) + +(defun gud-sdb-marker-filter (string) + (setq gud-marker-acc + (if gud-marker-acc (concat gud-marker-acc string) string)) + (let (start) + ;; Process all complete markers in this chunk + (while + (cond + ;; System V Release 3.2 uses this format + ((string-match "\\(^\\|\n\\)\\*?\\(0x\\w* in \\)?\\([^:\n]*\\):\\([0-9]*\\):.*\n" + gud-marker-acc start) + (setq gud-last-frame + (cons (match-string 3 gud-marker-acc) + (string-to-number (match-string 4 gud-marker-acc))))) + ;; System V Release 4.0 quite often clumps two lines together + ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n\\([0-9]+\\):" + gud-marker-acc start) + (setq gud-sdb-lastfile (match-string 2 gud-marker-acc)) + (setq gud-last-frame + (cons gud-sdb-lastfile + (string-to-number (match-string 3 gud-marker-acc))))) + ;; System V Release 4.0 + ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n" + gud-marker-acc start) + (setq gud-sdb-lastfile (match-string 2 gud-marker-acc))) + ((and gud-sdb-lastfile (string-match "^\\([0-9]+\\):" + gud-marker-acc start)) + (setq gud-last-frame + (cons gud-sdb-lastfile + (string-to-number (match-string 1 gud-marker-acc))))) + (t + (setq gud-sdb-lastfile nil))) + (setq start (match-end 0))) + + ;; Search for the last incomplete line in this chunk + (while (string-match "\n" gud-marker-acc start) + (setq start (match-end 0))) + + ;; If we have an incomplete line, store it in gud-marker-acc. + (setq gud-marker-acc (substring gud-marker-acc (or start 0)))) + string) + +(defun gud-sdb-find-file (f) + (if gud-sdb-needs-tags (find-tag-noselect f) (find-file-noselect f))) + +;;;###autoload +(defun sdb (command-line) + "Run sdb on program FILE in buffer *gud-FILE*. +The directory containing FILE becomes the initial working directory +and source-file directory for your debugger." + (interactive (list (gud-query-cmdline 'sdb))) + + (if gud-sdb-needs-tags (require 'etags)) + (if (and gud-sdb-needs-tags + (not (and (boundp 'tags-file-name) + (stringp tags-file-name) + (file-exists-p tags-file-name)))) + (error "The sdb support requires a valid tags table to work")) + + (gud-common-init command-line nil 'gud-sdb-marker-filter 'gud-sdb-find-file) + (set (make-local-variable 'gud-minor-mode) 'sdb) + + (gud-def gud-break "%l b" "\C-b" "Set breakpoint at current line.") + (gud-def gud-tbreak "%l c" "\C-t" "Set temporary breakpoint at current line.") + (gud-def gud-remove "%l d" "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "s %p" "\C-s" "Step one source line with display.") + (gud-def gud-stepi "i %p" "\C-i" "Step one instruction with display.") + (gud-def gud-next "S %p" "\C-n" "Step one line (skip functions).") + (gud-def gud-cont "c" "\C-r" "Continue with display.") + (gud-def gud-print "%e/" "\C-p" "Evaluate C expression at point.") + + (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'sdb-mode-hook) + ) + +;; ====================================================================== +;; dbx functions + +;; History of argument lists passed to dbx. +(defvar gud-dbx-history nil) + +(defcustom gud-dbx-directories nil + "*A list of directories that dbx should search for source code. +If nil, only source files in the program directory +will be known to dbx. + +The file names should be absolute, or relative to the directory +containing the executable being debugged." + :type '(choice (const :tag "Current Directory" nil) + (repeat :value ("") + directory)) + :group 'gud) + +(defun gud-dbx-massage-args (file args) + (nconc (let ((directories gud-dbx-directories) + (result nil)) + (while directories + (setq result (cons (car directories) (cons "-I" result))) + (setq directories (cdr directories))) + (nreverse result)) + args)) + +(defun gud-dbx-marker-filter (string) + (setq gud-marker-acc (if gud-marker-acc (concat gud-marker-acc string) string)) + + (let (start) + ;; Process all complete markers in this chunk. + (while (or (string-match + "stopped in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\"" + gud-marker-acc start) + (string-match + "signal .* in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\"" + gud-marker-acc start)) + (setq gud-last-frame + (cons (match-string 2 gud-marker-acc) + (string-to-number (match-string 1 gud-marker-acc))) + start (match-end 0))) + + ;; Search for the last incomplete line in this chunk + (while (string-match "\n" gud-marker-acc start) + (setq start (match-end 0))) + + ;; If the incomplete line APPEARS to begin with another marker, keep it + ;; in the accumulator. Otherwise, clear the accumulator to avoid an + ;; unnecessary concat during the next call. + (setq gud-marker-acc + (if (string-match "\\(stopped\\|signal\\)" gud-marker-acc start) + (substring gud-marker-acc (match-beginning 0)) + nil))) + string) + +;; Functions for Mips-style dbx. Given the option `-emacs', documented in +;; OSF1, not necessarily elsewhere, it produces markers similar to gdb's. +(defvar gud-mips-p + (or (string-match "^mips-[^-]*-ultrix" system-configuration) + ;; We haven't tested gud on this system: + (string-match "^mips-[^-]*-riscos" system-configuration) + ;; It's documented on OSF/1.3 + (string-match "^mips-[^-]*-osf1" system-configuration) + (string-match "^alpha[^-]*-[^-]*-osf" system-configuration)) + "Non-nil to assume the MIPS/OSF dbx conventions (argument `-emacs').") + +(defvar gud-dbx-command-name + (concat "dbx" (if gud-mips-p " -emacs"))) + +;; This is just like the gdb one except for the regexps since we need to cope +;; with an optional breakpoint number in [] before the ^Z^Z +(defun gud-mipsdbx-marker-filter (string) + (setq gud-marker-acc (concat gud-marker-acc string)) + (let ((output "")) + + ;; Process all the complete markers in this chunk. + (while (string-match + ;; This is like th gdb marker but with an optional + ;; leading break point number like `[1] ' + "[][ 0-9]*\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n" + gud-marker-acc) + (setq + + ;; Extract the frame position from the marker. + gud-last-frame + (cons (match-string 1 gud-marker-acc) + (string-to-number (match-string 2 gud-marker-acc))) + + ;; Append any text before the marker to the output we're going + ;; to return - we don't include the marker in this text. + output (concat output + (substring gud-marker-acc 0 (match-beginning 0))) + + ;; Set the accumulator to the remaining text. + gud-marker-acc (substring gud-marker-acc (match-end 0)))) + + ;; Does the remaining text look like it might end with the + ;; beginning of another marker? If it does, then keep it in + ;; gud-marker-acc until we receive the rest of it. Since we + ;; know the full marker regexp above failed, it's pretty simple to + ;; test for marker starts. + (if (string-match "[][ 0-9]*\032.*\\'" gud-marker-acc) + (progn + ;; Everything before the potential marker start can be output. + (setq output (concat output (substring gud-marker-acc + 0 (match-beginning 0)))) + + ;; Everything after, we save, to combine with later input. + (setq gud-marker-acc + (substring gud-marker-acc (match-beginning 0)))) + + (setq output (concat output gud-marker-acc) + gud-marker-acc "")) + + output)) + +;; The dbx in IRIX is a pain. It doesn't print the file name when +;; stopping at a breakpoint (but you do get it from the `up' and +;; `down' commands...). The only way to extract the information seems +;; to be with a `file' command, although the current line number is +;; available in $curline. Thus we have to look for output which +;; appears to indicate a breakpoint. Then we prod the dbx sub-process +;; to output the information we want with a combination of the +;; `printf' and `file' commands as a pseudo marker which we can +;; recognise next time through the marker-filter. This would be like +;; the gdb marker but you can't get the file name without a newline... +;; Note that gud-remove won't work since Irix dbx expects a breakpoint +;; number rather than a line number etc. Maybe this could be made to +;; work by listing all the breakpoints and picking the one(s) with the +;; correct line number, but life's too short. +;; d.love at dl.ac.uk (Dave Love) can be blamed for this + +(defvar gud-irix-p + (and (string-match "^mips-[^-]*-irix" system-configuration) + (not (string-match "irix[6-9]\\.[1-9]" system-configuration))) + "Non-nil to assume the interface appropriate for IRIX dbx. +This works in IRIX 4, 5 and 6, but `gud-dbx-use-stopformat-p' provides +a better solution in 6.1 upwards.") +(defvar gud-dbx-use-stopformat-p + (string-match "irix[6-9]\\.[1-9]" system-configuration) + "Non-nil to use the dbx feature present at least from Irix 6.1 +whereby $stopformat=1 produces an output format compatible with +`gud-dbx-marker-filter'.") +;; [Irix dbx seems to be a moving target. The dbx output changed +;; subtly sometime between OS v4.0.5 and v5.2 so that, for instance, +;; the output from `up' is no longer spotted by gud (and it's probably +;; not distinctive enough to try to match it -- use C-<, C-> +;; exclusively) . For 5.3 and 6.0, the $curline variable changed to +;; `long long'(why?!), so the printf stuff needed changing. The line +;; number was cast to `long' as a compromise between the new `long +;; long' and the original `int'. This is reported not to work in 6.2, +;; so it's changed back to int -- don't make your sources too long. +;; From Irix6.1 (but not 6.0?) dbx supports an undocumented feature +;; whereby `set $stopformat=1' reportedly produces output compatible +;; with `gud-dbx-marker-filter', which we prefer. + +;; The process filter is also somewhat +;; unreliable, sometimes not spotting the markers; I don't know +;; whether there's anything that can be done about that. It would be +;; much better if SGI could be persuaded to (re?)instate the MIPS +;; -emacs flag for gdb-like output (which ought to be possible as most +;; of the communication I've had over it has been from sgi.com).] + +;; this filter is influenced by the xdb one rather than the gdb one +(defun gud-irixdbx-marker-filter (string) + (let (result (case-fold-search nil)) + (if (or (string-match comint-prompt-regexp string) + (string-match ".*\012" string)) + (setq result (concat gud-marker-acc string) + gud-marker-acc "") + (setq gud-marker-acc (concat gud-marker-acc string))) + (if result + (cond + ;; look for breakpoint or signal indication e.g.: + ;; [2] Process 1267 (pplot) stopped at [params:338 ,0x400ec0] + ;; Process 1281 (pplot) stopped at [params:339 ,0x400ec8] + ;; Process 1270 (pplot) Floating point exception [._read._read:16 ,0x452188] + ((string-match + "^\\(\\[[0-9]+] \\)?Process +[0-9]+ ([^)]*) [^[]+\\[[^]\n]*]\n" + result) + ;; prod dbx into printing out the line number and file + ;; name in a form we can grok as below + (process-send-string (get-buffer-process gud-comint-buffer) + "printf \"\032\032%1d:\",(int)$curline;file\n")) + ;; look for result of, say, "up" e.g.: + ;; .pplot.pplot(0x800) ["src/pplot.f":261, 0x400c7c] + ;; (this will also catch one of the lines printed by "where") + ((string-match + "^[^ ][^[]*\\[\"\\([^\"]+\\)\":\\([0-9]+\\), [^]]+]\n" + result) + (let ((file (match-string 1 result))) + (if (file-exists-p file) + (setq gud-last-frame + (cons (match-string 1 result) + (string-to-number (match-string 2 result)))))) + result) + ((string-match ; kluged-up marker as above + "\032\032\\([0-9]*\\):\\(.*\\)\n" result) + (let ((file (gud-file-name (match-string 2 result)))) + (if (and file (file-exists-p file)) + (setq gud-last-frame + (cons file + (string-to-number (match-string 1 result)))))) + (setq result (substring result 0 (match-beginning 0)))))) + (or result ""))) + +(defvar gud-dgux-p (string-match "-dgux" system-configuration) + "Non-nil means to assume the interface approriate for DG/UX dbx. +This was tested using R4.11.") + +;; There are a couple of differences between DG's dbx output and normal +;; dbx output which make it nontrivial to integrate this into the +;; standard dbx-marker-filter (mainly, there are a different number of +;; backreferences). The markers look like: +;; +;; (0) Stopped at line 10, routine main(argc=1, argv=0xeffff0e0), file t.c +;; +;; from breakpoints (the `(0)' there isn't constant, it's the breakpoint +;; number), and +;; +;; Stopped at line 13, routine main(argc=1, argv=0xeffff0e0), file t.c +;; +;; from signals and +;; +;; Frame 21, line 974, routine command_loop(), file keyboard.c +;; +;; from up/down/where. + +(defun gud-dguxdbx-marker-filter (string) + (setq gud-marker-acc (if gud-marker-acc + (concat gud-marker-acc string) + string)) + (let ((re (concat "^\\(\\(([0-9]+) \\)?Stopped at\\|Frame [0-9]+,\\)" + " line \\([0-9]+\\), routine .*, file \\([^ \t\n]+\\)")) + start) + ;; Process all complete markers in this chunk. + (while (string-match re gud-marker-acc start) + (setq gud-last-frame + (cons (match-string 4 gud-marker-acc) + (string-to-number (match-string 3 gud-marker-acc))) + start (match-end 0))) + + ;; Search for the last incomplete line in this chunk + (while (string-match "\n" gud-marker-acc start) + (setq start (match-end 0))) + + ;; If the incomplete line APPEARS to begin with another marker, keep it + ;; in the accumulator. Otherwise, clear the accumulator to avoid an + ;; unnecessary concat during the next call. + (setq gud-marker-acc + (if (string-match "Stopped\\|Frame" gud-marker-acc start) + (substring gud-marker-acc (match-beginning 0)) + nil))) + string) + +;;;###autoload +(defun dbx (command-line) + "Run dbx on program FILE in buffer *gud-FILE*. +The directory containing FILE becomes the initial working directory +and source-file directory for your debugger." + (interactive (list (gud-query-cmdline 'dbx))) + + (cond + (gud-mips-p + (gud-common-init command-line nil 'gud-mipsdbx-marker-filter)) + (gud-irix-p + (gud-common-init command-line 'gud-dbx-massage-args + 'gud-irixdbx-marker-filter)) + (gud-dgux-p + (gud-common-init command-line 'gud-dbx-massage-args + 'gud-dguxdbx-marker-filter)) + (t + (gud-common-init command-line 'gud-dbx-massage-args + 'gud-dbx-marker-filter))) + + (set (make-local-variable 'gud-minor-mode) 'dbx) + + (cond + (gud-mips-p + (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.") + (gud-def gud-down "down %p" ">" "Down (numeric arg) stack frames.") + (gud-def gud-break "stop at \"%f\":%l" + "\C-b" "Set breakpoint at current line.") + (gud-def gud-finish "return" "\C-f" "Finish executing current function.")) + (gud-irix-p + (gud-def gud-break "stop at \"%d%f\":%l" + "\C-b" "Set breakpoint at current line.") + (gud-def gud-finish "return" "\C-f" "Finish executing current function.") + (gud-def gud-up "up %p; printf \"\032\032%1d:\",(int)$curline;file\n" + "<" "Up (numeric arg) stack frames.") + (gud-def gud-down "down %p; printf \"\032\032%1d:\",(int)$curline;file\n" + ">" "Down (numeric arg) stack frames.") + ;; Make dbx give out the source location info that we need. + (process-send-string (get-buffer-process gud-comint-buffer) + "printf \"\032\032%1d:\",(int)$curline;file\n")) + (t + (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.") + (gud-def gud-down "down %p" ">" "Down (numeric arg) stack frames.") + (gud-def gud-break "file \"%d%f\"\nstop at %l" + "\C-b" "Set breakpoint at current line.") + (if gud-dbx-use-stopformat-p + (process-send-string (get-buffer-process gud-comint-buffer) + "set $stopformat=1\n")))) + + (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "step %p" "\C-s" "Step one line with display.") + (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.") + (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).") + (gud-def gud-nexti "nexti %p" nil "Step one instruction (skip functions).") + (gud-def gud-cont "cont" "\C-r" "Continue with display.") + (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") + (gud-def gud-run "run" nil "Run the program.") + + (setq comint-prompt-regexp "^[^)\n]*dbx) *") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'dbx-mode-hook) + ) + +;; ====================================================================== +;; xdb (HP PARISC debugger) functions + +;; History of argument lists passed to xdb. +(defvar gud-xdb-history nil) + +(defcustom gud-xdb-directories nil + "*A list of directories that xdb should search for source code. +If nil, only source files in the program directory +will be known to xdb. + +The file names should be absolute, or relative to the directory +containing the executable being debugged." + :type '(choice (const :tag "Current Directory" nil) + (repeat :value ("") + directory)) + :group 'gud) + +(defun gud-xdb-massage-args (file args) + (nconc (let ((directories gud-xdb-directories) + (result nil)) + (while directories + (setq result (cons (car directories) (cons "-d" result))) + (setq directories (cdr directories))) + (nreverse result)) + args)) + +;; xdb does not print the lines all at once, so we have to accumulate them +(defun gud-xdb-marker-filter (string) + (let (result) + (if (or (string-match comint-prompt-regexp string) + (string-match ".*\012" string)) + (setq result (concat gud-marker-acc string) + gud-marker-acc "") + (setq gud-marker-acc (concat gud-marker-acc string))) + (if result + (if (or (string-match "\\([^\n \t:]+\\): [^:]+: \\([0-9]+\\)[: ]" + result) + (string-match "[^: \t]+:[ \t]+\\([^:]+\\): [^:]+: \\([0-9]+\\):" + result)) + (let ((line (string-to-number (match-string 2 result))) + (file (gud-file-name (match-string 1 result)))) + (if file + (setq gud-last-frame (cons file line)))))) + (or result ""))) + +;;;###autoload +(defun xdb (command-line) + "Run xdb on program FILE in buffer *gud-FILE*. +The directory containing FILE becomes the initial working directory +and source-file directory for your debugger. + +You can set the variable `gud-xdb-directories' to a list of program source +directories if your program contains sources from more than one directory." + (interactive (list (gud-query-cmdline 'xdb))) + + (gud-common-init command-line 'gud-xdb-massage-args + 'gud-xdb-marker-filter) + (set (make-local-variable 'gud-minor-mode) 'xdb) + + (gud-def gud-break "b %f:%l" "\C-b" "Set breakpoint at current line.") + (gud-def gud-tbreak "b %f:%l\\t" "\C-t" + "Set temporary breakpoint at current line.") + (gud-def gud-remove "db" "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "s %p" "\C-s" "Step one line with display.") + (gud-def gud-next "S %p" "\C-n" "Step one line (skip functions).") + (gud-def gud-cont "c" "\C-r" "Continue with display.") + (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.") + (gud-def gud-down "down %p" ">" "Down (numeric arg) stack frames.") + (gud-def gud-finish "bu\\t" "\C-f" "Finish executing current function.") + (gud-def gud-print "p %e" "\C-p" "Evaluate C expression at point.") + + (setq comint-prompt-regexp "^>") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'xdb-mode-hook)) + +;; ====================================================================== +;; perldb functions + +;; History of argument lists passed to perldb. +(defvar gud-perldb-history nil) + +(defun gud-perldb-massage-args (file args) + "Convert a command line as would be typed normally to run perldb +into one that invokes an Emacs-enabled debugging session. +\"-emacs\" is inserted where it will be $ARGV[0] (see perl5db.pl)." + ;; FIXME: what if the command is `make perldb' and doesn't accept those extra + ;; arguments ? + (let* ((new-args nil) + (seen-e nil) + (shift (lambda () (push (pop args) new-args)))) + + ;; Pass all switches and -e scripts through. + (while (and args + (string-match "^-" (car args)) + (not (equal "-" (car args))) + (not (equal "--" (car args)))) + (when (equal "-e" (car args)) + ;; -e goes with the next arg, so shift one extra. + (or (funcall shift) + ;; -e as the last arg is an error in Perl. + (error "No code specified for -e")) + (setq seen-e t)) + (funcall shift)) + + (unless seen-e + (if (or (not args) + (string-match "^-" (car args))) + (error "Can't use stdin as the script to debug")) + ;; This is the program name. + (funcall shift)) + + ;; If -e specified, make sure there is a -- so -emacs is not taken + ;; as -e macs. + (if (and args (equal "--" (car args))) + (funcall shift) + (and seen-e (push "--" new-args))) + + (push "-emacs" new-args) + (while args + (funcall shift)) + + (nreverse new-args))) + +;; There's no guarantee that Emacs will hand the filter the entire +;; marker at once; it could be broken up across several strings. We +;; might even receive a big chunk with several markers in it. If we +;; receive a chunk of text which looks like it might contain the +;; beginning of a marker, we save it here between calls to the +;; filter. +(defun gud-perldb-marker-filter (string) + (setq gud-marker-acc (concat gud-marker-acc string)) + (let ((output "")) + + ;; Process all the complete markers in this chunk. + (while (string-match "\032\032\\(\\([a-zA-Z]:\\)?[^:\n]*\\):\\([0-9]*\\):.*\n" + gud-marker-acc) + (setq + + ;; Extract the frame position from the marker. + gud-last-frame + (cons (match-string 1 gud-marker-acc) + (string-to-number (match-string 3 gud-marker-acc))) + + ;; Append any text before the marker to the output we're going + ;; to return - we don't include the marker in this text. + output (concat output + (substring gud-marker-acc 0 (match-beginning 0))) + + ;; Set the accumulator to the remaining text. + gud-marker-acc (substring gud-marker-acc (match-end 0)))) + + ;; Does the remaining text look like it might end with the + ;; beginning of another marker? If it does, then keep it in + ;; gud-marker-acc until we receive the rest of it. Since we + ;; know the full marker regexp above failed, it's pretty simple to + ;; test for marker starts. + (if (string-match "\032.*\\'" gud-marker-acc) + (progn + ;; Everything before the potential marker start can be output. + (setq output (concat output (substring gud-marker-acc + 0 (match-beginning 0)))) + + ;; Everything after, we save, to combine with later input. + (setq gud-marker-acc + (substring gud-marker-acc (match-beginning 0)))) + + (setq output (concat output gud-marker-acc) + gud-marker-acc "")) + + output)) + +(defcustom gud-perldb-command-name "perl -d" + "Default command to execute a Perl script under debugger." + :type 'string + :group 'gud) + +;;;###autoload +(defun perldb (command-line) + "Run perldb on program FILE in buffer *gud-FILE*. +The directory containing FILE becomes the initial working directory +and source-file directory for your debugger." + (interactive + (list (gud-query-cmdline 'perldb + (concat (or (buffer-file-name) "-e 0") " ")))) + + (gud-common-init command-line 'gud-perldb-massage-args + 'gud-perldb-marker-filter) + (set (make-local-variable 'gud-minor-mode) 'perldb) + + (gud-def gud-break "b %l" "\C-b" "Set breakpoint at current line.") + (gud-def gud-remove "B %l" "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "s" "\C-s" "Step one source line with display.") + (gud-def gud-next "n" "\C-n" "Step one line (skip functions).") + (gud-def gud-cont "c" "\C-r" "Continue with display.") +; (gud-def gud-finish "finish" "\C-f" "Finish executing current function.") +; (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).") +; (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).") + (gud-def gud-print "p %e" "\C-p" "Evaluate perl expression at point.") + (gud-def gud-until "c %l" "\C-u" "Continue to current line.") + + + (setq comint-prompt-regexp "^ DB<+[0-9]+>+ ") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'perldb-mode-hook)) + +;; ====================================================================== +;; pdb (Python debugger) functions + +;; History of argument lists passed to pdb. +(defvar gud-pdb-history nil) + +;; Last group is for return value, e.g. "> test.py(2)foo()->None" +;; Either file or function name may be omitted: "> (0)?()" +(defvar gud-pdb-marker-regexp + "^> \\([-a-zA-Z0-9_/.:\\]*\\|\\)(\\([0-9]+\\))\\([a-zA-Z0-9_]*\\|\\?\\|\\)()\\(->[^\n]*\\)?\n") +(defvar gud-pdb-marker-regexp-file-group 1) +(defvar gud-pdb-marker-regexp-line-group 2) +(defvar gud-pdb-marker-regexp-fnname-group 3) + +(defvar gud-pdb-marker-regexp-start "^> ") + +;; There's no guarantee that Emacs will hand the filter the entire +;; marker at once; it could be broken up across several strings. We +;; might even receive a big chunk with several markers in it. If we +;; receive a chunk of text which looks like it might contain the +;; beginning of a marker, we save it here between calls to the +;; filter. +(defun gud-pdb-marker-filter (string) + (setq gud-marker-acc (concat gud-marker-acc string)) + (let ((output "")) + + ;; Process all the complete markers in this chunk. + (while (string-match gud-pdb-marker-regexp gud-marker-acc) + (setq + + ;; Extract the frame position from the marker. + gud-last-frame + (let ((file (match-string gud-pdb-marker-regexp-file-group + gud-marker-acc)) + (line (string-to-number + (match-string gud-pdb-marker-regexp-line-group + gud-marker-acc)))) + (if (string-equal file "") + gud-last-frame + (cons file line))) + + ;; Output everything instead of the below + output (concat output (substring gud-marker-acc 0 (match-end 0))) +;; ;; Append any text before the marker to the output we're going +;; ;; to return - we don't include the marker in this text. +;; output (concat output +;; (substring gud-marker-acc 0 (match-beginning 0))) + + ;; Set the accumulator to the remaining text. + gud-marker-acc (substring gud-marker-acc (match-end 0)))) + + ;; Does the remaining text look like it might end with the + ;; beginning of another marker? If it does, then keep it in + ;; gud-marker-acc until we receive the rest of it. Since we + ;; know the full marker regexp above failed, it's pretty simple to + ;; test for marker starts. + (if (string-match gud-pdb-marker-regexp-start gud-marker-acc) + (progn + ;; Everything before the potential marker start can be output. + (setq output (concat output (substring gud-marker-acc + 0 (match-beginning 0)))) + + ;; Everything after, we save, to combine with later input. + (setq gud-marker-acc + (substring gud-marker-acc (match-beginning 0)))) + + (setq output (concat output gud-marker-acc) + gud-marker-acc "")) + + output)) + +(defcustom gud-pdb-command-name "pdb" + "File name for executing the Python debugger. +This should be an executable on your path, or an absolute file name." + :type 'string + :group 'gud) + +;;;###autoload +(defun pdb (command-line) + "Run pdb on program FILE in buffer `*gud-FILE*'. +The directory containing FILE becomes the initial working directory +and source-file directory for your debugger." + (interactive + (list (gud-query-cmdline 'pdb))) + + (gud-common-init command-line nil 'gud-pdb-marker-filter) + (set (make-local-variable 'gud-minor-mode) 'pdb) + + (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") + (gud-def gud-remove "clear %f:%l" "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "step" "\C-s" "Step one source line with display.") + (gud-def gud-next "next" "\C-n" "Step one line (skip functions).") + (gud-def gud-cont "continue" "\C-r" "Continue with display.") + (gud-def gud-finish "return" "\C-f" "Finish executing current function.") + (gud-def gud-up "up" "<" "Up one stack frame.") + (gud-def gud-down "down" ">" "Down one stack frame.") + (gud-def gud-print "p %e" "\C-p" "Evaluate Python expression at point.") + ;; Is this right? + (gud-def gud-statement "! %e" "\C-e" "Execute Python statement at point.") + + ;; (setq comint-prompt-regexp "^(.*pdb[+]?) *") + (setq comint-prompt-regexp "^(Pdb) *") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'pdb-mode-hook)) + +;; ====================================================================== +;; +;; JDB support. +;; +;; AUTHOR: Derek Davies +;; Zoltan Kemenczy +;; +;; CREATED: Sun Feb 22 10:46:38 1998 Derek Davies. +;; UPDATED: Nov 11, 2001 Zoltan Kemenczy +;; Dec 10, 2002 Zoltan Kemenczy - added nested class support +;; +;; INVOCATION NOTES: +;; +;; You invoke jdb-mode with: +;; +;; M-x jdb +;; +;; It responds with: +;; +;; Run jdb (like this): jdb +;; +;; type any jdb switches followed by the name of the class you'd like to debug. +;; Supply a fully qualfied classname (these do not have the ".class" extension) +;; for the name of the class to debug (e.g. "COM.the-kind.ddavies.CoolClass"). +;; See the known problems section below for restrictions when specifying jdb +;; command line switches (search forward for '-classpath'). +;; +;; You should see something like the following: +;; +;; Current directory is ~/src/java/hello/ +;; Initializing jdb... +;; 0xed2f6628:class(hello) +;; > +;; +;; To set an initial breakpoint try: +;; +;; > stop in hello.main +;; Breakpoint set in hello.main +;; > +;; +;; To execute the program type: +;; +;; > run +;; run hello +;; +;; Breakpoint hit: running ... +;; hello.main (hello:12) +;; +;; Type M-n to step over the current line and M-s to step into it. That, +;; along with the JDB 'help' command should get you started. The 'quit' +;; JDB command will get out out of the debugger. There is some truly +;; pathetic JDB documentation available at: +;; +;; http://java.sun.com/products/jdk/1.1/debugging/ +;; +;; KNOWN PROBLEMS AND FIXME's: +;; +;; Not sure what happens with inner classes ... haven't tried them. +;; +;; Does not grok UNICODE id's. Only ASCII id's are supported. +;; +;; You must not put whitespace between "-classpath" and the path to +;; search for java classes even though it is required when invoking jdb +;; from the command line. See gud-jdb-massage-args for details. +;; The same applies for "-sourcepath". +;; +;; Note: The following applies only if `gud-jdb-use-classpath' is nil; +;; refer to the documentation of `gud-jdb-use-classpath' and +;; `gud-jdb-classpath',`gud-jdb-sourcepath' variables for information +;; on using the classpath for locating java source files. +;; +;; If any of the source files in the directories listed in +;; gud-jdb-directories won't parse you'll have problems. Make sure +;; every file ending in ".java" in these directories parses without error. +;; +;; All the .java files in the directories in gud-jdb-directories are +;; syntactically analyzed each time gud jdb is invoked. It would be +;; nice to keep as much information as possible between runs. It would +;; be really nice to analyze the files only as neccessary (when the +;; source needs to be displayed.) I'm not sure to what extent the former +;; can be accomplished and I'm not sure the latter can be done at all +;; since I don't know of any general way to tell which .class files are +;; defined by which .java file without analyzing all the .java files. +;; If anyone knows why JavaSoft didn't put the source file names in +;; debuggable .class files please clue me in so I find something else +;; to be spiteful and bitter about. +;; +;; ====================================================================== +;; gud jdb variables and functions + +(defcustom gud-jdb-command-name "jdb" + "Command that executes the Java debugger." + :type 'string + :group 'gud) + +(defcustom gud-jdb-use-classpath t + "If non-nil, search for Java source files in classpath directories. +The list of directories to search is the value of `gud-jdb-classpath'. +The file pathname is obtained by converting the fully qualified +class information output by jdb to a relative pathname and appending +it to `gud-jdb-classpath' element by element until a match is found. + +This method has a significant jdb startup time reduction advantage +since it does not require the scanning of all `gud-jdb-directories' +and parsing all Java files for class information. + +Set to nil to use `gud-jdb-directories' to scan java sources for +class information on jdb startup (original method)." + :type 'boolean + :group 'gud) + +(defvar gud-jdb-classpath nil + "Java/jdb classpath directories list. +If `gud-jdb-use-classpath' is non-nil, gud-jdb derives the `gud-jdb-classpath' +list automatically using the following methods in sequence +\(with subsequent successful steps overriding the results of previous +steps): + +1) Read the CLASSPATH environment variable, +2) Read any \"-classpath\" argument used to run jdb, + or detected in jdb output (e.g. if jdb is run by a script + that echoes the actual jdb command before starting jdb), +3) Send a \"classpath\" command to jdb and scan jdb output for + classpath information if jdb is invoked with an \"-attach\" (to + an already running VM) argument (This case typically does not + have a \"-classpath\" command line argument - that is provided + to the VM when it is started). + +Note that method 3 cannot be used with oldjdb (or Java 1 jdb) since +those debuggers do not support the classpath command. Use 1) or 2).") + +(defvar gud-jdb-sourcepath nil + "Directory list provided by an (optional) \"-sourcepath\" option to jdb. +This list is prepended to `gud-jdb-classpath' to form the complete +list of directories searched for source files.") + +(defvar gud-marker-acc-max-length 4000 + "Maximum number of debugger output characters to keep. +This variable limits the size of `gud-marker-acc' which holds +the most recent debugger output history while searching for +source file information.") + +(defvar gud-jdb-history nil + "History of argument lists passed to jdb.") + + +;; List of Java source file directories. +(defvar gud-jdb-directories (list ".") + "*A list of directories that gud jdb should search for source code. +The file names should be absolute, or relative to the current +directory. + +The set of .java files residing in the directories listed are +syntactically analyzed to determine the classes they define and the +packages in which these classes belong. In this way gud jdb maps the +package-qualified class names output by the jdb debugger to the source +file from which the class originated. This allows gud mode to keep +the source code display in sync with the debugging session.") + +(defvar gud-jdb-source-files nil + "List of the java source files for this debugging session.") + +;; Association list of fully qualified class names (package + class name) +;; and their source files. +(defvar gud-jdb-class-source-alist nil + "Association list of fully qualified class names and source files.") + +;; This is used to hold a source file during analysis. +(defvar gud-jdb-analysis-buffer nil) + +(defvar gud-jdb-classpath-string nil + "Holds temporary classpath values.") + +(defun gud-jdb-build-source-files-list (path extn) + "Return a list of java source files (absolute paths). +PATH gives the directories in which to search for files with +extension EXTN. Normally EXTN is given as the regular expression + \"\\.java$\" ." + (apply 'nconc (mapcar (lambda (d) + (when (file-directory-p d) + (directory-files d t extn nil))) + path))) + +;; Move point past whitespace. +(defun gud-jdb-skip-whitespace () + (skip-chars-forward " \n\r\t\014")) + +;; Move point past a "// " type of comment. +(defun gud-jdb-skip-single-line-comment () + (end-of-line)) + +;; Move point past a "/* */" or "/** */" type of comment. +(defun gud-jdb-skip-traditional-or-documentation-comment () + (forward-char 2) + (catch 'break + (while (not (eobp)) + (if (eq (following-char) ?*) + (progn + (forward-char) + (if (not (eobp)) + (if (eq (following-char) ?/) + (progn + (forward-char) + (throw 'break nil))))) + (forward-char))))) + +;; Move point past any number of consecutive whitespace chars and/or comments. +(defun gud-jdb-skip-whitespace-and-comments () + (gud-jdb-skip-whitespace) + (catch 'done + (while t + (cond + ((looking-at "//") + (gud-jdb-skip-single-line-comment) + (gud-jdb-skip-whitespace)) + ((looking-at "/\\*") + (gud-jdb-skip-traditional-or-documentation-comment) + (gud-jdb-skip-whitespace)) + (t (throw 'done nil)))))) + +;; Move point past things that are id-like. The intent is to skip regular +;; id's, such as class or interface names as well as package and interface +;; names. +(defun gud-jdb-skip-id-ish-thing () + (skip-chars-forward "^ /\n\r\t\014,;{")) + +;; Move point past a string literal. +(defun gud-jdb-skip-string-literal () + (forward-char) + (while (not (cond + ((eq (following-char) ?\\) + (forward-char)) + ((eq (following-char) ?\042)))) + (forward-char)) + (forward-char)) + +;; Move point past a character literal. +(defun gud-jdb-skip-character-literal () + (forward-char) + (while + (progn + (if (eq (following-char) ?\\) + (forward-char 2)) + (not (eq (following-char) ?\'))) + (forward-char)) + (forward-char)) + +;; Move point past the following block. There may be (legal) cruft before +;; the block's opening brace. There must be a block or it's the end of life +;; in petticoat junction. +(defun gud-jdb-skip-block () + + ;; Find the begining of the block. + (while + (not (eq (following-char) ?{)) + + ;; Skip any constructs that can harbor literal block delimiter + ;; characters and/or the delimiters for the constructs themselves. + (cond + ((looking-at "//") + (gud-jdb-skip-single-line-comment)) + ((looking-at "/\\*") + (gud-jdb-skip-traditional-or-documentation-comment)) + ((eq (following-char) ?\042) + (gud-jdb-skip-string-literal)) + ((eq (following-char) ?\') + (gud-jdb-skip-character-literal)) + (t (forward-char)))) + + ;; Now at the begining of the block. + (forward-char) + + ;; Skip over the body of the block as well as the final brace. + (let ((open-level 1)) + (while (not (eq open-level 0)) + (cond + ((looking-at "//") + (gud-jdb-skip-single-line-comment)) + ((looking-at "/\\*") + (gud-jdb-skip-traditional-or-documentation-comment)) + ((eq (following-char) ?\042) + (gud-jdb-skip-string-literal)) + ((eq (following-char) ?\') + (gud-jdb-skip-character-literal)) + ((eq (following-char) ?{) + (setq open-level (+ open-level 1)) + (forward-char)) + ((eq (following-char) ?}) + (setq open-level (- open-level 1)) + (forward-char)) + (t (forward-char)))))) + +;; Find the package and class definitions in Java source file FILE. Assumes +;; that FILE contains a legal Java program. BUF is a scratch buffer used +;; to hold the source during analysis. +(defun gud-jdb-analyze-source (buf file) + (let ((l nil)) + (set-buffer buf) + (insert-file-contents file nil nil nil t) + (goto-char 0) + (catch 'abort + (let ((p "")) + (while (progn + (gud-jdb-skip-whitespace) + (not (eobp))) + (cond + + ;; Any number of semi's following a block is legal. Move point + ;; past them. Note that comments and whitespace may be + ;; interspersed as well. + ((eq (following-char) ?\073) + (forward-char)) + + ;; Move point past a single line comment. + ((looking-at "//") + (gud-jdb-skip-single-line-comment)) + + ;; Move point past a traditional or documentation comment. + ((looking-at "/\\*") + (gud-jdb-skip-traditional-or-documentation-comment)) + + ;; Move point past a package statement, but save the PackageName. + ((looking-at "package") + (forward-char 7) + (gud-jdb-skip-whitespace-and-comments) + (let ((s (point))) + (gud-jdb-skip-id-ish-thing) + (setq p (concat (buffer-substring s (point)) ".")) + (gud-jdb-skip-whitespace-and-comments) + (if (eq (following-char) ?\073) + (forward-char)))) + + ;; Move point past an import statement. + ((looking-at "import") + (forward-char 6) + (gud-jdb-skip-whitespace-and-comments) + (gud-jdb-skip-id-ish-thing) + (gud-jdb-skip-whitespace-and-comments) + (if (eq (following-char) ?\073) + (forward-char))) + + ;; Move point past the various kinds of ClassModifiers. + ((looking-at "public") + (forward-char 6)) + ((looking-at "abstract") + (forward-char 8)) + ((looking-at "final") + (forward-char 5)) + + ;; Move point past a ClassDeclaraction, but save the class + ;; Identifier. + ((looking-at "class") + (forward-char 5) + (gud-jdb-skip-whitespace-and-comments) + (let ((s (point))) + (gud-jdb-skip-id-ish-thing) + (setq + l (nconc l (list (concat p (buffer-substring s (point))))))) + (gud-jdb-skip-block)) + + ;; Move point past an interface statement. + ((looking-at "interface") + (forward-char 9) + (gud-jdb-skip-block)) + + ;; Anything else means the input is invalid. + (t + (message "Error parsing file %s." file) + (throw 'abort nil)))))) + l)) + +(defun gud-jdb-build-class-source-alist-for-file (file) + (mapcar + (lambda (c) + (cons c file)) + (gud-jdb-analyze-source gud-jdb-analysis-buffer file))) + +;; Return an alist of fully qualified classes and the source files +;; holding their definitions. SOURCES holds a list of all the source +;; files to examine. +(defun gud-jdb-build-class-source-alist (sources) + (setq gud-jdb-analysis-buffer (get-buffer-create " *gud-jdb-scratch*")) + (prog1 + (apply + 'nconc + (mapcar + 'gud-jdb-build-class-source-alist-for-file + sources)) + (kill-buffer gud-jdb-analysis-buffer) + (setq gud-jdb-analysis-buffer nil))) + +;; Change what was given in the minibuffer to something that can be used to +;; invoke the debugger. +(defun gud-jdb-massage-args (file args) + ;; The jdb executable must have whitespace between "-classpath" and + ;; its value while gud-common-init expects all switch values to + ;; follow the switch keyword without intervening whitespace. We + ;; require that when the user enters the "-classpath" switch in the + ;; EMACS minibuffer that they do so without the intervening + ;; whitespace. This function adds it back (it's called after + ;; gud-common-init). There are more switches like this (for + ;; instance "-host" and "-password") but I don't care about them + ;; yet. + (if args + (let (massaged-args user-error) + + (while (and args (not user-error)) + (cond + ((setq user-error (string-match "-classpath$" (car args)))) + ((setq user-error (string-match "-sourcepath$" (car args)))) + ((string-match "-classpath\\(.+\\)" (car args)) + (setq massaged-args + (append massaged-args + (list "-classpath" + (setq gud-jdb-classpath-string + (match-string 1 (car args))))))) + ((string-match "-sourcepath\\(.+\\)" (car args)) + (setq massaged-args + (append massaged-args + (list "-sourcepath" + (setq gud-jdb-sourcepath + (match-string 1 (car args))))))) + (t (setq massaged-args (append massaged-args (list (car args)))))) + (setq args (cdr args))) + + ;; By this point the current directory is all screwed up. Maybe we + ;; could fix things and re-invoke gud-common-init, but for now I think + ;; issueing the error is good enough. + (if user-error + (progn + (kill-buffer (current-buffer)) + (error "Error: Omit whitespace between '-classpath or -sourcepath' and its value"))) + massaged-args))) + +;; Search for an association with P, a fully qualified class name, in +;; gud-jdb-class-source-alist. The asssociation gives the fully +;; qualified file name of the source file which produced the class. +(defun gud-jdb-find-source-file (p) + (cdr (assoc p gud-jdb-class-source-alist))) + +;; Note: Reset to this value every time a prompt is seen +(defvar gud-jdb-lowest-stack-level 999) + +(defun gud-jdb-find-source-using-classpath (p) + "Find source file corresponding to fully qualified class P. +Convert P from jdb's output, converted to a pathname +relative to a classpath directory." + (save-match-data + (let + (;; Replace dots with slashes and append ".java" to generate file + ;; name relative to classpath + (filename + (concat + (mapconcat 'identity + (split-string + ;; Eliminate any subclass references in the class + ;; name string. These start with a "$" + ((lambda (x) + (if (string-match "$.*" x) + (replace-match "" t t x) p)) + p) + "\\.") "/") + ".java")) + (cplist (append gud-jdb-sourcepath gud-jdb-classpath)) + found-file) + (while (and cplist + (not (setq found-file + (file-readable-p + (concat (car cplist) "/" filename))))) + (setq cplist (cdr cplist))) + (if found-file (concat (car cplist) "/" filename))))) + +(defun gud-jdb-find-source (string) + "Alias for function used to locate source files. +Set to `gud-jdb-find-source-using-classpath' or `gud-jdb-find-source-file' +during jdb initialization depending on the value of +`gud-jdb-use-classpath'." + nil) + +(defun gud-jdb-parse-classpath-string (string) + "Parse the classpath list and convert each item to an absolute pathname." + (mapcar (lambda (s) (if (string-match "[/\\]$" s) + (replace-match "" nil nil s) s)) + (mapcar 'file-truename + (split-string + string + (concat "[ \t\n\r,\"" path-separator "]+"))))) + +;; See comentary for other debugger's marker filters - there you will find +;; important notes about STRING. +(defun gud-jdb-marker-filter (string) + + ;; Build up the accumulator. + (setq gud-marker-acc + (if gud-marker-acc + (concat gud-marker-acc string) + string)) + + ;; Look for classpath information until gud-jdb-classpath-string is found + ;; (interactive, multiple settings of classpath from jdb + ;; not supported/followed) + (if (and gud-jdb-use-classpath + (not gud-jdb-classpath-string) + (or (string-match "classpath:[ \t[]+\\([^]]+\\)" gud-marker-acc) + (string-match "-classpath[ \t\"]+\\([^ \"]+\\)" gud-marker-acc))) + (setq gud-jdb-classpath + (gud-jdb-parse-classpath-string + (setq gud-jdb-classpath-string + (match-string 1 gud-marker-acc))))) + + ;; We process STRING from left to right. Each time through the + ;; following loop we process at most one marker. After we've found a + ;; marker, delete gud-marker-acc up to and including the match + (let (file-found) + ;; Process each complete marker in the input. + (while + + ;; Do we see a marker? + (string-match + ;; jdb puts out a string of the following form when it + ;; hits a breakpoint: + ;; + ;; (:) + ;; + ;; 's are composed of Java ID's + ;; separated by periods. and are + ;; also Java ID's. begins with a period and + ;; may contain less-than and greater-than (constructors, + ;; for instance, are called in the symbol table.) + ;; Java ID's begin with a letter followed by letters + ;; and/or digits. The set of letters includes underscore + ;; and dollar sign. + ;; + ;; The first group matches , + ;; the second group matches and the third group + ;; matches . We don't care about using + ;; so we don't "group" it. + ;; + ;; FIXME: Java ID's are UNICODE strings, this matches ASCII + ;; ID's only. + ;; + ;; The ".," in the last square-bracket are necessary because + ;; of Sun's total disrespect for backwards compatibility in + ;; reported line numbers from jdb - starting in 1.4.0 they + ;; print line numbers using LOCALE, inserting a comma or a + ;; period at the thousands positions (how ingenious!). + + "\\(\\[[0-9]+] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \ +\\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9.,]+\\)" + gud-marker-acc) + + ;; A good marker is one that: + ;; 1) does not have a "[n] " prefix (not part of a stack backtrace) + ;; 2) does have an "[n] " prefix and n is the lowest prefix seen + ;; since the last prompt + ;; Figure out the line on which to position the debugging arrow. + ;; Return the info as a cons of the form: + ;; + ;; ( . ) . + (if (if (match-beginning 1) + (let (n) + (setq n (string-to-number (substring + gud-marker-acc + (1+ (match-beginning 1)) + (- (match-end 1) 2)))) + (if (< n gud-jdb-lowest-stack-level) + (progn (setq gud-jdb-lowest-stack-level n) t))) + t) + (if (setq file-found + (gud-jdb-find-source (match-string 2 gud-marker-acc))) + (setq gud-last-frame + (cons file-found + (string-to-number + (let + ((numstr (match-string 4 gud-marker-acc))) + (if (string-match "[.,]" numstr) + (replace-match "" nil nil numstr) + numstr))))) + (message "Could not find source file."))) + + ;; Set the accumulator to the remaining text. + (setq gud-marker-acc (substring gud-marker-acc (match-end 0)))) + + (if (string-match comint-prompt-regexp gud-marker-acc) + (setq gud-jdb-lowest-stack-level 999))) + + ;; Do not allow gud-marker-acc to grow without bound. If the source + ;; file information is not within the last 3/4 + ;; gud-marker-acc-max-length characters, well,... + (if (> (length gud-marker-acc) gud-marker-acc-max-length) + (setq gud-marker-acc + (substring gud-marker-acc + (- (/ (* gud-marker-acc-max-length 3) 4))))) + + ;; We don't filter any debugger output so just return what we were given. + string) + +(defvar gud-jdb-command-name "jdb" "Command that executes the Java debugger.") + +;;;###autoload +(defun jdb (command-line) + "Run jdb with command line COMMAND-LINE in a buffer. +The buffer is named \"*gud*\" if no initial class is given or +\"*gud-*\" if there is. If the \"-classpath\" +switch is given, omit all whitespace between it and its value. + +See `gud-jdb-use-classpath' and `gud-jdb-classpath' documentation for +information on how jdb accesses source files. Alternatively (if +`gud-jdb-use-classpath' is nil), see `gud-jdb-directories' for the +original source file access method. + +For general information about commands available to control jdb from +gud, see `gud-mode'." + (interactive + (list (gud-query-cmdline 'jdb))) + (setq gud-jdb-classpath nil) + (setq gud-jdb-sourcepath nil) + + ;; Set gud-jdb-classpath from the CLASSPATH environment variable, + ;; if CLASSPATH is set. + (setq gud-jdb-classpath-string (getenv "CLASSPATH")) + (if gud-jdb-classpath-string + (setq gud-jdb-classpath + (gud-jdb-parse-classpath-string gud-jdb-classpath-string))) + (setq gud-jdb-classpath-string nil) ; prepare for next + + (gud-common-init command-line 'gud-jdb-massage-args + 'gud-jdb-marker-filter) + (set (make-local-variable 'gud-minor-mode) 'jdb) + + ;; If a -classpath option was provided, set gud-jdb-classpath + (if gud-jdb-classpath-string + (setq gud-jdb-classpath + (gud-jdb-parse-classpath-string gud-jdb-classpath-string))) + (setq gud-jdb-classpath-string nil) ; prepare for next + ;; If a -sourcepath option was provided, parse it + (if gud-jdb-sourcepath + (setq gud-jdb-sourcepath + (gud-jdb-parse-classpath-string gud-jdb-sourcepath))) + + (gud-def gud-break "stop at %c:%l" "\C-b" "Set breakpoint at current line.") + (gud-def gud-remove "clear %c:%l" "\C-d" "Remove breakpoint at current line") + (gud-def gud-step "step" "\C-s" "Step one source line with display.") + (gud-def gud-next "next" "\C-n" "Step one line (skip functions).") + (gud-def gud-cont "cont" "\C-r" "Continue with display.") + (gud-def gud-finish "step up" "\C-f" "Continue until current method returns.") + (gud-def gud-up "up\C-Mwhere" "<" "Up one stack frame.") + (gud-def gud-down "down\C-Mwhere" ">" "Up one stack frame.") + (gud-def gud-run "run" nil "Run the program.") ;if VM start using jdb + (gud-def gud-print "print %e" "\C-p" "Evaluate Java expression at point.") + + + (setq comint-prompt-regexp "^> \\|^[^ ]+\\[[0-9]+\\] ") + (setq paragraph-start comint-prompt-regexp) + (run-hooks 'jdb-mode-hook) + + (if gud-jdb-use-classpath + ;; Get the classpath information from the debugger + (progn + (if (string-match "-attach" command-line) + (gud-call "classpath")) + (fset 'gud-jdb-find-source + 'gud-jdb-find-source-using-classpath)) + + ;; Else create and bind the class/source association list as well + ;; as the source file list. + (setq gud-jdb-class-source-alist + (gud-jdb-build-class-source-alist + (setq gud-jdb-source-files + (gud-jdb-build-source-files-list gud-jdb-directories + "\\.java$")))) + (fset 'gud-jdb-find-source 'gud-jdb-find-source-file))) + +;; +;; End of debugger-specific information +;; + + +;; When we send a command to the debugger via gud-call, it's annoying +;; to see the command and the new prompt inserted into the debugger's +;; buffer; we have other ways of knowing the command has completed. +;; +;; If the buffer looks like this: +;; -------------------- +;; (gdb) set args foo bar +;; (gdb) -!- +;; -------------------- +;; (the -!- marks the location of point), and we type `C-x SPC' in a +;; source file to set a breakpoint, we want the buffer to end up like +;; this: +;; -------------------- +;; (gdb) set args foo bar +;; Breakpoint 1 at 0x92: file make-docfile.c, line 49. +;; (gdb) -!- +;; -------------------- +;; Essentially, the old prompt is deleted, and the command's output +;; and the new prompt take its place. +;; +;; Not echoing the command is easy enough; you send it directly using +;; process-send-string, and it never enters the buffer. However, +;; getting rid of the old prompt is trickier; you don't want to do it +;; when you send the command, since that will result in an annoying +;; flicker as the prompt is deleted, redisplay occurs while Emacs +;; waits for a response from the debugger, and the new prompt is +;; inserted. Instead, we'll wait until we actually get some output +;; from the subprocess before we delete the prompt. If the command +;; produced no output other than a new prompt, that prompt will most +;; likely be in the first chunk of output received, so we will delete +;; the prompt and then replace it with an identical one. If the +;; command produces output, the prompt is moving anyway, so the +;; flicker won't be annoying. +;; +;; So - when we want to delete the prompt upon receipt of the next +;; chunk of debugger output, we position gud-delete-prompt-marker at +;; the start of the prompt; the process filter will notice this, and +;; delete all text between it and the process output marker. If +;; gud-delete-prompt-marker points nowhere, we leave the current +;; prompt alone. +(defvar gud-delete-prompt-marker nil) + + +(put 'gud-mode 'mode-class 'special) + +(define-derived-mode gud-mode comint-mode "Debugger" + "Major mode for interacting with an inferior debugger process. + + You start it up with one of the commands M-x gdb, M-x sdb, M-x dbx, +M-x perldb, M-x xdb, M-x jdb, or M-x lldb. Each entry point finishes by +executing a hook; `gdb-mode-hook', `sdb-mode-hook', `dbx-mode-hook', +`perldb-mode-hook', `xdb-mode-hook', `jdb-mode-hook', or `lldb-mode-hook' +respectively. + +After startup, the following commands are available in both the GUD +interaction buffer and any source buffer GUD visits due to a breakpoint stop +or step operation: + +\\[gud-break] sets a breakpoint at the current file and line. In the +GUD buffer, the current file and line are those of the last breakpoint or +step. In a source buffer, they are the buffer's file and current line. + +\\[gud-remove] removes breakpoints on the current file and line. + +\\[gud-refresh] displays in the source window the last line referred to +in the gud buffer. + +\\[gud-step], \\[gud-next], and \\[gud-stepi] do a step-one-line, +step-one-line (not entering function calls), and step-one-instruction +and then update the source window with the current file and position. +\\[gud-cont] continues execution. + +\\[gud-print] tries to find the largest C lvalue or function-call expression +around point, and sends it to the debugger for value display. + +The above commands are common to all supported debuggers except xdb which +does not support stepping instructions. + +Under gdb, sdb and xdb, \\[gud-tbreak] behaves exactly like \\[gud-break], +except that the breakpoint is temporary; that is, it is removed when +execution stops on it. + +Under gdb, dbx, xdb, and lldb, \\[gud-up] pops up through an enclosing stack +frame. \\[gud-down] drops back down through one. + +If you are using gdb or xdb, \\[gud-finish] runs execution to the return from +the current function and stops. + +All the keystrokes above are accessible in the GUD buffer +with the prefix C-c, and in all buffers through the prefix C-x C-a. + +All pre-defined functions for which the concept make sense repeat +themselves the appropriate number of times if you give a prefix +argument. + +You may use the `gud-def' macro in the initialization hook to define other +commands. + +Other commands for interacting with the debugger process are inherited from +comint mode, which see." + (setq mode-line-process '(":%s")) + (define-key (current-local-map) "\C-c\C-l" 'gud-refresh) + (set (make-local-variable 'gud-last-frame) nil) + (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) + (make-local-variable 'comint-prompt-regexp) + ;; Don't put repeated commands in command history many times. + (set (make-local-variable 'comint-input-ignoredups) t) + (make-local-variable 'paragraph-start) + (set (make-local-variable 'gud-delete-prompt-marker) (make-marker)) + (add-hook 'kill-buffer-hook 'gud-kill-buffer-hook nil t)) + +;; Cause our buffers to be displayed, by default, +;; in the selected window. +;;;###autoload (add-hook 'same-window-regexps "\\*gud-.*\\*\\(\\|<[0-9]+>\\)") + +(defcustom gud-chdir-before-run t + "Non-nil if GUD should `cd' to the debugged executable." + :group 'gud + :type 'boolean) + +(defvar gud-target-name "--unknown--" + "The apparent name of the program being debugged in a gud buffer.") + +;; Perform initializations common to all debuggers. +;; The first arg is the specified command line, +;; which starts with the program to debug. +;; The other three args specify the values to use +;; for local variables in the debugger buffer. +(defun gud-common-init (command-line massage-args marker-filter + &optional find-file) + (let* ((words (split-string-and-unquote command-line)) + (program (car words)) + (dir default-directory) + ;; Extract the file name from WORDS + ;; and put t in its place. + ;; Later on we will put the modified file name arg back there. + (file-word (let ((w (cdr words))) + (while (and w (= ?- (aref (car w) 0))) + (setq w (cdr w))) + (and w + (prog1 (car w) + (setcar w t))))) + (file-subst + (and file-word (substitute-in-file-name file-word))) + (args (cdr words)) + ;; If a directory was specified, expand the file name. + ;; Otherwise, don't expand it, so GDB can use the PATH. + ;; A file name without directory is literally valid + ;; only if the file exists in ., and in that case, + ;; omitting the expansion here has no visible effect. + (file (and file-word + (if (file-name-directory file-subst) + (expand-file-name file-subst) + file-subst))) + (filepart (and file-word (concat "-" (file-name-nondirectory file)))) + (existing-buffer (get-buffer (concat "*gud" filepart "*")))) + (pop-to-buffer (concat "*gud" filepart "*")) + (when (and existing-buffer (get-buffer-process existing-buffer)) + (error "This program is already being debugged")) + ;; Set the dir, in case the buffer already existed with a different dir. + (setq default-directory dir) + ;; Set default-directory to the file's directory. + (and file-word + gud-chdir-before-run + ;; Don't set default-directory if no directory was specified. + ;; In that case, either the file is found in the current directory, + ;; in which case this setq is a no-op, + ;; or it is found by searching PATH, + ;; in which case we don't know what directory it was found in. + (file-name-directory file) + (setq default-directory (file-name-directory file))) + (or (bolp) (newline)) + (insert "Current directory is " default-directory "\n") + ;; Put the substituted and expanded file name back in its place. + (let ((w args)) + (while (and w (not (eq (car w) t))) + (setq w (cdr w))) + (if w + (setcar w file))) + (apply 'make-comint (concat "gud" filepart) program nil + (if massage-args (funcall massage-args file args) args)) + ;; Since comint clobbered the mode, we don't set it until now. + (gud-mode) + (set (make-local-variable 'gud-target-name) + (and file-word (file-name-nondirectory file)))) + (set (make-local-variable 'gud-marker-filter) marker-filter) + (if find-file (set (make-local-variable 'gud-find-file) find-file)) + (setq gud-last-last-frame nil) + + (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter) + (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel) + (gud-set-buffer)) + +(defun gud-set-buffer () + (when (eq major-mode 'gud-mode) + (setq gud-comint-buffer (current-buffer)))) + +(defvar gud-filter-defer-flag nil + "Non-nil means don't process anything from the debugger right now. +It is saved for when this flag is not set.") + +;; These functions are responsible for inserting output from your debugger +;; into the buffer. The hard work is done by the method that is +;; the value of gud-marker-filter. + +(defun gud-filter (proc string) + ;; Here's where the actual buffer insertion is done + (let (output process-window) + (if (buffer-name (process-buffer proc)) + (if gud-filter-defer-flag + ;; If we can't process any text now, + ;; save it for later. + (setq gud-filter-pending-text + (concat (or gud-filter-pending-text "") string)) + + ;; If we have to ask a question during the processing, + ;; defer any additional text that comes from the debugger + ;; during that time. + (let ((gud-filter-defer-flag t)) + ;; Process now any text we previously saved up. + (if gud-filter-pending-text + (setq string (concat gud-filter-pending-text string) + gud-filter-pending-text nil)) + + (with-current-buffer (process-buffer proc) + ;; If we have been so requested, delete the debugger prompt. + (save-restriction + (widen) + (if (marker-buffer gud-delete-prompt-marker) + (let ((inhibit-read-only t)) + (delete-region (process-mark proc) + gud-delete-prompt-marker) + (comint-update-fence) + (set-marker gud-delete-prompt-marker nil))) + ;; Save the process output, checking for source file markers. + (setq output (gud-marker-filter string)) + ;; Check for a filename-and-line number. + ;; Don't display the specified file + ;; unless (1) point is at or after the position where output appears + ;; and (2) this buffer is on the screen. + (setq process-window + (and gud-last-frame + (>= (point) (process-mark proc)) + (get-buffer-window (current-buffer))))) + + ;; Let the comint filter do the actual insertion. + ;; That lets us inherit various comint features. + (comint-output-filter proc output)) + + ;; Put the arrow on the source line. + ;; This must be outside of the save-excursion + ;; in case the source file is our current buffer. + (if process-window + (with-selected-window process-window + (gud-display-frame)) + ;; We have to be in the proper buffer, (process-buffer proc), + ;; but not in a save-excursion, because that would restore point. + (with-current-buffer (process-buffer proc) + (gud-display-frame)))) + + ;; If we deferred text that arrived during this processing, + ;; handle it now. + (if gud-filter-pending-text + (gud-filter proc "")))))) + +(defvar gud-minor-mode-type nil) +(defvar gud-overlay-arrow-position nil) +(add-to-list 'overlay-arrow-variable-list 'gud-overlay-arrow-position) + +(defun gud-sentinel (proc msg) + (cond ((null (buffer-name (process-buffer proc))) + ;; buffer killed + ;; Stop displaying an arrow in a source file. + (setq gud-overlay-arrow-position nil) + (set-process-buffer proc nil) + (if (and (boundp 'speedbar-frame) + (string-equal speedbar-initial-expansion-list-name "GUD")) + (speedbar-change-initial-expansion-list + speedbar-previously-used-expansion-list-name)) + (if (memq gud-minor-mode-type '(gdbmi gdba)) + (gdb-reset) + (gud-reset))) + ((memq (process-status proc) '(signal exit)) + ;; Stop displaying an arrow in a source file. + (setq gud-overlay-arrow-position nil) + (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdba gdbmi)) + (gdb-reset) + (gud-reset)) + (let* ((obuf (current-buffer))) + ;; save-excursion isn't the right thing if + ;; process-buffer is current-buffer + (unwind-protect + (progn + ;; Write something in the GUD buffer and hack its mode line, + (set-buffer (process-buffer proc)) + ;; Fix the mode line. + (setq mode-line-process + (concat ":" + (symbol-name (process-status proc)))) + (force-mode-line-update) + (if (eobp) + (insert ?\n mode-name " " msg) + (save-excursion + (goto-char (point-max)) + (insert ?\n mode-name " " msg))) + ;; If buffer and mode line will show that the process + ;; is dead, we can delete it now. Otherwise it + ;; will stay around until M-x list-processes. + (delete-process proc)) + ;; Restore old buffer, but don't restore old point + ;; if obuf is the gud buffer. + (set-buffer obuf)))))) + +(defun gud-kill-buffer-hook () + (setq gud-minor-mode-type gud-minor-mode) + (condition-case nil + (kill-process (get-buffer-process (current-buffer))) + (error nil))) + +(defun gud-reset () + (dolist (buffer (buffer-list)) + (unless (eq buffer gud-comint-buffer) + (with-current-buffer buffer + (when gud-minor-mode + (setq gud-minor-mode nil) + (kill-local-variable 'tool-bar-map)))))) + +(defun gud-display-frame () + "Find and obey the last filename-and-line marker from the debugger. +Obeying it means displaying in another window the specified file and line." + (interactive) + (when gud-last-frame + (gud-set-buffer) + (gud-display-line (car gud-last-frame) (cdr gud-last-frame)) + (setq gud-last-last-frame gud-last-frame + gud-last-frame nil))) + +;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen +;; and that its line LINE is visible. +;; Put the overlay-arrow on the line LINE in that buffer. +;; Most of the trickiness in here comes from wanting to preserve the current +;; region-restriction if that's possible. We use an explicit display-buffer +;; to get around the fact that this is called inside a save-excursion. + +(defun gud-display-line (true-file line) + (let* ((last-nonmenu-event t) ; Prevent use of dialog box for questions. + (buffer + (with-current-buffer gud-comint-buffer + (gud-find-file true-file))) + (window (and buffer + (or (get-buffer-window buffer) + (if (memq gud-minor-mode '(gdbmi gdba)) + (or (if (get-buffer-window buffer 0) + (display-buffer buffer nil 0)) + (unless (gdb-display-source-buffer buffer) + (gdb-display-buffer buffer nil)))) + (display-buffer buffer)))) + (pos)) + (if buffer + (progn + (with-current-buffer buffer + (unless (or (verify-visited-file-modtime buffer) gud-keep-buffer) + (if (yes-or-no-p + (format "File %s changed on disk. Reread from disk? " + (buffer-name))) + (revert-buffer t t) + (setq gud-keep-buffer t))) + (save-restriction + (widen) + (goto-line line) + (setq pos (point)) + (or gud-overlay-arrow-position + (setq gud-overlay-arrow-position (make-marker))) + (set-marker gud-overlay-arrow-position (point) (current-buffer)) + ;; If they turned on hl-line, move the hl-line highlight to + ;; the arrow's line. + (when (featurep 'hl-line) + (cond + (global-hl-line-mode + (global-hl-line-highlight)) + ((and hl-line-mode hl-line-sticky-flag) + (hl-line-highlight))))) + (cond ((or (< pos (point-min)) (> pos (point-max))) + (widen) + (goto-char pos)))) + (when window + (set-window-point window gud-overlay-arrow-position) + (if (memq gud-minor-mode '(gdbmi gdba)) + (setq gdb-source-window window))))))) + +;; The gud-call function must do the right thing whether its invoking +;; keystroke is from the GUD buffer itself (via major-mode binding) +;; or a C buffer. In the former case, we want to supply data from +;; gud-last-frame. Here's how we do it: + +(defun gud-format-command (str arg) + (let ((insource (not (eq (current-buffer) gud-comint-buffer))) + (frame (or gud-last-frame gud-last-last-frame)) + result) + (while (and str + (let ((case-fold-search nil)) + (string-match "\\([^%]*\\)%\\([abdefFlpc]\\)" str))) + (let ((key (string-to-char (match-string 2 str))) + subst) + (cond + ((eq key ?f) + (setq subst (file-name-nondirectory (if insource + (buffer-file-name) + (car frame))))) + ((eq key ?F) + (setq subst (file-name-sans-extension + (file-name-nondirectory (if insource + (buffer-file-name) + (car frame)))))) + ((eq key ?d) + (setq subst (file-name-directory (if insource + (buffer-file-name) + (car frame))))) + ((eq key ?l) + (setq subst (int-to-string + (if insource + (save-restriction + (widen) + (+ (count-lines (point-min) (point)) + (if (bolp) 1 0))) + (cdr frame))))) + ((eq key ?e) + (setq subst (gud-find-expr))) + ((eq key ?a) + (setq subst (gud-read-address))) + ((eq key ?b) + (setq subst gud-breakpoint-id)) + ((eq key ?c) + (setq subst + (gud-find-class + (if insource + (buffer-file-name) + (car frame)) + (if insource + (save-restriction + (widen) + (+ (count-lines (point-min) (point)) + (if (bolp) 1 0))) + (cdr frame))))) + ((eq key ?p) + (setq subst (if arg (int-to-string arg))))) + (setq result (concat result (match-string 1 str) subst))) + (setq str (substring str (match-end 2)))) + ;; There might be text left in STR when the loop ends. + (concat result str))) + +(defun gud-read-address () + "Return a string containing the core-address found in the buffer at point." + (save-match-data + (save-excursion + (let ((pt (point)) found begin) + (setq found (if (search-backward "0x" (- pt 7) t) (point))) + (cond + (found (forward-char 2) + (buffer-substring found + (progn (re-search-forward "[^0-9a-f]") + (forward-char -1) + (point)))) + (t (setq begin (progn (re-search-backward "[^0-9]") + (forward-char 1) + (point))) + (forward-char 1) + (re-search-forward "[^0-9]") + (forward-char -1) + (buffer-substring begin (point)))))))) + +(defun gud-call (fmt &optional arg) + (let ((msg (gud-format-command fmt arg))) + (message "Command: %s" msg) + (sit-for 0) + (gud-basic-call msg))) + +(defun gud-basic-call (command) + "Invoke the debugger COMMAND displaying source in other window." + (interactive) + (gud-set-buffer) + (let ((proc (get-buffer-process gud-comint-buffer))) + (or proc (error "Current buffer has no process")) + ;; Arrange for the current prompt to get deleted. + (save-excursion + (set-buffer gud-comint-buffer) + (save-restriction + (widen) + (if (marker-position gud-delete-prompt-marker) + ;; We get here when printing an expression. + (goto-char gud-delete-prompt-marker) + (goto-char (process-mark proc)) + (forward-line 0)) + (if (looking-at comint-prompt-regexp) + (set-marker gud-delete-prompt-marker (point))) + (if (memq gud-minor-mode '(gdbmi gdba)) + (apply comint-input-sender (list proc command)) + (process-send-string proc (concat command "\n"))))))) + +(defun gud-refresh (&optional arg) + "Fix up a possibly garbled display, and redraw the arrow." + (interactive "P") + (or gud-last-frame (setq gud-last-frame gud-last-last-frame)) + (gud-display-frame) + (recenter arg)) + +;; Code for parsing expressions out of C or Fortran code. The single entry +;; point is gud-find-expr, which tries to return an lvalue expression from +;; around point. + +(defvar gud-find-expr-function 'gud-find-c-expr) + +(defun gud-find-expr (&rest args) + (let ((expr (if (and transient-mark-mode mark-active) + (buffer-substring (region-beginning) (region-end)) + (apply gud-find-expr-function args)))) + (save-match-data + (if (string-match "\n" expr) + (error "Expression must not include a newline")) + (with-current-buffer gud-comint-buffer + (save-excursion + (goto-char (process-mark (get-buffer-process gud-comint-buffer))) + (forward-line 0) + (when (looking-at comint-prompt-regexp) + (set-marker gud-delete-prompt-marker (point)) + (set-marker-insertion-type gud-delete-prompt-marker t)) + (unless (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + 'jdb) + (insert (concat expr " = ")))))) + expr)) + +;; The next eight functions are hacked from gdbsrc.el by +;; Debby Ayers , +;; Rich Schaefer Schlumberger, Austin, Tx. + +(defun gud-find-c-expr () + "Returns the expr that surrounds point." + (interactive) + (save-excursion + (let ((p (point)) + (expr (gud-innermost-expr)) + (test-expr (gud-prev-expr))) + (while (and test-expr (gud-expr-compound test-expr expr)) + (let ((prev-expr expr)) + (setq expr (cons (car test-expr) (cdr expr))) + (goto-char (car expr)) + (setq test-expr (gud-prev-expr)) + ;; If we just pasted on the condition of an if or while, + ;; throw it away again. + (if (member (buffer-substring (car test-expr) (cdr test-expr)) + '("if" "while" "for")) + (setq test-expr nil + expr prev-expr)))) + (goto-char p) + (setq test-expr (gud-next-expr)) + (while (gud-expr-compound expr test-expr) + (setq expr (cons (car expr) (cdr test-expr))) + (setq test-expr (gud-next-expr))) + (buffer-substring (car expr) (cdr expr))))) + +(defun gud-innermost-expr () + "Returns the smallest expr that point is in; move point to beginning of it. +The expr is represented as a cons cell, where the car specifies the point in +the current buffer that marks the beginning of the expr and the cdr specifies +the character after the end of the expr." + (let ((p (point)) begin end) + (gud-backward-sexp) + (setq begin (point)) + (gud-forward-sexp) + (setq end (point)) + (if (>= p end) + (progn + (setq begin p) + (goto-char p) + (gud-forward-sexp) + (setq end (point))) + ) + (goto-char begin) + (cons begin end))) + +(defun gud-backward-sexp () + "Version of `backward-sexp' that catches errors." + (condition-case nil + (backward-sexp) + (error t))) + +(defun gud-forward-sexp () + "Version of `forward-sexp' that catches errors." + (condition-case nil + (forward-sexp) + (error t))) + +(defun gud-prev-expr () + "Returns the previous expr, point is set to beginning of that expr. +The expr is represented as a cons cell, where the car specifies the point in +the current buffer that marks the beginning of the expr and the cdr specifies +the character after the end of the expr" + (let ((begin) (end)) + (gud-backward-sexp) + (setq begin (point)) + (gud-forward-sexp) + (setq end (point)) + (goto-char begin) + (cons begin end))) + +(defun gud-next-expr () + "Returns the following expr, point is set to beginning of that expr. +The expr is represented as a cons cell, where the car specifies the point in +the current buffer that marks the beginning of the expr and the cdr specifies +the character after the end of the expr." + (let ((begin) (end)) + (gud-forward-sexp) + (gud-forward-sexp) + (setq end (point)) + (gud-backward-sexp) + (setq begin (point)) + (cons begin end))) + +(defun gud-expr-compound-sep (span-start span-end) + "Scan from SPAN-START to SPAN-END for punctuation characters. +If `->' is found, return `?.'. If `.' is found, return `?.'. +If any other punctuation is found, return `??'. +If no punctuation is found, return `? '." + (let ((result ?\s) + (syntax)) + (while (< span-start span-end) + (setq syntax (char-syntax (char-after span-start))) + (cond + ((= syntax ?\s) t) + ((= syntax ?.) (setq syntax (char-after span-start)) + (cond + ((= syntax ?.) (setq result ?.)) + ((and (= syntax ?-) (= (char-after (+ span-start 1)) ?>)) + (setq result ?.) + (setq span-start (+ span-start 1))) + (t (setq span-start span-end) + (setq result ??))))) + (setq span-start (+ span-start 1))) + result)) + +(defun gud-expr-compound (first second) + "Non-nil if concatenating FIRST and SECOND makes a single C expression. +The two exprs are represented as a cons cells, where the car +specifies the point in the current buffer that marks the beginning of the +expr and the cdr specifies the character after the end of the expr. +Link exprs of the form: + Expr -> Expr + Expr . Expr + Expr (Expr) + Expr [Expr] + (Expr) Expr + [Expr] Expr" + (let ((span-start (cdr first)) + (span-end (car second)) + (syntax)) + (setq syntax (gud-expr-compound-sep span-start span-end)) + (cond + ((= (car first) (car second)) nil) + ((= (cdr first) (cdr second)) nil) + ((= syntax ?.) t) + ((= syntax ?\s) + (setq span-start (char-after (- span-start 1))) + (setq span-end (char-after span-end)) + (cond + ((= span-start ?)) t) + ((= span-start ?]) t) + ((= span-end ?() t) + ((= span-end ?[) t) + (t nil))) + (t nil)))) + +(defun gud-find-class (f line) + "Find fully qualified class in file F at line LINE. +This function uses the `gud-jdb-classpath' (and optional +`gud-jdb-sourcepath') list(s) to derive a file +pathname relative to its classpath directory. The values in +`gud-jdb-classpath' are assumed to have been converted to absolute +pathname standards using file-truename. +If F is visited by a buffer and its mode is CC-mode(Java), +syntactic information of LINE is used to find the enclosing (nested) +class string which is appended to the top level +class of the file (using s to separate nested class ids)." + ;; Convert f to a standard representation and remove suffix + (if (and gud-jdb-use-classpath (or gud-jdb-classpath gud-jdb-sourcepath)) + (save-match-data + (let ((cplist (append gud-jdb-sourcepath gud-jdb-classpath)) + (fbuffer (get-file-buffer f)) + syntax-symbol syntax-point class-found) + (setq f (file-name-sans-extension (file-truename f))) + ;; Syntax-symbol returns the symbol of the *first* element + ;; in the syntactical analysis result list, syntax-point + ;; returns the buffer position of same + (fset 'syntax-symbol (lambda (x) (c-langelem-sym (car x)))) + (fset 'syntax-point (lambda (x) (c-langelem-pos (car x)))) + ;; Search through classpath list for an entry that is + ;; contained in f + (while (and cplist (not class-found)) + (if (string-match (car cplist) f) + (setq class-found + (mapconcat 'identity + (split-string + (substring f (+ (match-end 0) 1)) + "/") "."))) + (setq cplist (cdr cplist))) + ;; if f is visited by a java(cc-mode) buffer, walk up the + ;; syntactic information chain and collect any 'inclass + ;; symbols until 'topmost-intro is reached to find out if + ;; point is within a nested class + (if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode")) + (save-excursion + (set-buffer fbuffer) + (let ((nclass) (syntax)) + ;; While the c-syntactic information does not start + ;; with the 'topmost-intro symbol, there may be + ;; nested classes... + (while (not (eq 'topmost-intro + (syntax-symbol (c-guess-basic-syntax)))) + ;; Check if the current position c-syntactic + ;; analysis has 'inclass + (setq syntax (c-guess-basic-syntax)) + (while + (and (not (eq 'inclass (syntax-symbol syntax))) + (cdr syntax)) + (setq syntax (cdr syntax))) + (if (eq 'inclass (syntax-symbol syntax)) + (progn + (goto-char (syntax-point syntax)) + ;; Now we're at the beginning of a class + ;; definition. Find class name + (looking-at + "[A-Za-z0-9 \t\n]*?class[ \t\n]+\\([^ \t\n]+\\)") + (setq nclass + (append (list (match-string-no-properties 1)) + nclass))) + (setq syntax (c-guess-basic-syntax)) + (while (and (not (syntax-point syntax)) (cdr syntax)) + (setq syntax (cdr syntax))) + (goto-char (syntax-point syntax)) + )) + (string-match (concat (car nclass) "$") class-found) + (setq class-found + (replace-match (mapconcat 'identity nclass "$") + t t class-found))))) + (if (not class-found) + (message "gud-find-class: class for file %s not found!" f)) + class-found)) + ;; Not using classpath - try class/source association list + (let ((class-found (rassoc f gud-jdb-class-source-alist))) + (if class-found + (car class-found) + (message "gud-find-class: class for file %s not found in gud-jdb-class-source-alist!" f) + nil)))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; GDB script mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defvar gdb-script-mode-syntax-table + (let ((st (make-syntax-table))) + (modify-syntax-entry ?' "\"" st) + (modify-syntax-entry ?# "<" st) + (modify-syntax-entry ?\n ">" st) + st)) + +(defvar gdb-script-font-lock-keywords + '(("^define\\s-+\\(\\(\\w\\|\\s_\\)+\\)" (1 font-lock-function-name-face)) + ("\\$\\(\\w+\\)" (1 font-lock-variable-name-face)) + ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face)))) + +(defvar gdb-script-font-lock-syntactic-keywords + '(("^document\\s-.*\\(\n\\)" (1 "< b")) + ("^end\\>" + (0 (unless (eq (match-beginning 0) (point-min)) + ;; We change the \n in front, which is more difficult, but results + ;; in better highlighting. If the doc is empty, the single \n is + ;; both the beginning and the end of the docstring, which can't be + ;; expressed in syntax-tables. Instead, we place the "> b" after + ;; placing the "< b", so the start marker is overwritten by the + ;; termination marker and in the end Emacs simply considers that + ;; there's no docstring at all, which is fine. + (put-text-property (1- (match-beginning 0)) (match-beginning 0) + 'syntax-table (eval-when-compile + (string-to-syntax "> b"))) + ;; Make sure that rehighlighting the previous line won't erase our + ;; syntax-table property. + (put-text-property (1- (match-beginning 0)) (match-end 0) + 'font-lock-multiline t) + nil))))) + +(defun gdb-script-font-lock-syntactic-face (state) + (cond + ((nth 3 state) font-lock-string-face) + ((nth 7 state) font-lock-doc-face) + (t font-lock-comment-face))) + +(defvar gdb-script-basic-indent 2) + +(defun gdb-script-skip-to-head () + "We're just in front of an `end' and we need to go to its head." + (while (and (re-search-backward "^\\s-*\\(\\(end\\)\\|define\\|document\\|if\\|while\\|commands\\)\\>" nil 'move) + (match-end 2)) + (gdb-script-skip-to-head))) + +(defun gdb-script-calculate-indentation () + (cond + ((looking-at "end\\>") + (gdb-script-skip-to-head) + (current-indentation)) + ((looking-at "else\\>") + (while (and (re-search-backward "^\\s-*\\(if\\|\\(end\\)\\)\\>" nil 'move) + (match-end 2)) + (gdb-script-skip-to-head)) + (current-indentation)) + (t + (forward-comment (- (point-max))) + (forward-line 0) + (skip-chars-forward " \t") + (+ (current-indentation) + (if (looking-at "\\(if\\|while\\|define\\|else\\|commands\\)\\>") + gdb-script-basic-indent 0))))) + +(defun gdb-script-indent-line () + "Indent current line of GDB script." + (interactive) + (if (and (eq (get-text-property (point) 'face) font-lock-doc-face) + (save-excursion + (forward-line 0) + (skip-chars-forward " \t") + (not (looking-at "end\\>")))) + 'noindent + (let* ((savep (point)) + (indent (condition-case nil + (save-excursion + (forward-line 0) + (skip-chars-forward " \t") + (if (>= (point) savep) (setq savep nil)) + (max (gdb-script-calculate-indentation) 0)) + (error 0)))) + (if savep + (save-excursion (indent-line-to indent)) + (indent-line-to indent))))) + +;; Derived from cfengine.el. +(defun gdb-script-beginning-of-defun () + "`beginning-of-defun' function for Gdb script mode. +Treats actions as defuns." + (unless (<= (current-column) (current-indentation)) + (end-of-line)) + (if (re-search-backward "^define \\|^document " nil t) + (beginning-of-line) + (goto-char (point-min))) + t) + +;; Derived from cfengine.el. +(defun gdb-script-end-of-defun () + "`end-of-defun' function for Gdb script mode. +Treats actions as defuns." + (end-of-line) + (if (re-search-forward "^end" nil t) + (beginning-of-line) + (goto-char (point-max))) + t) + +;; Besides .gdbinit, gdb documents other names to be usable for init +;; files, cross-debuggers can use something like +;; .PROCESSORNAME-gdbinit so that the host and target gdbinit files +;; don't interfere with each other. +;;;###autoload +(add-to-list 'auto-mode-alist '("/\\.[a-z0-9-]*gdbinit" . gdb-script-mode)) + +;;;###autoload +(define-derived-mode gdb-script-mode nil "GDB-Script" + "Major mode for editing GDB scripts." + (set (make-local-variable 'comment-start) "#") + (set (make-local-variable 'comment-start-skip) "#+\\s-*") + (set (make-local-variable 'outline-regexp) "[ \t]") + (set (make-local-variable 'imenu-generic-expression) + '((nil "^define[ \t]+\\(\\w+\\)" 1))) + (set (make-local-variable 'indent-line-function) 'gdb-script-indent-line) + (set (make-local-variable 'beginning-of-defun-function) + #'gdb-script-beginning-of-defun) + (set (make-local-variable 'end-of-defun-function) + #'gdb-script-end-of-defun) + (set (make-local-variable 'font-lock-defaults) + '(gdb-script-font-lock-keywords nil nil ((?_ . "w")) nil + (font-lock-syntactic-keywords + . gdb-script-font-lock-syntactic-keywords) + (font-lock-syntactic-face-function + . gdb-script-font-lock-syntactic-face)))) + + +;;; tooltips for GUD + +;;; Customizable settings + +(define-minor-mode gud-tooltip-mode + "Toggle the display of GUD tooltips." + :global t + :group 'gud + :group 'tooltip + (require 'tooltip) + (if gud-tooltip-mode + (progn + (add-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode) + (add-hook 'pre-command-hook 'tooltip-hide) + (add-hook 'tooltip-hook 'gud-tooltip-tips) + (define-key global-map [mouse-movement] 'gud-tooltip-mouse-motion)) + (unless tooltip-mode (remove-hook 'pre-command-hook 'tooltip-hide) + (remove-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode) + (remove-hook 'tooltip-hook 'gud-tooltip-tips) + (define-key global-map [mouse-movement] 'ignore))) + (gud-tooltip-activate-mouse-motions-if-enabled) + (if (and gud-comint-buffer + (buffer-name gud-comint-buffer); gud-comint-buffer might be killed + (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) + '(gdbmi gdba))) + (if gud-tooltip-mode + (progn + (dolist (buffer (buffer-list)) + (unless (eq buffer gud-comint-buffer) + (with-current-buffer buffer + (when (and (memq gud-minor-mode '(gdbmi gdba)) + (not (string-match "\\`\\*.+\\*\\'" + (buffer-name)))) + (make-local-variable 'gdb-define-alist) + (gdb-create-define-alist) + (add-hook 'after-save-hook + 'gdb-create-define-alist nil t)))))) + (kill-local-variable 'gdb-define-alist) + (remove-hook 'after-save-hook 'gdb-create-define-alist t)))) + +(defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode + python-mode) + "List of modes for which to enable GUD tooltips." + :type 'sexp + :group 'gud + :group 'tooltip) + +(defcustom gud-tooltip-display + '((eq (tooltip-event-buffer gud-tooltip-event) + (marker-buffer gud-overlay-arrow-position))) + "List of forms determining where GUD tooltips are displayed. + +Forms in the list are combined with AND. The default is to display +only tooltips in the buffer containing the overlay arrow." + :type 'sexp + :group 'gud + :group 'tooltip) + +(defcustom gud-tooltip-echo-area nil + "Use the echo area instead of frames for GUD tooltips." + :type 'boolean + :group 'gud + :group 'tooltip) + +(define-obsolete-variable-alias 'tooltip-gud-modes + 'gud-tooltip-modes "22.1") +(define-obsolete-variable-alias 'tooltip-gud-display + 'gud-tooltip-display "22.1") + +;;; Reacting on mouse movements + +(defun gud-tooltip-change-major-mode () + "Function added to `change-major-mode-hook' when tooltip mode is on." + (add-hook 'post-command-hook 'gud-tooltip-activate-mouse-motions-if-enabled)) + +(defun gud-tooltip-activate-mouse-motions-if-enabled () + "Reconsider for all buffers whether mouse motion events are desired." + (remove-hook 'post-command-hook + 'gud-tooltip-activate-mouse-motions-if-enabled) + (dolist (buffer (buffer-list)) + (save-excursion + (set-buffer buffer) + (if (and gud-tooltip-mode + (memq major-mode gud-tooltip-modes)) + (gud-tooltip-activate-mouse-motions t) + (gud-tooltip-activate-mouse-motions nil))))) + +(defvar gud-tooltip-mouse-motions-active nil + "Locally t in a buffer if tooltip processing of mouse motion is enabled.") + +;; We don't set track-mouse globally because this is a big redisplay +;; problem in buffers having a pre-command-hook or such installed, +;; which does a set-buffer, like the summary buffer of Gnus. Calling +;; set-buffer prevents redisplay optimizations, so every mouse motion +;; would be accompanied by a full redisplay. + +(defun gud-tooltip-activate-mouse-motions (activatep) + "Activate/deactivate mouse motion events for the current buffer. +ACTIVATEP non-nil means activate mouse motion events." + (if activatep + (progn + (make-local-variable 'gud-tooltip-mouse-motions-active) + (setq gud-tooltip-mouse-motions-active t) + (make-local-variable 'track-mouse) + (setq track-mouse t)) + (when gud-tooltip-mouse-motions-active + (kill-local-variable 'gud-tooltip-mouse-motions-active) + (kill-local-variable 'track-mouse)))) + +(defun gud-tooltip-mouse-motion (event) + "Command handler for mouse movement events in `global-map'." + (interactive "e") + (tooltip-hide) + (when (car (mouse-pixel-position)) + (setq tooltip-last-mouse-motion-event (copy-sequence event)) + (tooltip-start-delayed-tip))) + +;;; Tips for `gud' + +(defvar gud-tooltip-original-filter nil + "Process filter to restore after GUD output has been received.") + +(defvar gud-tooltip-dereference nil + "Non-nil means print expressions with a `*' in front of them. +For C this would dereference a pointer expression.") + +(defvar gud-tooltip-event nil + "The mouse movement event that led to a tooltip display. +This event can be examined by forms in `gud-tooltip-display'.") + +(defun gud-tooltip-dereference (&optional arg) + "Toggle whether tooltips should show `* expr' or `expr'. +With arg, dereference expr if ARG is positive, otherwise do not derereference." + (interactive "P") + (setq gud-tooltip-dereference + (if (null arg) + (not gud-tooltip-dereference) + (> (prefix-numeric-value arg) 0))) + (message "Dereferencing is now %s." + (if gud-tooltip-dereference "on" "off"))) + +(define-obsolete-function-alias 'tooltip-gud-toggle-dereference + 'gud-tooltip-dereference "22.1") + +; This will only display data that comes in one chunk. +; Larger arrays (say 400 elements) are displayed in +; the tooltip incompletely and spill over into the gud buffer. +; Switching the process-filter creates timing problems and +; it may be difficult to do better. Using annotations as in +; gdb-ui.el gets round this problem. +(defun gud-tooltip-process-output (process output) + "Process debugger output and show it in a tooltip window." + (set-process-filter process gud-tooltip-original-filter) + (tooltip-show (tooltip-strip-prompt process output) + (or gud-tooltip-echo-area tooltip-use-echo-area))) + +(defun gud-tooltip-print-command (expr) + "Return a suitable command to print the expression EXPR." + (case gud-minor-mode + ; '-o' to print the objc object description if available + (lldb (concat "expression -o -- " expr)) + (gdba (concat "server print " expr)) + ((dbx gdbmi) (concat "print " expr)) + ((xdb pdb) (concat "p " expr)) + (sdb (concat expr "/")))) + +(defun gud-tooltip-tips (event) + "Show tip for identifier or selection under the mouse. +The mouse must either point at an identifier or inside a selected +region for the tip window to be shown. If `gud-tooltip-dereference' is t, +add a `*' in front of the printed expression. In the case of a C program +controlled by GDB, show the associated #define directives when program is +not executing. + +This function must return nil if it doesn't handle EVENT." + (let (process) + (when (and (eventp event) + gud-tooltip-mode + gud-comint-buffer + (buffer-name gud-comint-buffer); might be killed + (setq process (get-buffer-process gud-comint-buffer)) + (posn-point (event-end event)) + (or (and (eq gud-minor-mode 'gdba) (not gdb-active-process)) + (progn (setq gud-tooltip-event event) + (eval (cons 'and gud-tooltip-display))))) + (let ((expr (tooltip-expr-to-print event))) + (when expr + (if (and (eq gud-minor-mode 'gdba) + (not gdb-active-process)) + (progn + (with-current-buffer (tooltip-event-buffer event) + (let ((define-elt (assoc expr gdb-define-alist))) + (unless (null define-elt) + (tooltip-show + (cdr define-elt) + (or gud-tooltip-echo-area tooltip-use-echo-area)) + expr)))) + (when gud-tooltip-dereference + (setq expr (concat "*" expr))) + (let ((cmd (gud-tooltip-print-command expr))) + (when (and gud-tooltip-mode (eq gud-minor-mode 'gdb)) + (gud-tooltip-mode -1) + (message-box "Using GUD tooltips in this mode is unsafe\n\ +so they have been disabled.")) + (unless (null cmd) ; CMD can be nil if unknown debugger + (if (memq gud-minor-mode '(gdba gdbmi)) + (if gdb-macro-info + (gdb-enqueue-input + (list (concat + gdb-server-prefix "macro expand " expr "\n") + `(lambda () (gdb-tooltip-print-1 ,expr)))) + (gdb-enqueue-input + (list (concat cmd "\n") + `(lambda () (gdb-tooltip-print ,expr))))) + (setq gud-tooltip-original-filter (process-filter process)) + (set-process-filter process 'gud-tooltip-process-output) + (gud-basic-call cmd)) + expr)))))))) + +(provide 'gud) + +;;; arch-tag: 6d990948-df65-461a-be39-1c7fb83ac4c4 +;;; gud.el ends here From scallanan at apple.com Fri Oct 29 20:46:19 2010 From: scallanan at apple.com (Sean Callanan) Date: Sat, 30 Oct 2010 01:46:19 -0000 Subject: [Lldb-commits] [lldb] r117767 - /lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp Message-ID: <20101030014619.8DD6F2A6C12C@llvm.org> Author: spyffe Date: Fri Oct 29 20:46:19 2010 New Revision: 117767 URL: http://llvm.org/viewvc/llvm-project?rev=117767&view=rev Log: Using proper Objective-C types doesn't seem to make the sky fall. Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp?rev=117767&r1=117766&r2=117767&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntimeV2/AppleObjCRuntimeV2.cpp Fri Oct 29 20:46:19 2010 @@ -87,15 +87,6 @@ str.Printf ("Value doesn't point to an ObjC object.\n"); return false; } - // FIXME: If we use the real types here then we end up crashing in the expression parser. - // For now, forcing this to be a generic pointer makes it work... -#if 1 - ClangASTContext *ast_context = exe_ctx.target->GetScratchClangASTContext(); - if (value.GetContextType() == Value::eContextTypeOpaqueClangQualType) - { - value.SetContext(Value::eContextTypeOpaqueClangQualType, ast_context->GetVoidPtrType(false)); - } -#endif } else { From scallanan at apple.com Fri Oct 29 20:56:11 2010 From: scallanan at apple.com (Sean Callanan) Date: Sat, 30 Oct 2010 01:56:11 -0000 Subject: [Lldb-commits] [lldb] r117768 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20101030015611.25E452A6C12C@llvm.org> Author: spyffe Date: Fri Oct 29 20:56:10 2010 New Revision: 117768 URL: http://llvm.org/viewvc/llvm-project?rev=117768&view=rev Log: Added a hack that allows expressions to ignore Objective-C member accessibility restrictions. Ultimately Clang should have a flag that ignores accessibility for Objective-C like it has one for C++. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=117768&r1=117767&r2=117768&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Oct 29 20:56:10 2010 @@ -1128,6 +1128,12 @@ } } } + + // FIXME: Make Clang ignore Objective-C accessibility for expressions + + if (class_language == eLanguageTypeObjC || + class_language == eLanguageTypeObjC_plus_plus) + accessibility = eAccessNone; if (is_artificial == false) { From gclayton at apple.com Fri Oct 29 23:51:46 2010 From: gclayton at apple.com (Greg Clayton) Date: Sat, 30 Oct 2010 04:51:46 -0000 Subject: [Lldb-commits] [lldb] r117772 - in /lldb/trunk: include/lldb/API/ source/API/ source/Target/ Message-ID: <20101030045147.2D81C2A6C12C@llvm.org> Author: gclayton Date: Fri Oct 29 23:51:46 2010 New Revision: 117772 URL: http://llvm.org/viewvc/llvm-project?rev=117772&view=rev Log: Improved API logging. Modified: lldb/trunk/include/lldb/API/SBBlock.h lldb/trunk/include/lldb/API/SBFrame.h lldb/trunk/include/lldb/API/SBProcess.h lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/include/lldb/API/SBThread.h lldb/trunk/source/API/SBBlock.cpp lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBCommunication.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBError.cpp lldb/trunk/source/API/SBEvent.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBInputReader.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBSymbol.cpp lldb/trunk/source/API/SBSymbolContext.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/API/SBBlock.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBlock.h?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBlock.h (original) +++ lldb/trunk/include/lldb/API/SBBlock.h Fri Oct 29 23:51:46 2010 @@ -58,6 +58,9 @@ #ifndef SWIG + const lldb_private::Block * + get () const; + SBBlock (lldb_private::Block *lldb_object_ptr); void Modified: lldb/trunk/include/lldb/API/SBFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFrame.h (original) +++ lldb/trunk/include/lldb/API/SBFrame.h Fri Oct 29 23:51:46 2010 @@ -124,9 +124,6 @@ protected: friend class SBValue; - lldb_private::StackFrame * - GetLLDBObjectPtr (); - private: friend class SBThread; friend class lldb_private::ScriptInterpreterPython; Modified: lldb/trunk/include/lldb/API/SBProcess.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBProcess.h (original) +++ lldb/trunk/include/lldb/API/SBProcess.h Fri Oct 29 23:51:46 2010 @@ -106,11 +106,8 @@ SBError Destroy (); - bool - WaitUntilProcessHasStopped (lldb::SBCommandReturnObject &result); - lldb::pid_t - AttachByPID (lldb::pid_t pid); // DEPRECATED: will be removed in a few builds in favor of SBError AttachByPID(pid_t) + AttachByPID (lldb::pid_t pid); // DEPRECATED // DEPRECATED: relocated to "SBProcess SBTarget::AttachToProcess (lldb::pid_t pid, SBError& error)" SBError Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Fri Oct 29 23:51:46 2010 @@ -43,9 +43,6 @@ //------------------------------------------------------------------ ~SBTarget(); - const lldb::SBTarget& - Assign (const lldb::SBTarget& rhs); - bool IsValid() const; Modified: lldb/trunk/include/lldb/API/SBThread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBThread.h (original) +++ lldb/trunk/include/lldb/API/SBThread.h Fri Oct 29 23:51:46 2010 @@ -89,9 +89,6 @@ #endif bool - GetDescription (lldb::SBStream &description); - - bool GetDescription (lldb::SBStream &description) const; protected: @@ -102,11 +99,12 @@ friend class SBDebugger; friend class SBValue; - lldb_private::Thread * - GetLLDBObjectPtr (); #ifndef SWIG + lldb_private::Thread * + get (); + const lldb_private::Thread * operator->() const; Modified: lldb/trunk/source/API/SBBlock.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBlock.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBBlock.cpp (original) +++ lldb/trunk/source/API/SBBlock.cpp Fri Oct 29 23:51:46 2010 @@ -133,6 +133,12 @@ return sb_block; } +const lldb_private::Block * +SBBlock::get () const +{ + return m_opaque_ptr; +} + bool SBBlock::GetDescription (SBStream &description) Modified: lldb/trunk/source/API/SBBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpoint.cpp (original) +++ lldb/trunk/source/API/SBBreakpoint.cpp Fri Oct 29 23:51:46 2010 @@ -72,31 +72,12 @@ SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBBreakpoint::SBBreakpoint (const SBBreakpoint rhs.sp=%p) " - "=> this.sp = %p (%s)", - rhs.m_opaque_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } } SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) : m_opaque_sp (bp_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf("SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp=%p) => this.sp = %p (%s)", - bp_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } } SBBreakpoint::~SBBreakpoint() @@ -106,20 +87,8 @@ const SBBreakpoint & SBBreakpoint::operator = (const SBBreakpoint& rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBBreakpoint::operator="); - if (this != &rhs) - { m_opaque_sp = rhs.m_opaque_sp; - } - - if (log) - log->Printf ("SBBreakpoint::operator= (const SBBreakpoint &rhs.sp=%p) => this.sp = %p", - rhs.m_opaque_sp.get(), m_opaque_sp.get()); - return *this; } @@ -128,19 +97,16 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBBreakpoint::GetID"); - if (m_opaque_sp) { - break_id_t id = m_opaque_sp->GetID(); + break_id_t break_id = m_opaque_sp->GetID(); if (log) - log->Printf ("SBBreakpoint::GetID (this.sp=%p) => %d", m_opaque_sp.get(), id); - return id; + log->Printf ("SBBreakpoint(%p)::GetID () => %u", m_opaque_sp.get(), break_id); + return break_id; } if (log) - log->Printf ("SBBreakpoint::GetID (this.sp=%p) => LLDB_INVALID_BREAK_ID", m_opaque_sp.get()); + log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID", m_opaque_sp.get()); return LLDB_INVALID_BREAK_ID; } @@ -232,8 +198,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetEnabled (this.sp=%p, enable='%s')", m_opaque_sp.get(), - (enable ? "true" : "false")); + log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable); if (m_opaque_sp) m_opaque_sp->SetEnabled (enable); @@ -254,7 +219,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetIgnoreCount (this.sp=%p, count='%d')", m_opaque_sp.get(), count); + log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count); if (m_opaque_sp) m_opaque_sp->SetIgnoreCount (count); @@ -275,55 +240,61 @@ uint32_t SBBreakpoint::GetHitCount () const { + uint32_t count = 0; + if (m_opaque_sp) + count = m_opaque_sp->GetHitCount(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); - //if (log) - // log->Printf ("SBBreakpoint::GetHitCount"); - - if (m_opaque_sp) - { - uint32_t hit_count = m_opaque_sp->GetHitCount(); - if (log) - log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '%d'", m_opaque_sp.get(), hit_count); - return m_opaque_sp->GetHitCount(); - } - else - { - if (log) - log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '0'", m_opaque_sp.get()); - return 0; - } + return count; } uint32_t SBBreakpoint::GetIgnoreCount () const { + uint32_t count = 0; if (m_opaque_sp) - return m_opaque_sp->GetIgnoreCount(); - else - return 0; + count = m_opaque_sp->GetIgnoreCount(); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count); + + return count; } void -SBBreakpoint::SetThreadID (tid_t sb_thread_id) +SBBreakpoint::SetThreadID (tid_t tid) { if (m_opaque_sp) - m_opaque_sp->SetThreadID (sb_thread_id); + m_opaque_sp->SetThreadID (tid); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4x)", m_opaque_sp.get(), tid); + } tid_t SBBreakpoint::GetThreadID () { - tid_t lldb_thread_id = LLDB_INVALID_THREAD_ID; + tid_t tid = LLDB_INVALID_THREAD_ID; if (m_opaque_sp) - lldb_thread_id = m_opaque_sp->GetThreadID(); + tid = m_opaque_sp->GetThreadID(); - return lldb_thread_id; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid); + return tid; } void SBBreakpoint::SetThreadIndex (uint32_t index) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index); if (m_opaque_sp) m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index); } @@ -331,14 +302,17 @@ uint32_t SBBreakpoint::GetThreadIndex() const { + uint32_t thread_idx = 0; if (m_opaque_sp) { const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); if (thread_spec == NULL) - return 0; - else - return thread_spec->GetIndex(); + thread_idx = thread_spec->GetIndex(); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), index); + return 0; } @@ -346,6 +320,10 @@ void SBBreakpoint::SetThreadName (const char *thread_name) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name); + if (m_opaque_sp) m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name); } @@ -353,20 +331,26 @@ const char * SBBreakpoint::GetThreadName () const { + const char *name = NULL; if (m_opaque_sp) { const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); if (thread_spec == NULL) - return NULL; - else - return thread_spec->GetName(); + name = thread_spec->GetName(); } - return NULL; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name); + + return name; } void SBBreakpoint::SetQueueName (const char *queue_name) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name); if (m_opaque_sp) m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name); } @@ -374,33 +358,41 @@ const char * SBBreakpoint::GetQueueName () const { + const char *name = NULL; if (m_opaque_sp) { const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); - if (thread_spec == NULL) - return NULL; - else - return thread_spec->GetQueueName(); + name = thread_spec->GetQueueName(); } - return NULL; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name); + + return name; } size_t SBBreakpoint::GetNumResolvedLocations() const { + size_t num_resolved = 0; if (m_opaque_sp) - return m_opaque_sp->GetNumResolvedLocations(); - else - return 0; + num_resolved = m_opaque_sp->GetNumResolvedLocations(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %zu", m_opaque_sp.get(), num_resolved); + return num_resolved; } size_t SBBreakpoint::GetNumLocations() const { + size_t num_locs = 0; if (m_opaque_sp) - return m_opaque_sp->GetNumLocations(); - else - return 0; + num_locs = m_opaque_sp->GetNumLocations(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %zu", m_opaque_sp.get(), num_locs); + return num_locs; } bool @@ -461,18 +453,11 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBBreakpoint::SetCallback (this.sp=%p, :", m_opaque_sp.get()); + log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton); if (m_opaque_sp.get()) { BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton)); - if (log) - { - // CAROLINE: FIXME!! - //StreamString sstr; - //baton_sp->GetDescription (sstr, lldb::eDescriptionLevelFull); - //log->Printf ("%s", sstr.GetData()); - } m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false); } } Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri Oct 29 23:51:46 2010 @@ -36,8 +36,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter = %p)" - " => this.obj = %p", interpreter, m_opaque_ptr); + log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)" + " => SBCommandInterpreter(%p)", interpreter, m_opaque_ptr); } SBCommandInterpreter::~SBCommandInterpreter () @@ -73,8 +73,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf("SBCommandInterpreter::HandleCommand (this.obj=%p, command_line='%s', result=%p, " - "add_to_history='%s')", m_opaque_ptr, command_line, &result, (add_to_history ? "true" : "false")); + log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command_line='%s', result=%p, add_to_history=%i)", + m_opaque_ptr, command_line, &result, add_to_history); result.Clear(); if (m_opaque_ptr) @@ -93,8 +93,8 @@ { SBStream sstr; result.GetDescription (sstr); - log->Printf ("SBCommandInterpreter::HandleCommand ('%s') => SBCommandReturnObject: '%s'", - command_line, sstr.GetData()); + log->Printf ("SBCommandInterpreter(%p)::HandleCommand (\"%s\") => SBCommandReturnObject(%p): '%s'", + m_opaque_ptr, command_line, result.get(), sstr.GetData()); } return result.GetStatus(); @@ -156,27 +156,39 @@ if (target) process.SetProcess(target->GetProcessSP()); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)", + m_opaque_ptr, process.get()); + + return process; } ssize_t SBCommandInterpreter::WriteToScriptInterpreter (const char *src) { - if (m_opaque_ptr && src && src[0]) - return WriteToScriptInterpreter (src, strlen(src)); - return 0; + return WriteToScriptInterpreter (src, strlen(src)); } ssize_t SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + ssize_t bytes_written = 0; if (m_opaque_ptr && src && src[0]) { ScriptInterpreter *script_interpreter = m_opaque_ptr->GetScriptInterpreter(); if (script_interpreter) - return ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len); + bytes_written = ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len); } - return 0; + if (log) + log->Printf ("SBCommandInterpreter(%p)::WriteToScriptInterpreter (src=\"%s\", src_len=%zu) => %zi", + m_opaque_ptr, src, src_len, bytes_written); + + return bytes_written; } @@ -212,6 +224,12 @@ result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))", + m_opaque_ptr, result.get()); + } void @@ -227,6 +245,11 @@ result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))", + m_opaque_ptr, result.get()); } SBBroadcaster @@ -234,13 +257,10 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommandInterpreter::GetBroadcaster ()"); - SBBroadcaster broadcaster (m_opaque_ptr, false); if (log) - log->Printf ("SBCommandInterpreter::GetBroadcaster (this.obj=%p) => SBBroadcaster (this.m_opaque_ptr=%p)", + log->Printf ("SBCommandInterpreter(%p)::GetBroadcaster() => SBBroadcaster(%p)", m_opaque_ptr, broadcaster.get()); return broadcaster; Modified: lldb/trunk/source/API/SBCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommunication.cpp (original) +++ lldb/trunk/source/API/SBCommunication.cpp Fri Oct 29 23:51:46 2010 @@ -32,7 +32,7 @@ if (log) log->Printf ("SBCommunication::SBCommunication (broadcaster_name='%s') => " - "this.obj = %p", broadcaster_name, m_opaque); + "SBCommunication(%p): owned = 1", broadcaster_name, m_opaque); } SBCommunication::~SBCommunication() @@ -84,10 +84,7 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommunication::AdoptFileDescriptor (this=%p, fd='%d', owns_fd='%s')", this, fd, - // (owns_fd ? "true" : "false")); - + ConnectionStatus status = eConnectionStatusNoConnection; if (m_opaque) { if (m_opaque->HasConnection ()) @@ -97,26 +94,16 @@ } m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd)); if (m_opaque->IsConnected()) - { - if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor (this.obj=%p, fd=%d, ownd_fd='%s') " - "=> eConnectionStatusSuccess", m_opaque, fd, (owns_fd ? "true" : "false")); - return eConnectionStatusSuccess; - } + status = eConnectionStatusSuccess; else - { - if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor (this.obj=%p, fd=%d, ownd_fd='%s') " - "=> eConnectionStatusLostConnection", m_opaque, fd, (owns_fd ? "true" : "false")); - return eConnectionStatusLostConnection; - } + status = eConnectionStatusLostConnection; } if (log) - log->Printf ("SBCommunication::AdoptFileDescriptor (this,obj=%p, fd=%d, ownd_fd='%s') " - "=> eConnectionStatusNoConnection", m_opaque, fd, (owns_fd ? "true" : "false")); + log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s", + m_opaque, fd, owns_fd, Communication::ConnectionStatusAsCString (status)); - return eConnectionStatusNoConnection; + return status; } @@ -125,15 +112,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommunication::Disconnect ()"); - ConnectionStatus status= eConnectionStatusNoConnection; if (m_opaque) status = m_opaque->Disconnect (); if (log) - log->Printf ("SBCommunication::Disconnect (this.obj=%p) => '%s'", m_opaque, + log->Printf ("SBCommunication(%p)::Disconnect () => %s", m_opaque, Communication::ConnectionStatusAsCString (status)); return status; @@ -142,27 +126,52 @@ bool SBCommunication::IsConnected () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + bool result = false; if (m_opaque) - return m_opaque->IsConnected (); + result = m_opaque->IsConnected (); + + if (log) + log->Printf ("SBCommunication(%p)::IsConnected () => %i", m_opaque, result); + return false; } size_t SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status) { - if (m_opaque) - return m_opaque->Read (dst, dst_len, timeout_usec, status, NULL); - status = eConnectionStatusNoConnection; - return 0; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status)...", + m_opaque, dst, dst_len, timeout_usec); + size_t bytes_read = 0; + if (m_opaque) + bytes_read = m_opaque->Read (dst, dst_len, timeout_usec, status, NULL); + else + status = eConnectionStatusNoConnection; + + if (log) + log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status=%s) => %zu", + m_opaque, dst, dst_len, timeout_usec, Communication::ConnectionStatusAsCString (status), + bytes_read); + return bytes_read; } size_t SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &status) { + size_t bytes_written = 0; if (m_opaque) - return m_opaque->Write (src, src_len, status, NULL); - status = eConnectionStatusNoConnection; + bytes_written = m_opaque->Write (src, src_len, status, NULL); + else + status = eConnectionStatusNoConnection; + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%zu, &status=%s) => %zu", + m_opaque, src, src_len, Communication::ConnectionStatusAsCString (status), bytes_written); + return 0; } @@ -171,16 +180,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBCommunication::ReadThreadStart ()"); - bool success = false; if (m_opaque) success = m_opaque->StartReadThread (); log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommunication::ReadThreadStart (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); + log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i", m_opaque, success); return success; } @@ -189,17 +195,16 @@ bool SBCommunication::ReadThreadStop () { - - //if (log) - // log->Printf ("SBCommunication::ReadThreadStop ()"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque); bool success = false; if (m_opaque) success = m_opaque->StopReadThread (); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBCommunication::ReadThreadStop (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false")); + log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i", m_opaque, success); return success; } @@ -207,9 +212,13 @@ bool SBCommunication::ReadThreadIsRunning () { + bool result = false; if (m_opaque) - return m_opaque->ReadThreadIsRunning (); - return false; + result = m_opaque->ReadThreadIsRunning (); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result); + return result; } bool @@ -221,28 +230,31 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (log) - log->Printf ("SBCommunication::SetReadThreadBytesReceivedCallback (this.obj=%p, callback=%p, baton=%p)", - m_opaque, callback, callback_baton); - + bool result = false; if (m_opaque) { m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton); - if (log) - log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback (this.obj=%p...) => true", m_opaque); - return true; + result = true; } if (log) - log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback (this.obj=%p...) => false", m_opaque); + log->Printf ("SBCommunication(%p)::SetReadThreadBytesReceivedCallback (callback=%p, baton=%p) => %i", + m_opaque, callback, callback_baton, result); - return false; + return result; } SBBroadcaster SBCommunication::GetBroadcaster () { SBBroadcaster broadcaster (m_opaque, false); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)", + m_opaque, broadcaster.get()); + return broadcaster; } Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Fri Oct 29 23:51:46 2010 @@ -411,19 +411,20 @@ const char * SBDebugger::StateAsCString (lldb::StateType state) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBDebugger::StateAsCString (state=%d) => '%s'", state, - lldb_private::StateAsCString (state)); - return lldb_private::StateAsCString (state); } bool SBDebugger::StateIsRunningState (lldb::StateType state) { - return lldb_private::StateIsRunningState (state); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + const bool result = lldb_private::StateIsRunningState (state); + if (log) + log->Printf ("SBDebugger::StateIsRunningState (state=%s) => %i", + lldb_private::StateAsCString (state), result); + + return result; } bool @@ -431,11 +432,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + const bool result = lldb_private::StateIsStoppedState (state); if (log) - log->Printf ("SBDebugger::StateIsStoppedState (state=%d) => '%s'", state, - (lldb_private::StateIsStoppedState (state) ? "true" : "false")); + log->Printf ("SBDebugger::StateIsStoppedState (state=%s) => %i", + lldb_private::StateAsCString (state), result); - return lldb_private::StateIsStoppedState (state); + return result; } @@ -453,6 +455,14 @@ Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp)); target.reset (target_sp); } + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename='%s', tiple = %s) => SBTarget(%p)", + m_opaque_sp.get(), filename, target_triple, target.get()); + } + return target; } @@ -501,11 +511,8 @@ if (log) { - SBStream sstr; - target.GetDescription (sstr, lldb::eDescriptionLevelFull); - log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename='%s', arcname='%s') " - "=> SBTarget(%p): %s", m_opaque_sp.get(), filename, archname, target.get(), - sstr.GetData()); + log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename='%s', arch = %s) => SBTarget(%p)", + m_opaque_sp.get(), filename, archname, target.get()); } return target; @@ -543,6 +550,12 @@ target.reset (target_sp); } } + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBDebugger(%p)::CreateTarget (filename='%s') => SBTarget(%p)", + m_opaque_sp.get(), filename, target.get()); + } return target; } Modified: lldb/trunk/source/API/SBError.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBError.cpp (original) +++ lldb/trunk/source/API/SBError.cpp Fri Oct 29 23:51:46 2010 @@ -35,8 +35,8 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBError::SBError (const SBError rhs.ap=%p) => this.ap = %p (%s)", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get(), sstr.GetData()); + log->Printf ("SBError::SBError (const SBError rhs.ap=%p) => SBError(%p): %s", + rhs.m_opaque_ap.get(), m_opaque_ap.get(), sstr.GetData()); } } @@ -49,7 +49,7 @@ 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()) @@ -66,8 +66,8 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBError::operator= (this.ap=%p, rhs.ap=%p) => this (%s)", - m_opaque_ap.get(), (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), sstr.GetData()); + log->Printf ("SBError(%p)::operator= (SBError(%p)) => SBError(%s)", + old_error, rhs.m_opaque_ap.get(), sstr.GetData()); } return *this; @@ -94,15 +94,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBError::Fail ()"); - bool ret_value = false; if (m_opaque_ap.get()) ret_value = m_opaque_ap->Fail(); if (log) - log->Printf ("SBError::Fail (this.ap=%p) => '%s'", m_opaque_ap.get(), (ret_value ? "true" : "false")); + log->Printf ("SBError(%p)::Fail () => %i", m_opaque_ap.get(), ret_value); return ret_value; } @@ -110,25 +107,45 @@ bool SBError::Success () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + bool ret_value = false; if (m_opaque_ap.get()) - return m_opaque_ap->Success(); - return false; + ret_value = m_opaque_ap->Success(); + + if (log) + log->Printf ("SBError(%p)::Success () => %i", m_opaque_ap.get(), ret_value); + + return ret_value; } uint32_t SBError::GetError () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + uint32_t err = 0; if (m_opaque_ap.get()) - return m_opaque_ap->GetError(); - return true; + err = m_opaque_ap->GetError(); + + if (log) + log->Printf ("SBError(%p)::GetError () => 0x%8.8x", m_opaque_ap.get(), err); + + + return err; } ErrorType SBError::GetType () const { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + ErrorType err_type = eErrorTypeInvalid; if (m_opaque_ap.get()) - return m_opaque_ap->GetType(); - return eErrorTypeInvalid; + err_type = m_opaque_ap->GetType(); + + if (log) + log->Printf ("SBError(%p)::GetType () => %i", m_opaque_ap.get(), err_type); + + return err_type; } void Modified: lldb/trunk/source/API/SBEvent.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBEvent.cpp (original) +++ lldb/trunk/source/API/SBEvent.cpp Fri Oct 29 23:51:46 2010 @@ -117,10 +117,10 @@ success = lldb_event->BroadcasterIs (broadcaster.get()); if (log) - log->Printf ("SBEvent(%p)::BroadcasterMathesRef (broadcaster.ptr=%p) => %s", + log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p)) => %i", get(), broadcaster.get(), - success ? "true" : "false"); + success); return success; } Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Fri Oct 29 23:51:46 2010 @@ -108,29 +108,27 @@ const char * SBFileSpec::GetFilename() const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - + const char *s = NULL; if (m_opaque_ap.get()) - { - if (log) - log->Printf ("SBFileSpec(%p)::GetFilename () => %s", m_opaque_ap.get(), - m_opaque_ap->GetFilename().AsCString()); - - return m_opaque_ap->GetFilename().AsCString(); - } + s = m_opaque_ap->GetFilename().AsCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get()); + log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s ? s : ""); - return NULL; + return s; } const char * SBFileSpec::GetDirectory() const { + const char *s = NULL; if (m_opaque_ap.get()) - return m_opaque_ap->GetDirectory().AsCString(); - return NULL; + 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 : ""); + return s; } uint32_t Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Fri Oct 29 23:51:46 2010 @@ -57,8 +57,8 @@ { SBStream sstr; GetDescription (sstr); - log->Printf ("SBFrame::SBFrame (lldb_object_sp=%p) => this.sp = %p (%s)", lldb_object_sp.get(), - m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s", + lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -71,7 +71,16 @@ void SBFrame::SetFrame (const lldb::StackFrameSP &lldb_object_sp) { + void *old_ptr = m_opaque_sp.get(); m_opaque_sp = lldb_object_sp; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + { + log->Printf ("SBFrame(%p)::SetFrame(sp=%p) := SBFrame(%p)", + old_ptr, lldb_object_sp.get(), m_opaque_sp.get()); + } + } @@ -84,17 +93,14 @@ SBSymbolContext SBFrame::GetSymbolContext (uint32_t resolve_scope) const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetSymbolContext (this.sp=%p, resolve_scope=%d)", m_opaque_sp.get(), resolve_scope); SBSymbolContext sb_sym_ctx; if (m_opaque_sp) sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope)); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetSymbolContext (this.sp=%p, resolve_scope=%d) => SBSymbolContext (this.ap = %p)", + log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)", m_opaque_sp.get(), resolve_scope, sb_sym_ctx.get()); return sb_sym_ctx; @@ -104,22 +110,23 @@ SBFrame::GetModule () const { SBModule sb_module (m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)", + m_opaque_sp.get(), sb_module.get()); + return sb_module; } SBCompileUnit SBFrame::GetCompileUnit () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetCompileUnit()"); - SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetCompileUnit (this.sp=%p) => SBCompileUnit (this=%p)", m_opaque_sp.get(), - sb_comp_unit.get()); + log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)", + m_opaque_sp.get(), sb_comp_unit.get()); return sb_comp_unit; } @@ -128,6 +135,12 @@ SBFrame::GetFunction () const { SBFunction sb_function(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)", + m_opaque_sp.get(), sb_function.get()); + return sb_function; } @@ -135,6 +148,10 @@ SBFrame::GetSymbol () const { SBSymbol sb_symbol(m_opaque_sp->GetSymbolContext (eSymbolContextSymbol).symbol); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)", + m_opaque_sp.get(), sb_symbol.get()); return sb_symbol; } @@ -142,6 +159,10 @@ SBFrame::GetBlock () const { SBBlock sb_block(m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)", + m_opaque_sp.get(), sb_block.get()); return sb_block; } @@ -149,6 +170,10 @@ SBFrame::GetFrameBlock () const { SBBlock sb_block(m_opaque_sp->GetFrameBlock ()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)", + m_opaque_sp.get(), sb_block.get()); return sb_block; } @@ -156,32 +181,36 @@ SBFrame::GetLineEntry () const { SBLineEntry sb_line_entry(&m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)", + m_opaque_sp.get(), sb_line_entry.get()); return sb_line_entry; } uint32_t SBFrame::GetFrameID () const { - if (m_opaque_sp) - return m_opaque_sp->GetFrameIndex (); - else - return UINT32_MAX; + uint32_t frame_idx = m_opaque_sp ? m_opaque_sp->GetFrameIndex () : UINT32_MAX; + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetFrameID () => %u", + m_opaque_sp.get(), frame_idx); + return frame_idx; } lldb::addr_t SBFrame::GetPC () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetPC (this.sp=%p)", m_opaque_sp.get()); lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetPC (this.sp=%p) => %p", m_opaque_sp.get(), addr); + log->Printf ("SBFrame(%p)::GetPC () => %0xllx", m_opaque_sp.get(), addr); return addr; } @@ -189,18 +218,15 @@ bool SBFrame::SetPC (lldb::addr_t new_pc) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::SetPC (this.sp=%p, new_pc=%p)", m_opaque_sp.get(), new_pc); bool ret_val = false; if (m_opaque_sp) ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::SetPC (this.sp=%p, new_pc=%p) => '%s'", m_opaque_sp.get(), new_pc, - (ret_val ? "true" : "false")); + log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i", + m_opaque_sp.get(), new_pc, ret_val); return ret_val; } @@ -208,27 +234,27 @@ lldb::addr_t SBFrame::GetSP () const { + addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) - return m_opaque_sp->GetRegisterContext()->GetSP(); - return LLDB_INVALID_ADDRESS; + 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); + + return addr; } lldb::addr_t SBFrame::GetFP () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBFrame::GetFP ()"); - lldb::addr_t addr = LLDB_INVALID_ADDRESS; if (m_opaque_sp) addr = m_opaque_sp->GetRegisterContext()->GetFP(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetFP (this.sp=%p) => %p", m_opaque_sp.get(), addr); - + log->Printf ("SBFrame(%p)::GetFP () => %0xllx", m_opaque_sp.get(), addr); return addr; } @@ -239,6 +265,9 @@ SBAddress sb_addr; if (m_opaque_sp) sb_addr.SetAddress (&m_opaque_sp->GetFrameCodeAddress()); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", m_opaque_sp.get(), sb_addr.get()); return sb_addr; } @@ -274,13 +303,17 @@ if (!found) var_sp.reset(); } - if (var_sp) - { - SBValue sb_value (ValueObjectSP (new ValueObjectVariable (var_sp))); - return sb_value; - } SBValue sb_value; + + if (var_sp) + *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp)); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::LookupVar (name=\"%s\") => SBValue(%p)", + m_opaque_sp.get(), var_name, sb_value.get()); + return sb_value; } @@ -327,13 +360,16 @@ } } + SBValue sb_value; if (var_sp) - { - SBValue sb_value (ValueObjectSP (new ValueObjectVariable (var_sp))); - return sb_value; - } + *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp)); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBFrame(%p)::LookupVarInScope (name=\"%s\", scope=%s) => SBValue(%p)", + m_opaque_sp.get(), var_name, scope, sb_value.get()); + - SBValue sb_value; return sb_value; } @@ -376,8 +412,8 @@ { SBStream sstr; sb_thread.GetDescription (sstr); - log->Printf ("SBFrame::GetThread (this.sp=%p) => SBThread : this.sp= %p, '%s'", m_opaque_sp.get(), - sb_thread.GetLLDBObjectPtr(), sstr.GetData()); + log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s", m_opaque_sp.get(), + sb_thread.get(), sstr.GetData()); } return sb_thread; @@ -386,27 +422,18 @@ const char * SBFrame::Disassemble () const { + const char *disassembly = NULL; + if (m_opaque_sp) + disassembly = m_opaque_sp->Disassemble(); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - Log *verbose_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); - if (verbose_log) - verbose_log->Printf ("SBFrame::Disassemble (this.sp=%p) => %s", m_opaque_sp.get(), m_opaque_sp->Disassemble()); - else if (log) - log->Printf ("SBFrame::Disassemble (this.sp=%p)", m_opaque_sp.get()); + if (log) + log->Printf ("SBFrame(%p)::Disassemble () => %s", m_opaque_sp.get(), disassembly); - if (m_opaque_sp) - return m_opaque_sp->Disassemble(); - return NULL; + return disassembly; } - -lldb_private::StackFrame * -SBFrame::GetLLDBObjectPtr () -{ - return m_opaque_sp.get(); -} - SBValueList SBFrame::GetVariables (bool arguments, bool locals, @@ -416,12 +443,12 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBFrame::GetVariables (this_sp.get=%p, arguments=%s, locals=%s, statics=%s, in_scope_only=%s)", + log->Printf ("SBFrame(%p)::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", m_opaque_sp.get(), - (arguments ? "true" : "false"), - (locals ? "true" : "false"), - (statics ? "true" : "false"), - (in_scope_only ? "true" : "false")); + arguments, + locals, + statics, + in_scope_only); SBValueList value_list; if (m_opaque_sp) @@ -472,14 +499,8 @@ if (log) { - log->Printf ("SBFrame::GetVariables (this.sp=%p,...) => SBValueList (this.ap = %p)", m_opaque_sp.get(), + log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", m_opaque_sp.get(), value_list.get()); - //uint32_t num_vars = value_list.GetSize(); - //for (uint32_t i = 0; i < num_vars; ++i) - //{ - // SBValue value = value_list.GetValueAtIndex (i); - // log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this)); - //} } return value_list; @@ -490,9 +511,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBFrame::GetRegisters ()"); - SBValueList value_list; if (m_opaque_sp) { @@ -508,16 +526,7 @@ } if (log) - { - log->Printf ("SBFrame::Registers (this.sp=%p) => SBValueList (this.ap = %p)", m_opaque_sp.get(), - value_list.get() ); - //uint32_t num_vars = value_list.GetSize(); - //for (uint32_t i = 0; i < num_vars; ++i) - //{ - // SBValue value = value_list.GetValueAtIndex (i); - // log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this)); - //} - } + log->Printf ("SBFrame(%p)::Registers () => SBValueList(%p)", m_opaque_sp.get(), value_list.get()); return value_list; } @@ -542,7 +551,12 @@ lldb::SBValue SBFrame::EvaluateExpression (const char *expr) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + lldb::SBValue expr_result_value; + if (log) + log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\")...", m_opaque_sp.get(), expr); + if (m_opaque_sp) { ExecutionContext exe_ctx; @@ -555,5 +569,9 @@ *expr_result_value = 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()); + return expr_result_value; } Modified: lldb/trunk/source/API/SBInputReader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBInputReader.cpp (original) +++ lldb/trunk/source/API/SBInputReader.cpp Fri Oct 29 23:51:46 2010 @@ -36,7 +36,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => this.sp = %p", reader_sp.get(), + log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => SBInputReader(%p)", reader_sp.get(), m_opaque_sp.get()); } @@ -46,7 +46,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => this.sp = %p", + log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => SBInputReader(%p)", rhs.m_opaque_sp.get(), m_opaque_sp.get()); } @@ -87,10 +87,14 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf("SBInputReader::Initialize (this.sp=%p, debugger.sp=%p, callback_function=%p, callback_baton=%p, " - "granularity='%s', end_token='%s', prompt='%s', echo=%s)", m_opaque_sp.get(), debugger.get(), - callback_baton, InputReader::GranularityAsCString (granularity), end_token, prompt, - (echo ? "true" : "false")); + log->Printf("SBInputReader(%p)::Initialize (SBDebugger(%p), callback_function=%p, callback_baton=%p, " + "granularity='%s', end_token='%s', prompt='%s', echo=%i)", + m_opaque_sp.get(), + debugger.get(), + callback_function, + callback_baton, + InputReader::GranularityAsCString (granularity), end_token, prompt, + echo); SBError sb_error; m_opaque_sp.reset (new InputReader (debugger.ref())); @@ -119,7 +123,7 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBInputReader::Initialize (this.sp=%p, ...) => SBError (this.ap=%p, '%s')", m_opaque_sp.get(), + log->Printf ("SBInputReader(%p)::Initialize (...) => SBError(%p): %s", m_opaque_sp.get(), sb_error.get(), sstr.GetData()); } @@ -192,16 +196,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBInputReader::IsActive ()"); - bool ret_value = false; if (m_opaque_sp) ret_value = m_opaque_sp->IsActive(); if (log) - log->Printf ("SBInputReader::IsActive (this.sp=%p) => '%s'", m_opaque_sp.get(), - (ret_value ? "true" : "false")); + log->Printf ("SBInputReader(%p)::IsActive () => %i", m_opaque_sp.get(), ret_value); return ret_value; } Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Fri Oct 29 23:51:46 2010 @@ -87,18 +87,18 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - uint32_t ret_value = 0; + uint32_t aquired_event_mask = 0; if (m_opaque_ptr && broadcaster.IsValid()) { - ret_value = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); + aquired_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) => %d", - m_opaque_ptr, broadcaster.get(), event_mask, ret_value); + 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); - return ret_value; + return aquired_event_mask; } bool Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Fri Oct 29 23:51:46 2010 @@ -28,10 +28,6 @@ SBModule::SBModule (const lldb::ModuleSP& module_sp) : m_opaque_sp (module_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBModule::SBModule (module_sp=%p) => this.sp = %p", module_sp.get(), m_opaque_sp.get()); } SBModule::~SBModule () @@ -49,9 +45,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBModule::GetFileSpec ()"); - SBFileSpec file_spec; if (m_opaque_sp) file_spec.SetFileSpec(m_opaque_sp->GetFileSpec()); @@ -60,7 +53,7 @@ { SBStream sstr; file_spec.GetDescription (sstr); - log->Printf ("SBModule::GetFileSpec (this.sp=%p) => SBFileSpec : this.ap = %p, 's'", m_opaque_sp.get(), + log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_sp.get(), file_spec.get(), sstr.GetData()); } @@ -72,23 +65,22 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBModule::GetUUIDBytes ()"); - + const uint8_t *uuid_bytes = NULL; if (m_opaque_sp) + uuid_bytes = (const uint8_t *)m_opaque_sp->GetUUID().GetBytes(); + + if (log) { - if (log) + if (uuid_bytes) { - StreamString sstr; - m_opaque_sp->GetUUID().Dump (&sstr); - log->Printf ("SBModule::GetUUIDBytes (this.sp=%p) => '%s'", m_opaque_sp.get(), sstr.GetData()); + StreamString s; + m_opaque_sp->GetUUID().Dump (&s); + log->Printf ("SBModule(%p)::GetUUIDBytes () => %s", m_opaque_sp.get(), s.GetData()); } - return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes(); + else + log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL", m_opaque_sp.get()); } - - if (log) - log->Printf ("SBModule::GetUUIDBytes (this.sp=%p) => NULL", m_opaque_sp.get()); - return NULL; + return uuid_bytes; } Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Fri Oct 29 23:51:46 2010 @@ -53,20 +53,12 @@ SBProcess::SBProcess (const SBProcess& rhs) : m_opaque_sp (rhs.m_opaque_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBProcess::SBProcess(%p)", rhs.m_opaque_sp.get()); } SBProcess::SBProcess (const lldb::ProcessSP &process_sp) : m_opaque_sp (process_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBProcess::SBProcess(%p)", process_sp.get()); } //---------------------------------------------------------------------- @@ -125,7 +117,7 @@ if (log) { - log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), sb_thread.GetLLDBObjectPtr()); + log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", m_opaque_sp.get(), sb_thread.get()); } return sb_thread; @@ -289,7 +281,7 @@ if (log) { log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)", - m_opaque_sp.get(), (uint32_t) index, thread.GetLLDBObjectPtr()); + m_opaque_sp.get(), (uint32_t) index, thread.get()); } return thread; @@ -298,12 +290,12 @@ StateType SBProcess::GetState () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); StateType ret_val = eStateInvalid; if (m_opaque_sp != NULL) ret_val = m_opaque_sp->GetState(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBProcess(%p)::GetState () => '%s'", m_opaque_sp.get(), @@ -316,30 +308,38 @@ int SBProcess::GetExitStatus () { - if (m_opaque_sp != NULL) - return m_opaque_sp->GetExitStatus (); - else - return 0; + int exit_status = 0; + if (m_opaque_sp) + exit_status = m_opaque_sp->GetExitStatus (); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)", + m_opaque_sp.get(), exit_status, exit_status); + + return exit_status; } const char * SBProcess::GetExitDescription () { + const char *exit_desc = NULL; if (m_opaque_sp != NULL) - return m_opaque_sp->GetExitDescription (); - else - return NULL; + exit_desc = m_opaque_sp->GetExitDescription (); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBProcess(%p)::GetExitDescription () => %s", + m_opaque_sp.get(), exit_desc); + return exit_desc; } lldb::pid_t SBProcess::GetProcessID () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - lldb::pid_t ret_val = LLDB_INVALID_PROCESS_ID; if (m_opaque_sp) ret_val = m_opaque_sp->GetID(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val); @@ -349,42 +349,23 @@ uint32_t SBProcess::GetAddressByteSize () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - uint32_t size = 0; if (m_opaque_sp) size = m_opaque_sp->GetAddressByteSize(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", m_opaque_sp.get(), size); return size; } -bool -SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result) -{ - bool state_changed = false; - - if (IsValid()) - { - EventSP event_sp; - StateType state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp); - - while (StateIsStoppedState (state)) - { - state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp); - SBEvent event (event_sp); - AppendEventStateReport (event, result); - state_changed = true; - } - } - return state_changed; -} - SBError SBProcess::Continue () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBProcess(%p)::Continue ()...", m_opaque_sp.get()); SBError sb_error; if (IsValid()) @@ -393,14 +374,17 @@ if (error.Success()) { if (m_opaque_sp->GetTarget().GetDebugger().GetAsyncExecution () == false) + { + if (log) + log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...", m_opaque_sp.get()); m_opaque_sp->WaitForProcessToStop (NULL); + } } sb_error.SetError(error); } else sb_error.SetErrorString ("SBProcess is invalid"); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) { SBStream sstr; @@ -421,6 +405,14 @@ else sb_error.SetErrorString ("SBProcess is invalid"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s", m_opaque_sp.get(), sb_error.get(), sstr.GetData()); + } + return sb_error; } @@ -475,7 +467,7 @@ SBError -SBProcess::AttachByName (const char *name, bool wait_for_launch) +SBProcess::AttachByName (const char *name, bool wait_for_launch) // DEPRECATED { SBError sb_error; if (m_opaque_sp) @@ -486,7 +478,7 @@ } lldb::pid_t -SBProcess::AttachByPID (lldb::pid_t attach_pid) // DEPRECATED: will be removed in a few builds in favor of SBError AttachByPID(pid_t) +SBProcess::AttachByPID (lldb::pid_t attach_pid) // DEPRECATED { Attach (attach_pid); return GetProcessID(); @@ -494,7 +486,7 @@ SBError -SBProcess::Attach (lldb::pid_t attach_pid) +SBProcess::Attach (lldb::pid_t attach_pid) // DEPRECATED { SBError sb_error; if (m_opaque_sp) @@ -517,23 +509,44 @@ } SBError -SBProcess::Signal (int signal) +SBProcess::Signal (int signo) { SBError sb_error; if (m_opaque_sp) - sb_error.SetError (m_opaque_sp->Signal (signal)); + sb_error.SetError (m_opaque_sp->Signal (signo)); else sb_error.SetErrorString ("SBProcess is invalid"); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s", + m_opaque_sp.get(), + signo, + sb_error.get(), + sstr.GetData()); + } return sb_error; } SBThread -SBProcess::GetThreadByID (tid_t sb_thread_id) +SBProcess::GetThreadByID (tid_t tid) { - SBThread thread; + SBThread sb_thread; if (m_opaque_sp) - thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) sb_thread_id)); - return thread; + sb_thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) tid)); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4x) => SBThread (%p)", + m_opaque_sp.get(), + tid, + sb_thread.get()); + } + + return sb_thread; } StateType @@ -591,6 +604,16 @@ size_t bytes_read = 0; + if (log) + { + log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p))...", + m_opaque_sp.get(), + addr, + dst, + (uint32_t) dst_len, + sb_error.get()); + } + if (IsValid()) { Error error; @@ -606,7 +629,7 @@ { SBStream sstr; sb_error.GetDescription (sstr); - log->Printf ("SBProcess(%p)::ReadMemory (addr=%llx, dst=%p, dst_len=%d, SBError (%p): %s) => %d", + log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%zu, SBError (%p): %s) => %d", m_opaque_sp.get(), addr, dst, @@ -624,6 +647,17 @@ { size_t bytes_written = 0; + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + { + log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p))...", + m_opaque_sp.get(), + addr, + src, + (uint32_t) src_len, + sb_error.get()); + } + if (IsValid()) { Error error; @@ -631,6 +665,20 @@ sb_error.SetError (error); } + if (log) + { + SBStream sstr; + sb_error.GetDescription (sstr); + log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p): %s) => %d", + m_opaque_sp.get(), + addr, + src, + (uint32_t) src_len, + sb_error.get(), + sstr.GetData(), + (uint32_t) bytes_written); + } + return bytes_written; } Modified: lldb/trunk/source/API/SBSymbol.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbol.cpp (original) +++ lldb/trunk/source/API/SBSymbol.cpp Fri Oct 29 23:51:46 2010 @@ -27,16 +27,6 @@ SBSymbol::SBSymbol (lldb_private::Symbol *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 ("SBSymbol::SBSymbol (lldb_object_ptr=%p) => this.obj = %p (%s)", lldb_object_ptr, m_opaque_ptr, - sstr.GetData()); - - } } SBSymbol::~SBSymbol () @@ -53,32 +43,27 @@ const char * SBSymbol::GetName() const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBSymbol::GetName ()"); - + const char *name = NULL; if (m_opaque_ptr) - { - if (log) - log->Printf ("SBSymbol::GetName (this.obj=%p) => '%s'", m_opaque_ptr, - m_opaque_ptr->GetMangled().GetName().AsCString()); + name = m_opaque_ptr->GetMangled().GetName().AsCString(); - return m_opaque_ptr->GetMangled().GetName().AsCString(); - } - + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBSymbol::GetName (this.obj=%p) => NULL", m_opaque_ptr); - - return NULL; + log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : ""); + return name; } const char * SBSymbol::GetMangledName () const { + const char *name = NULL; if (m_opaque_ptr) - return m_opaque_ptr->GetMangled().GetMangledName().AsCString(); - return NULL; + name = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + if (log) + log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : ""); + + return name; } Modified: lldb/trunk/source/API/SBSymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbolContext.cpp (original) +++ lldb/trunk/source/API/SBSymbolContext.cpp Fri Oct 29 23:51:46 2010 @@ -25,26 +25,13 @@ SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - if (sc_ptr) m_opaque_ap.reset (new SymbolContext (*sc_ptr)); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBSymbolContext::SBSymcolContext (sc_ptr=%p) => this.ap = %p (%s)", - sc_ptr, m_opaque_ap.get(), sstr.GetData()); - } } SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) : m_opaque_ap () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (rhs.IsValid()) { if (m_opaque_ap.get()) @@ -52,11 +39,6 @@ else ref() = *rhs.m_opaque_ap; } - - if (log) - log->Printf ("SBSymbolContext::SBSymcolContext (rhs.ap=%p) => this.ap = %p", - (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), m_opaque_ap.get()); - } SBSymbolContext::~SBSymbolContext () @@ -104,9 +86,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetModule ()"); - SBModule sb_module; if (m_opaque_ap.get()) sb_module.SetModule(m_opaque_ap->module_sp); @@ -115,8 +94,8 @@ { SBStream sstr; sb_module.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetModule (this.ap=%p) => SBModule (this.sp = %p, '%s')", m_opaque_ap.get(), - sb_module.get(), sstr.GetData()); + log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s", + m_opaque_ap.get(), sb_module.get(), sstr.GetData()); } return sb_module; @@ -133,13 +112,10 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetFunction ()"); - SBFunction ret_function (m_opaque_ap.get() ? m_opaque_ap->function : NULL); if (log) - log->Printf ("SBSymbolContext::GetFunction (this.ap=%p) => SBFunction (this.obj = %p, '%s')", + log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p): %s", m_opaque_ap.get(), ret_function.get(), ret_function.GetName()); return ret_function; @@ -156,9 +132,6 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetLineEntry ()"); - SBLineEntry sb_line_entry; if (m_opaque_ap.get()) sb_line_entry.SetLineEntry (m_opaque_ap->line_entry); @@ -167,7 +140,7 @@ { SBStream sstr; sb_line_entry.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetLineEntry (this.ap=%p) => SBLineEntry (this.ap = %p, '%s')", + log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p): %s", m_opaque_ap.get(), sb_line_entry.get(), sstr.GetData()); } @@ -180,16 +153,13 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBSymbolContext::GetSymbol ()"); - SBSymbol ret_symbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL); if (log) { SBStream sstr; ret_symbol.GetDescription (sstr); - log->Printf ("SBSymbolContext::GetSymbol (this.ap=%p) => SBSymbol (this.ap = %p, '%s')", m_opaque_ap.get(), + log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p): %s", m_opaque_ap.get(), ret_symbol.get(), sstr.GetData()); } Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Fri Oct 29 23:51:46 2010 @@ -57,48 +57,31 @@ 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()); - } +// 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()); - } -} - -const SBTarget& -SBTarget::Assign (const SBTarget& rhs) -{ - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBTarget(%p)::Assign (rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); - - if (this != &rhs) - { - m_opaque_sp = rhs.m_opaque_sp; - } - - return *this; +// 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()); +// } } - //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- @@ -178,7 +161,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%i)", + log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty=\"%s\", launch_flags=%d, stop_at_entry=%i)", m_opaque_sp.get(), argv, envp, tty, launch_flags, stop_at_entry); SBError sb_error; @@ -211,7 +194,7 @@ if (log) { - log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, tty='%s', launch_flags=%d, stop_at_entry=%i, &error (%p))...", + log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, tty=\"%s\", launch_flags=%d, stop_at_entry=%i, &error (%p))...", m_opaque_sp.get(), argv, envp, tty, launch_flags, stop_at_entry, error.get()); } SBProcess sb_process; @@ -429,20 +412,7 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - SBBreakpoint sb_bp; - if (file != NULL && line != 0) - sb_bp = BreakpointCreateByLocation (SBFileSpec (file), line); - - if (log) - { - SBStream sstr; - sb_bp.GetDescription (sstr); - log->Printf("SBTarget(%p)::BreakpointCreateByLocation (file='%s', line=%d) => SBBreakpoint(%p): %s", m_opaque_sp.get(), file, line, sb_bp.get(), sstr.GetData()); - } - - return sb_bp; + return SBBreakpoint(BreakpointCreateByLocation (SBFileSpec (file), line)); } SBBreakpoint @@ -458,8 +428,13 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByLocation (sb_file_spec.ap=%p, line=%d) => " - "SBBreakpoint(%p): %s", m_opaque_sp.get(), sb_file_spec.get(), line, sb_bp.get(), + 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", + m_opaque_sp.get(), + dir ? dir : "", dir ? "/" : "", file ? file : "", + line, + sb_bp.get(), sstr.GetData()); } @@ -489,7 +464,7 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol_name='%s', module_name='%s') => " + 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()); } @@ -523,7 +498,7 @@ { SBStream sstr; sb_bp.GetDescription (sstr); - log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_name_regex='%s', module_name='%s') " + 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()); } Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Oct 29 23:51:46 2010 @@ -49,27 +49,10 @@ SBThread::SBThread (const ThreadSP& lldb_object_sp) : m_opaque_sp (lldb_object_sp) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - { - SBStream sstr; - GetDescription (sstr); - log->Printf ("SBThread::SBThread (lldb_object_sp=%p) => SBThread(%p) :%s", - lldb_object_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } } SBThread::SBThread (const SBThread &rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - m_opaque_sp = rhs.m_opaque_sp; - - if (log) - log->Printf ("SBThread::SBThread (rhs.sp=%p) => SBThread(%p)", - rhs.m_opaque_sp.get(), m_opaque_sp.get()); - } //---------------------------------------------------------------------- @@ -106,7 +89,7 @@ } if (log) - log->Printf ("SBThread(%p)::GetStopReason () => '%s'", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::GetStopReason () => %s", m_opaque_sp.get(), Thread::StopReasonAsCString (reason)); return reason; @@ -126,7 +109,7 @@ if (stop_desc) { if (log) - log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'", + log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"", m_opaque_sp.get(), stop_desc); if (dst) return ::snprintf (dst, dst_len, "%s", stop_desc); @@ -224,15 +207,12 @@ { Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - //if (log) - // log->Printf ("SBThread::GetThreadID()"); - lldb::tid_t id = LLDB_INVALID_THREAD_ID; if (m_opaque_sp) id = m_opaque_sp->GetID(); if (log) - log->Printf ("SBThread::GetThreadID (this.sp=%p) => %d", m_opaque_sp.get(), (uint32_t) id); + log->Printf ("SBThread(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), id); return id; } @@ -247,44 +227,29 @@ const char * SBThread::GetName () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBThread::GetName ()"); - + const char *name = NULL; if (m_opaque_sp) - { - if (log) - log->Printf ("SBThread::GetName (this.sp=%p) => '%s'", m_opaque_sp.get(), m_opaque_sp->GetName()); - return m_opaque_sp->GetName(); - } - + name = m_opaque_sp->GetName(); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::GetName (this.sp=%p) => NULL", m_opaque_sp.get()); + log->Printf ("SBThread(%p)::GetName () => %s", m_opaque_sp.get(), name ? name : "NULL"); - return NULL; + return name; } const char * SBThread::GetQueueName () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - //if (log) - // log->Printf ("SBThread::GetQueueName ()"); - + const char *name = NULL; if (m_opaque_sp) - { - if (log) - log->Printf ("SBThread::GetQueueName (this.sp=%p) => '%s'", m_opaque_sp.get(), - m_opaque_sp->GetQueueName()); - return m_opaque_sp->GetQueueName(); - } - + name = m_opaque_sp->GetQueueName(); + + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::GetQueueName (this.sp=%p) => NULL", m_opaque_sp.get()); + log->Printf ("SBThread(%p)::GetQueueName () => %s", m_opaque_sp.get(), name ? name : "NULL"); - return NULL; + return name; } @@ -390,7 +355,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); if (log) - log->Printf ("SBThread::StepOut (this.sp=%p)", m_opaque_sp.get()); + log->Printf ("SBThread(%p)::StepOut ()", m_opaque_sp.get()); if (m_opaque_sp) { @@ -482,7 +447,7 @@ { SBStream sstr; process.GetDescription (sstr); - log->Printf ("SBThread::GetProcess (this.sp=%p) => SBProcess : this.sp = %p, '%s'", m_opaque_sp.get(), + log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", m_opaque_sp.get(), process.get(), sstr.GetData()); } @@ -499,7 +464,7 @@ num_frames = m_opaque_sp->GetStackFrameCount(); if (log) - log->Printf ("SBThread::GetNumFrames (this.sp=%p) => %d", m_opaque_sp.get(), num_frames); + log->Printf ("SBThread(%p)::GetNumFrames () => %u", m_opaque_sp.get(), num_frames); return num_frames; } @@ -517,7 +482,7 @@ { SBStream sstr; sb_frame.GetDescription (sstr); - log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame.sp : this = %p, '%s'", + log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s", m_opaque_sp.get(), idx, sb_frame.get(), sstr.GetData()); } @@ -527,12 +492,8 @@ const lldb::SBThread & SBThread::operator = (const lldb::SBThread &rhs) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); - - if (log) - log->Printf ("SBThread(%p)::operator= (rhs.sp=%p)", m_opaque_sp.get(), rhs.m_opaque_sp.get()); - - m_opaque_sp = rhs.m_opaque_sp; + if (this != &rhs) + m_opaque_sp = rhs.m_opaque_sp; return *this; } @@ -549,7 +510,7 @@ } lldb_private::Thread * -SBThread::GetLLDBObjectPtr () +SBThread::get () { return m_opaque_sp.get(); } @@ -579,20 +540,6 @@ } bool -SBThread::GetDescription (SBStream &description) -{ - if (m_opaque_sp) - { - StreamString strm; - description.Printf("SBThread: tid = 0x%4.4x", m_opaque_sp->GetID()); - } - else - description.Printf ("No value"); - - return true; -} - -bool SBThread::GetDescription (SBStream &description) const { if (m_opaque_sp) Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117772&r1=117771&r2=117772&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Fri Oct 29 23:51:46 2010 @@ -80,7 +80,7 @@ } else { - s->Printf ("%s", GetExecutableModule()->GetFileSpec().GetFilename().GetCString()); + s->PutCString (GetExecutableModule()->GetFileSpec().GetFilename().GetCString()); } } From johnny.chen at apple.com Sat Oct 30 02:36:05 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 30 Oct 2010 07:36:05 -0000 Subject: [Lldb-commits] [lldb] r117777 - /lldb/trunk/utils/emacs/lldb-gud-window.tiff Message-ID: <20101030073605.500222A6C12D@llvm.org> Author: johnny Date: Sat Oct 30 02:36:05 2010 New Revision: 117777 URL: http://llvm.org/viewvc/llvm-project?rev=117777&view=rev Log: Submit the screen capture as a followup of r117752. Added: lldb/trunk/utils/emacs/lldb-gud-window.tiff (with props) Added: lldb/trunk/utils/emacs/lldb-gud-window.tiff URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/lldb-gud-window.tiff?rev=117777&view=auto ============================================================================== Binary file - no diff available. Propchange: lldb/trunk/utils/emacs/lldb-gud-window.tiff ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream From benny.kra at googlemail.com Sat Oct 30 03:27:08 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sat, 30 Oct 2010 08:27:08 -0000 Subject: [Lldb-commits] [lldb] r117778 - in /lldb/trunk/utils/emacs: lldb-gud-window.png lldb-gud-window.tiff Message-ID: <20101030082708.3E55C2A6C12C@llvm.org> Author: d0k Date: Sat Oct 30 03:27:07 2010 New Revision: 117778 URL: http://llvm.org/viewvc/llvm-project?rev=117778&view=rev Log: Compress screenshot. Added: lldb/trunk/utils/emacs/lldb-gud-window.png Removed: lldb/trunk/utils/emacs/lldb-gud-window.tiff Added: lldb/trunk/utils/emacs/lldb-gud-window.png URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/lldb-gud-window.png?rev=117778&view=auto ============================================================================== Binary files lldb/trunk/utils/emacs/lldb-gud-window.png (added) and lldb/trunk/utils/emacs/lldb-gud-window.png Sat Oct 30 03:27:07 2010 differ Removed: lldb/trunk/utils/emacs/lldb-gud-window.tiff URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/lldb-gud-window.tiff?rev=117777&view=auto ============================================================================== Binary file - no diff available. From gclayton at apple.com Sat Oct 30 13:27:00 2010 From: gclayton at apple.com (Greg Clayton) Date: Sat, 30 Oct 2010 18:27:00 -0000 Subject: [Lldb-commits] [lldb] r117825 - /lldb/trunk/source/API/SBThread.cpp Message-ID: <20101030182700.121C22A6C12C@llvm.org> Author: gclayton Date: Sat Oct 30 13:26:59 2010 New Revision: 117825 URL: http://llvm.org/viewvc/llvm-project?rev=117825&view=rev Log: Fixed the copy constructor for SBThread. Modified: lldb/trunk/source/API/SBThread.cpp Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117825&r1=117824&r2=117825&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Sat Oct 30 13:26:59 2010 @@ -51,7 +51,8 @@ { } -SBThread::SBThread (const SBThread &rhs) +SBThread::SBThread (const SBThread &rhs) : + m_opaque_sp (rhs.m_opaque_sp) { } @@ -490,7 +491,7 @@ } const lldb::SBThread & -SBThread::operator = (const lldb::SBThread &rhs) +SBThread::operator = (const SBThread &rhs) { if (this != &rhs) m_opaque_sp = rhs.m_opaque_sp; From johnny.chen at apple.com Sat Oct 30 16:22:23 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Sat, 30 Oct 2010 14:22:23 -0700 Subject: [Lldb-commits] [lldb] r117778 - in /lldb/trunk/utils/emacs: lldb-gud-window.png lldb-gud-window.tiff In-Reply-To: <20101030082708.3E55C2A6C12C@llvm.org> References: <20101030082708.3E55C2A6C12C@llvm.org> Message-ID: Thanks! Sent from my iPhone ?????E On Oct 30, 2010, at 1:27 AM, Benjamin Kramer wrote: > Author: d0k > Date: Sat Oct 30 03:27:07 2010 > New Revision: 117778 > > URL: http://llvm.org/viewvc/llvm-project?rev=117778&view=rev > Log: > Compress screenshot. > > Added: > lldb/trunk/utils/emacs/lldb-gud-window.png > Removed: > lldb/trunk/utils/emacs/lldb-gud-window.tiff > > Added: lldb/trunk/utils/emacs/lldb-gud-window.png > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/lldb-gud-window.png?rev=117778&view=auto > ============================================================================== > Binary files lldb/trunk/utils/emacs/lldb-gud-window.png (added) and lldb/trunk/utils/emacs/lldb-gud-window.png Sat Oct 30 03:27:07 2010 differ > > Removed: lldb/trunk/utils/emacs/lldb-gud-window.tiff > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/emacs/lldb-gud-window.tiff?rev=117777&view=auto > ============================================================================== > Binary file - no diff available. > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From gclayton at apple.com Sat Oct 30 22:01:06 2010 From: gclayton at apple.com (Greg Clayton) Date: Sun, 31 Oct 2010 03:01:06 -0000 Subject: [Lldb-commits] [lldb] r117851 - in /lldb/trunk: include/lldb/API/ include/lldb/Core/ lldb.xcodeproj/ source/API/ source/Core/ source/Host/common/ source/Interpreter/ source/Target/ Message-ID: <20101031030106.AFEF72A6C12C@llvm.org> Author: gclayton Date: Sat Oct 30 22:01:06 2010 New Revision: 117851 URL: http://llvm.org/viewvc/llvm-project?rev=117851&view=rev Log: Cleaned up the API logging a lot more to reduce redundant information and keep the file size a bit smaller. Exposed SBValue::GetExpressionPath() so SBValue users can get an expression path for their values. Modified: lldb/trunk/include/lldb/API/SBBroadcaster.h lldb/trunk/include/lldb/API/SBStream.h lldb/trunk/include/lldb/API/SBValue.h lldb/trunk/include/lldb/Core/Address.h lldb/trunk/include/lldb/Core/Broadcaster.h lldb/trunk/include/lldb/Core/FileSpec.h lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBAddress.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/API/SBBroadcaster.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBCommandReturnObject.cpp lldb/trunk/source/API/SBCommunication.cpp lldb/trunk/source/API/SBCompileUnit.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBError.cpp lldb/trunk/source/API/SBEvent.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBFunction.cpp lldb/trunk/source/API/SBHostOS.cpp lldb/trunk/source/API/SBInputReader.cpp lldb/trunk/source/API/SBLineEntry.cpp lldb/trunk/source/API/SBListener.cpp lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBSymbolContext.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Core/Broadcaster.cpp lldb/trunk/source/Core/FileSpec.cpp lldb/trunk/source/Core/Log.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/include/lldb/API/SBBroadcaster.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBroadcaster.h?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBroadcaster.h (original) +++ lldb/trunk/include/lldb/API/SBBroadcaster.h Sat Oct 30 22:01:06 2010 @@ -39,7 +39,7 @@ AddListener (const lldb::SBListener &listener, uint32_t event_mask); const char * - GetName (); + GetName () const; bool EventTypeHasListeners (uint32_t event_type); Modified: lldb/trunk/include/lldb/API/SBStream.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStream.h?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBStream.h (original) +++ lldb/trunk/include/lldb/API/SBStream.h Sat Oct 30 22:01:06 2010 @@ -70,6 +70,7 @@ friend class SBSymbolContext; friend class SBTarget; friend class SBThread; + friend class SBValue; #ifndef SWIG Modified: lldb/trunk/include/lldb/API/SBValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValue.h (original) +++ lldb/trunk/include/lldb/API/SBValue.h Sat Oct 30 22:01:06 2010 @@ -89,11 +89,14 @@ Dereference (); bool - TypeIsPtrType (); + TypeIsPointerType (); bool GetDescription (lldb::SBStream &description); + bool + GetExpressionPath (lldb::SBStream &description); + protected: friend class SBValueList; friend class SBFrame; Modified: lldb/trunk/include/lldb/Core/Address.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Address.h (original) +++ lldb/trunk/include/lldb/Core/Address.h Sat Oct 30 22:01:06 2010 @@ -247,21 +247,6 @@ 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 Modified: lldb/trunk/include/lldb/Core/Broadcaster.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Broadcaster.h?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Broadcaster.h (original) +++ lldb/trunk/include/lldb/Core/Broadcaster.h Sat Oct 30 22:01:06 2010 @@ -12,10 +12,10 @@ // C Includes // C++ Includes +#include #include #include - // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" @@ -142,6 +142,35 @@ 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 @@ // Classes that inherit from Broadcaster can see and modify these //------------------------------------------------------------------ typedef std::vector< std::pair > collection; + typedef std::map 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: //------------------------------------------------------------------ Modified: lldb/trunk/include/lldb/Core/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpec.h?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/FileSpec.h (original) +++ lldb/trunk/include/lldb/Core/FileSpec.h Sat Oct 30 22:01:06 2010 @@ -348,10 +348,14 @@ /// 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 Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Sat Oct 30 22:01:06 2010 @@ -88,7 +88,7 @@ } virtual void - GetExpressionPath (Stream &s);//, ValueObject *child); + GetExpressionPath (Stream &s); virtual bool IsInScope (StackFrame *frame) Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sat Oct 30 22:01:06 2010 @@ -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; }; Modified: lldb/trunk/source/API/SBAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBAddress.cpp (original) +++ lldb/trunk/source/API/SBAddress.cpp Sat Oct 30 22:01:06 2010 @@ -25,31 +25,15 @@ 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 @@ 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 @@ 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 @@ 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"); Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Sat Oct 30 22:01:06 2010 @@ -242,7 +242,7 @@ { 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; Modified: lldb/trunk/source/API/SBBroadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBBroadcaster.cpp (original) +++ lldb/trunk/source/API/SBBroadcaster.cpp Sat Oct 30 22:01:06 2010 @@ -37,7 +37,7 @@ 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 @@ } const char * -SBBroadcaster::GetName () +SBBroadcaster::GetName () const { if (m_opaque) - return m_opaque->GetBroadcasterName().AsCString(); + return m_opaque->GetBroadcasterName().GetCString(); return NULL; } Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Sat Oct 30 22:01:06 2010 @@ -73,8 +73,8 @@ 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 @@ { 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(); Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandReturnObject.cpp (original) +++ lldb/trunk/source/API/SBCommandReturnObject.cpp Sat Oct 30 22:01:06 2010 @@ -19,10 +19,6 @@ 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 @@ { 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 @@ { 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; } Modified: lldb/trunk/source/API/SBCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommunication.cpp (original) +++ lldb/trunk/source/API/SBCommunication.cpp Sat Oct 30 22:01:06 2010 @@ -31,8 +31,8 @@ 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() Modified: lldb/trunk/source/API/SBCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBCompileUnit.cpp (original) +++ lldb/trunk/source/API/SBCompileUnit.cpp Sat Oct 30 22:01:06 2010 @@ -27,15 +27,6 @@ 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 @@ { 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 @@ { 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 @@ { 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 @@ 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 Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Sat Oct 30 22:01:06 2010 @@ -118,8 +118,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { 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"); Modified: lldb/trunk/source/API/SBError.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBError.cpp (original) +++ lldb/trunk/source/API/SBError.cpp Sat Oct 30 22:01:06 2010 @@ -26,18 +26,8 @@ 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 @@ 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 @@ 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; } Modified: lldb/trunk/source/API/SBEvent.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBEvent.cpp (original) +++ lldb/trunk/source/API/SBEvent.cpp Sat Oct 30 22:01:06 2010 @@ -33,26 +33,12 @@ 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 @@ 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 @@ 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 @@ 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(EventDataBytes::GetBytesFromEvent (event.get()))); Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Sat Oct 30 22:01:06 2010 @@ -34,7 +34,7 @@ { 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 @@ 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 @@ 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 @@ 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 @@ { 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 @@ { 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"); Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Sat Oct 30 22:01:06 2010 @@ -210,7 +210,7 @@ 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 @@ 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 @@ 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 @@ { 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 @@ { 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 @@ 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; } Modified: lldb/trunk/source/API/SBFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBFunction.cpp (original) +++ lldb/trunk/source/API/SBFunction.cpp Sat Oct 30 22:01:06 2010 @@ -30,16 +30,6 @@ 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 @@ 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 Modified: lldb/trunk/source/API/SBHostOS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBHostOS.cpp (original) +++ lldb/trunk/source/API/SBHostOS.cpp Sat Oct 30 22:01:06 2010 @@ -38,7 +38,7 @@ 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? Modified: lldb/trunk/source/API/SBInputReader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBInputReader.cpp (original) +++ lldb/trunk/source/API/SBInputReader.cpp Sat Oct 30 22:01:06 2010 @@ -88,7 +88,7 @@ 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, Modified: lldb/trunk/source/API/SBLineEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBLineEntry.cpp (original) +++ lldb/trunk/source/API/SBLineEntry.cpp Sat Oct 30 22:01:06 2010 @@ -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 (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 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 @@ 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 @@ 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 @@ { 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 @@ { 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 @@ { 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 @@ { if (m_opaque_ap.get()) { - // Line entry: File, line x {, column y}: Addresses: - 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"); Modified: lldb/trunk/source/API/SBListener.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBListener.cpp (original) +++ lldb/trunk/source/API/SBListener.cpp Sat Oct 30 22:01:06 2010 @@ -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 @@ 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 @@ 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 @@ { 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 @@ } 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 Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Sat Oct 30 22:01:06 2010 @@ -51,10 +51,8 @@ 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; Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Sat Oct 30 22:01:06 2010 @@ -152,7 +152,7 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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; Modified: lldb/trunk/source/API/SBSymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBSymbolContext.cpp (original) +++ lldb/trunk/source/API/SBSymbolContext.cpp Sat Oct 30 22:01:06 2010 @@ -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 @@ { 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 @@ 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 @@ { 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* Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Sat Oct 30 22:01:06 2010 @@ -57,29 +57,11 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ SBFileSpec SBTarget::GetExecutable () { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); SBFileSpec exe_file_spec; if (m_opaque_sp) @@ -352,18 +325,11 @@ 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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Sat Oct 30 22:01:06 2010 @@ -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 @@ } //---------------------------------------------------------------------- +// 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 @@ 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 { Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Sat Oct 30 22:01:06 2010 @@ -42,14 +42,6 @@ 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 @@ 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 @@ 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() : ""); + 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 @@ { 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 @@ { 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 @@ { 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 @@ 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 @@ { 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 @@ { bool result = true; - if (IsValid()) - { + if (m_opaque_sp) result = m_opaque_sp->GetValueIsValid(); - } return result; } @@ -249,25 +338,31 @@ 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 @@ } 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) Modified: lldb/trunk/source/Core/Address.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Core/Address.cpp (original) +++ lldb/trunk/source/Core/Address.cpp Sat Oct 30 22:01:06 2010 @@ -410,7 +410,8 @@ 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 @@ return false; } s->Address (file_addr, addr_size); - if (style == DumpStyleModuleWithFileAddress) + if (style == DumpStyleModuleWithFileAddress && m_section) s->PutChar(']'); } break; @@ -737,21 +738,6 @@ } } -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) { Modified: lldb/trunk/source/Core/Broadcaster.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Broadcaster.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Core/Broadcaster.cpp (original) +++ lldb/trunk/source/Core/Broadcaster.cpp Sat Oct 30 22:01:06 2010 @@ -23,10 +23,10 @@ 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 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ 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; } Modified: lldb/trunk/source/Core/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpec.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Core/FileSpec.cpp (original) +++ lldb/trunk/source/Core/FileSpec.cpp Sat Oct 30 22:01:06 2010 @@ -559,41 +559,27 @@ // 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; } //------------------------------------------------------------------ Modified: lldb/trunk/source/Core/Log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Core/Log.cpp (original) +++ lldb/trunk/source/Core/Log.cpp Sat Oct 30 22:01:06 2010 @@ -116,6 +116,7 @@ const char *thread_name_str = Host::GetThreadName (getpid(), Host::GetCurrentThreadID()); if (thread_name_str) header.Printf ("%s ", thread_name_str); + } header.PrintfVarArg (format, args); Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Sat Oct 30 22:01:06 2010 @@ -380,13 +380,16 @@ { 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 Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Sat Oct 30 22:01:06 2010 @@ -22,6 +22,7 @@ #include #if defined (__APPLE__) +#include #include #include #endif @@ -545,6 +546,13 @@ 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 } Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Sat Oct 30 22:01:06 2010 @@ -58,7 +58,7 @@ 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 @@ 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 Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Sat Oct 30 22:01:06 2010 @@ -66,7 +66,7 @@ //---------------------------------------------------------------------- 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 @@ 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 | Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117851&r1=117850&r2=117851&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Sat Oct 30 22:01:06 2010 @@ -35,7 +35,7 @@ // Target constructor //---------------------------------------------------------------------- Target::Target(Debugger &debugger) : - Broadcaster("Target"), + Broadcaster("lldb.target"), TargetInstanceSettings (*(Target::GetSettingsController().get())), m_debugger (debugger), m_images(), @@ -48,6 +48,10 @@ 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); From gclayton at apple.com Sat Oct 30 22:02:30 2010 From: gclayton at apple.com (Greg Clayton) Date: Sun, 31 Oct 2010 03:02:30 -0000 Subject: [Lldb-commits] [lldb] r117852 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20101031030230.E406E2A6C12C@llvm.org> Author: gclayton Date: Sat Oct 30 22:02:30 2010 New Revision: 117852 URL: http://llvm.org/viewvc/llvm-project?rev=117852&view=rev Log: Bumped version in Xcode project to lldb-27, and debugserver to debugserver-115. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/resources/LLDB-Info.plist lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117852&r1=117851&r2=117852&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sat Oct 30 22:02:30 2010 @@ -2991,9 +2991,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 26; + DYLIB_CURRENT_VERSION = 27; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3045,11 +3045,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 26; + DYLIB_CURRENT_VERSION = 27; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3120,7 +3120,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3156,11 +3156,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 26; + DYLIB_CURRENT_VERSION = 27; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3210,7 +3210,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3250,7 +3250,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", Modified: lldb/trunk/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=117852&r1=117851&r2=117852&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Sat Oct 30 22:02:30 2010 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 26 + 27 CFBundleName ${EXECUTABLE_NAME} Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=117852&r1=117851&r2=117852&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Sat Oct 30 22:02:30 2010 @@ -456,7 +456,7 @@ i386, ); COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; STRIP_INSTALLED_PRODUCT = NO; @@ -474,7 +474,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -494,7 +494,7 @@ x86_64, i386, ); - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; DEAD_CODE_STRIPPING = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -511,7 +511,7 @@ buildSettings = { "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( @@ -552,7 +552,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( "$(SDKROOT)/System/Library/PrivateFrameworks", @@ -593,7 +593,7 @@ "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 114; + CURRENT_PROJECT_VERSION = 115; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks; "FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = ( From gclayton at apple.com Sun Oct 31 14:57:43 2010 From: gclayton at apple.com (Greg Clayton) Date: Sun, 31 Oct 2010 19:57:43 -0000 Subject: [Lldb-commits] [lldb] r117864 - /lldb/trunk/source/API/SBModule.cpp Message-ID: <20101031195743.DA7362A6C12C@llvm.org> Author: gclayton Date: Sun Oct 31 14:57:43 2010 New Revision: 117864 URL: http://llvm.org/viewvc/llvm-project?rev=117864&view=rev Log: Fixed an include so case sensitive builders can build. Modified: lldb/trunk/source/API/SBModule.cpp Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=117864&r1=117863&r2=117864&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Sun Oct 31 14:57:43 2010 @@ -14,7 +14,7 @@ #include "lldb/API/SBStream.h" #include "lldb/Core/Module.h" #include "lldb/Core/Log.h" -#include "lldb/Core/STreamString.h" +#include "lldb/Core/StreamString.h" using namespace lldb; using namespace lldb_private; From gclayton at apple.com Sun Oct 31 14:58:25 2010 From: gclayton at apple.com (Greg Clayton) Date: Sun, 31 Oct 2010 19:58:25 -0000 Subject: [Lldb-commits] [lldb] r117865 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist Message-ID: <20101031195825.5D0612A6C12C@llvm.org> Author: gclayton Date: Sun Oct 31 14:58:25 2010 New Revision: 117865 URL: http://llvm.org/viewvc/llvm-project?rev=117865&view=rev Log: Bumped lldb Xcode project version to 28 for lldb-28. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/resources/LLDB-Info.plist Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117865&r1=117864&r2=117865&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Oct 31 14:58:25 2010 @@ -2991,9 +2991,9 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 27; + DYLIB_CURRENT_VERSION = 28; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3045,11 +3045,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 27; + DYLIB_CURRENT_VERSION = 28; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3120,7 +3120,7 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3156,11 +3156,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 27; + DYLIB_CURRENT_VERSION = 28; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -3210,7 +3210,7 @@ buildSettings = { CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3250,7 +3250,7 @@ ); CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 27; + CURRENT_PROJECT_VERSION = 28; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", Modified: lldb/trunk/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=117865&r1=117864&r2=117865&view=diff ============================================================================== --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Sun Oct 31 14:58:25 2010 @@ -17,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 27 + 28 CFBundleName ${EXECUTABLE_NAME} From gclayton at apple.com Sun Oct 31 15:13:10 2010 From: gclayton at apple.com (Greg Clayton) Date: Sun, 31 Oct 2010 20:13:10 -0000 Subject: [Lldb-commits] [lldb] r117866 - /lldb/trunk/lldb.xcodeproj/project.pbxproj Message-ID: <20101031201311.081FF2A6C12C@llvm.org> Author: gclayton Date: Sun Oct 31 15:13:10 2010 New Revision: 117866 URL: http://llvm.org/viewvc/llvm-project?rev=117866&view=rev Log: Make sure darwin-debug gets installed in /Developer/usr/bin instead of /usr/local/bin. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=117866&r1=117865&r2=117866&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Oct 31 15:13:10 2010 @@ -2953,7 +2953,7 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - INSTALL_PATH = /usr/local/bin; + INSTALL_PATH = /Developer/usr/bin; PREBINDING = NO; PRODUCT_NAME = "darwin-debug"; }; @@ -2967,7 +2967,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; - INSTALL_PATH = /usr/local/bin; + INSTALL_PATH = /Developer/usr/bin; PREBINDING = NO; PRODUCT_NAME = "darwin-debug"; ZERO_LINK = NO; @@ -2980,7 +2980,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; - INSTALL_PATH = /usr/local/bin; + INSTALL_PATH = /Developer/usr/bin; PREBINDING = NO; PRODUCT_NAME = "darwin-debug"; }; From scallanan at apple.com Sun Oct 31 23:38:59 2010 From: scallanan at apple.com (Sean Callanan) Date: Mon, 01 Nov 2010 04:38:59 -0000 Subject: [Lldb-commits] [lldb] r117896 - /lldb/trunk/source/Target/StackFrame.cpp Message-ID: <20101101043859.4A3EB2A6C12C@llvm.org> Author: spyffe Date: Sun Oct 31 23:38:59 2010 New Revision: 117896 URL: http://llvm.org/viewvc/llvm-project?rev=117896&view=rev Log: Fixed StackFrame::GetVariableList to add global variables to the list of found variables if they have not yet been added. Modified: lldb/trunk/source/Target/StackFrame.cpp Modified: lldb/trunk/source/Target/StackFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=117896&r1=117895&r2=117896&view=diff ============================================================================== --- lldb/trunk/source/Target/StackFrame.cpp (original) +++ lldb/trunk/source/Target/StackFrame.cpp Sun Oct 31 23:38:59 2010 @@ -36,6 +36,7 @@ #define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_CODE_ADDR << 1) #define GOT_FRAME_BASE (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1) #define RESOLVED_VARIABLES (GOT_FRAME_BASE << 1) +#define RESOLVED_GLOBAL_VARIABLES (RESOLVED_VARIABLES << 1) StackFrame::StackFrame ( @@ -454,22 +455,26 @@ const bool can_create = true; m_variable_list_sp = frame_block->GetVariableList (get_child_variables, can_create); } + } + + if (m_flags.IsClear(RESOLVED_GLOBAL_VARIABLES) && + get_file_globals) + { + m_flags.Set(RESOLVED_GLOBAL_VARIABLES); - if (get_file_globals) + if (m_flags.IsClear (eSymbolContextCompUnit)) + GetSymbolContext (eSymbolContextCompUnit); + + if (m_sc.comp_unit) { - if (m_flags.IsClear (eSymbolContextCompUnit)) - GetSymbolContext (eSymbolContextCompUnit); - - if (m_sc.comp_unit) - { - VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true)); - if (m_variable_list_sp) - m_variable_list_sp->AddVariables (global_variable_list_sp.get()); - else - m_variable_list_sp = global_variable_list_sp; - } + VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true)); + if (m_variable_list_sp) + m_variable_list_sp->AddVariables (global_variable_list_sp.get()); + else + m_variable_list_sp = global_variable_list_sp; } } + return m_variable_list_sp.get(); }