summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/Makefile90
-rw-r--r--lldb/include/Makefile13
-rw-r--r--lldb/include/lldb/API/SBBreakpoint.h4
-rw-r--r--lldb/include/lldb/API/SBBreakpointLocation.h4
-rw-r--r--lldb/include/lldb/Breakpoint/Breakpoint.h4
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointIDList.h16
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointLocation.h4
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h10
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointLocationList.h16
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointOptions.h6
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointSite.h4
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointSiteList.h18
-rw-r--r--lldb/include/lldb/Breakpoint/StoppointLocation.h6
-rw-r--r--lldb/include/lldb/Breakpoint/WatchpointLocation.h6
-rw-r--r--lldb/include/lldb/Core/FileSpec.h4
-rw-r--r--lldb/include/lldb/Expression/ClangExpression.h1
-rw-r--r--lldb/include/lldb/Expression/ClangFunction.h4
-rw-r--r--lldb/include/lldb/Host/Predicate.h8
-rw-r--r--lldb/include/lldb/Interpreter/CommandCompletions.h2
-rw-r--r--lldb/include/lldb/Makefile31
-rw-r--r--lldb/include/lldb/Target/Process.h8
-rw-r--r--lldb/include/lldb/Target/ThreadPlanShouldStopHere.h2
-rw-r--r--lldb/include/lldb/Target/ThreadSpec.h2
-rw-r--r--lldb/lib/Makefile128
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj6
-rwxr-xr-xlldb/scripts/generate-vers.pl46
-rw-r--r--lldb/source/API/Makefile14
-rw-r--r--lldb/source/API/SBBreakpoint.cpp4
-rw-r--r--lldb/source/API/SBBreakpointLocation.cpp4
-rw-r--r--lldb/source/API/SBFrame.cpp7
-rw-r--r--lldb/source/API/SBTarget.cpp2
-rw-r--r--lldb/source/API/SBThread.cpp7
-rw-r--r--lldb/source/Breakpoint/Breakpoint.cpp29
-rw-r--r--lldb/source/Breakpoint/BreakpointIDList.cpp72
-rw-r--r--lldb/source/Breakpoint/BreakpointLocation.cpp4
-rw-r--r--lldb/source/Breakpoint/BreakpointLocationCollection.cpp23
-rw-r--r--lldb/source/Breakpoint/BreakpointLocationList.cpp31
-rw-r--r--lldb/source/Breakpoint/BreakpointOptions.cpp6
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverFileLine.cpp2
-rw-r--r--lldb/source/Breakpoint/BreakpointSite.cpp8
-rw-r--r--lldb/source/Breakpoint/BreakpointSiteList.cpp22
-rw-r--r--lldb/source/Breakpoint/Makefile14
-rw-r--r--lldb/source/Breakpoint/StoppointLocation.cpp12
-rw-r--r--lldb/source/Breakpoint/WatchpointLocation.cpp4
-rw-r--r--lldb/source/Commands/CommandCompletions.cpp8
-rw-r--r--lldb/source/Commands/CommandObjectAppend.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectApropos.cpp6
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp81
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.h6
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp9
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp10
-rw-r--r--lldb/source/Commands/CommandObjectCrossref.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectHelp.cpp7
-rw-r--r--lldb/source/Commands/CommandObjectImage.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp13
-rw-r--r--lldb/source/Commands/CommandObjectSyntax.cpp48
-rw-r--r--lldb/source/Commands/CommandObjectSyntax.h11
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp2
-rw-r--r--lldb/source/Commands/Makefile14
-rw-r--r--lldb/source/Core/Address.cpp10
-rw-r--r--lldb/source/Core/AddressRange.cpp3
-rw-r--r--lldb/source/Core/AddressResolverFileLine.cpp2
-rw-r--r--lldb/source/Core/ArchSpec.cpp8
-rw-r--r--lldb/source/Core/ConstString.cpp5
-rw-r--r--lldb/source/Core/DataBufferMemoryMap.cpp14
-rw-r--r--lldb/source/Core/DataExtractor.cpp4
-rw-r--r--lldb/source/Core/Error.cpp2
-rw-r--r--lldb/source/Core/FileSpec.cpp18
-rw-r--r--lldb/source/Core/Language.cpp2
-rw-r--r--lldb/source/Core/Makefile14
-rw-r--r--lldb/source/Core/SearchFilter.cpp10
-rw-r--r--lldb/source/Core/Stream.cpp38
-rw-r--r--lldb/source/Core/StreamFile.cpp20
-rw-r--r--lldb/source/Core/StringList.cpp8
-rw-r--r--lldb/source/Core/Value.cpp7
-rw-r--r--lldb/source/Core/ValueObject.cpp5
-rw-r--r--lldb/source/Core/ValueObjectChild.cpp6
-rw-r--r--lldb/source/Expression/ClangExpression.cpp7
-rw-r--r--lldb/source/Expression/ClangFunction.cpp47
-rw-r--r--lldb/source/Expression/ClangStmtVisitor.cpp23
-rw-r--r--lldb/source/Expression/DWARFExpression.cpp3
-rw-r--r--lldb/source/Expression/Makefile14
-rw-r--r--lldb/source/Generated/Makefile19
-rw-r--r--lldb/source/Host/Makefile20
-rw-r--r--lldb/source/Host/linux/Makefile14
-rw-r--r--lldb/source/Host/macosx/Host.mm35
-rw-r--r--lldb/source/Host/macosx/Makefile16
-rw-r--r--lldb/source/Host/macosx/Symbols.cpp7
-rw-r--r--lldb/source/Host/posix/Makefile14
-rw-r--r--lldb/source/Interpreter/Args.cpp11
-rw-r--r--lldb/source/Interpreter/Makefile24
-rw-r--r--lldb/source/Makefile20
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-i386/Makefile14
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/Makefile14
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp3
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/Makefile14
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile14
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h3
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h7
-rw-r--r--lldb/source/Plugins/Makefile21
-rw-r--r--lldb/source/Plugins/ObjectContainer/BSD-Archive/Makefile14
-rw-r--r--lldb/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile14
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/Makefile14
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/Makefile14
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/Makefile17
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h2
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp11
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h12
-rw-r--r--lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp11
-rw-r--r--lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.h2
-rw-r--r--lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp15
-rw-r--r--lldb/source/Plugins/Process/Utility/Makefile14
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindLibUnwind.h2
-rw-r--r--lldb/source/Plugins/Process/Utility/libunwind/include/libunwind.h6
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp9
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp17
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBServer.cpp1148
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBServerLog.cpp80
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBServerLog.h55
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/Makefile14
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp20
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h8
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp8
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/Makefile14
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/Makefile14
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/Makefile14
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp10
-rw-r--r--lldb/source/Symbol/Makefile14
-rw-r--r--lldb/source/Symbol/Type.cpp22
-rw-r--r--lldb/source/Target/Makefile14
-rw-r--r--lldb/source/Target/ObjCObjectPrinter.cpp32
-rw-r--r--lldb/source/Target/Process.cpp40
-rw-r--r--lldb/source/Target/ThreadPlanStepRange.cpp4
-rw-r--r--lldb/source/Target/ThreadPlanStepUntil.cpp6
-rw-r--r--lldb/source/Utility/Makefile14
-rw-r--r--lldb/source/Utility/StringExtractor.cpp2
-rw-r--r--lldb/source/Utility/StringExtractorGDBRemote.cpp2
-rw-r--r--lldb/source/Utility/StringExtractorGDBRemote.h2
-rw-r--r--lldb/source/lldb.cpp4
-rw-r--r--lldb/tools/Makefile13
-rw-r--r--lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj6
-rw-r--r--lldb/tools/debugserver/source/RNBRemote.cpp2
-rw-r--r--lldb/tools/driver/Driver.cpp66
-rw-r--r--lldb/tools/driver/IOChannel.cpp9
-rw-r--r--lldb/tools/driver/IOChannel.h8
-rw-r--r--lldb/tools/driver/Makefile25
151 files changed, 1439 insertions, 1887 deletions
diff --git a/lldb/Makefile b/lldb/Makefile
new file mode 100644
index 00000000000..51b0c0a9b54
--- /dev/null
+++ b/lldb/Makefile
@@ -0,0 +1,90 @@
+##===- Makefile --------------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+# If LLDB_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
+# are being included from a subdirectory makefile.
+
+ifndef LLDB_LEVEL
+
+IS_TOP_LEVEL := 1
+LLDB_LEVEL := .
+DIRS := include source lib tools
+
+PARALLEL_DIRS :=
+endif
+
+###
+# Common Makefile code, shared by all LLDB Makefiles.
+
+# Set LLVM source root level.
+LEVEL := $(LLDB_LEVEL)/../..
+
+# Include LLVM common makefile.
+include $(LEVEL)/Makefile.common
+
+# Set common LLDB build flags.
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/include
+CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/include
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/../clang/include
+CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/../clang/include
+CPP.Flags += -I/usr/include/python2.6
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source
+CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/Utility
+ifeq ($(HOST_OS),Darwin)
+CPP.Flags += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
+endif
+ifdef LLDB_VENDOR
+CPP.Flags += -DLLDB_VENDOR='"$(LLDB_VENDOR) "'
+endif
+
+# Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
+# work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
+# GCC's have false positive warnings with it on Linux (which prove a pain to
+# fix). For example:
+# http://gcc.gnu.org/PR41874
+# http://gcc.gnu.org/PR41838
+#
+# We can revisit this when LLVM/Clang support it.
+CXX.Flags += -fno-strict-aliasing
+
+###
+# LLDB Top Level specific stuff.
+
+ifeq ($(IS_TOP_LEVEL),1)
+
+ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
+$(RecursiveTargets)::
+ $(Verb) if [ ! -f test/Makefile ]; then \
+ $(MKDIR) test; \
+ $(CP) $(PROJ_SRC_DIR)/test/Makefile test/Makefile; \
+ fi
+endif
+
+test::
+ @ $(MAKE) -C test
+
+report::
+ @ $(MAKE) -C test report
+
+clean::
+ @ $(MAKE) -C test clean
+
+tags::
+ $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
+ grep -v /lib/Headers | grep -v /test/`
+
+cscope.files:
+ find tools lib include -name '*.cpp' \
+ -or -name '*.def' \
+ -or -name '*.td' \
+ -or -name '*.h' > cscope.files
+
+.PHONY: test report clean cscope.files
+
+endif
diff --git a/lldb/include/Makefile b/lldb/include/Makefile
new file mode 100644
index 00000000000..02acdce1027
--- /dev/null
+++ b/lldb/include/Makefile
@@ -0,0 +1,13 @@
+##===- include/Makefile ------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ..
+DIRS := lldb
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/include/lldb/API/SBBreakpoint.h b/lldb/include/lldb/API/SBBreakpoint.h
index c2ad910fb97..b34c0bc907f 100644
--- a/lldb/include/lldb/API/SBBreakpoint.h
+++ b/lldb/include/lldb/API/SBBreakpoint.h
@@ -69,9 +69,9 @@ public:
IsEnabled ();
void
- SetIgnoreCount (int32_t count);
+ SetIgnoreCount (uint32_t count);
- int32_t
+ uint32_t
GetIgnoreCount () const;
void
diff --git a/lldb/include/lldb/API/SBBreakpointLocation.h b/lldb/include/lldb/API/SBBreakpointLocation.h
index 02cc4093d8d..fc866546f6c 100644
--- a/lldb/include/lldb/API/SBBreakpointLocation.h
+++ b/lldb/include/lldb/API/SBBreakpointLocation.h
@@ -35,11 +35,11 @@ public:
bool
IsEnabled ();
- int32_t
+ uint32_t
GetIgnoreCount ();
void
- SetIgnoreCount (int32_t n);
+ SetIgnoreCount (uint32_t n);
void
SetThreadID (lldb::tid_t sb_thread_id);
diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h
index 1f08636b54e..77ad7325c3c 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -321,14 +321,14 @@ public:
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void
- SetIgnoreCount (int32_t count);
+ SetIgnoreCount (uint32_t count);
//------------------------------------------------------------------
/// Return the current Ignore Count.
/// @return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
- int32_t
+ uint32_t
GetIgnoreCount () const;
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Breakpoint/BreakpointIDList.h b/lldb/include/lldb/Breakpoint/BreakpointIDList.h
index bc88087616d..47531f9f0ca 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointIDList.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointIDList.h
@@ -37,14 +37,14 @@ public:
virtual
~BreakpointIDList ();
- int
- Size();
+ size_t
+ GetSize();
BreakpointID &
- GetBreakpointIDAtIndex (int index);
+ GetBreakpointIDAtIndex (uint32_t index);
bool
- RemoveBreakpointIDAtIndex (int index);
+ RemoveBreakpointIDAtIndex (uint32_t index);
void
Clear();
@@ -56,16 +56,16 @@ public:
AddBreakpointID (const char *bp_id);
bool
- FindBreakpointID (BreakpointID &bp_id, int *position);
+ FindBreakpointID (BreakpointID &bp_id, uint32_t *position);
bool
- FindBreakpointID (const char *bp_id, int *position);
+ FindBreakpointID (const char *bp_id, uint32_t *position);
void
- InsertStringArray (const char **string_array, int array_size, CommandReturnObject &result);
+ InsertStringArray (const char **string_array, uint32_t array_size, CommandReturnObject &result);
static bool
- StringContainsIDRangeExpression (const char *in_string, int *range_start_len, int *range_end_pos);
+ StringContainsIDRangeExpression (const char *in_string, uint32_t *range_start_len, uint32_t *range_end_pos);
static void
FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, Args &new_args);
diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index 1ab667dd938..d11cd103415 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -119,7 +119,7 @@ public:
/// @return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
- int32_t
+ uint32_t
GetIgnoreCount ();
//------------------------------------------------------------------
@@ -129,7 +129,7 @@ public:
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void
- SetIgnoreCount (int32_t n);
+ SetIgnoreCount (uint32_t n);
//------------------------------------------------------------------
/// Set the callback action invoked when the breakpoint is hit.
diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h b/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
index 9f0dd0fb2e0..f77a99c8b9b 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
@@ -53,7 +53,7 @@ public:
/// \b true if the breakpoint was in the list.
//------------------------------------------------------------------
bool
- Remove (lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+ Remove (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
@@ -70,7 +70,7 @@ public:
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
- FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+ FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
@@ -87,7 +87,7 @@ public:
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
- FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const;
+ FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
@@ -187,10 +187,10 @@ private:
typedef std::vector<lldb::BreakpointLocationSP> collection;
collection::iterator
- GetIDPairIterator(lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+ GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
collection::const_iterator
- GetIDPairConstIterator(lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const;
+ GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
collection m_break_loc_collection;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocationList.h b/lldb/include/lldb/Breakpoint/BreakpointLocationList.h
index 5c1c8ff5114..4c8ebe9bacf 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocationList.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocationList.h
@@ -72,7 +72,7 @@ public:
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP
- FindByID (lldb::user_id_t breakID);
+ FindByID (lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id
@@ -86,7 +86,7 @@ public:
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
- FindByID (lldb::user_id_t breakID) const;
+ FindByID (lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns the breakpoint location id to the breakpoint location
@@ -98,7 +98,7 @@ public:
/// @result
/// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
- lldb::user_id_t
+ lldb::break_id_t
FindIDByAddress (Address &addr);
//------------------------------------------------------------------
@@ -183,7 +183,7 @@ public:
/// \b true if the breakpoint \a breakID was in the list.
//------------------------------------------------------------------
bool
- Remove (lldb::user_id_t breakID);
+ Remove (lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Enquires of the breakpoint location in this list with ID \a
@@ -200,7 +200,7 @@ public:
//------------------------------------------------------------------
bool
ShouldStop (StoppointCallbackContext *context,
- lldb::user_id_t breakID);
+ lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list.
@@ -252,7 +252,7 @@ protected:
/// @result
/// Returns breakpoint location id.
//------------------------------------------------------------------
- virtual lldb::user_id_t
+ virtual lldb::break_id_t
Add (lldb::BreakpointLocationSP& bp_loc_sp);
typedef std::vector<lldb::BreakpointLocationSP> collection;
@@ -269,10 +269,10 @@ protected:
GetNextID();
collection::iterator
- GetIDIterator(lldb::user_id_t breakID);
+ GetIDIterator(lldb::break_id_t breakID);
collection::const_iterator
- GetIDConstIterator(lldb::user_id_t breakID) const;
+ GetIDConstIterator(lldb::break_id_t breakID) const;
collection m_locations;
addr_map m_address_to_location;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/lldb/include/lldb/Breakpoint/BreakpointOptions.h
index c6206df5ead..a223f4bc382 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointOptions.h
@@ -108,14 +108,14 @@ public:
SetEnabled (bool enabled);
void
- SetIgnoreCount (int32_t n);
+ SetIgnoreCount (uint32_t n);
//------------------------------------------------------------------
/// Return the current Ignore Count.
/// @return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
- int32_t
+ uint32_t
GetIgnoreCount () const;
//------------------------------------------------------------------
@@ -216,7 +216,7 @@ private:
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_callback_is_synchronous;
bool m_enabled;
- int32_t m_ignore_count; // Number of times to ignore this breakpoint
+ uint32_t m_ignore_count; // Number of times to ignore this breakpoint
std::auto_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this breakpoint will take
};
diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h b/lldb/include/lldb/Breakpoint/BreakpointSite.h
index 50d8fe50137..6dec29ba933 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSite.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h
@@ -243,8 +243,8 @@ private:
/// \a break_loc_id is the Breakpoint Location to remove.
//------------------------------------------------------------------
uint32_t
- RemoveOwner (lldb::user_id_t break_id,
- lldb::user_id_t break_loc_id);
+ RemoveOwner (lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id);
BreakpointSite::Type m_type;///< The type of this breakpoint site.
uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site uses trap opcodes.
diff --git a/lldb/include/lldb/Breakpoint/BreakpointSiteList.h b/lldb/include/lldb/Breakpoint/BreakpointSiteList.h
index bfa8c51e3e8..f22c7c74e40 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSiteList.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSiteList.h
@@ -50,7 +50,7 @@ public:
/// @return
/// The ID of the BreakpointSite in the list.
//------------------------------------------------------------------
- lldb::user_id_t
+ lldb::break_id_t
Add (const lldb::BreakpointSiteSP& bp_site_sp);
//------------------------------------------------------------------
@@ -86,7 +86,7 @@ public:
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSiteSP
- FindByID (lldb::user_id_t breakID);
+ FindByID (lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site with id \a breakID - const version.
@@ -99,7 +99,7 @@ public:
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSiteSP
- FindByID (lldb::user_id_t breakID) const;
+ FindByID (lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns the breakpoint site id to the breakpoint site at address \a addr.
@@ -110,7 +110,7 @@ public:
/// @result
/// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
- lldb::user_id_t
+ lldb::break_id_t
FindIDByAddress (lldb::addr_t addr);
//------------------------------------------------------------------
@@ -149,7 +149,7 @@ public:
/// \b true if the breakpoint site \a breakID was in the list.
//------------------------------------------------------------------
bool
- Remove (lldb::user_id_t breakID);
+ Remove (lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Removes the breakpoint site at address \a addr from this list.
@@ -164,7 +164,7 @@ public:
RemoveByAddress (lldb::addr_t addr);
void
- SetEnabledForAll(const bool enable, const lldb::user_id_t except_id = LLDB_INVALID_BREAK_ID);
+ SetEnabledForAll(const bool enable, const lldb::break_id_t except_id = LLDB_INVALID_BREAK_ID);
typedef void (*BreakpointSiteSPMapFunc) (lldb::BreakpointSiteSP &bp, void *baton);
@@ -182,7 +182,7 @@ public:
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool
- ShouldStop (StoppointCallbackContext *context, lldb::user_id_t breakID);
+ ShouldStop (StoppointCallbackContext *context, lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns the number of elements in the list.
@@ -197,10 +197,10 @@ protected:
typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
collection::iterator
- GetIDIterator(lldb::user_id_t breakID);
+ GetIDIterator(lldb::break_id_t breakID);
collection::const_iterator
- GetIDConstIterator(lldb::user_id_t breakID) const;
+ GetIDConstIterator(lldb::break_id_t breakID) const;
// This function exposes the m_bp_site_list. I use the in Process because there
// are places there where you want to iterate over the list, and it is less efficient
diff --git a/lldb/include/lldb/Breakpoint/StoppointLocation.h b/lldb/include/lldb/Breakpoint/StoppointLocation.h
index 2978fd5ecc6..57a85af753b 100644
--- a/lldb/include/lldb/Breakpoint/StoppointLocation.h
+++ b/lldb/include/lldb/Breakpoint/StoppointLocation.h
@@ -82,9 +82,9 @@ protected:
//------------------------------------------------------------------
// Classes that inherit from StoppointLocation can see and modify these
//------------------------------------------------------------------
- lldb::break_id_t m_loc_id; // Break ID
- lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't
- // store a full Address since that's not needed for the breakpoint sites.
+ lldb::break_id_t m_loc_id; // Break ID
+ lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't
+ // store a full Address since that's not needed for the breakpoint sites.
bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources)
uint32_t m_hw_index; // The hardware resource index for this breakpoint/watchpoint
uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for
diff --git a/lldb/include/lldb/Breakpoint/WatchpointLocation.h b/lldb/include/lldb/Breakpoint/WatchpointLocation.h
index 9bf559d7166..d85a578be8d 100644
--- a/lldb/include/lldb/Breakpoint/WatchpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/WatchpointLocation.h
@@ -41,8 +41,8 @@ public:
bool WatchpointRead () const;
bool WatchpointWrite () const;
- int32_t GetIgnoreCount () const;
- void SetIgnoreCount (int32_t n);
+ uint32_t GetIgnoreCount () const;
+ void SetIgnoreCount (uint32_t n);
void SetWatchpointType (uint32_t type);
bool BreakpointWasHit (StoppointCallbackContext *context);
bool SetCallback (WatchpointHitCallback callback, void *callback_baton);
@@ -54,7 +54,7 @@ private:
m_watch_write:1, // 1 if we stop when the watched data is written to
m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access
m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access
- int32_t m_ignore_count; // Number of times to ignore this breakpoint
+ uint32_t m_ignore_count; // Number of times to ignore this breakpoint
WatchpointHitCallback m_callback;
void * m_callback_baton; // Callback user data to pass to callback
diff --git a/lldb/include/lldb/Core/FileSpec.h b/lldb/include/lldb/Core/FileSpec.h
index ca661f2f6ac..22ab298f33c 100644
--- a/lldb/include/lldb/Core/FileSpec.h
+++ b/lldb/include/lldb/Core/FileSpec.h
@@ -451,7 +451,7 @@ public:
/// resolved path doesn't fit in dst_len, dst_len-1 characters will
/// be written to \a dst_path, but the actual required length will still be returned.
//------------------------------------------------------------------
- static int
+ static size_t
Resolve (const char *src_path, char *dst_path, size_t dst_len);
//------------------------------------------------------------------
@@ -475,7 +475,7 @@ public:
/// resolved path doesn't fit in dst_len, dst_len-1 characters will
/// be written to \a dst_path, but the actual required length will still be returned.
//------------------------------------------------------------------
- static int
+ static size_t
ResolveUsername (const char *src_path, char *dst_path, size_t dst_len);
diff --git a/lldb/include/lldb/Expression/ClangExpression.h b/lldb/include/lldb/Expression/ClangExpression.h
index 67b885dae9c..8bf48959fc8 100644
--- a/lldb/include/lldb/Expression/ClangExpression.h
+++ b/lldb/include/lldb/Expression/ClangExpression.h
@@ -15,6 +15,7 @@
#include <string>
#include <map>
#include <memory>
+#include <vector>
// Other libraries and framework includes
// Project includes
diff --git a/lldb/include/lldb/Expression/ClangFunction.h b/lldb/include/lldb/Expression/ClangFunction.h
index 960667726a3..f76157a9c6d 100644
--- a/lldb/include/lldb/Expression/ClangFunction.h
+++ b/lldb/include/lldb/Expression/ClangFunction.h
@@ -224,10 +224,10 @@ private:
std::string m_wrapper_function_name;
std::string m_wrapper_struct_name;
+ lldb::addr_t m_wrapper_function_addr;
+ std::list<lldb::addr_t> m_wrapper_args_addrs;
const clang::ASTRecordLayout *m_struct_layout;
ValueList m_arg_values;
- lldb::addr_t m_wrapper_fun_addr;
- std::list<lldb::addr_t> m_wrapper_args_addrs;
size_t m_value_struct_size;
size_t m_return_offset;
diff --git a/lldb/include/lldb/Host/Predicate.h b/lldb/include/lldb/Host/Predicate.h
index 9c3f10bceae..8fa653021e5 100644
--- a/lldb/include/lldb/Host/Predicate.h
+++ b/lldb/include/lldb/Host/Predicate.h
@@ -53,9 +53,9 @@ public:
/// constructors.
//------------------------------------------------------------------
Predicate () :
+ m_value(),
m_mutex(),
- m_condition(),
- m_value()
+ m_condition()
{
}
@@ -69,9 +69,9 @@ public:
/// The initial value for our T object.
//------------------------------------------------------------------
Predicate (T initial_value) :
+ m_value(initial_value),
m_mutex(),
- m_condition(),
- m_value(initial_value)
+ m_condition()
{
}
diff --git a/lldb/include/lldb/Interpreter/CommandCompletions.h b/lldb/include/lldb/Interpreter/CommandCompletions.h
index 5d3f47cbd95..377e2c9ad58 100644
--- a/lldb/include/lldb/Interpreter/CommandCompletions.h
+++ b/lldb/include/lldb/Interpreter/CommandCompletions.h
@@ -52,7 +52,7 @@ public:
struct CommonCompletionElement
{
- CommonCompletionTypes type;
+ uint32_t type;
CompletionCallback callback;
};
diff --git a/lldb/include/lldb/Makefile b/lldb/include/lldb/Makefile
new file mode 100644
index 00000000000..c64359e854c
--- /dev/null
+++ b/lldb/include/lldb/Makefile
@@ -0,0 +1,31 @@
+LEVEL = ../../../..
+DIRS :=
+
+include $(LEVEL)/Makefile.common
+
+install-local::
+ $(Echo) Installing Clang include files
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
+ $(Verb) if test -d "$(PROJ_SRC_ROOT)/tools/clang/include/clang" ; then \
+ cd $(PROJ_SRC_ROOT)/tools/clang/include && \
+ for hdr in `find clang -type f '!' '(' -name '*~' \
+ -o -name '.#*' -o -name '*.in' -o -name '*.txt' \
+ -o -name 'Makefile' -o -name '*.td' -o -name '*.orig' ')' -print \
+ | grep -v CVS | grep -v .svn | grep -v .dir` ; do \
+ instdir=$(DESTDIR)`dirname "$(PROJ_includedir)/$$hdr"` ; \
+ if test \! -d "$$instdir" ; then \
+ $(EchoCmd) Making install directory $$instdir ; \
+ $(MKDIR) $$instdir ;\
+ fi ; \
+ $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
+ done ; \
+ fi
+ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
+ $(Verb) if test -d "$(PROJ_OBJ_ROOT)/tools/clang/include/clang" ; then \
+ cd $(PROJ_OBJ_ROOT)/tools/clang/include && \
+ for hdr in `find clang -type f '!' '(' -name 'Makefile' ')' -print \
+ | grep -v CVS | grep -v .tmp | grep -v .dir` ; do \
+ $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
+ done ; \
+ fi
+endif
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index ed827be8ef3..32a7cd1075d 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -466,7 +466,7 @@ public:
/// Returns an error object.
//------------------------------------------------------------------
virtual Error
- WillAttach (lldb::pid_t pid)
+ WillAttachToProcessWithID (lldb::pid_t pid)
{
return Error();
}
@@ -481,7 +481,7 @@ public:
/// Returns an error object.
//------------------------------------------------------------------
virtual Error
- WillAttach (const char *process_name, bool wait_for_launch)
+ WillAttachToProcessWithName (const char *process_name, bool wait_for_launch)
{
return Error();
}
@@ -497,7 +497,7 @@ public:
/// LLDB_INVALID_PROCESS_ID if attaching fails.
//------------------------------------------------------------------
virtual Error
- DoAttach (lldb::pid_t pid) = 0;
+ DoAttachToProcessWithID (lldb::pid_t pid) = 0;
//------------------------------------------------------------------
/// Attach to an existing process using a partial process name.
@@ -515,7 +515,7 @@ public:
/// LLDB_INVALID_PROCESS_ID if attaching fails.
//------------------------------------------------------------------
virtual Error
- DoAttach (const char *process_name, bool wait_for_launch)
+ DoAttachToProcessWithName (const char *process_name, bool wait_for_launch)
{
Error error;
error.SetErrorString("attach by name is not supported");
diff --git a/lldb/include/lldb/Target/ThreadPlanShouldStopHere.h b/lldb/include/lldb/Target/ThreadPlanShouldStopHere.h
index 66270dfa5a3..02c8cf0baf8 100644
--- a/lldb/include/lldb/Target/ThreadPlanShouldStopHere.h
+++ b/lldb/include/lldb/Target/ThreadPlanShouldStopHere.h
@@ -38,7 +38,7 @@ public:
{
eNone = 0,
eAvoidInlines = (1 << 0),
- eAvoidNoDebug = (1 << 1),
+ eAvoidNoDebug = (1 << 1)
};
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Target/ThreadSpec.h b/lldb/include/lldb/Target/ThreadSpec.h
index 94401ce6eae..016862c01ed 100644
--- a/lldb/include/lldb/Target/ThreadSpec.h
+++ b/lldb/include/lldb/Target/ThreadSpec.h
@@ -93,7 +93,7 @@ public:
bool
IndexMatches (uint32_t index) const
{
- if (m_index == -1 || index == -1)
+ if (m_index == UINT32_MAX || index == UINT32_MAX)
return true;
else
return index == m_index;
diff --git a/lldb/lib/Makefile b/lldb/lib/Makefile
new file mode 100644
index 00000000000..3a5709f9ed6
--- /dev/null
+++ b/lldb/lib/Makefile
@@ -0,0 +1,128 @@
+##===- source/Makefile -------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL := ../../..
+LLDB_LEVEL := ..
+
+LIBRARYNAME = lldb
+
+#EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/../resources/lldb-framework-exports
+NO_BUILD_ARCHIVE = 1
+LINK_LIBS_IN_SHARED = 1
+SHARED_LIBRARY = 1
+
+# Include all archives in liblldb.a files
+USEDLIBS = lldbAPI.a \
+ lldbBreakpoint.a \
+ lldbCommands.a \
+ lldbCore.a \
+ lldbExpression.a \
+ lldbHostMacOSX.a \
+ lldbHostPosix.a \
+ lldbInitAndLog.a \
+ lldbInterpreter.a \
+ lldbPluginABIMacOSX_i386.a \
+ lldbPluginABISysV_x86_64.a \
+ lldbPluginDisassemblerLLVM.a \
+ lldbPluginDynamicLoaderMacOSX.a \
+ lldbPluginObjectContainerBSDArchive.a \
+ lldbPluginObjectContainerUniversalMachO.a \
+ lldbPluginObjectFileELF.a \
+ lldbPluginObjectFileMachO.a \
+ lldbPluginProcessGDBRemote.a \
+ lldbPluginSymbolFileDWARF.a \
+ lldbPluginSymbolFileSymtab.a \
+ lldbPluginSymbolVendorMacOSX.a \
+ lldbPluginUtility.a \
+ lldbSymbol.a \
+ lldbTarget.a \
+ lldbUtility.a \
+ plugin_llvmc_Base.a \
+ plugin_llvmc_Clang.a \
+ clangAnalysis.a \
+ clangAST.a \
+ clangBasic.a \
+ clangCodeGen.a \
+ clangFrontend.a \
+ clangDriver.a \
+ clangIndex.a \
+ clangLex.a \
+ clangRewrite.a \
+ clangParse.a \
+ clangSema.a \
+ CompilerDriver.a \
+ EnhancedDisassembly.a \
+ LLVMAnalysis.a \
+ LLVMArchive.a \
+ LLVMARMAsmParser.a \
+ LLVMARMAsmPrinter.a \
+ LLVMARMCodeGen.a \
+ LLVMARMDisassembler.a \
+ LLVMARMInfo.a \
+ LLVMAsmParser.a \
+ LLVMAsmPrinter.a \
+ LLVMBitReader.a \
+ LLVMBitWriter.a \
+ LLVMCodeGen.a \
+ LLVMCore.a \
+ LLVMExecutionEngine.a \
+ LLVMInstCombine.a \
+ LLVMInstrumentation.a \
+ LLVMipa.a \
+ LLVMInterpreter.a \
+ LLVMipo.a \
+ LLVMJIT.a \
+ LLVMLinker.a \
+ LLVMMC.a \
+ LLVMMCParser.a \
+ LLVMScalarOpts.a \
+ LLVMSelectionDAG.a \
+ LLVMSupport.a \
+ LLVMSystem.a \
+ LLVMTarget.a \
+ LLVMTransformUtils.a \
+ LLVMX86AsmParser.a \
+ LLVMX86AsmPrinter.a \
+ LLVMX86CodeGen.a \
+ LLVMX86Disassembler.a \
+ LLVMX86Info.a \
+ clangChecker.a
+
+include $(LEVEL)/Makefile.common
+
+LLVMLibsOptions += -Wl,-all_load -v
+
+ifeq ($(HOST_OS),Darwin)
+ # set dylib internal version number to llvmCore submission number
+ ifdef LLDB_SUBMIT_VERSION
+ LLVMLibsOptions += -Wl,-current_version \
+ -Wl,$(LLDB_SUBMIT_VERSION).$(LLDB_SUBMIT_SUBVERSION) \
+ -Wl,-compatibility_version -Wl,1
+ endif
+ # extra options to override libtool defaults
+ LLVMLibsOptions += -avoid-version
+ LLVMLibsOptions += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
+ LLVMLibsOptions += -framework Foundation -framework CoreFoundation
+ LLVMLibsOptions += -framework DebugSymbols -lpython2.6 -lobjc
+ LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,$(LLDB_LEVEL)/resources/lldb-framework-exports
+ # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
+ DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
+ ifneq ($(DARWIN_VERS),8)
+ LLVMLibsOptions += -no-undefined -Wl,-install_name \
+ -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
+ endif
+endif
+
+ifeq ($(HOST_OS), Linux)
+ # Include everything from the .a's into the shared library.
+ LLVMLibsOptions := -Wl,--whole-archive $(LLDBLibsOptions) \
+ -Wl,--no-whole-archive
+ # Don't allow unresolved symbols.
+ LLVMLibsOptions += -Wl,--no-undefined
+endif
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index a535726b68e..ad1b225251c 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -2773,7 +2773,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = LLDB;
- USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include";
+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/source $(SRCROOT)/source/Plugins/Process/Utility $(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include";
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
@@ -2826,7 +2826,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = LLDB;
- USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include";
+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/source $(SRCROOT)/source/Plugins/Process/Utility $(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include";
VERSIONING_SYSTEM = "apple-generic";
ZERO_LINK = NO;
};
@@ -2935,7 +2935,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = LLDB;
- USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include";
+ USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/source $(SRCROOT)/source/Plugins/Process/Utility $(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include";
VERSIONING_SYSTEM = "apple-generic";
ZERO_LINK = NO;
};
diff --git a/lldb/scripts/generate-vers.pl b/lldb/scripts/generate-vers.pl
new file mode 100755
index 00000000000..c874c2438e9
--- /dev/null
+++ b/lldb/scripts/generate-vers.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+
+sub usage()
+{
+ print "Usage: generate-vers.pl /path/toproject.pbxproj";
+ exit(0);
+}
+
+(scalar @ARGV == 1) or usage();
+
+open $pbxproj, $ARGV[0] or die "Couldn't open ".$ARGV[0];
+
+$current_project_version = None;
+$product_name = None;
+
+while ($line = <$pbxproj>)
+{
+ chomp ($line);
+
+ if ($current_project_version == None &&
+ $line =~ /CURRENT_PROJECT_VERSION = ([0-9]+)/)
+ {
+ $current_project_version = $1;
+ }
+
+ if ($product_name == None &&
+ $line =~ /productName = ([^;]+)/)
+ {
+ $product_name = $1;
+ }
+}
+
+if (!$product_name || !$current_project_version)
+{
+ print "Couldn't get needed information from the .pbxproj";
+ exit(-1);
+}
+
+$uppercase_name = uc $product_name;
+$lowercase_name = lc $product_name;
+
+close $pbxproj;
+
+$file_string = " const unsigned char ".$uppercase_name."VersionString[] __attribute__ ((used)) = \"@(#)PROGRAM:".$uppercase_name." PROJECT:".$lowercase_name."-".$current_project_version."\" \"\\n\"; const double ".$uppercase_name."VersionNumber __attribute__ ((used)) = (double)".$current_project_version.".;\n";
+
+print $file_string;
diff --git a/lldb/source/API/Makefile b/lldb/source/API/Makefile
new file mode 100644
index 00000000000..75be5372c11
--- /dev/null
+++ b/lldb/source/API/Makefile
@@ -0,0 +1,14 @@
+##===- source/API/Makefile ---------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbAPI
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp
index f90d7ad37e6..4ab200c1bb1 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -235,13 +235,13 @@ SBBreakpoint::IsEnabled ()
}
void
-SBBreakpoint::SetIgnoreCount (int32_t count)
+SBBreakpoint::SetIgnoreCount (uint32_t count)
{
if (m_opaque_sp)
m_opaque_sp->SetIgnoreCount (count);
}
-int32_t
+uint32_t
SBBreakpoint::GetIgnoreCount () const
{
if (m_opaque_sp)
diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp
index f376f5368b5..948b78f0c29 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -76,7 +76,7 @@ SBBreakpointLocation::IsEnabled ()
return false;
}
-int32_t
+uint32_t
SBBreakpointLocation::GetIgnoreCount ()
{
if (m_opaque_sp)
@@ -86,7 +86,7 @@ SBBreakpointLocation::GetIgnoreCount ()
}
void
-SBBreakpointLocation::SetIgnoreCount (int32_t n)
+SBBreakpointLocation::SetIgnoreCount (uint32_t n)
{
if (m_opaque_sp)
m_opaque_sp->SetIgnoreCount (n);
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index cd9b4cd7b4f..b8c2f700fb2 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -187,7 +187,7 @@ SBFrame::LookupVar (const char *var_name)
const uint32_t num_variables = variable_list.GetSize();
bool found = false;
- for (int i = 0; i < num_variables && !found; ++i)
+ for (uint32_t i = 0; i < num_variables && !found; ++i)
{
var_sp = variable_list.GetVariableAtIndex(i);
if (var_sp
@@ -231,7 +231,7 @@ SBFrame::LookupVarInScope (const char *var_name, const char *scope)
const uint32_t num_variables = variable_list.GetSize();
bool found = false;
- for (int i = 0; i < num_variables && !found; ++i)
+ for (uint32_t i = 0; i < num_variables && !found; ++i)
{
var_sp = variable_list.GetVariableAtIndex(i);
if (var_sp
@@ -331,6 +331,9 @@ SBFrame::GetVariables (bool arguments,
case eValueTypeVariableLocal:
add_variable = locals;
break;
+
+ default:
+ break;
}
if (add_variable)
{
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index ba0ed01f460..86186434aee 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -289,7 +289,7 @@ SBTarget::ListAllBreakpoints ()
{
const BreakpointList &bp_list = m_opaque_sp->GetBreakpointList();
size_t num_bps = bp_list.GetSize();
- for (int i = 0; i < num_bps; ++i)
+ for (size_t i = 0; i < num_bps; ++i)
{
SBBreakpoint sb_breakpoint (bp_list.GetBreakpointByIndex (i));
sb_breakpoint.GetDescription (out_file, "full");
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 24e5484c9cf..ede388d83dd 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -147,7 +147,10 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
stop_desc = exc_desc;
stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
}
- break;
+ break;
+
+ default:
+ break;
}
if (stop_desc && stop_desc[0])
@@ -225,7 +228,7 @@ SBThread::DisplayFramesForCurrentContext (FILE *out,
{
uint32_t num_stack_frames = m_opaque_sp->GetStackFrameCount ();
StackFrameSP frame_sp;
- int frame_idx = 0;
+ uint32_t frame_idx = 0;
for (frame_idx = first_frame; frame_idx < first_frame + num_frames; ++frame_idx)
{
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp
index 12dceac7476..e11604ba22e 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -153,12 +153,12 @@ Breakpoint::IsEnabled ()
}
void
-Breakpoint::SetIgnoreCount (int32_t n)
+Breakpoint::SetIgnoreCount (uint32_t n)
{
m_options.SetIgnoreCount(n);
}
-int32_t
+uint32_t
Breakpoint::GetIgnoreCount () const
{
return m_options.GetIgnoreCount();
@@ -255,7 +255,7 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
// them after the locations pass. Have to do it this way because
// resolving breakpoints will add new locations potentially.
- for (int i = 0; i < module_list.GetSize(); i++)
+ for (size_t i = 0; i < module_list.GetSize(); i++)
{
bool seen = false;
ModuleSP module_sp (module_list.GetModuleAtIndex (i));
@@ -263,9 +263,9 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
if (!m_filter_sp->ModulePasses (module_sp))
continue;
- for (int i = 0; i < m_locations.GetSize(); i++)
+ for (size_t j = 0; j < m_locations.GetSize(); j++)
{
- BreakpointLocationSP break_loc = m_locations.GetByIndex(i);
+ BreakpointLocationSP break_loc = m_locations.GetByIndex(j);
const Section *section = break_loc->GetAddress().GetSection();
if (section == NULL || section->GetModule() == module)
{
@@ -300,15 +300,15 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
// the same? Or do we need to do an equality on modules that is an
// "equivalence"???
- for (int i = 0; i < module_list.GetSize(); i++)
+ for (size_t i = 0; i < module_list.GetSize(); i++)
{
ModuleSP module_sp (module_list.GetModuleAtIndex (i));
if (!m_filter_sp->ModulePasses (module_sp))
continue;
- for (int i = 0; i < m_locations.GetSize(); i++)
+ for (size_t j = 0; j < m_locations.GetSize(); j++)
{
- BreakpointLocationSP break_loc = m_locations.GetByIndex(i);
+ BreakpointLocationSP break_loc = m_locations.GetByIndex(j);
const Section *section = break_loc->GetAddress().GetSection();
if (section)
{
@@ -353,8 +353,8 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l
GetResolverDescription (s);
GetFilterDescription (s);
- const uint32_t num_locations = GetNumLocations ();
- const uint32_t num_resolved_locations = GetNumResolvedLocations ();
+ const size_t num_locations = GetNumLocations ();
+ const size_t num_resolved_locations = GetNumResolvedLocations ();
switch (level)
{
@@ -362,9 +362,9 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l
case lldb::eDescriptionLevelFull:
if (num_locations > 0)
{
- s->Printf(", locations = %u", num_locations);
+ s->Printf(", locations = %zu", num_locations);
if (num_resolved_locations > 0)
- s->Printf(", resolved = %u", num_resolved_locations);
+ s->Printf(", resolved = %zu", num_resolved_locations);
}
else
{
@@ -387,12 +387,15 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l
s->Indent();
GetOptions()->GetDescription(s, level);
break;
+
+ default:
+ break;
}
if (show_locations)
{
s->IndentMore();
- for (int i = 0; i < GetNumLocations(); ++i)
+ for (size_t i = 0; i < num_locations; ++i)
{
BreakpointLocation *loc = GetLocationAtIndex(i).get();
loc->GetDescription(s, level);
diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp
index 998afbf6ccb..949bbbed74e 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -31,14 +31,14 @@ BreakpointIDList::~BreakpointIDList ()
{
}
-int
-BreakpointIDList::Size()
+size_t
+BreakpointIDList::GetSize()
{
return m_breakpoint_ids.size();
}
BreakpointID &
-BreakpointIDList::GetBreakpointIDAtIndex (int index)
+BreakpointIDList::GetBreakpointIDAtIndex (uint32_t index)
{
if (index < m_breakpoint_ids.size())
return m_breakpoint_ids[index];
@@ -47,23 +47,13 @@ BreakpointIDList::GetBreakpointIDAtIndex (int index)
}
bool
-BreakpointIDList::RemoveBreakpointIDAtIndex (int index)
+BreakpointIDList::RemoveBreakpointIDAtIndex (uint32_t index)
{
- bool success = false;
- if (index < m_breakpoint_ids.size())
- {
- BreakpointIDArray::iterator pos;
- int i;
+ if (index >= m_breakpoint_ids.size())
+ return false;
- for (pos = m_breakpoint_ids.begin(), i = 0; i != index && pos != m_breakpoint_ids.end(); ++pos, ++i);
- assert (i == index);
- if (pos != m_breakpoint_ids.end())
- {
- m_breakpoint_ids.erase (pos);
- success = true;
- }
- }
- return success;
+ m_breakpoint_ids.erase (m_breakpoint_ids.begin() + index);
+ return true;
}
void
@@ -99,12 +89,12 @@ BreakpointIDList::AddBreakpointID (const char *bp_id_str)
}
bool
-BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, int *position)
+BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, uint32_t *position)
{
bool success = false;
BreakpointIDArray::iterator tmp_pos;
- for (int i = 0; i < m_breakpoint_ids.size(); ++i)
+ for (size_t i = 0; i < m_breakpoint_ids.size(); ++i)
{
BreakpointID tmp_id = m_breakpoint_ids[i];
if (tmp_id.GetBreakpointID() == bp_id.GetBreakpointID()
@@ -120,7 +110,7 @@ BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, int *position)
}
bool
-BreakpointIDList::FindBreakpointID (const char *bp_id_str, int *position)
+BreakpointIDList::FindBreakpointID (const char *bp_id_str, uint32_t *position)
{
BreakpointID temp_bp_id;
break_id_t bp_id;
@@ -136,12 +126,12 @@ BreakpointIDList::FindBreakpointID (const char *bp_id_str, int *position)
}
void
-BreakpointIDList::InsertStringArray (const char **string_array, int array_size, CommandReturnObject &result)
+BreakpointIDList::InsertStringArray (const char **string_array, uint32_t array_size, CommandReturnObject &result)
{
if (string_array == NULL)
return;
- for (int i = 0; i < array_size; ++i)
+ for (uint32_t i = 0; i < array_size; ++i)
{
break_id_t bp_id;
break_id_t loc_id;
@@ -176,24 +166,23 @@ void
BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result,
Args &new_args)
{
- char *range_start;
+ std::string range_start;
const char *range_end;
const char *current_arg;
- int num_old_args = old_args.GetArgumentCount();
+ const size_t num_old_args = old_args.GetArgumentCount();
- for (int i = 0; i < num_old_args; ++i)
+ for (size_t i = 0; i < num_old_args; ++i)
{
bool is_range = false;
current_arg = old_args.GetArgumentAtIndex (i);
- int range_start_len = 0;
- int range_end_pos = 0;
+ uint32_t range_start_len = 0;
+ uint32_t range_end_pos = 0;
if (BreakpointIDList::StringContainsIDRangeExpression (current_arg, &range_start_len, &range_end_pos))
{
is_range = true;
range_start = (char *) malloc (range_start_len + 1);
- strncpy (range_start, current_arg, range_start_len);
- range_start[range_start_len] = '\0';
+ range_start.assign (current_arg, range_start_len);
range_end = current_arg + range_end_pos;
}
else if ((i + 2 < num_old_args)
@@ -201,7 +190,7 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
&& BreakpointID::IsValidIDExpression (current_arg)
&& BreakpointID::IsValidIDExpression (old_args.GetArgumentAtIndex (i+2)))
{
- range_start = (char *) current_arg;
+ range_start.assign (current_arg);
range_end = old_args.GetArgumentAtIndex (i+2);
is_range = true;
i = i+2;
@@ -214,14 +203,14 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
break_id_t start_loc_id;
break_id_t end_loc_id;
- BreakpointID::ParseCanonicalReference (range_start, &start_bp_id, &start_loc_id);
+ BreakpointID::ParseCanonicalReference (range_start.c_str(), &start_bp_id, &start_loc_id);
BreakpointID::ParseCanonicalReference (range_end, &end_bp_id, &end_loc_id);
if ((start_bp_id == LLDB_INVALID_BREAK_ID)
|| (! target->GetBreakpointByID (start_bp_id)))
{
new_args.Clear();
- result.AppendErrorWithFormat ("'%s' is not a valid breakpoint ID.\n", range_start);
+ result.AppendErrorWithFormat ("'%s' is not a valid breakpoint ID.\n", range_start.c_str());
result.SetStatus (eReturnStatusFailed);
return;
}
@@ -239,8 +228,8 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
// target and find all the breakpoints that fit into this range, and add them to new_args.
const BreakpointList& breakpoints = target->GetBreakpointList();
- size_t num_breakpoints = breakpoints.GetSize();
- for (int j = 0; j < num_breakpoints; ++j)
+ const size_t num_breakpoints = breakpoints.GetSize();
+ for (size_t j = 0; j < num_breakpoints; ++j)
{
Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (j).get();
break_id_t cur_bp_id = breakpoint->GetID();
@@ -248,11 +237,11 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
if ((cur_bp_id < start_bp_id) || (cur_bp_id > end_bp_id))
continue;
- size_t num_locations = breakpoint->GetNumLocations();
+ const size_t num_locations = breakpoint->GetNumLocations();
if ((cur_bp_id == start_bp_id) && (start_loc_id != LLDB_INVALID_BREAK_ID))
{
- for (int k = 0; k < num_locations; ++k)
+ for (size_t k = 0; k < num_locations; ++k)
{
BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get();
if (bp_loc->GetID() >= start_loc_id)
@@ -265,7 +254,7 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
}
else if ((cur_bp_id == end_bp_id) && (end_loc_id != LLDB_INVALID_BREAK_ID))
{
- for (int k = 0; k < num_locations; ++k)
+ for (size_t k = 0; k < num_locations; ++k)
{
BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get();
if (bp_loc->GetID() <= end_loc_id)
@@ -294,19 +283,14 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
return;
}
-//bool
-//BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, const char **range_start,
-// const **range_end)
bool
-BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, int *range_start_len, int *range_end_pos)
+BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, uint32_t *range_start_len, uint32_t *range_end_pos)
{
bool is_range_expression = false;
std::string arg_str = in_string;
std::string::size_type idx;
std::string::size_type start_pos = 0;
- //*range_start = NULL;
- //*range_end = NULL;
*range_start_len = 0;
*range_end_pos = 0;
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index dfaa4eba252..46ed6dcebe1 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -137,14 +137,14 @@ BreakpointLocation::ClearCallback ()
GetLocationOptions()->ClearCallback();
}
-int32_t
+uint32_t
BreakpointLocation::GetIgnoreCount ()
{
return GetOptionsNoCreate()->GetIgnoreCount();
}
void
-BreakpointLocation::SetIgnoreCount (int32_t n)
+BreakpointLocation::SetIgnoreCount (uint32_t n)
{
GetLocationOptions()->SetIgnoreCount(n);
}
diff --git a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
index 464d38f1d78..af3f8e54be7 100644
--- a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
@@ -46,7 +46,7 @@ BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc)
}
bool
-BreakpointLocationCollection::Remove (lldb::user_id_t bp_id, lldb::user_id_t bp_loc_id)
+BreakpointLocationCollection::Remove (lldb::break_id_t bp_id, lldb::break_id_t bp_loc_id)
{
collection::iterator pos = GetIDPairIterator(bp_id, bp_loc_id); // Predicate
if (pos != m_break_loc_collection.end())
@@ -61,7 +61,7 @@ BreakpointLocationCollection::Remove (lldb::user_id_t bp_id, lldb::user_id_t bp_
class BreakpointIDPairMatches
{
public:
- BreakpointIDPairMatches (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) :
+ BreakpointIDPairMatches (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) :
m_break_id(break_id),
m_break_loc_id (break_loc_id)
{
@@ -74,26 +74,26 @@ public:
}
private:
- const lldb::user_id_t m_break_id;
- const lldb::user_id_t m_break_loc_id;
+ const lldb::break_id_t m_break_id;
+ const lldb::break_id_t m_break_loc_id;
};
BreakpointLocationCollection::collection::iterator
-BreakpointLocationCollection::GetIDPairIterator (lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
+BreakpointLocationCollection::GetIDPairIterator (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
{
return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range
BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
}
BreakpointLocationCollection::collection::const_iterator
-BreakpointLocationCollection::GetIDPairConstIterator (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const
+BreakpointLocationCollection::GetIDPairConstIterator (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const
{
return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range
BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
}
BreakpointLocationSP
-BreakpointLocationCollection::FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
+BreakpointLocationCollection::FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
{
BreakpointLocationSP stop_sp;
collection::iterator pos = GetIDPairIterator(break_id, break_loc_id);
@@ -104,7 +104,7 @@ BreakpointLocationCollection::FindByIDPair (lldb::user_id_t break_id, lldb::user
}
const BreakpointLocationSP
-BreakpointLocationCollection::FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const
+BreakpointLocationCollection::FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const
{
BreakpointLocationSP stop_sp;
collection::const_iterator pos = GetIDPairConstIterator(break_id, break_loc_id);
@@ -118,7 +118,7 @@ BreakpointLocationSP
BreakpointLocationCollection::GetByIndex (uint32_t i)
{
BreakpointLocationSP stop_sp;
- if (i >= 0 && i < m_break_loc_collection.size())
+ if (i < m_break_loc_collection.size())
stop_sp = m_break_loc_collection[i];
return stop_sp;
@@ -128,7 +128,7 @@ const BreakpointLocationSP
BreakpointLocationCollection::GetByIndex (uint32_t i) const
{
BreakpointLocationSP stop_sp;
- if (i >= 0 && i < m_break_loc_collection.size())
+ if (i < m_break_loc_collection.size())
stop_sp = m_break_loc_collection[i];
return stop_sp;
@@ -139,7 +139,8 @@ BreakpointLocationCollection::ShouldStop (StoppointCallbackContext *context)
{
bool shouldStop = false;
- for (int i = 0; i < GetSize(); i++) {
+ const size_t count = GetSize();
+ for (size_t i = 0; i < count; i++) {
bool one_result = GetByIndex(i)->ShouldStop(context);
if (one_result)
shouldStop = true;
diff --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp b/lldb/source/Breakpoint/BreakpointLocationList.cpp
index d86a8cf4c47..6a6ac50cb60 100644
--- a/lldb/source/Breakpoint/BreakpointLocationList.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp
@@ -32,7 +32,7 @@ BreakpointLocationList::~BreakpointLocationList()
{
}
-lldb::user_id_t
+lldb::break_id_t
BreakpointLocationList::Add (BreakpointLocationSP &bp_loc_sp)
{
if (bp_loc_sp)
@@ -46,7 +46,7 @@ BreakpointLocationList::Add (BreakpointLocationSP &bp_loc_sp)
}
bool
-BreakpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::user_id_t break_id)
+BreakpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::break_id_t break_id)
{
BreakpointLocationSP bp = FindByID (break_id);
if (bp)
@@ -61,7 +61,7 @@ BreakpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::use
return true;
}
-lldb::user_id_t
+lldb::break_id_t
BreakpointLocationList::FindIDByAddress (Address &addr)
{
BreakpointLocationSP bp_loc_sp = FindByAddress (addr);
@@ -73,7 +73,7 @@ BreakpointLocationList::FindIDByAddress (Address &addr)
}
bool
-BreakpointLocationList::Remove (lldb::user_id_t break_id)
+BreakpointLocationList::Remove (lldb::break_id_t break_id)
{
Mutex::Locker locker (m_mutex);
collection::iterator pos = GetIDIterator(break_id); // Predicate
@@ -90,7 +90,7 @@ BreakpointLocationList::Remove (lldb::user_id_t break_id)
class BreakpointLocationIDMatches
{
public:
- BreakpointLocationIDMatches (lldb::user_id_t break_id) :
+ BreakpointLocationIDMatches (lldb::break_id_t break_id) :
m_break_id(break_id)
{
}
@@ -101,7 +101,7 @@ public:
}
private:
- const lldb::user_id_t m_break_id;
+ const lldb::break_id_t m_break_id;
};
class BreakpointLocationAddressMatches
@@ -122,7 +122,7 @@ private:
};
BreakpointLocationList::collection::iterator
-BreakpointLocationList::GetIDIterator (lldb::user_id_t break_id)
+BreakpointLocationList::GetIDIterator (lldb::break_id_t break_id)
{
Mutex::Locker locker (m_mutex);
return std::find_if (m_locations.begin(),
@@ -131,7 +131,7 @@ BreakpointLocationList::GetIDIterator (lldb::user_id_t break_id)
}
BreakpointLocationList::collection::const_iterator
-BreakpointLocationList::GetIDConstIterator (lldb::user_id_t break_id) const
+BreakpointLocationList::GetIDConstIterator (lldb::break_id_t break_id) const
{
Mutex::Locker locker (m_mutex);
return std::find_if (m_locations.begin(),
@@ -140,7 +140,7 @@ BreakpointLocationList::GetIDConstIterator (lldb::user_id_t break_id) const
}
BreakpointLocationSP
-BreakpointLocationList::FindByID (lldb::user_id_t break_id)
+BreakpointLocationList::FindByID (lldb::break_id_t break_id)
{
Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp;
@@ -152,7 +152,7 @@ BreakpointLocationList::FindByID (lldb::user_id_t break_id)
}
const BreakpointLocationSP
-BreakpointLocationList::FindByID (lldb::user_id_t break_id) const
+BreakpointLocationList::FindByID (lldb::break_id_t break_id) const
{
Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp;
@@ -192,13 +192,6 @@ BreakpointLocationList::FindInModule (Module *module,
return bp_loc_list.GetSize() - orig_size;
}
-
-static int
-FindLocationByAddress (Address *addr_ptr, const BreakpointLocationSP *bp_loc_sp_ptr)
-{
- return Address::CompareModulePointerAndOffset(*addr_ptr, (*bp_loc_sp_ptr)->GetAddress());
-}
-
const BreakpointLocationSP
BreakpointLocationList::FindByAddress (Address &addr) const
{
@@ -234,7 +227,7 @@ BreakpointLocationList::GetByIndex (uint32_t i)
{
Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp;
- if (i >= 0 && i < m_locations.size())
+ if (i < m_locations.size())
stop_sp = m_locations[i];
return stop_sp;
@@ -245,7 +238,7 @@ BreakpointLocationList::GetByIndex (uint32_t i) const
{
Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp;
- if (i >= 0 && i < m_locations.size())
+ if (i < m_locations.size())
stop_sp = m_locations[i];
return stop_sp;
diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp
index aa89c442bea..9054f3b89a6 100644
--- a/lldb/source/Breakpoint/BreakpointOptions.cpp
+++ b/lldb/source/Breakpoint/BreakpointOptions.cpp
@@ -32,8 +32,8 @@ BreakpointOptions::NullCallback (void *baton, StoppointCallbackContext *context,
//----------------------------------------------------------------------
BreakpointOptions::BreakpointOptions() :
m_callback (BreakpointOptions::NullCallback),
- m_callback_is_synchronous (false),
m_callback_baton_sp (),
+ m_callback_is_synchronous (false),
m_enabled (true),
m_ignore_count (0),
m_thread_spec_ap (NULL)
@@ -160,14 +160,14 @@ BreakpointOptions::SetEnabled (bool enabled)
m_enabled = enabled;
}
-int32_t
+uint32_t
BreakpointOptions::GetIgnoreCount () const
{
return m_ignore_count;
}
void
-BreakpointOptions::SetIgnoreCount (int32_t n)
+BreakpointOptions::SetIgnoreCount (uint32_t n)
{
m_ignore_count = n;
}
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index da015dc8191..cb620f9a853 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -59,7 +59,7 @@ BreakpointResolverFileLine::SearchCallback
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list);
- for (int i = 0; i < sc_list_size; i++)
+ for (uint32_t i = 0; i < sc_list_size; i++)
{
SymbolContext sc;
if (sc_list.GetContextAtIndex(i, sc))
diff --git a/lldb/source/Breakpoint/BreakpointSite.cpp b/lldb/source/Breakpoint/BreakpointSite.cpp
index d9397fcb412..082a9379a90 100644
--- a/lldb/source/Breakpoint/BreakpointSite.cpp
+++ b/lldb/source/Breakpoint/BreakpointSite.cpp
@@ -40,7 +40,8 @@ BreakpointSite::BreakpointSite
BreakpointSite::~BreakpointSite()
{
BreakpointLocationSP bp_loc_sp;
- for (int i = 0; i < m_owners.GetSize(); i++)
+ const size_t owner_count = m_owners.GetSize();
+ for (size_t i = 0; i < owner_count; i++)
{
m_owners.GetByIndex(i)->ClearBreakpointSite();
}
@@ -66,7 +67,8 @@ BreakpointSite::ShouldStop (StoppointCallbackContext *context)
bool
BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
{
- for (int i = 0; i < m_owners.GetSize(); i++)
+ const size_t owner_count = m_owners.GetSize();
+ for (size_t i = 0; i < owner_count; i++)
{
if (m_owners.GetByIndex(i)->GetBreakpoint().GetID() == bp_id)
return true;
@@ -158,7 +160,7 @@ BreakpointSite::AddOwner (BreakpointLocationSP &owner)
}
uint32_t
-BreakpointSite::RemoveOwner (lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
+BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
{
m_owners.Remove(break_id, break_loc_id);
return m_owners.GetSize();
diff --git a/lldb/source/Breakpoint/BreakpointSiteList.cpp b/lldb/source/Breakpoint/BreakpointSiteList.cpp
index 919ec452617..9a5ee92f37b 100644
--- a/lldb/source/Breakpoint/BreakpointSiteList.cpp
+++ b/lldb/source/Breakpoint/BreakpointSiteList.cpp
@@ -31,7 +31,7 @@ BreakpointSiteList::~BreakpointSiteList()
// Add breakpoint site to the list. However, if the element already exists in the
// list, then we don't add it, and return LLDB_INVALID_BREAK_ID.
-lldb::user_id_t
+lldb::break_id_t
BreakpointSiteList::Add(const BreakpointSiteSP &bp)
{
lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
@@ -49,7 +49,7 @@ BreakpointSiteList::Add(const BreakpointSiteSP &bp)
}
bool
-BreakpointSiteList::ShouldStop (StoppointCallbackContext *context, lldb::user_id_t break_id)
+BreakpointSiteList::ShouldStop (StoppointCallbackContext *context, lldb::break_id_t break_id)
{
BreakpointSiteSP bp = FindByID (break_id);
if (bp)
@@ -63,7 +63,7 @@ BreakpointSiteList::ShouldStop (StoppointCallbackContext *context, lldb::user_id
// doesn't exist.
return true;
}
-lldb::user_id_t
+lldb::break_id_t
BreakpointSiteList::FindIDByAddress (lldb::addr_t addr)
{
BreakpointSiteSP bp = FindByAddress (addr);
@@ -77,7 +77,7 @@ BreakpointSiteList::FindIDByAddress (lldb::addr_t addr)
}
bool
-BreakpointSiteList::Remove (lldb::user_id_t break_id)
+BreakpointSiteList::Remove (lldb::break_id_t break_id)
{
collection::iterator pos = GetIDIterator(break_id); // Predicate
if (pos != m_bp_site_list.end())
@@ -103,7 +103,7 @@ BreakpointSiteList::RemoveByAddress (lldb::addr_t address)
class BreakpointSiteIDMatches
{
public:
- BreakpointSiteIDMatches (lldb::user_id_t break_id) :
+ BreakpointSiteIDMatches (lldb::break_id_t break_id) :
m_break_id(break_id)
{
}
@@ -114,25 +114,25 @@ public:
}
private:
- const lldb::user_id_t m_break_id;
+ const lldb::break_id_t m_break_id;
};
BreakpointSiteList::collection::iterator
-BreakpointSiteList::GetIDIterator (lldb::user_id_t break_id)
+BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
{
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate
}
BreakpointSiteList::collection::const_iterator
-BreakpointSiteList::GetIDConstIterator (lldb::user_id_t break_id) const
+BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
{
return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate
}
BreakpointSiteSP
-BreakpointSiteList::FindByID (lldb::user_id_t break_id)
+BreakpointSiteList::FindByID (lldb::break_id_t break_id)
{
BreakpointSiteSP stop_sp;
collection::iterator pos = GetIDIterator(break_id);
@@ -143,7 +143,7 @@ BreakpointSiteList::FindByID (lldb::user_id_t break_id)
}
const BreakpointSiteSP
-BreakpointSiteList::FindByID (lldb::user_id_t break_id) const
+BreakpointSiteList::FindByID (lldb::break_id_t break_id) const
{
BreakpointSiteSP stop_sp;
collection::const_iterator pos = GetIDConstIterator(break_id);
@@ -210,7 +210,7 @@ BreakpointSiteList::GetByIndex (uint32_t i) const
}
void
-BreakpointSiteList::SetEnabledForAll (const bool enabled, const lldb::user_id_t except_id)
+BreakpointSiteList::SetEnabledForAll (const bool enabled, const lldb::break_id_t except_id)
{
collection::iterator end = m_bp_site_list.end();
collection::iterator pos;
diff --git a/lldb/source/Breakpoint/Makefile b/lldb/source/Breakpoint/Makefile
new file mode 100644
index 00000000000..223e4c24465
--- /dev/null
+++ b/lldb/source/Breakpoint/Makefile
@@ -0,0 +1,14 @@
+##===- source/Breakpoint/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbBreakpoint
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Breakpoint/StoppointLocation.cpp b/lldb/source/Breakpoint/StoppointLocation.cpp
index 60280ef2748..8d7325f0389 100644
--- a/lldb/source/Breakpoint/StoppointLocation.cpp
+++ b/lldb/source/Breakpoint/StoppointLocation.cpp
@@ -22,21 +22,21 @@ using namespace lldb_private;
//----------------------------------------------------------------------
StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, bool hardware) :
m_loc_id(bid),
- m_byte_size(0),
m_addr(addr),
- m_hit_count(0),
m_hw_preferred(hardware),
- m_hw_index(LLDB_INVALID_INDEX32)
+ m_hw_index(LLDB_INVALID_INDEX32),
+ m_byte_size(0),
+ m_hit_count(0)
{
}
StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, size_t size, bool hardware) :
m_loc_id(bid),
- m_byte_size(size),
m_addr(addr),
- m_hit_count(0),
m_hw_preferred(hardware),
- m_hw_index(LLDB_INVALID_INDEX32)
+ m_hw_index(LLDB_INVALID_INDEX32),
+ m_byte_size(size),
+ m_hit_count(0)
{
}
diff --git a/lldb/source/Breakpoint/WatchpointLocation.cpp b/lldb/source/Breakpoint/WatchpointLocation.cpp
index bf24421a091..c4bd975cdde 100644
--- a/lldb/source/Breakpoint/WatchpointLocation.cpp
+++ b/lldb/source/Breakpoint/WatchpointLocation.cpp
@@ -123,14 +123,14 @@ WatchpointLocation::WatchpointWrite () const
{
return m_watch_write != 0;
}
-int32_t
+uint32_t
WatchpointLocation::GetIgnoreCount () const
{
return m_ignore_count;
}
void
-WatchpointLocation::SetIgnoreCount (int32_t n)
+WatchpointLocation::SetIgnoreCount (uint32_t n)
{
m_ignore_count = n;
}
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index 39bb1f46093..85470164f61 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -161,7 +161,7 @@ DiskFilesOrDirectories
// but for completeness sake we'll resolve the user name and only put a slash
// on the end if it exists.
char resolved_username[PATH_MAX];
- int resolved_username_len = FileSpec::ResolveUsername (partial_name_copy, resolved_username,
+ size_t resolved_username_len = FileSpec::ResolveUsername (partial_name_copy, resolved_username,
sizeof (resolved_username));
// Not sure how this would happen, a username longer than PATH_MAX? Still...
@@ -238,7 +238,7 @@ DiskFilesOrDirectories
if (*partial_name_copy == '~')
{
- int resolved_username_len = FileSpec::ResolveUsername(containing_part, containing_part, sizeof (containing_part));
+ size_t resolved_username_len = FileSpec::ResolveUsername(containing_part, containing_part, sizeof (containing_part));
// User name doesn't exist, we're not getting any further...
if (resolved_username_len == 0 || resolved_username_len >= sizeof (containing_part))
return matches.GetSize();
@@ -591,7 +591,7 @@ CommandCompletions::SymbolCompleter::SearchCallback (
SymbolContext sc;
// Now add the functions & symbols to the list - only add if unique:
- for (int i = 0; i < func_list.GetSize(); i++)
+ for (uint32_t i = 0; i < func_list.GetSize(); i++)
{
if (func_list.GetContextAtIndex(i, sc))
{
@@ -602,7 +602,7 @@ CommandCompletions::SymbolCompleter::SearchCallback (
}
}
- for (int i = 0; i < sym_list.GetSize(); i++)
+ for (uint32_t i = 0; i < sym_list.GetSize(); i++)
{
if (sym_list.GetContextAtIndex(i, sc))
{
diff --git a/lldb/source/Commands/CommandObjectAppend.cpp b/lldb/source/Commands/CommandObjectAppend.cpp
index 6bdbc36572e..89d5cee71e4 100644
--- a/lldb/source/Commands/CommandObjectAppend.cpp
+++ b/lldb/source/Commands/CommandObjectAppend.cpp
@@ -73,7 +73,7 @@ CommandObjectAppend::Execute
{
if (var->GetType() == StateVariable::eTypeString)
{
- for (int i = 0; i < command.GetArgumentCount(); ++i)
+ for (size_t i = 0; i < command.GetArgumentCount(); ++i)
var->AppendStringValue (command.GetArgumentAtIndex(i));
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp
index 3987f452dfb..59621af5f24 100644
--- a/lldb/source/Commands/CommandObjectApropos.cpp
+++ b/lldb/source/Commands/CommandObjectApropos.cpp
@@ -69,14 +69,14 @@ CommandObjectApropos::Execute
result.AppendMessageWithFormat ("The following commands may relate to '%s':\n", search_word);
size_t max_len = 0;
- for (int i = 0; i < commands_found.GetSize(); ++i)
+ for (size_t i = 0; i < commands_found.GetSize(); ++i)
{
- int len = strlen (commands_found.GetStringAtIndex (i));
+ size_t len = strlen (commands_found.GetStringAtIndex (i));
if (len > max_len)
max_len = len;
}
- for (int i = 0; i < commands_found.GetSize(); ++i)
+ for (size_t i = 0; i < commands_found.GetSize(); ++i)
interpreter.OutputFormattedHelpText (result.GetOutputStream(),
commands_found.GetStringAtIndex(i),
"--", commands_help.
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 830fbec6fbc..30f99f0c65a 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -56,11 +56,11 @@ CommandObjectBreakpointSet::CommandOptions::CommandOptions() :
m_func_regexp (),
m_modules (),
m_load_addr(),
+ m_ignore_count (0),
m_thread_id(LLDB_INVALID_THREAD_ID),
- m_thread_index (-1),
+ m_thread_index (UINT32_MAX),
m_thread_name(),
- m_queue_name(),
- m_ignore_count (-1)
+ m_queue_name()
{
}
@@ -190,8 +190,8 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (int option_idx, cons
}
case 'k':
{
- m_ignore_count = Args::StringToSInt32(optarg, -1, 0);
- if (m_ignore_count == -1)
+ m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0);
+ if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg);
}
break;
@@ -210,8 +210,8 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (int option_idx, cons
break;
case 'x':
{
- m_thread_index = Args::StringToUInt64(optarg, -1, 0);
- if (m_thread_id == -1)
+ m_thread_index = Args::StringToUInt32(optarg, UINT32_MAX, 0);
+ if (m_thread_id == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg);
}
@@ -237,9 +237,9 @@ CommandObjectBreakpointSet::CommandOptions::ResetOptionValues ()
m_func_regexp.clear();
m_load_addr = LLDB_INVALID_ADDRESS;
m_modules.clear();
- m_ignore_count = -1;
+ m_ignore_count = 0;
m_thread_id = LLDB_INVALID_THREAD_ID;
- m_thread_index = -1;
+ m_thread_index = UINT32_MAX;
m_thread_name.clear();
m_queue_name.clear();
}
@@ -469,7 +469,7 @@ CommandObjectBreakpointSet::Execute
if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
bp->SetThreadID (m_options.m_thread_id);
- if (m_options.m_thread_index != -1)
+ if (m_options.m_thread_index != UINT32_MAX)
bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
if (!m_options.m_thread_name.empty())
@@ -478,7 +478,7 @@ CommandObjectBreakpointSet::Execute
if (!m_options.m_queue_name.empty())
bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str());
- if (m_options.m_ignore_count != -1)
+ if (m_options.m_ignore_count != 0)
bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count);
}
@@ -558,7 +558,7 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
// NOW, convert the list of breakpoint id strings in TEMP_ARGS into an actual BreakpointIDList:
- valid_ids->InsertStringArray ((const char **) temp_args.GetArgumentVector(), temp_args.GetArgumentCount(), result);
+ valid_ids->InsertStringArray (temp_args.GetConstArgumentVector(), temp_args.GetArgumentCount(), result);
// At this point, all of the breakpoint ids that the user passed in have been converted to breakpoint IDs
// and put into valid_ids.
@@ -568,7 +568,8 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
// Now that we've converted everything from args into a list of breakpoint ids, go through our tentative list
// of breakpoint id's and verify that they correspond to valid/currently set breakpoints.
- for (int i = 0; i < valid_ids->Size(); ++i)
+ const size_t count = valid_ids->GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_ids->GetBreakpointIDAtIndex (i);
Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
@@ -578,9 +579,10 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
if (cur_bp_id.GetLocationID() > num_locations)
{
StreamString id_str;
- BreakpointID::GetCanonicalReference (&id_str, cur_bp_id.GetBreakpointID(),
- cur_bp_id.GetLocationID());
- i = valid_ids->Size() + 1;
+ BreakpointID::GetCanonicalReference (&id_str,
+ cur_bp_id.GetBreakpointID(),
+ cur_bp_id.GetLocationID());
+ i = valid_ids->GetSize() + 1;
result.AppendErrorWithFormat ("'%s' is not a currently valid breakpoint/location id.\n",
id_str.GetData());
result.SetStatus (eReturnStatusFailed);
@@ -588,7 +590,7 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
}
else
{
- i = valid_ids->Size() + 1;
+ i = valid_ids->GetSize() + 1;
result.AppendErrorWithFormat ("'%d' is not a currently valid breakpoint id.\n", cur_bp_id.GetBreakpointID());
result.SetStatus (eReturnStatusFailed);
}
@@ -731,7 +733,7 @@ CommandObjectBreakpointList::Execute
{
// No breakpoint selected; show info about all currently set breakpoints.
result.AppendMessage ("Current breakpoints:");
- for (int i = 0; i < num_breakpoints; ++i)
+ for (size_t i = 0; i < num_breakpoints; ++i)
{
Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (i).get();
AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level);
@@ -746,7 +748,7 @@ CommandObjectBreakpointList::Execute
if (result.Succeeded())
{
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ for (size_t i = 0; i < valid_bp_ids.GetSize(); ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
@@ -834,7 +836,8 @@ CommandObjectBreakpointEnable::Execute
{
int enable_count = 0;
int loc_count = 0;
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ const size_t count = valid_bp_ids.GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
@@ -933,7 +936,8 @@ CommandObjectBreakpointDisable::Execute
{
int disable_count = 0;
int loc_count = 0;
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ const size_t count = valid_bp_ids.GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
@@ -1035,7 +1039,8 @@ CommandObjectBreakpointDelete::Execute
{
int delete_count = 0;
int disable_count = 0;
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ const size_t count = valid_bp_ids.GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
@@ -1074,12 +1079,15 @@ CommandObjectBreakpointDelete::Execute
CommandObjectBreakpointModify::CommandOptions::CommandOptions() :
Options (),
+ m_ignore_count (0),
m_thread_id(LLDB_INVALID_THREAD_ID),
- m_thread_index (-1),
+ m_thread_index (UINT32_MAX),
m_thread_name(),
m_queue_name(),
- m_ignore_count (-1),
- m_enable_passed (false)
+ m_enable_passed (false),
+ m_enable_value (false),
+ m_name_passed (false),
+ m_queue_passed (false)
{
}
@@ -1139,8 +1147,8 @@ CommandObjectBreakpointModify::CommandOptions::SetOptionValue (int option_idx, c
break;
case 'k':
{
- m_ignore_count = Args::StringToSInt32(optarg, -1, 0);
- if (m_ignore_count == -1)
+ m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0);
+ if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg);
}
break;
@@ -1167,8 +1175,8 @@ CommandObjectBreakpointModify::CommandOptions::SetOptionValue (int option_idx, c
break;
case 'x':
{
- m_thread_index = Args::StringToUInt64(optarg, -1, 0);
- if (m_thread_id == -1)
+ m_thread_index = Args::StringToUInt32 (optarg, UINT32_MAX, 0);
+ if (m_thread_id == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg);
}
@@ -1186,9 +1194,9 @@ CommandObjectBreakpointModify::CommandOptions::ResetOptionValues ()
{
Options::ResetOptionValues();
- m_ignore_count = -1;
+ m_ignore_count = 0;
m_thread_id = LLDB_INVALID_THREAD_ID;
- m_thread_index = -1;
+ m_thread_index = UINT32_MAX;
m_thread_name.clear();
m_queue_name.clear();
m_enable_passed = false;
@@ -1249,7 +1257,8 @@ CommandObjectBreakpointModify::Execute
if (result.Succeeded())
{
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ const size_t count = valid_bp_ids.GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
@@ -1264,7 +1273,7 @@ CommandObjectBreakpointModify::Execute
if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
location->SetThreadID (m_options.m_thread_id);
- if (m_options.m_thread_index != -1)
+ if (m_options.m_thread_index != UINT32_MAX)
location->GetLocationOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
if (m_options.m_name_passed)
@@ -1273,7 +1282,7 @@ CommandObjectBreakpointModify::Execute
if (m_options.m_queue_passed)
location->GetLocationOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str());
- if (m_options.m_ignore_count != -1)
+ if (m_options.m_ignore_count != 0)
location->GetLocationOptions()->SetIgnoreCount(m_options.m_ignore_count);
if (m_options.m_enable_passed)
@@ -1285,7 +1294,7 @@ CommandObjectBreakpointModify::Execute
if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
bp->SetThreadID (m_options.m_thread_id);
- if (m_options.m_thread_index != -1)
+ if (m_options.m_thread_index != UINT32_MAX)
bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
if (m_options.m_name_passed)
@@ -1294,7 +1303,7 @@ CommandObjectBreakpointModify::Execute
if (m_options.m_queue_passed)
bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str());
- if (m_options.m_ignore_count != -1)
+ if (m_options.m_ignore_count != 0)
bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count);
if (m_options.m_enable_passed)
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.h b/lldb/source/Commands/CommandObjectBreakpoint.h
index 20f2c3b994a..b998e3d07c3 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.h
+++ b/lldb/source/Commands/CommandObjectBreakpoint.h
@@ -104,9 +104,9 @@ public:
std::string m_func_name;
uint32_t m_func_name_type_mask;
std::string m_func_regexp;
- lldb::addr_t m_load_addr;
STLStringArray m_modules;
- int32_t m_ignore_count;
+ lldb::addr_t m_load_addr;
+ uint32_t m_ignore_count;
lldb::tid_t m_thread_id;
uint32_t m_thread_index;
std::string m_thread_name;
@@ -164,7 +164,7 @@ public:
// Instance variables to hold the values for command options.
- int32_t m_ignore_count;
+ uint32_t m_ignore_count;
lldb::tid_t m_thread_id;
uint32_t m_thread_index;
std::string m_thread_name;
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 547192dc68a..123a5ade061 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -244,7 +244,8 @@ CommandObjectBreakpointCommandAdd::Execute
if (result.Succeeded())
{
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ const size_t count = valid_bp_ids.GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
@@ -441,7 +442,8 @@ CommandObjectBreakpointCommandRemove::Execute
if (result.Succeeded())
{
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ const size_t count = valid_bp_ids.GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
@@ -526,7 +528,8 @@ CommandObjectBreakpointCommandList::Execute
if (result.Succeeded())
{
- for (int i = 0; i < valid_bp_ids.Size(); ++i)
+ const size_t count = valid_bp_ids.GetSize();
+ for (size_t i = 0; i < count; ++i)
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index b2c4ec32808..0db3c3a6818 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -205,14 +205,14 @@ public:
CommandReturnObject &result
)
{
- const int argc = args.GetArgumentCount();
+ const size_t argc = args.GetArgumentCount();
if (argc < 2)
- {
+ {
result.AppendError ("'alias' requires at least two arguments");
result.SetStatus (eReturnStatusFailed);
return false;
- }
+ }
const std::string alias_command = args.GetArgumentAtIndex(0);
const std::string actual_command = args.GetArgumentAtIndex(1);
@@ -236,7 +236,7 @@ public:
if (command_obj_sp.get())
{
CommandObject *cmd_obj = command_obj_sp.get();
- CommandObject *sub_cmd_obj;
+ CommandObject *sub_cmd_obj = NULL;
OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector);
OptionArgVector *option_arg_vector = option_arg_vector_sp.get();
@@ -299,7 +299,7 @@ public:
}
else
{
- for (int i = 0; i < args.GetArgumentCount(); ++i)
+ for (size_t i = 0; i < argc; ++i)
option_arg_vector->push_back (OptionArgPair ("<argument>",
std::string (args.GetArgumentAtIndex (i))));
}
diff --git a/lldb/source/Commands/CommandObjectCrossref.cpp b/lldb/source/Commands/CommandObjectCrossref.cpp
index 0d11369c6e7..a9e833e3a4d 100644
--- a/lldb/source/Commands/CommandObjectCrossref.cpp
+++ b/lldb/source/Commands/CommandObjectCrossref.cpp
@@ -74,7 +74,8 @@ CommandObjectCrossref::GenerateHelpText (CommandReturnObject &result)
{
result.AppendMessage ("This command can be called on the following types of objects:");
- for (int i = 0; i < m_crossref_object_types.GetArgumentCount(); ++i)
+ const size_t count = m_crossref_object_types.GetArgumentCount();
+ for (size_t i = 0; i < count; ++i)
{
const char *obj_name = m_crossref_object_types.GetArgumentAtIndex(i);
result.AppendMessageWithFormat (" %s (e.g. '%s %s')\n", obj_name,
diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp
index 37802a85b2a..4bf8a30edba 100644
--- a/lldb/source/Commands/CommandObjectHelp.cpp
+++ b/lldb/source/Commands/CommandObjectHelp.cpp
@@ -27,8 +27,8 @@ using namespace lldb_private;
CommandObjectHelp::CommandObjectHelp () :
CommandObject ("help",
- "Shows a list of all debugger commands, or give details about specific commands.",
- "help [<cmd-name>]")
+ "Shows a list of all debugger commands, or give details about specific commands.",
+ "help [<cmd-name>]")
{
}
@@ -123,7 +123,8 @@ CommandObjectHelp::Execute (CommandInterpreter &interpreter, Args& command, Comm
{
Stream &output_strm = result.GetOutputStream();
output_strm.Printf("Help requested with ambiguous command name, possible completions:\n");
- for (int i = 0; i < matches.GetSize(); i++)
+ const uint32_t match_count = matches.GetSize();
+ for (uint32_t i = 0; i < match_count; i++)
{
output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i));
}
diff --git a/lldb/source/Commands/CommandObjectImage.cpp b/lldb/source/Commands/CommandObjectImage.cpp
index c835aa311a6..0b61816fbcb 100644
--- a/lldb/source/Commands/CommandObjectImage.cpp
+++ b/lldb/source/Commands/CommandObjectImage.cpp
@@ -469,7 +469,7 @@ public:
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
- bool word_complete,
+ bool &word_complete,
StringList &matches)
{
// Arguments are the standard source file completer.
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 9400200070a..30dfe2a0bd5 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -462,11 +462,20 @@ public:
return false;
}
- size_t item_byte_size = m_options.m_byte_size ? m_options.m_byte_size : 1;
StreamString buffer (Stream::eBinary,
process->GetAddressByteSize(),
process->GetByteOrder());
+ size_t item_byte_size = m_options.m_byte_size;
+
+ if (m_options.m_byte_size == 0)
+ {
+ if (m_options.m_format == eFormatPointer)
+ item_byte_size = buffer.GetAddressByteSize();
+ else
+ item_byte_size = 1;
+ }
+
lldb::addr_t addr = Args::StringToUInt64(command.GetArgumentAtIndex(0), LLDB_INVALID_ADDRESS, 0);
if (addr == LLDB_INVALID_ADDRESS)
@@ -513,6 +522,8 @@ public:
case eFormatDefault:
case eFormatBytes:
case eFormatHex:
+ case eFormatPointer:
+
// Decode hex bytes
uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 16, &success);
if (!success)
diff --git a/lldb/source/Commands/CommandObjectSyntax.cpp b/lldb/source/Commands/CommandObjectSyntax.cpp
index 3279da2c1d6..072ae29777e 100644
--- a/lldb/source/Commands/CommandObjectSyntax.cpp
+++ b/lldb/source/Commands/CommandObjectSyntax.cpp
@@ -40,62 +40,20 @@ CommandObjectSyntax::~CommandObjectSyntax()
bool
-CommandObjectSyntax::OldExecute
+CommandObjectSyntax::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- Debugger *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
- CommandObject *cmd_obj;
-
- if (command.GetArgumentCount() != 0)
- {
- cmd_obj = interpreter->GetCommandObject(command.GetArgumentAtIndex(0));
- if (cmd_obj)
- {
- Stream &output_strm = result.GetOutputStream();
- if (cmd_obj->GetOptions() != NULL)
- {
- output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax());
- //cmd_obj->GetOptions()->GenerateOptionUsage (output_strm, cmd_obj);
- output_strm.Printf ("(Try 'help %s' for more information on command options syntax.)\n",
- cmd_obj->GetCommandName());
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else
- {
- output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax());
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- }
- else
- {
- result.AppendErrorWithFormat ("'%s' is not a known command.\n", command.GetArgumentAtIndex(0));
- result.AppendError ("Try 'help' to see a current list of commands.");
- result.SetStatus (eReturnStatusFailed);
- }
- }
- else
- {
- result.AppendError ("Must call 'syntax' with a valid command.");
- result.SetStatus (eReturnStatusFailed);
- }
- return result.Succeeded();
-}
-
-bool
-CommandObjectSyntax::Execute (Args &command, Debugger *context, CommandInterpreter *interpreter,
- CommandReturnObject &result)
-{
CommandObject::CommandMap::iterator pos;
CommandObject *cmd_obj;
const int argc = command.GetArgumentCount();
if (argc > 0)
{
- cmd_obj = interpreter->GetCommandObject (command.GetArgumentAtIndex(0));
+ cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex(0));
bool all_okay = true;
for (int i = 1; i < argc; ++i)
{
diff --git a/lldb/source/Commands/CommandObjectSyntax.h b/lldb/source/Commands/CommandObjectSyntax.h
index 3caf533fed8..47b3e8e1033 100644
--- a/lldb/source/Commands/CommandObjectSyntax.h
+++ b/lldb/source/Commands/CommandObjectSyntax.h
@@ -30,17 +30,10 @@ public:
virtual
~CommandObjectSyntax ();
-
- bool
- OldExecute (Args& command,
- Debugger *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
virtual bool
- Execute (Args& command,
- Debugger *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 97387584d5f..85829124b41 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -173,7 +173,7 @@ lldb_private::DisplayFramesForExecutionContext
strm.IndentMore();
StackFrameSP frame_sp;
- int frame_idx = 0;
+ uint32_t frame_idx = 0;
if (ascending)
{
diff --git a/lldb/source/Commands/Makefile b/lldb/source/Commands/Makefile
new file mode 100644
index 00000000000..dbef40c520b
--- /dev/null
+++ b/lldb/source/Commands/Makefile
@@ -0,0 +1,14 @@
+##===- source/Commands/Makefile ----------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbCommands
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index c857a6b6d1f..057b8567a4d 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -241,24 +241,28 @@ ReadCStringFromMemory (ExecutionContextScope *exe_scope, const Address &address,
}
Address::Address () :
+ SymbolContextScope(),
m_section (NULL),
m_offset (LLDB_INVALID_ADDRESS)
{
}
Address::Address (const Address& rhs) :
+ SymbolContextScope(rhs),
m_section (rhs.m_section),
m_offset (rhs.m_offset)
{
}
Address::Address (const Section* section, addr_t offset) :
+ SymbolContextScope(),
m_section (section),
m_offset (offset)
{
}
Address::Address (addr_t address, const SectionList * sections) :
+ SymbolContextScope(),
m_section (NULL),
m_offset (LLDB_INVALID_ADDRESS)
{
@@ -430,6 +434,9 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
lldb_private::Address so_addr;
switch (style)
{
+ case DumpStyleInvalid:
+ return false;
+
case DumpStyleSectionNameOffset:
if (m_section != NULL)
{
@@ -637,6 +644,9 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
}
}
break;
+
+ default:
+ break;
}
}
diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp
index fbdf7026e5a..47b957aca0a 100644
--- a/lldb/source/Core/AddressRange.cpp
+++ b/lldb/source/Core/AddressRange.cpp
@@ -146,6 +146,9 @@ AddressRange::Dump(Stream *s, Process *process, Address::DumpStyle style, Addres
switch (style)
{
+ default:
+ break;
+
case Address::DumpStyleSectionNameOffset:
case Address::DumpStyleSectionPointerOffset:
s->PutChar ('[');
diff --git a/lldb/source/Core/AddressResolverFileLine.cpp b/lldb/source/Core/AddressResolverFileLine.cpp
index c4aadcca9c1..b93f331d823 100644
--- a/lldb/source/Core/AddressResolverFileLine.cpp
+++ b/lldb/source/Core/AddressResolverFileLine.cpp
@@ -54,7 +54,7 @@ AddressResolverFileLine::SearchCallback
sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything,
sc_list);
- for (int i = 0; i < sc_list_size; i++)
+ for (uint32_t i = 0; i < sc_list_size; i++)
{
SymbolContext sc;
if (sc_list.GetContextAtIndex(i, sc))
diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp
index b7fbf5f25a0..006aa708a55 100644
--- a/lldb/source/Core/ArchSpec.cpp
+++ b/lldb/source/Core/ArchSpec.cpp
@@ -239,6 +239,7 @@ ArchSpec::AsCString (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t su
switch (arch_type)
{
+ case kNumArchTypes:
case eArchTypeInvalid:
break;
@@ -334,6 +335,7 @@ ArchSpec::GetGenericCPUType () const
{
switch (m_type)
{
+ case kNumArchTypes:
case eArchTypeInvalid:
break;
@@ -990,7 +992,7 @@ enum
eRegNumPPC_GCC_vscr = 110,
eRegNumPPC_GCC_spe_acc = 111,
eRegNumPPC_GCC_spefscr = 112,
- eRegNumPPC_GCC_sfp = 113,
+ eRegNumPPC_GCC_sfp = 113
};
static const char * g_arm_gcc_reg_names[] = {
@@ -1605,6 +1607,7 @@ ArchSpec::GetAddressByteSize() const
{
switch (m_type)
{
+ case kNumArchTypes:
case eArchTypeInvalid:
break;
@@ -1702,6 +1705,9 @@ ArchSpec::SetArch (const char *arch_name)
}
}
break;
+
+ case kNumArchTypes:
+ break;
}
const char *str = arch_name;
diff --git a/lldb/source/Core/ConstString.cpp b/lldb/source/Core/ConstString.cpp
index 06d83829fae..1caf843a3d3 100644
--- a/lldb/source/Core/ConstString.cpp
+++ b/lldb/source/Core/ConstString.cpp
@@ -85,10 +85,7 @@ public:
Mutex::Locker locker (m_mutex);
llvm::StringRef string_ref (cstr, cstr_len);
llvm::StringMapEntry<uint32_t>& entry = m_string_map.GetOrCreateValue (string_ref);
- const char *ccstr = entry.getKeyData();
- llvm::StringMapEntry<uint32_t>&reconstituted_entry = GetStringMapEntryFromKeyData (ccstr);
- assert (&entry == &reconstituted_entry);
- return ccstr;
+ return entry.getKeyData();
}
return NULL;
}
diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp
index 9c63bf134db..898280e25bc 100644
--- a/lldb/source/Core/DataBufferMemoryMap.cpp
+++ b/lldb/source/Core/DataBufferMemoryMap.cpp
@@ -154,12 +154,16 @@ DataBufferMemoryMap::MemoryMapFromFileDescriptor (int fd, off_t offset, size_t l
{
if ((stat.st_mode & S_IFREG) && (stat.st_size > offset))
{
+ const size_t max_bytes_available = stat.st_size - offset;
if (length == SIZE_MAX)
- length = stat.st_size - offset;
-
- // Cap the length if too much data was requested
- if (length > stat.st_size - offset)
- length = stat.st_size - offset;
+ {
+ length = max_bytes_available;
+ }
+ else if (length > max_bytes_available)
+ {
+ // Cap the length if too much data was requested
+ length = max_bytes_available;
+ }
if (length > 0)
{
diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp
index 0b1f5403333..72d7d934054 100644
--- a/lldb/source/Core/DataExtractor.cpp
+++ b/lldb/source/Core/DataExtractor.cpp
@@ -1088,7 +1088,7 @@ DataExtractor::GetSLEB128 (uint32_t *offset_ptr) const
int size = sizeof (uint32_t) * 8;
const uint8_t *src = m_start + *offset_ptr;
- uint8_t byte;
+ uint8_t byte = 0;
int bytecount = 0;
while (src < m_end)
@@ -1316,6 +1316,8 @@ DataExtractor::Dump
s->Address(GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset), sizeof (addr_t));
break;
+ default:
+ case eFormatDefault:
case eFormatHex:
if (item_byte_size <= 8)
{
diff --git a/lldb/source/Core/Error.cpp b/lldb/source/Core/Error.cpp
index 206fd699b4f..104dfc6d693 100644
--- a/lldb/source/Core/Error.cpp
+++ b/lldb/source/Core/Error.cpp
@@ -334,7 +334,7 @@ Error::SetErrorStringWithVarArg (const char *format, va_list args)
// allocated buffer above
va_list copy_args;
va_copy (copy_args, args);
- int length = ::vsnprintf (buf.data(), buf.size(), format, args);
+ size_t length = ::vsnprintf (buf.data(), buf.size(), format, args);
if (length >= buf.size())
{
// The error formatted string didn't fit into our buffer, resize it
diff --git a/lldb/source/Core/FileSpec.cpp b/lldb/source/Core/FileSpec.cpp
index bf90e967cc2..7e2e087a545 100644
--- a/lldb/source/Core/FileSpec.cpp
+++ b/lldb/source/Core/FileSpec.cpp
@@ -58,7 +58,7 @@ GetCachedGlobTildeSlash()
// Returns 0 if there WAS a ~ in the path but the username couldn't be resolved.
// Otherwise returns the number of characters copied into dst_path. If the return
// is >= dst_len, then the resolved path is too long...
-int
+size_t
FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len)
{
char user_home[PATH_MAX];
@@ -70,7 +70,7 @@ FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len)
// If there's no ~, then just copy src_path straight to dst_path (they may be the same string...)
if (src_path[0] != '~')
{
- int len = strlen (src_path);
+ size_t len = strlen (src_path);
if (len >= dst_len)
{
::bcopy (src_path, dst_path, dst_len - 1);
@@ -106,7 +106,7 @@ FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len)
// User name of "" means the current user...
struct passwd *user_entry;
- const char *home_dir;
+ const char *home_dir = NULL;
if (user_name[0] == '\0')
{
@@ -125,7 +125,7 @@ FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len)
return ::snprintf (dst_path, dst_len, "%s%s", home_dir, remainder);
}
-int
+size_t
FileSpec::Resolve (const char *src_path, char *dst_path, size_t dst_len)
{
if (src_path == NULL || src_path[0] == '\0')
@@ -135,7 +135,7 @@ FileSpec::Resolve (const char *src_path, char *dst_path, size_t dst_len)
char unglobbed_path[PATH_MAX];
if (src_path[0] == '~')
{
- int return_count = ResolveUsername(src_path, unglobbed_path, sizeof(unglobbed_path));
+ size_t return_count = ResolveUsername(src_path, unglobbed_path, sizeof(unglobbed_path));
// If we couldn't find the user referred to, or the resultant path was too long,
// then just copy over the src_path.
@@ -509,16 +509,16 @@ FileSpec::GetPath(char *path, size_t max_path_length) const
{
if (filename && filename[0])
{
- return snprintf (path, max_path_length, "%s/%s", dirname, filename) < max_path_length;
+ return (size_t)::snprintf (path, max_path_length, "%s/%s", dirname, filename) < max_path_length;
}
else
{
- strncpy (path, dirname, max_path_length);
+ ::strncpy (path, dirname, max_path_length);
}
}
else if (filename)
{
- strncpy (path, filename, max_path_length);
+ ::strncpy (path, filename, max_path_length);
}
else
{
@@ -660,7 +660,7 @@ FileSpec::ReadFileContents (off_t file_offset, size_t file_size) const
{
// Make sure we read exactly what we asked for and if we got
// less, adjust the array
- if (bytesRead < data_heap_ap->GetByteSize())
+ if ((size_t)bytesRead < data_heap_ap->GetByteSize())
data_heap_ap->SetByteSize(bytesRead);
data_sp.reset(data_heap_ap.release());
}
diff --git a/lldb/source/Core/Language.cpp b/lldb/source/Core/Language.cpp
index b209d186f28..add2a22d66c 100644
--- a/lldb/source/Core/Language.cpp
+++ b/lldb/source/Core/Language.cpp
@@ -48,7 +48,7 @@ g_languages[] =
{ { "python" , NULL , "Python" } }
};
-static const uint32_t
+static const size_t
g_num_languages = sizeof(g_languages)/sizeof(LanguageStrings);
Language::Language(Language::Type language) :
diff --git a/lldb/source/Core/Makefile b/lldb/source/Core/Makefile
new file mode 100644
index 00000000000..b7773e3f571
--- /dev/null
+++ b/lldb/source/Core/Makefile
@@ -0,0 +1,14 @@
+##===- source/Core/Makefile --------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbCore
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp
index b08f4d80d5e..c8888421af7 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -154,9 +154,9 @@ SearchFilter::SearchInModuleList (Searcher &searcher, ModuleList &modules)
searcher.SearchCallback (*this, empty_sc, NULL, false);
else
{
- size_t numModules = modules.GetSize();
+ const size_t numModules = modules.GetSize();
- for (int i = 0; i < numModules; i++)
+ for (size_t i = 0; i < numModules; i++)
{
ModuleSP module_sp(modules.GetModuleAtIndex(i));
if (ModulePasses(module_sp))
@@ -186,7 +186,7 @@ SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searche
if (!context.module_sp)
{
size_t n_modules = m_target_sp->GetImages().GetSize();
- for (int i = 0; i < n_modules; i++)
+ for (size_t i = 0; i < n_modules; i++)
{
// If this is the last level supplied, then call the callback directly,
// otherwise descend.
@@ -395,8 +395,8 @@ SearchFilterByModule::Search (Searcher &searcher)
// find the ones that match the file name.
ModuleList matching_modules;
- // const size_t num_matching_modules = m_target_sp->GetImages().FindModules(&m_module_spec, NULL, NULL, NULL, matching_modules);
- for (int i = 0; i < m_target_sp->GetImages().GetSize (); i++)
+ const size_t num_modules = m_target_sp->GetImages().GetSize ();
+ for (size_t i = 0; i < num_modules; i++)
{
Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0)
diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp
index 0d3c8e0aced..9beec35c8f7 100644
--- a/lldb/source/Core/Stream.cpp
+++ b/lldb/source/Core/Stream.cpp
@@ -67,12 +67,10 @@ Stream::PutSLEB128 (int64_t sval)
if (m_flags.IsSet(eBinary))
{
bool more = true;
- bool negative = (sval < 0);
while (more)
{
uint8_t byte = sval & 0x7fu;
sval >>= 7;
- assert((!negative && sval >= 0) || (negative && sval < 0));
/* sign bit of byte is 2nd high order bit (0x40) */
if ((sval == 0 && !(byte & 0x40)) ||
(sval == -1 && (byte & 0x40)) )
@@ -209,7 +207,7 @@ Stream::PrintfVarArg (const char *format, va_list args)
int bytes_written = 0;
// Try and format our string into a fixed buffer first and see if it fits
- int length = vsnprintf (str, sizeof(str), format, args);
+ size_t length = ::vsnprintf (str, sizeof(str), format, args);
if (length < sizeof(str))
{
va_end (args);
@@ -479,16 +477,15 @@ Stream::PrintfAsRawHex8 (const char *format, ...)
va_start (args, format);
va_copy (args, args_copy); // Copy this so we
- int i;
char str[1024];
int bytes_written = 0;
// Try and format our string into a fixed buffer first and see if it fits
- int length = vsnprintf (str, sizeof(str), format, args);
+ size_t length = ::vsnprintf (str, sizeof(str), format, args);
if (length < sizeof(str))
{
// The formatted string fit into our stack based buffer, so we can just
// append that to our packet
- for (i=0; i<length; ++i)
+ for (size_t i=0; i<length; ++i)
bytes_written += _PutHex8 (str[i], false);
}
else
@@ -499,7 +496,7 @@ Stream::PrintfAsRawHex8 (const char *format, ...)
length = ::vasprintf (&str_ptr, format, args_copy);
if (str_ptr)
{
- for (i=0; i<length; ++i)
+ for (size_t i=0; i<length; ++i)
bytes_written += _PutHex8 (str_ptr[i], false);
::free (str_ptr);
}
@@ -514,7 +511,7 @@ int
Stream::PutNHex8 (size_t n, uint8_t uvalue)
{
int bytes_written = 0;
- for (int i=0; i<n; ++i)
+ for (size_t i=0; i<n; ++i)
bytes_written += _PutHex8 (uvalue, m_flags.IsSet(eAddPrefix));
return bytes_written;
}
@@ -555,15 +552,14 @@ Stream::PutHex16 (uint16_t uvalue, ByteOrder byte_order)
bool add_prefix = m_flags.IsSet(eAddPrefix);
int bytes_written = 0;
- int byte;
if (byte_order == eByteOrderLittle)
{
- for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
+ for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
}
else
{
- for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false)
+ for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false)
bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
}
return bytes_written;
@@ -577,15 +573,14 @@ Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order)
bool add_prefix = m_flags.IsSet(eAddPrefix);
int bytes_written = 0;
- int byte;
if (byte_order == eByteOrderLittle)
{
- for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
+ for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
}
else
{
- for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false)
+ for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false)
bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
}
return bytes_written;
@@ -599,15 +594,14 @@ Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order)
bool add_prefix = m_flags.IsSet(eAddPrefix);
int bytes_written = 0;
- int byte;
if (byte_order == eByteOrderLittle)
{
- for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
+ for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
}
else
{
- for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false)
+ for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false)
bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
}
return bytes_written;
@@ -675,17 +669,16 @@ Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, By
int bytes_written = 0;
const uint8_t *src = (const uint8_t *)s;
- int i;
bool binary_is_clear = m_flags.IsClear (eBinary);
m_flags.Set (eBinary);
if (src_byte_order == dst_byte_order)
{
- for (i=0;i<src_len; ++i)
+ for (size_t i = 0; i < src_len; ++i)
bytes_written += _PutHex8 (src[i], false);
}
else
{
- for (i=src_len-1;i>=0; --i)
+ for (size_t i = src_len-1; i < src_len; --i)
bytes_written += _PutHex8 (src[i], false);
}
if (binary_is_clear)
@@ -705,17 +698,16 @@ Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_ord
int bytes_written = 0;
const uint8_t *src = (const uint8_t *)s;
- int i;
bool binary_is_set = m_flags.IsSet(eBinary);
m_flags.Clear(eBinary);
if (src_byte_order == dst_byte_order)
{
- for (i=0;i<src_len; ++i)
+ for (size_t i = 0; i < src_len; ++i)
bytes_written += _PutHex8 (src[i], false);
}
else
{
- for (i=src_len-1;i>=0; --i)
+ for (size_t i = src_len-1; i < src_len; --i)
bytes_written += _PutHex8 (src[i], false);
}
if (binary_is_set)
diff --git a/lldb/source/Core/StreamFile.cpp b/lldb/source/Core/StreamFile.cpp
index 415822789bb..c8e87d91a5a 100644
--- a/lldb/source/Core/StreamFile.cpp
+++ b/lldb/source/Core/StreamFile.cpp
@@ -24,32 +24,32 @@ using namespace lldb_private;
StreamFile::StreamFile () :
Stream (),
m_file (NULL),
- m_path_name (),
- m_close_file (false)
+ m_close_file (false),
+ m_path_name ()
{
}
StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, FILE *f) :
Stream (flags, addr_size, byte_order),
m_file(f),
- m_path_name (),
- m_close_file(false)
+ m_close_file(false),
+ m_path_name ()
{
}
StreamFile::StreamFile(FILE *f) :
Stream (),
m_file(f),
- m_path_name (),
- m_close_file(false)
+ m_close_file(false),
+ m_path_name ()
{
}
StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, const char *path, const char *permissions) :
Stream (flags, addr_size, byte_order),
m_file (NULL),
- m_path_name (path),
- m_close_file(false)
+ m_close_file(false),
+ m_path_name (path)
{
Open(path, permissions);
}
@@ -57,8 +57,8 @@ StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order,
StreamFile::StreamFile(const char *path, const char *permissions) :
Stream (),
m_file (NULL),
- m_path_name (path),
- m_close_file(false)
+ m_close_file(false),
+ m_path_name (path)
{
Open(path, permissions);
}
diff --git a/lldb/source/Core/StringList.cpp b/lldb/source/Core/StringList.cpp
index cb96fb0f7b9..61d78834966 100644
--- a/lldb/source/Core/StringList.cpp
+++ b/lldb/source/Core/StringList.cpp
@@ -68,7 +68,7 @@ StringList::AppendList (StringList strings)
{
uint32_t len = strings.GetSize();
- for (int i = 0; i < len; ++i)
+ for (uint32_t i = 0; i < len; ++i)
m_strings.push_back (strings.GetStringAtIndex(i));
}
@@ -106,7 +106,7 @@ StringList::LongestCommonPrefix (std::string &common_prefix)
for (++pos; pos != end; ++pos)
{
- int new_size = strlen (m_strings[pos].c_str());
+ size_t new_size = strlen (m_strings[pos].c_str());
// First trim common_prefix if it is longer than the current element:
if (common_prefix.size() > new_size)
@@ -114,7 +114,7 @@ StringList::LongestCommonPrefix (std::string &common_prefix)
// Then trim it at the first disparity:
- for (int i = 0; i < common_prefix.size(); i++)
+ for (size_t i = 0; i < common_prefix.size(); i++)
{
if (m_strings[pos][i] != common_prefix[i])
{
@@ -189,7 +189,7 @@ StringList::RemoveBlankLines ()
if (GetSize() == 0)
return;
- int idx = 0;
+ size_t idx = 0;
while (idx < m_strings.size())
{
if (m_strings[idx].empty())
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index c4c17dd0428..32c27496b8f 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -616,7 +616,7 @@ Value::GetValueAsData (ExecutionContext *exe_ctx, clang::ASTContext *ast_context
data.SetData(data_sp);
}
- uint8_t* dst = (uint8_t*)data.PeekData (data_offset, byte_size);
+ uint8_t* dst = const_cast<uint8_t*>(data.PeekData (data_offset, byte_size));
if (dst != NULL)
{
if (address_type == eAddressTypeHost)
@@ -677,6 +677,10 @@ Value::ResolveValue(ExecutionContext *exe_ctx, clang::ASTContext *ast_context)
case eValueTypeScalar: // raw scalar value
break;
+ case eContextTypeValue:
+ m_value.Clear(); // TODO: Sean, fill this in
+ break;
+
default:
case eValueTypeFileAddress:
m_value.Clear();
@@ -757,6 +761,7 @@ Value::GetContextTypeAsCString (ContextType context_type)
case eContextTypeDCRegisterInfo: return "RegisterInfo *";
case eContextTypeDCType: return "Type *";
case eContextTypeDCVariable: return "Variable *";
+ case eContextTypeValue: return "Value"; // TODO: Sean, more description here?
};
return "???";
}
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 8baa4e1a979..4a1e002242e 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -516,6 +516,9 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope)
}
}
break;
+
+ default:
+ break;
}
}
}
@@ -579,7 +582,7 @@ ValueObject::SetValueFromCString (ExecutionContextScope *exe_scope, const char *
{
const size_t byte_size = GetByteSize();
const off_t byte_offset = GetByteOffset();
- uint8_t *dst = (uint8_t *)m_data.PeekData(byte_offset, byte_size);
+ uint8_t *dst = const_cast<uint8_t *>(m_data.PeekData(byte_offset, byte_size));
if (dst != NULL)
{
// We are decoding a float into host byte order below, so make
diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp
index 5c6e9d2e357..b9258bd45db 100644
--- a/lldb/source/Core/ValueObjectChild.cpp
+++ b/lldb/source/Core/ValueObjectChild.cpp
@@ -111,9 +111,9 @@ ValueObjectChild::GetTypeName()
const char *clang_type_name = m_type_name.AsCString();
if (clang_type_name)
{
- char bitfield_type_name[strlen(clang_type_name) + 32];
- ::snprintf (bitfield_type_name, sizeof(bitfield_type_name), "%s:%u", clang_type_name, m_bitfield_bit_size);
- m_type_name.SetCString(bitfield_type_name);
+ std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0);
+ ::snprintf (bitfield_type_name.data(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size);
+ m_type_name.SetCString(bitfield_type_name.data());
}
}
}
diff --git a/lldb/source/Expression/ClangExpression.cpp b/lldb/source/Expression/ClangExpression.cpp
index 702c273db9f..2383faef054 100644
--- a/lldb/source/Expression/ClangExpression.cpp
+++ b/lldb/source/Expression/ClangExpression.cpp
@@ -195,9 +195,12 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
ClangExpression::ClangExpression(const char *target_triple,
ClangExpressionDeclMap *decl_map) :
m_target_triple (),
- m_jit_mm_ptr (NULL),
+ m_decl_map (decl_map),
+ m_clang_ap (),
m_code_generator_ptr (NULL),
- m_decl_map (decl_map)
+ m_jit_mm_ptr (NULL),
+ m_execution_engine (),
+ m_jitted_functions ()
{
if (target_triple && target_triple[0])
m_target_triple = target_triple;
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index f833bab1320..3b775e5cb36 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -43,14 +43,19 @@ using namespace lldb_private;
//----------------------------------------------------------------------
ClangFunction::ClangFunction(const char *target_triple, ClangASTContext *ast_context, void *return_qualtype, const Address& functionAddress, const ValueList &arg_value_list) :
ClangExpression (target_triple, NULL),
- m_function_addr (functionAddress),
m_function_ptr (NULL),
- m_arg_values (arg_value_list),
- m_clang_ast_context (ast_context),
+ m_function_addr (functionAddress),
m_function_return_qual_type(return_qualtype),
+ m_clang_ast_context (ast_context),
m_wrapper_function_name ("__lldb_caller_function"),
m_wrapper_struct_name ("__lldb_caller_struct"),
+ m_wrapper_function_addr (),
+ m_wrapper_args_addrs (),
+ m_struct_layout (NULL),
+ m_arg_values (arg_value_list),
+ m_value_struct_size (0),
m_return_offset(0),
+ m_return_size (0),
m_compiled (false),
m_JITted (false)
{
@@ -59,12 +64,18 @@ ClangFunction::ClangFunction(const char *target_triple, ClangASTContext *ast_con
ClangFunction::ClangFunction(const char *target_triple, Function &function, ClangASTContext *ast_context, const ValueList &arg_value_list) :
ClangExpression (target_triple, NULL),
m_function_ptr (&function),
- m_arg_values (arg_value_list),
+ m_function_addr (),
+ m_function_return_qual_type (),
m_clang_ast_context (ast_context),
- m_function_return_qual_type (NULL),
m_wrapper_function_name ("__lldb_function_caller"),
m_wrapper_struct_name ("__lldb_caller_struct"),
- m_return_offset(0),
+ m_wrapper_function_addr (),
+ m_wrapper_args_addrs (),
+ m_struct_layout (NULL),
+ m_arg_values (arg_value_list),
+ m_value_struct_size (0),
+ m_return_offset (0),
+ m_return_size (0),
m_compiled (false),
m_JITted (false)
{
@@ -109,22 +120,24 @@ ClangFunction::CompileFunction (Stream &errors)
// to pull the defined arguments out of the function, then add the types from the
// arguments list for the variable arguments.
- size_t num_args = -1;
+ uint32_t num_args = UINT32_MAX;
bool trust_function = false;
// GetArgumentCount returns -1 for an unprototyped function.
if (m_function_ptr)
{
- num_args = m_function_ptr->GetArgumentCount();
- if (num_args != -1)
+ int num_func_args = m_function_ptr->GetArgumentCount();
+ if (num_func_args >= 0)
trust_function = true;
+ else
+ num_args = num_func_args;
}
- if (num_args == -1)
+ if (num_args == UINT32_MAX)
num_args = m_arg_values.GetSize();
std::string args_buffer; // This one stores the definition of all the args in "struct caller".
std::string args_list_buffer; // This one stores the argument list called from the structure.
- for (int i = 0; i < num_args; i++)
+ for (size_t i = 0; i < num_args; i++)
{
const char *type_string;
std::string type_stdstr;
@@ -157,7 +170,7 @@ ClangFunction::CompileFunction (Stream &errors)
char arg_buf[32];
args_buffer.append (" ");
args_buffer.append (type_string);
- snprintf(arg_buf, 31, "arg_%d", i);
+ snprintf(arg_buf, 31, "arg_%zd", i);
args_buffer.push_back (' ');
args_buffer.append (arg_buf);
args_buffer.append (";\n");
@@ -253,8 +266,8 @@ ClangFunction::WriteFunctionWrapper (ExecutionContext &exc_context, Stream &erro
}
// Next get the call address for the function:
- m_wrapper_fun_addr = GetFunctionAddress (m_wrapper_function_name.c_str());
- if (m_wrapper_fun_addr == LLDB_INVALID_ADDRESS)
+ m_wrapper_function_addr = GetFunctionAddress (m_wrapper_function_name.c_str());
+ if (m_wrapper_function_addr == LLDB_INVALID_ADDRESS)
return false;
return true;
@@ -322,7 +335,7 @@ ClangFunction::WriteFunctionArguments (ExecutionContext &exc_context, lldb::addr
return false;
}
- for (int i = 0; i < num_args; i++)
+ for (size_t i = 0; i < num_args; i++)
{
// FIXME: We should sanity check sizes.
@@ -366,7 +379,7 @@ ClangFunction::InsertFunction (ExecutionContext &exc_context, lldb::addr_t &args
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
- log->Printf ("Call Address: 0x%llx Struct Address: 0x%llx.\n", m_wrapper_fun_addr, args_addr_ref);
+ log->Printf ("Call Address: 0x%llx Struct Address: 0x%llx.\n", m_wrapper_function_addr, args_addr_ref);
return true;
}
@@ -386,7 +399,7 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exc_context, lldb:
// Okay, now run the function:
- Address wrapper_address (NULL, m_wrapper_fun_addr);
+ Address wrapper_address (NULL, m_wrapper_function_addr);
ThreadPlan *new_plan = new ThreadPlanCallFunction (*exc_context.thread,
wrapper_address,
args_addr,
diff --git a/lldb/source/Expression/ClangStmtVisitor.cpp b/lldb/source/Expression/ClangStmtVisitor.cpp
index b3aecebaeac..cfe525068a5 100644
--- a/lldb/source/Expression/ClangStmtVisitor.cpp
+++ b/lldb/source/Expression/ClangStmtVisitor.cpp
@@ -37,6 +37,9 @@ GetScalarTypeForClangType (clang::ASTContext &ast_context, clang::QualType clang
switch (clang_type->getTypeClass())
{
+ default:
+ break;
+
case clang::Type::FunctionNoProto:
case clang::Type::FunctionProto:
break;
@@ -135,8 +138,8 @@ lldb_private::ClangStmtVisitor::ClangStmtVisitor
lldb_private::StreamString &strm
) :
m_ast_context (ast_context),
- m_variable_list (variable_list),
m_decl_map (decl_map),
+ m_variable_list (variable_list),
m_stream (strm)
{
}
@@ -477,22 +480,10 @@ lldb_private::ClangStmtVisitor::VisitStringLiteral (clang::StringLiteral *Str)
bool is_wide = Str->isWide();
size_t new_length = byte_length + (is_wide ? 1 : 2);
+
+ std::string null_terminated_string (Str->getStrData(), byte_length);
- uint8_t null_terminated_string[new_length];
-
- memcpy(&null_terminated_string[0], Str->getStrData(), byte_length);
-
- if(is_wide)
- {
- null_terminated_string[byte_length] = '\0';
- null_terminated_string[byte_length + 1] = '\0';
- }
- else
- {
- null_terminated_string[byte_length] = '\0';
- }
-
- Value *val = new Value(null_terminated_string, new_length);
+ Value *val = new Value((uint8_t*)null_terminated_string.c_str(), new_length);
val->SetContext(Value::eContextTypeOpaqueClangQualType, Str->getType().getAsOpaquePtr());
uint32_t val_idx = m_variable_list.AppendValue(val);
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 3873766a07b..839cf2ef592 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -303,6 +303,9 @@ DWARFExpression::DumpLocation (Stream *s, uint32_t offset, uint32_t length, lldb
switch (level)
{
+ default:
+ break;
+
case lldb::eDescriptionLevelBrief:
if (offset > start_offset)
s->PutChar(' ');
diff --git a/lldb/source/Expression/Makefile b/lldb/source/Expression/Makefile
new file mode 100644
index 00000000000..fa4404f1813
--- /dev/null
+++ b/lldb/source/Expression/Makefile
@@ -0,0 +1,14 @@
+##===- source/Expression/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbExpression
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Generated/Makefile b/lldb/source/Generated/Makefile
new file mode 100644
index 00000000000..8a3569a270b
--- /dev/null
+++ b/lldb/source/Generated/Makefile
@@ -0,0 +1,19 @@
+##===- source/Generated/Makefile ---------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbGenerated
+BUILD_ARCHIVE = 1
+
+BUILT_SOURCES = LLDB_vers.c
+
+include $(LLDB_LEVEL)/Makefile
+
+LLDB_vers.c: $(PROJ_SRC_DIR)/../../scripts/generate-vers.pl $(PROJ_SRC_DIR)/../../lldb.xcodeproj/project.pbxproj
+ $(PROJ_SRC_DIR)/../../scripts/generate-vers.pl $(PROJ_SRC_DIR)/../../lldb.xcodeproj/project.pbxproj > $(PROJ_OBJ_DIR)/LLDB_vers.c
diff --git a/lldb/source/Host/Makefile b/lldb/source/Host/Makefile
new file mode 100644
index 00000000000..76e3d34ff43
--- /dev/null
+++ b/lldb/source/Host/Makefile
@@ -0,0 +1,20 @@
+##===- source/Host/Makefile --------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+
+include $(LLDB_LEVEL)/../../Makefile.config
+
+ifeq ($(HOST_OS),Darwin)
+DIRS := macosx posix
+else
+DIRS := linux posix
+endif
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Host/linux/Makefile b/lldb/source/Host/linux/Makefile
new file mode 100644
index 00000000000..bd6d7e4fff8
--- /dev/null
+++ b/lldb/source/Host/linux/Makefile
@@ -0,0 +1,14 @@
+##===- source/Host/linux/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+LIBRARYNAME := lldbHostLinux
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index 4aee4445b61..b2ca2bb6ce9 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -23,9 +23,9 @@
#include <Foundation/Foundation.h>
-#include "CFCBundle.h"
-#include "CFCReleaser.h"
-#include "CFCString.h"
+#include "cfcpp/CFCBundle.h"
+#include "cfcpp/CFCReleaser.h"
+#include "cfcpp/CFCString.h"
#include "lldb/Host/Host.h"
#include "lldb/Core/ArchSpec.h"
@@ -434,7 +434,7 @@ Host::SetThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name)
// Set the pthread name if possible
if (pid == curr_pid && tid == curr_tid)
{
- ::pthread_setname_np (name) == 0;
+ ::pthread_setname_np (name);
}
#endif
ThreadNameAccessor (false, pid, tid, name);
@@ -446,21 +446,22 @@ Host::GetProgramFileSpec ()
static FileSpec g_program_filepsec;
if (!g_program_filepsec)
{
- std::string program_fullpath;
- program_fullpath.resize (PATH_MAX);
+ char program_fullpath[PATH_MAX];
// If DST is NULL, then return the number of bytes needed.
- uint32_t len = program_fullpath.size();
- int err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len);
- if (err < 0)
+ uint32_t len = sizeof(program_fullpath);
+ int err = _NSGetExecutablePath (program_fullpath, &len);
+ if (err == 0)
+ g_program_filepsec.SetFile (program_fullpath);
+ else if (err == -1)
{
- // The path didn't fit in the buffer provided, increase its size
- // and try again
- program_fullpath.resize(len);
- len = program_fullpath.size();
- err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len);
+ char *large_program_fullpath = (char *)::malloc (len + 1);
+
+ err = _NSGetExecutablePath (large_program_fullpath, &len);
+ if (err == 0)
+ g_program_filepsec.SetFile (large_program_fullpath);
+
+ ::free (large_program_fullpath);
}
- if (err == 0)
- g_program_filepsec.SetFile(program_fullpath.data());
}
return g_program_filepsec;
}
@@ -505,7 +506,7 @@ Host::ResolveExecutableInBundle (FileSpec *file)
struct MonitorInfo
{
- int handle;
+ uint32_t handle;
pthread_t thread;
Host::MonitorChildProcessCallback callback;
void *callback_baton;
diff --git a/lldb/source/Host/macosx/Makefile b/lldb/source/Host/macosx/Makefile
new file mode 100644
index 00000000000..de505891d76
--- /dev/null
+++ b/lldb/source/Host/macosx/Makefile
@@ -0,0 +1,16 @@
+##===- source/Host/macosx/Makefile -------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+LIBRARYNAME := lldbHostMacOSX
+BUILD_ARCHIVE = 1
+
+SOURCES := $(notdir $(wildcard *.cpp *.mm))
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index 2b8026f7985..ccdde69bcbf 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -19,20 +19,23 @@
#include <CoreFoundation/CoreFoundation.h>
// Project includes
-#include "CFCReleaser.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/UUID.h"
+#include "Host/macosx/cfcpp/CFCReleaser.h"
+
using namespace lldb;
using namespace lldb_private;
extern "C" {
+
CFURLRef DBGCopyFullDSYMURLForUUID (CFUUIDRef uuid, CFURLRef exec_url);
CFDictionaryRef DBGCopyDSYMPropertyLists (CFURLRef dsym_url);
-};
+
+}
static bool
SkinnyMachOFileContainsArchAndUUID
diff --git a/lldb/source/Host/posix/Makefile b/lldb/source/Host/posix/Makefile
new file mode 100644
index 00000000000..d263510f6e2
--- /dev/null
+++ b/lldb/source/Host/posix/Makefile
@@ -0,0 +1,14 @@
+##===- source/Host/posix/Makefile --------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../..
+LIBRARYNAME := lldbHostPosix
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp
index 3b0019a33f6..78c1003e575 100644
--- a/lldb/source/Interpreter/Args.cpp
+++ b/lldb/source/Interpreter/Args.cpp
@@ -779,7 +779,7 @@ Args::LongestCommonPrefix (std::string &common_prefix)
for (++pos; pos != end; ++pos)
{
- int new_size = (*pos).size();
+ size_t new_size = (*pos).size();
// First trim common_prefix if it is longer than the current element:
if (common_prefix.size() > new_size)
@@ -787,7 +787,7 @@ Args::LongestCommonPrefix (std::string &common_prefix)
// Then trim it at the first disparity:
- for (int i = 0; i < common_prefix.size(); i++)
+ for (size_t i = 0; i < common_prefix.size(); i++)
{
if ((*pos)[i] != common_prefix[i])
{
@@ -998,7 +998,7 @@ Args::ParseArgsForCompletion
// So we have to build another Arg and pass that to getopt_long so it doesn't
// change the one we have.
- std::vector<const char *> dummy_vec(GetArgumentVector(), GetArgumentVector() + GetArgumentCount() + 1);
+ std::vector<const char *> dummy_vec (GetArgumentVector(), GetArgumentVector() + GetArgumentCount() + 1);
bool failed_once = false;
uint32_t dash_dash_pos = -1;
@@ -1009,7 +1009,10 @@ Args::ParseArgsForCompletion
int parse_start = optind;
int long_options_index = -1;
- val = ::getopt_long (dummy_vec.size() - 1,(char *const *) dummy_vec.data(), sstr.GetData(), long_options,
+ val = ::getopt_long (dummy_vec.size() - 1,
+ (char *const *) dummy_vec.data(),
+ sstr.GetData(),
+ long_options,
&long_options_index);
if (val == -1)
diff --git a/lldb/source/Interpreter/Makefile b/lldb/source/Interpreter/Makefile
new file mode 100644
index 00000000000..f6d7afe39ba
--- /dev/null
+++ b/lldb/source/Interpreter/Makefile
@@ -0,0 +1,24 @@
+##===- source/Interpreter/Makefile ------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbInterpreter
+BUILD_ARCHIVE = 1
+
+BUILT_SOURCES := LLDBWrapPython.cpp
+
+include $(LLDB_LEVEL)/Makefile
+
+LLDB_PYTHON_SWIG_CPP = $(PROJ_OBJ_ROOT)/$(BuildMode)/LLDBWrapPython.cpp
+LLDB_BIN_DIR := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
+PYTHON_DIR := $(LLDB_BIN_DIR)
+
+LLDBWrapPython.cpp:
+ swig -c++ -shadow -python -I"$(LLDB_LEVEL)/include" -I./. -outdir "$(LLDB_BIN_DIR)" -o LLDBWrapPython.cpp "$(LLDB_LEVEL)/scripts/lldb.swig"
+ cp embedded_interpreter.py "$(PYTHON_DIR)"
diff --git a/lldb/source/Makefile b/lldb/source/Makefile
new file mode 100644
index 00000000000..347aedbe5c2
--- /dev/null
+++ b/lldb/source/Makefile
@@ -0,0 +1,20 @@
+##===- source/Makefile -------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ..
+DIRS := API Breakpoint Commands Core Expression Host Interpreter Plugins Symbol Target Utility
+LIBRARYNAME := lldbInitAndLog
+BUILD_ARCHIVE = 1
+
+BUILT_SOURCES = LLDB_vers.c
+
+include $(LLDB_LEVEL)/Makefile
+
+LLDB_vers.c: $(LLDB_LEVEL)/scripts/generate-vers.pl $(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj
+ $(LLDB_LEVEL)/scripts/generate-vers.pl $(LLDB_LEVEL)/lldb.xcodeproj/project.pbxproj > LLDB_vers.c
diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/Makefile b/lldb/source/Plugins/ABI/MacOSX-i386/Makefile
new file mode 100644
index 00000000000..d9bc7392256
--- /dev/null
+++ b/lldb/source/Plugins/ABI/MacOSX-i386/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/ABI/MacOSX-i386/Makefile -------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginABIMacOSX_i386
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/Makefile b/lldb/source/Plugins/ABI/SysV-x86_64/Makefile
new file mode 100644
index 00000000000..32990a64f95
--- /dev/null
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/ABI/SysV-x86_64/Makefile -------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginABISysV_x86_64
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index c831d95aab2..945ef871d68 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -376,8 +376,7 @@ DisassemblerLLVM::DisassemblerLLVM(const ArchSpec &arch) :
char triple[256];
if (TripleForArchSpec (arch, triple, sizeof(triple)))
{
- EDAssemblySyntax_t syntax = SyntaxForArchSpec (arch);
- assert(!EDGetDisassembler(&m_disassembler, triple, syntax) && "No disassembler created!");
+ assert(!EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch)) && "No disassembler created!");
}
}
diff --git a/lldb/source/Plugins/Disassembler/llvm/Makefile b/lldb/source/Plugins/Disassembler/llvm/Makefile
new file mode 100644
index 00000000000..a1309cdd081
--- /dev/null
+++ b/lldb/source/Plugins/Disassembler/llvm/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/Disassembler/llvm/Makefile -------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginDisassemblerLLVM
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile
new file mode 100644
index 00000000000..70400caa7d8
--- /dev/null
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/Disassembler/llvm/Makefile -------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginDynamicLoaderMacOSX
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h
index bc06d267d2f..961a5cc4d94 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h
@@ -16,7 +16,6 @@
#include <string>
// Other libraries and framework includes
// Project includes
-#include "lldb.h"
#include "lldb/Expression/ClangExpression.h"
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Host/Mutex.h"
@@ -128,6 +127,6 @@ private:
};
-}; // using namespace lldb_private
+} // using namespace lldb_private
#endif // lldb_ObjCTrampolineHandler_h_
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h
index 8033718277e..f30c333df6b 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h
@@ -14,8 +14,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb-types.h"
-#include "lldb-enumerations.h"
+#include "lldb/lldb-types.h"
+#include "lldb/lldb-enumerations.h"
#include "lldb/Target/ThreadPlan.h"
#include "ObjCTrampolineHandler.h"
@@ -90,5 +90,6 @@ private:
lldb::addr_t m_sel_ptr;
};
-}; // namespace lldb_private
+} // namespace lldb_private
+
#endif // lldb_ThreadPlanStepThroughObjCTrampoline_h_
diff --git a/lldb/source/Plugins/Makefile b/lldb/source/Plugins/Makefile
new file mode 100644
index 00000000000..ab62b87aec9
--- /dev/null
+++ b/lldb/source/Plugins/Makefile
@@ -0,0 +1,21 @@
+##===- source/Plugins/Makefile -----------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+
+include $(LLDB_LEVEL)/../../Makefile.config
+
+
+DIRS := ABI/MacOSX-i386 ABI/SysV-x86_64 Disassembler/llvm ObjectContainer/BSD-Archive ObjectFile/ELF SymbolFile/DWARF SymbolFile/Symtab SymbolVendor/MacOSX
+
+ifeq ($(HOST_OS),Darwin)
+ DIRS += DynamicLoader/MacOSX-DYLD ObjectContainer/Universal-Mach-O ObjectFile/Mach-O Process/gdb-remote Process/Utility
+endif
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/Makefile b/lldb/source/Plugins/ObjectContainer/BSD-Archive/Makefile
new file mode 100644
index 00000000000..00c5911ea95
--- /dev/null
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/ObjectContainer/BSD-Archive/Makefile -------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginObjectContainerBSDArchive
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile
new file mode 100644
index 00000000000..274ecddf927
--- /dev/null
+++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/ObjectContainer/Universal-Mach-O/Makefile -------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginObjectContainerUniversalMachO
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/ObjectFile/ELF/Makefile b/lldb/source/Plugins/ObjectFile/ELF/Makefile
new file mode 100644
index 00000000000..470660bb786
--- /dev/null
+++ b/lldb/source/Plugins/ObjectFile/ELF/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/ObjectFile/ELF/Makefile --------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginObjectFileELF
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/Makefile b/lldb/source/Plugins/ObjectFile/Mach-O/Makefile
new file mode 100644
index 00000000000..2fab0238e41
--- /dev/null
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/ObjectFile/Mach-O/Makefile -----------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginObjectFileMachO
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/Process/MacOSX-User/Makefile b/lldb/source/Plugins/Process/MacOSX-User/Makefile
new file mode 100644
index 00000000000..8fb3e46e6c8
--- /dev/null
+++ b/lldb/source/Plugins/Process/MacOSX-User/Makefile
@@ -0,0 +1,17 @@
+##===- source/Plugins/Process/MacOSX-User/Makefile ---------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginProcessMacOSXUser
+BUILD_ARCHIVE = 1
+
+Source := $(wildcard $(PROJ_SRC_DIR)/source/*.cpp)
+Source += $(wildcard $(PROJ_SRC_DIR)/source/MacOSX/*.cpp)
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h
index 1f3aeb07b0a..78e7ed5e68b 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h
@@ -131,7 +131,7 @@ public:
enum
{
e_actionForward, // Forward signal to inferior process
- e_actionStop, // Stop when this signal is received
+ e_actionStop // Stop when this signal is received
};
struct Action
{
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index 648e9539b8d..b9adb31c8a4 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -341,7 +341,7 @@ ProcessMacOSX::DoLaunch
}
Error
-ProcessMacOSX::DoAttach (lldb::pid_t attach_pid)
+ProcessMacOSX::DoAttachToProcessWithID (lldb::pid_t attach_pid)
{
Error error;
@@ -493,12 +493,19 @@ ProcessMacOSX::DidAttach ()
}
Error
-ProcessMacOSX::WillAttach (lldb::pid_t pid)
+ProcessMacOSX::WillAttachToProcessWithID (lldb::pid_t pid)
{
return WillLaunchOrAttach ();
}
Error
+ProcessMacOSX::WillAttachToProcessWithName (const char *process_name, bool wait_for_launch)
+{
+ return WillLaunchOrAttach ();
+}
+
+
+Error
ProcessMacOSX::DoResume ()
{
Error error;
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
index 8388d4e46fe..6f1f3362679 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
@@ -22,8 +22,8 @@
#include "lldb/Target/Thread.h"
// Project includes
-#include "MachTask.h"
-#include "MachException.h"
+#include "MacOSX/MachTask.h"
+#include "MacOSX/MachException.h"
typedef enum PDLaunch
{
@@ -33,6 +33,7 @@ typedef enum PDLaunch
#if defined (__arm__)
eLaunchSpringBoard,
#endif
+ kNumPDLaunchTypes
} PDLaunchType;
@@ -99,10 +100,13 @@ public:
DidLaunch ();
virtual lldb_private::Error
- WillAttach (lldb::pid_t pid);
+ WillAttachToProcessWithID (lldb::pid_t pid);
virtual lldb_private::Error
- DoAttach (lldb::pid_t pid);
+ WillAttachToProcessWithName (const char *process_name, bool wait_for_launch);
+
+ virtual lldb_private::Error
+ DoAttachToProcessWithID (lldb::pid_t pid);
virtual void
DidAttach ();
diff --git a/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp b/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp
index bf6b6c2eac4..96bba7e9b99 100644
--- a/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp
@@ -166,6 +166,9 @@ LibUnwindRegisterContext::ReadRegisterValue (uint32_t reg, Scalar &value)
break;
}
break;
+
+ default:
+ break;
}
return false;
}
@@ -197,9 +200,12 @@ LibUnwindRegisterContext::WriteRegisterValue (uint32_t reg, const Scalar &value)
const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg);
if (reg_info == NULL)
return false;
- unw_word_t reg_value;
+ unw_word_t reg_value = 0;
switch (value.GetType())
{
+ case Scalar::e_void:
+ return false;
+
case Scalar::e_sint: reg_value = value.SInt(); break;
case Scalar::e_uint: reg_value = value.UInt(); break;
case Scalar::e_slong: reg_value = value.SLong(); break;
@@ -294,6 +300,9 @@ LibUnwindRegisterContext::WriteRegisterBytes (uint32_t reg, DataExtractor &data,
default:
return false;
}
+
+ default:
+ return false;
}
return WriteRegisterValue (reg, value);
}
diff --git a/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.h b/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.h
index 4e89b27961f..bd7d8bd3bea 100644
--- a/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.h
+++ b/lldb/source/Plugins/Process/Utility/LibUnwindRegisterContext.h
@@ -17,7 +17,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Target/RegisterContext.h"
-#include "libunwind.h"
+#include "libunwind/include/libunwind.h"
class LibUnwindRegisterContext : public lldb_private::RegisterContext
{
diff --git a/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp b/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp
index e6c7b354abc..902e22c3431 100644
--- a/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp
+++ b/lldb/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp
@@ -21,10 +21,11 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
-#include "lldb-enumerations.h"
-#include "libunwind.h"
+#include "lldb/lldb-enumerations.h"
#include "llvm-c/EnhancedDisassembly.h"
+#include "libunwind/include/libunwind.h"
+
using namespace lldb;
namespace lldb_private {
@@ -191,7 +192,15 @@ access_raw (lldb_private::unw_addr_space_t as, lldb_private::unw_word_t addr, ll
static int
-reg_info (lldb_private::unw_addr_space_t as, lldb_private::unw_regnum_t regnum, lldb_private::unw_regtype_t *type, char *buf, size_t buflen, void *arg)
+reg_info
+(
+ lldb_private::unw_addr_space_t as,
+ lldb_private::unw_regnum_t regnum,
+ lldb_private::unw_regtype_t *type,
+ char *buf,
+ size_t buflen,
+ void *arg
+)
{
if (arg == 0)
return -1;
diff --git a/lldb/source/Plugins/Process/Utility/Makefile b/lldb/source/Plugins/Process/Utility/Makefile
new file mode 100644
index 00000000000..f82fa88eddb
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/Utility/Makefile ---------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginUtility
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
index df2f7c07f65..937ae84e3ee 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
@@ -18,7 +18,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Target/Thread.h"
// Project includes
-#include "StringExtractorGDBRemote.h"
+#include "Utility/StringExtractorGDBRemote.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/Plugins/Process/Utility/UnwindLibUnwind.h b/lldb/source/Plugins/Process/Utility/UnwindLibUnwind.h
index d91f164a2f9..8b3489b80e1 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindLibUnwind.h
+++ b/lldb/source/Plugins/Process/Utility/UnwindLibUnwind.h
@@ -15,7 +15,7 @@
#include <vector>
// Other libraries and framework includes
-#include "libunwind.h"
+#include "libunwind/include/libunwind.h"
// Project includes
#include "lldb/lldb-private.h"
diff --git a/lldb/source/Plugins/Process/Utility/libunwind/include/libunwind.h b/lldb/source/Plugins/Process/Utility/libunwind/include/libunwind.h
index 63cc8ba2366..df7025653ea 100644
--- a/lldb/source/Plugins/Process/Utility/libunwind/include/libunwind.h
+++ b/lldb/source/Plugins/Process/Utility/libunwind/include/libunwind.h
@@ -56,7 +56,7 @@ enum unw_as_type { UNW_LOCAL, UNW_REMOTE };
struct unw_addr_space
{
enum unw_as_type type;
- uint8_t data[];
+ uint8_t data[1];
};
typedef struct unw_addr_space* unw_addr_space_t;
@@ -345,7 +345,7 @@ extern int unw_end_of_prologue_setup(unw_cursor_t*, unw_word_t sta
// architecture independent register numbers
enum {
UNW_REG_IP = -1, // instruction pointer
- UNW_REG_SP = -2, // stack pointer
+ UNW_REG_SP = -2 // stack pointer
};
@@ -502,7 +502,7 @@ enum {
};
-}; // namespace lldb_private
+} // namespace lldb_private
#endif
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index c144fed163b..66c4b241ef3 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -21,7 +21,7 @@
#include "lldb/Host/TimeValue.h"
// Project includes
-#include "StringExtractorGDBRemote.h"
+#include "Utility/StringExtractorGDBRemote.h"
#include "ProcessGDBRemote.h"
#include "ProcessGDBRemoteLog.h"
@@ -78,7 +78,7 @@ GDBRemoteCommunication::CalculcateChecksum (const char *payload, size_t payload_
// We only need to compute the checksum if we are sending acks
if (m_send_acks)
{
- for (int i = 0; i < payload_length; ++i)
+ for (size_t i = 0; i < payload_length; ++i)
checksum += payload[i];
}
return checksum & 255;
@@ -365,7 +365,10 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le
if (bytes_written == packet.GetSize())
{
if (m_send_acks)
- GetAck (1) == '+';
+ {
+ if (GetAck (1) != '+')
+ return 0;
+ }
}
return bytes_written;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
index 051fa445ff1..9351c6a7790 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -26,7 +26,7 @@
#include "lldb/Host/Mutex.h"
#include "lldb/Host/Predicate.h"
-#include "StringExtractorGDBRemote.h"
+#include "Utility/StringExtractorGDBRemote.h"
class ProcessGDBRemote;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index d69b172366d..5af4c9c2035 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -17,11 +17,11 @@
#include "lldb/Core/Scalar.h"
#include "lldb/Core/StreamString.h"
// Project includes
-#include "StringExtractorGDBRemote.h"
+#include "Utility/StringExtractorGDBRemote.h"
#include "ProcessGDBRemote.h"
#include "ThreadGDBRemote.h"
-#include "ARM_GCC_Registers.h"
-#include "ARM_DWARF_Registers.h"
+#include "Utility/ARM_GCC_Registers.h"
+#include "Utility/ARM_DWARF_Registers.h"
using namespace lldb;
using namespace lldb_private;
@@ -171,7 +171,10 @@ GDBRemoteRegisterContext::ReadRegisterValue (uint32_t reg, Scalar &value)
return true;
}
break;
- }
+
+ default:
+ break;
+ }
}
return false;
}
@@ -219,10 +222,10 @@ GDBRemoteRegisterContext::ReadRegisterBytes (uint32_t reg, DataExtractor &data)
else
{
// Get each register individually
- packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg, false);
+ packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg);
assert (packet_len < (sizeof(packet) - 1));
if (gdb_comm.SendPacketAndWaitForResponse(packet, response, 1, false))
- if (response.GetHexBytes ((uint8_t*)m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size), reg_info->byte_size, '\xcc') == reg_info->byte_size)
+ if (response.GetHexBytes (const_cast<uint8_t*>(m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)), reg_info->byte_size, '\xcc') == reg_info->byte_size)
m_reg_valid[reg] = true;
}
}
@@ -276,7 +279,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (uint32_t reg, DataExtractor &data,
if (reg_info)
{
// Grab a pointer to where we are going to put this register
- uint8_t *dst = (uint8_t *)m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size);
+ uint8_t *dst = const_cast<uint8_t*>(m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size));
if (dst == NULL)
return false;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBServer.cpp
deleted file mode 100644
index a88ec7b09d4..00000000000
--- a/lldb/source/Plugins/Process/gdb-remote/GDBServer.cpp
+++ /dev/null
@@ -1,1148 +0,0 @@
-//===-- GDBServer.cpp -------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <getopt.h>
-#include <netinet/in.h>
-#include <sys/select.h>
-#include <sys/sysctl.h>
-#include <string>
-#include <vector>
-#include <asl.h>
-
-#include "GDBServerLog.h"
-#include "GDBRemoteSession.h"
-
-using namespace lldb;
-
-//----------------------------------------------------------------------
-// Run loop modes which determine which run loop function will be called
-//----------------------------------------------------------------------
-typedef enum
-{
- eDCGSRunLoopModeInvalid = 0,
- eDCGSRunLoopModeGetStartModeFromRemoteProtocol,
- eDCGSRunLoopModeInferiorAttaching,
- eDCGSRunLoopModeInferiorLaunching,
- eDCGSRunLoopModeInferiorExecuting,
- eDCGSRunLoopModeInferiorKillOrDetach,
- eDCGSRunLoopModeExit
-} GSRunLoopMode;
-
-typedef enum
-{
- eLaunchFlavorDefault = 0,
- eLaunchFlavorPosixSpawn,
-#if defined (__arm__)
- eLaunchFlavorSpringBoard,
-#endif
- eLaunchFlavorForkExec,
-} GSLaunchFlavor;
-
-typedef lldb::shared_ptr<GDBRemoteSession> GDBRemoteSP;
-
-typedef struct HandleBroadcastEventInfo
-{
- TargetSP target_sp;
- GDBRemoteSP remote_sp;
- GSRunLoopMode mode;
-
- Target *
- GetTarget ()
- {
- return target_sp.get();
- }
-
- Process *
- GetProcess()
- {
- if (target_sp.get())
- return target_sp->GetProcess().get();
- return NULL;
- }
-
- GDBRemoteSession *
- GetRemote ()
- {
- return remote_sp.get();
- }
-
-};
-
-
-//----------------------------------------------------------------------
-// Global Variables
-//----------------------------------------------------------------------
-static int g_lockdown_opt = 0;
-static int g_applist_opt = 0;
-static GSLaunchFlavor g_launch_flavor = eLaunchFlavorDefault;
-int g_isatty = 0;
-
-//----------------------------------------------------------------------
-// Run Loop function prototypes
-//----------------------------------------------------------------------
-void GSRunLoopGetStartModeFromRemote (HandleBroadcastEventInfo *info);
-void GSRunLoopInferiorExecuting (HandleBroadcastEventInfo *info);
-
-
-//----------------------------------------------------------------------
-// Get our program path and arguments from the remote connection.
-// We will need to start up the remote connection without a PID, get the
-// arguments, wait for the new process to finish launching and hit its
-// entry point, and then return the run loop mode that should come next.
-//----------------------------------------------------------------------
-void
-GSRunLoopGetStartModeFromRemote (HandleBroadcastEventInfo *info)
-{
- std::string packet;
-
- Target *target = info->GetTarget();
- GDBRemoteSession *remote = info->GetRemote();
- if (target != NULL && remote != NULL)
- {
- // Spin waiting to get the A packet.
- while (1)
- {
- gdb_err_t err = gdb_err;
- GDBRemoteSession::PacketEnum type;
-
- err = remote->HandleReceivedPacket (&type);
-
- // check if we tried to attach to a process
- if (type == GDBRemoteSession::vattach || type == GDBRemoteSession::vattachwait)
- {
- if (err == gdb_success)
- {
- info->mode = eDCGSRunLoopModeInferiorExecuting;
- return;
- }
- else
- {
- Log::STDERR ("error: attach failed.");
- info->mode = eDCGSRunLoopModeExit;
- return;
- }
- }
-
- if (err == gdb_success)
- {
- // If we got our arguments we are ready to launch using the arguments
- // and any environment variables we received.
- if (type == GDBRemoteSession::set_argv)
- {
- info->mode = eDCGSRunLoopModeInferiorLaunching;
- return;
- }
- }
- else if (err == gdb_not_connected)
- {
- Log::STDERR ("error: connection lost.");
- info->mode = eDCGSRunLoopModeExit;
- return;
- }
- else
- {
- // a catch all for any other gdb remote packets that failed
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Error getting packet.",__FUNCTION__);
- continue;
- }
-
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "#### %s", __FUNCTION__);
- }
- }
- info->mode = eDCGSRunLoopModeExit;
-}
-
-
-//----------------------------------------------------------------------
-// This run loop mode will wait for the process to launch and hit its
-// entry point. It will currently ignore all events except for the
-// process state changed event, where it watches for the process stopped
-// or crash process state.
-//----------------------------------------------------------------------
-GSRunLoopMode
-GSRunLoopLaunchInferior (HandleBroadcastEventInfo *info)
-{
- // The Process stuff takes a c array, the GSContext has a vector...
- // So make up a c array.
- Target *target = info->GetTarget();
- GDBRemoteSession *remote = info->GetRemote();
- Process* process = info->GetProcess();
-
- if (process == NULL)
- return eDCGSRunLoopModeExit;
-
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Launching '%s'...", __FUNCTION__, target->GetExecutableModule()->GetFileSpec().GetFilename().AsCString());
-
- // Our launch type hasn't been set to anything concrete, so we need to
- // figure our how we are going to launch automatically.
-
- GSLaunchFlavor launch_flavor = g_launch_flavor;
- if (launch_flavor == eLaunchFlavorDefault)
- {
- // Our default launch method is posix spawn
- launch_flavor = eLaunchFlavorPosixSpawn;
-
-#if defined (__arm__)
- // Check if we have an app bundle, if so launch using SpringBoard.
- if (strstr(inferior_argv[0], ".app"))
- {
- launch_flavor = eLaunchFlavorSpringBoard;
- }
-#endif
- }
-
- //ctx.SetLaunchFlavor(launch_flavor);
-
- const char *stdio_file = NULL;
- lldb::pid_t pid = process->Launch (remote->GetARGV(), remote->GetENVP(), stdio_file, stdio_file, stdio_file);
-
- if (pid == LLDB_INVALID_PROCESS_ID)
- {
- Log::STDERR ("error: process launch failed: %s", process->GetError().AsCString());
- }
- else
- {
- if (remote->IsConnected())
- {
- // It we are connected already, the next thing gdb will do is ask
- // whether the launch succeeded, and if not, whether there is an
- // error code. So we need to fetch one packet from gdb before we wait
- // on the stop from the target.
- gdb_err_t err = gdb_err;
- GDBRemoteSession::PacketEnum type;
-
- err = remote->HandleReceivedPacket (&type);
-
- if (err != gdb_success)
- {
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Error getting packet.", __FUNCTION__);
- return eDCGSRunLoopModeExit;
- }
- if (type != GDBRemoteSession::query_launch_success)
- {
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Didn't get the expected qLaunchSuccess packet.", __FUNCTION__);
- }
- }
- }
-
- Listener listener("GSRunLoopLaunchInferior");
- listener.StartListeningForEvents (process, Process::eBroadcastBitStateChanged);
- while (process->GetID() != LLDB_INVALID_PROCESS_ID)
- {
- uint32_t event_mask = 0;
- while (listener.WaitForEvent(NULL, &event_mask))
- {
- if (event_mask & Process::eBroadcastBitStateChanged)
- {
- Event event;
- StateType event_state;
- while ((event_state = process->GetNextEvent (&event)))
- if (StateIsStoppedState(event_state))
- {
- GDBServerLog::LogIf (GS_LOG_EVENTS, "%s process %4.4x stopped with state %s", __FUNCTION__, pid, StateAsCString(event_state));
-
- switch (event_state)
- {
- default:
- case eStateInvalid:
- case eStateUnloaded:
- case eStateAttaching:
- case eStateLaunching:
- case eStateSuspended:
- break; // Ignore
-
- case eStateRunning:
- case eStateStepping:
- // Still waiting to stop at entry point...
- break;
-
- case eStateStopped:
- case eStateCrashed:
- return eDCGSRunLoopModeInferiorExecuting;
-
- case eStateDetached:
- case eStateExited:
- pid = LLDB_INVALID_PROCESS_ID;
- return eDCGSRunLoopModeExit;
- }
- }
-
- if (event_state = eStateInvalid)
- break;
- }
- }
- }
-
- return eDCGSRunLoopModeExit;
-}
-
-
-//----------------------------------------------------------------------
-// This run loop mode will wait for the process to launch and hit its
-// entry point. It will currently ignore all events except for the
-// process state changed event, where it watches for the process stopped
-// or crash process state.
-//----------------------------------------------------------------------
-GSRunLoopMode
-GSRunLoopLaunchAttaching (HandleBroadcastEventInfo *info, lldb::pid_t& pid)
-{
- Process* process = info->GetProcess();
-
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Attaching to pid %i...", __FUNCTION__, pid);
- pid = process->Attach(pid);
-
- if (pid == LLDB_INVALID_PROCESS_ID)
- return eDCGSRunLoopModeExit;
- return eDCGSRunLoopModeInferiorExecuting;
-}
-
-//----------------------------------------------------------------------
-// Watch for signals:
-// SIGINT: so we can halt our inferior. (disabled for now)
-// SIGPIPE: in case our child process dies
-//----------------------------------------------------------------------
-lldb::pid_t g_pid;
-int g_sigpipe_received = 0;
-void
-signal_handler(int signo)
-{
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (%s)", __FUNCTION__, Host::GetSignalAsCString(signo));
-
- switch (signo)
- {
-// case SIGINT:
-// DNBProcessKill (g_pid, signo);
-// break;
-
- case SIGPIPE:
- g_sigpipe_received = 1;
- break;
- }
-}
-
-// Return the new run loop mode based off of the current process state
-void
-HandleProcessStateChange (HandleBroadcastEventInfo *info, bool initialize)
-{
- Process *process = info->GetProcess();
- if (process == NULL)
- {
- info->mode = eDCGSRunLoopModeExit;
- return;
- }
-
- if (process->GetID() == LLDB_INVALID_PROCESS_ID)
- {
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "#### %s error: pid invalid, exiting...", __FUNCTION__);
- info->mode = eDCGSRunLoopModeExit;
- return;
- }
- StateType pid_state = process->GetState ();
-
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (info, initialize=%i) pid_state = %s", __FUNCTION__, (int)initialize, StateAsCString(pid_state));
-
- switch (pid_state)
- {
- case eStateInvalid:
- case eStateUnloaded:
- // Something bad happened
- info->mode = eDCGSRunLoopModeExit;
- return;
-
- case eStateAttaching:
- case eStateLaunching:
- info->mode = eDCGSRunLoopModeInferiorExecuting;
- return;
-
- case eStateSuspended:
- case eStateCrashed:
- case eStateStopped:
- if (initialize == false)
- {
- // Compare the last stop count to our current notion of a stop count
- // to make sure we don't notify more than once for a given stop.
- static uint32_t g_prev_stop_id = 0;
- uint32_t stop_id = process->GetStopID();
- bool pid_stop_count_changed = g_prev_stop_id != stop_id;
- if (pid_stop_count_changed)
- {
- info->GetRemote()->FlushSTDIO();
-
- if (stop_id == 1)
- {
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, StateAsCString (pid_state), stop_id, g_prev_stop_id);
- }
- else
- {
-
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? YES!!!", __FUNCTION__, (int)initialize, StateAsCString (pid_state), stop_id, g_prev_stop_id);
- info->GetRemote()->NotifyThatProcessStopped ();
- }
- }
- else
- {
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? skipping...", __FUNCTION__, (int)initialize, StateAsCString (pid_state), stop_id, g_prev_stop_id);
- }
- }
- info->mode = eDCGSRunLoopModeInferiorExecuting;
- return;
-
- case eStateStepping:
- case eStateRunning:
- info->mode = eDCGSRunLoopModeInferiorExecuting;
- return;
-
- case eStateExited:
- info->GetRemote()->HandlePacket_last_signal (NULL);
- info->mode = eDCGSRunLoopModeExit;
- return;
-
- }
-
- // Catch all...
- info->mode = eDCGSRunLoopModeExit;
-}
-
-bool
-CommunicationHandleBroadcastEvent (Broadcaster *broadcaster, uint32_t event_mask, void *baton)
-{
- HandleBroadcastEventInfo *info = (HandleBroadcastEventInfo *)baton;
- Process *process = info->GetProcess();
-
- if (process == NULL)
- {
- info->mode = eDCGSRunLoopModeExit;
- return true;
- }
-
- if (event_mask & Communication::eBroadcastBitPacketAvailable)
- {
- if (process->IsRunning())
- {
- if (info->GetRemote()->HandleAsyncPacket() == gdb_not_connected)
- info->mode = eDCGSRunLoopModeExit;
- }
- else
- {
- if (info->GetRemote()->HandleReceivedPacket() == gdb_not_connected)
- info->mode = eDCGSRunLoopModeExit;
- }
- }
- if (event_mask & Communication::eBroadcastBitReadThreadDidExit)
- {
- info->mode = eDCGSRunLoopModeExit;
- }
- if (event_mask & Communication::eBroadcastBitDisconnected)
- {
- info->mode = eDCGSRunLoopModeExit;
- }
-
- return true;
-
-}
-
-bool
-ProcessHandleBroadcastEvent (Broadcaster *broadcaster, uint32_t event_mask, void *baton)
-{
- HandleBroadcastEventInfo *info = (HandleBroadcastEventInfo *)baton;
- Process *process = info->GetProcess();
- if (process == NULL)
- {
- info->mode = eDCGSRunLoopModeExit;
- return true;
- }
-
- if (event_mask & Process::eBroadcastBitStateChanged)
- {
- // Consume all available process events with no timeout
- Event event;
- StateType process_state;
- while ((process_state = process->GetNextEvent (&event)) != eStateInvalid)
- {
- if (StateIsStoppedState(process_state))
- info->GetRemote()->FlushSTDIO();
- HandleProcessStateChange (info, false);
-
- if (info->mode != eDCGSRunLoopModeInferiorExecuting)
- break;
- }
- }
- else
- if (event_mask & (Process::eBroadcastBitSTDOUT | Process::eBroadcastBitSTDERR))
- {
- info->GetRemote()->FlushSTDIO();
- }
- return true;
-}
-
-// This function handles the case where our inferior program is stopped and
-// we are waiting for gdb remote protocol packets. When a packet occurs that
-// makes the inferior run, we need to leave this function with a new state
-// as the return code.
-void
-GSRunLoopInferiorExecuting (HandleBroadcastEventInfo *info)
-{
- GDBServerLog::LogIf (GS_LOG_MINIMAL, "#### %s", __FUNCTION__);
-
- // Init our mode and set 'is_running' based on the current process state
- HandleProcessStateChange (info, true);
-
- uint32_t desired_mask, acquired_mask;
- Listener listener("GSRunLoopInferiorExecuting");
-
- desired_mask = Communication::eBroadcastBitPacketAvailable |
- Communication::eBroadcastBitReadThreadDidExit |
- Communication::eBroadcastBitDisconnected;
-
- acquired_mask = listener.StartListeningForEvents (&(info->GetRemote()->GetPacketComm()),
- desired_mask,
- CommunicationHandleBroadcastEvent,
- info);
-
- assert (acquired_mask == desired_mask);
- desired_mask = GDBRemotePacket::eBroadcastBitPacketAvailable;
-
- acquired_mask = listener.StartListeningForEvents (&(info->GetRemote()->GetPacketComm()),
- desired_mask,
- CommunicationHandleBroadcastEvent,
- info);
-
- assert (acquired_mask == desired_mask);
-
- desired_mask = Process::eBroadcastBitStateChanged |
- Process::eBroadcastBitSTDOUT |
- Process::eBroadcastBitSTDERR ;
- acquired_mask = listener.StartListeningForEvents (info->GetProcess (),
- desired_mask,
- ProcessHandleBroadcastEvent,
- info);
-
- assert (acquired_mask == desired_mask);
-
- Process *process = info->GetProcess();
-
- while (process->IsAlive())
- {
- if (!info->GetRemote()->IsConnected())
- {
- info->mode = eDCGSRunLoopModeInferiorKillOrDetach;
- break;
- }
-
- // We want to make sure we consume all process state changes and have
- // whomever is notifying us to wait for us to reset the event bit before
- // continuing.
- //ctx.Events().SetResetAckMask (GSContext::event_proc_state_changed);
- uint32_t event_mask = 0;
- Broadcaster *broadcaster = listener.WaitForEvent(NULL, &event_mask);
- if (broadcaster)
- {
- listener.HandleBroadcastEvent(broadcaster, event_mask);
- }
- }
-}
-
-
-//----------------------------------------------------------------------
-// Convenience function to set up the remote listening port
-// Returns 1 for success 0 for failure.
-//----------------------------------------------------------------------
-
-static bool
-StartListening (HandleBroadcastEventInfo *info, int listen_port)
-{
- if (!info->GetRemote()->IsConnected())
- {
- Log::STDOUT ("Listening to port %i...\n", listen_port);
- char connect_url[256];
- snprintf(connect_url, sizeof(connect_url), "listen://%i", listen_port);
-
- Communication &comm = info->remote_sp->GetPacketComm();
- comm.SetConnection (new ConnectionFileDescriptor);
-
- if (comm.Connect (connect_url))
- {
- if (comm.StartReadThread())
- return true;
-
- Log::STDERR ("Failed to start the communication read thread.\n", connect_url);
- comm.Disconnect();
- }
- else
- {
- Log::STDERR ("Failed to connection to %s.\n", connect_url);
- }
- return false;
- }
- return true;
-}
-
-//----------------------------------------------------------------------
-// ASL Logging callback that can be registered with DNBLogSetLogDCScriptInterpreter::Type
-//----------------------------------------------------------------------
-//void
-//ASLLogDCScriptInterpreter::Type(void *baton, uint32_t flags, const char *format, va_list args)
-//{
-// if (format == NULL)
-// return;
-// static aslmsg g_aslmsg = NULL;
-// if (g_aslmsg == NULL)
-// {
-// g_aslmsg = ::asl_new (ASL_TYPE_MSG);
-// char asl_key_sender[PATH_MAX];
-// snprintf(asl_key_sender, sizeof(asl_key_sender), "com.apple.dc-gdbserver-%g", dc_gdbserverVersionNumber);
-// ::asl_set (g_aslmsg, ASL_KEY_SENDER, asl_key_sender);
-// }
-//
-// int asl_level;
-// if (flags & DNBLOG_FLAG_FATAL) asl_level = ASL_LEVEL_CRIT;
-// else if (flags & DNBLOG_FLAG_ERROR) asl_level = ASL_LEVEL_ERR;
-// else if (flags & DNBLOG_FLAG_WARNING) asl_level = ASL_LEVEL_WARNING;
-// else if (flags & DNBLOG_FLAG_VERBOSE) asl_level = ASL_LEVEL_WARNING; //ASL_LEVEL_INFO;
-// else asl_level = ASL_LEVEL_WARNING; //ASL_LEVEL_DEBUG;
-//
-// ::asl_vlog (NULL, g_aslmsg, asl_level, format, args);
-//}
-
-//----------------------------------------------------------------------
-// FILE based Logging callback that can be registered with
-// DNBLogSetLogDCScriptInterpreter::Type
-//----------------------------------------------------------------------
-void
-FileLogDCScriptInterpreter::Type(void *baton, uint32_t flags, const char *format, va_list args)
-{
- if (baton == NULL || format == NULL)
- return;
-
- ::vfprintf ((FILE *)baton, format, args);
- ::fprintf ((FILE *)baton, "\n");
-}
-
-//----------------------------------------------------------------------
-// option descriptors for getopt_long()
-//----------------------------------------------------------------------
-static struct option g_long_options[] =
-{
- { "arch", required_argument, NULL, 'c' },
- { "attach", required_argument, NULL, 'a' },
- { "debug", no_argument, NULL, 'g' },
- { "verbose", no_argument, NULL, 'v' },
- { "lockdown", no_argument, &g_lockdown_opt, 1 }, // short option "-k"
- { "applist", no_argument, &g_applist_opt, 1 }, // short option "-t"
- { "log-file", required_argument, NULL, 'l' },
- { "log-flags", required_argument, NULL, 'f' },
- { "launch", required_argument, NULL, 'x' }, // Valid values are "auto", "posix-spawn", "fork-exec", "springboard" (arm only)
- { "waitfor", required_argument, NULL, 'w' }, // Wait for a process whose namet starts with ARG
- { "waitfor-interval", required_argument, NULL, 'i' }, // Time in usecs to wait between sampling the pid list when waiting for a process by name
- { "waitfor-duration", required_argument, NULL, 'd' }, // The time in seconds to wait for a process to show up by name
- { NULL, 0, NULL, 0 }
-};
-
-extern const double dc_gdbserverVersionNumber;
-int
-main (int argc, char *argv[])
-{
- Initialize();
- Host::ThreadCreated ("[main]");
-
- g_isatty = ::isatty (STDIN_FILENO);
-
-// signal (SIGINT, signal_handler);
- signal (SIGPIPE, signal_handler);
-
- Log *log = GDBServerLog::GetLogIfAllCategoriesSet(GS_LOG_ALL);
- const char *this_exe_name = argv[0];
- int i;
- int attach_pid = LLDB_INVALID_PROCESS_ID;
- for (i=0; i<argc; i++)
- GDBServerLog::LogIf(GS_LOG_DEBUG, "argv[%i] = %s", i, argv[i]);
-
- FILE* log_file = NULL;
- uint32_t log_flags = 0;
- // Parse our options
- int ch;
- int long_option_index = 0;
- int debug = 0;
- std::string waitfor_pid_name; // Wait for a process that starts with this name
- std::string attach_pid_name;
- useconds_t waitfor_interval = 1000; // Time in usecs between process lists polls when waiting for a process by name, default 1 msec.
- useconds_t waitfor_duration = 0; // Time in seconds to wait for a process by name, 0 means wait forever.
- ArchSpec arch;
- GSRunLoopMode start_mode = eDCGSRunLoopModeExit;
-
- while ((ch = getopt_long(argc, argv, "a:c:d:gi:vktl:f:w:x:", g_long_options, &long_option_index)) != -1)
- {
-// DNBLogDebug("option: ch == %c (0x%2.2x) --%s%c%s\n",
-// ch, (uint8_t)ch,
-// g_long_options[long_option_index].name,
-// g_long_options[long_option_index].has_arg ? '=' : ' ',
-// optarg ? optarg : "");
- switch (ch)
- {
- case 0: // Any optional that auto set themselves will return 0
- break;
-
- case 'c':
- arch.SetArch(optarg);
- if (!arch.IsValid())
- {
- Log::STDERR ("error: invalid arch string '%s'\n", optarg);
- exit (8);
- }
- break;
-
- case 'a':
- if (optarg && optarg[0])
- {
- if (isdigit(optarg[0]))
- {
- char *end = NULL;
- attach_pid = strtoul(optarg, &end, 0);
- if (end == NULL || *end != '\0')
- {
- Log::STDERR ("error: invalid pid option '%s'\n", optarg);
- exit (4);
- }
- }
- else
- {
- attach_pid_name = optarg;
- }
- start_mode = eDCGSRunLoopModeInferiorAttaching;
- }
- break;
-
- // --waitfor=NAME
- case 'w':
- if (optarg && optarg[0])
- {
- waitfor_pid_name = optarg;
- start_mode = eDCGSRunLoopModeInferiorAttaching;
- }
- break;
-
- // --waitfor-interval=USEC
- case 'i':
- if (optarg && optarg[0])
- {
- char *end = NULL;
- waitfor_interval = strtoul(optarg, &end, 0);
- if (end == NULL || *end != '\0')
- {
- Log::STDERR ("error: invalid waitfor-interval option value '%s'.\n", optarg);
- exit (6);
- }
- }
- break;
-
- // --waitfor-duration=SEC
- case 'd':
- if (optarg && optarg[0])
- {
- char *end = NULL;
- waitfor_duration = strtoul(optarg, &end, 0);
- if (end == NULL || *end != '\0')
- {
- Log::STDERR ("error: invalid waitfor-duration option value '%s'.\n", optarg);
- exit (7);
- }
- }
- break;
-
- case 'x':
- if (optarg && optarg[0])
- {
- if (strcasecmp(optarg, "auto") == 0)
- g_launch_flavor = eLaunchFlavorDefault;
- else if (strcasestr(optarg, "posix") == optarg)
- g_launch_flavor = eLaunchFlavorPosixSpawn;
- else if (strcasestr(optarg, "fork") == optarg)
- g_launch_flavor = eLaunchFlavorForkExec;
-#if defined (__arm__)
- else if (strcasestr(optarg, "spring") == optarg)
- g_launch_flavor = eLaunchFlavorSpringBoard;
-#endif
- else
- {
- Log::STDERR ("error: invalid TYPE for the --launch=TYPE (-x TYPE) option: '%s'\n", optarg);
- Log::STDERR ("Valid values TYPE are:\n");
- Log::STDERR (" auto Auto-detect the best launch method to use.\n");
- Log::STDERR (" posix Launch the executable using posix_spawn.\n");
- Log::STDERR (" fork Launch the executable using fork and exec.\n");
-#if defined (__arm__)
- Log::STDERR (" spring Launch the executable through Springboard.\n");
-#endif
- exit (5);
- }
- }
- break;
-
- case 'l': // Set Log File
- if (optarg && optarg[0])
- {
- if (strcasecmp(optarg, "stdout") == 0)
- log_file = stdout;
- else if (strcasecmp(optarg, "stderr") == 0)
- log_file = stderr;
- else
- log_file = fopen(optarg, "w+");
-
- if (log_file == NULL)
- {
- const char *errno_str = strerror(errno);
- Log::STDERR ("Failed to open log file '%s' for writing: errno = %i (%s)", optarg, errno, errno_str ? errno_str : "unknown error");
- }
- }
- break;
-
- case 'f': // Log Flags
- if (optarg && optarg[0])
- log_flags = strtoul(optarg, NULL, 0);
- break;
-
- case 'g':
- debug = 1;
- //DNBLogSetDebug(1);
- break;
-
- case 't':
- g_applist_opt = 1;
- break;
-
- case 'k':
- g_lockdown_opt = 1;
- break;
-
- case 'v':
- //DNBLogSetVerbose(1);
- break;
- }
- }
-
- // Skip any options we consumed with getopt_long
- argc -= optind;
- argv += optind;
-
- // It is ok for us to set NULL as the logfile (this will disable any logging)
-
-// if (log_file != NULL)
-// {
-// DNBLogSetLogDCScriptInterpreter::Type(FileLogDCScriptInterpreter::Type, log_file);
-// // If our log file was set, yet we have no log flags, log everything!
-// if (log_flags == 0)
-// log_flags = LOG_ALL | LOG_DCGS_ALL;
-//
-// DNBLogSetLogMask (log_flags);
-// }
-// else
-// {
-// // Enable DNB logging
-// DNBLogSetLogDCScriptInterpreter::Type(ASLLogDCScriptInterpreter::Type, NULL);
-// DNBLogSetLogMask (log_flags);
-//
-// }
-
- // as long as we're dropping remotenub in as a replacement for gdbserver,
- // explicitly note that this is not gdbserver.
-
- Log::STDOUT ("debugserver-%g \n", dc_gdbserverVersionNumber);
- int listen_port = -1;
- if (g_lockdown_opt == 0 && g_applist_opt == 0)
- {
- // Make sure we at least have port
- if (argc < 1)
- {
- Log::STDERR ("Usage: %s host:port [program-name program-arg1 program-arg2 ...]\n", this_exe_name);
- exit (1);
- }
- // accept 'localhost:' prefix on port number
-
- std::string host_str;
- std::string port_str(argv[0]);
-
- // We just used the host:port arg...
- argc--;
- argv++;
-
- size_t port_idx = port_str.find(':');
- if (port_idx != std::string::npos)
- {
- host_str.assign(port_str, 0, port_idx);
- port_str.erase(0, port_idx + 1);
- }
-
- if (port_str.empty())
- {
- Log::STDERR ("error: no port specified\nUsage: %s host:port [program-name program-arg1 program-arg2 ...]\n", this_exe_name);
- exit (2);
- }
- else if (port_str.find_first_not_of("0123456789") != std::string::npos)
- {
- Log::STDERR ("error: port must be an integer: %s\nUsage: %s host:port [program-name program-arg1 program-arg2 ...]\n", port_str.c_str(), this_exe_name);
- exit (3);
- }
- //DNBLogDebug("host_str = '%s' port_str = '%s'", host_str.c_str(), port_str.c_str());
- listen_port = atoi (port_str.c_str());
- }
-
-
- // We must set up some communications now.
-
- FileSpec exe_spec;
- if (argv[0])
- exe_spec.SetFile (argv[0]);
-
- HandleBroadcastEventInfo info;
- info.target_sp = TargetList::SharedList().CreateTarget(&exe_spec, &arch);
- ProcessSP process_sp (info.target_sp->CreateProcess ());
- info.remote_sp.reset (new GDBRemoteSession (process_sp));
-
- info.remote_sp->SetLog (log);
- StreamString sstr;
- sstr.Printf("ConnectionFileDescriptor(%s)", argv[0]);
-
- if (info.remote_sp.get() == NULL)
- {
- Log::STDERR ("error: failed to create a GDBRemoteSession class\n");
- return -1;
- }
-
-
-
- // If we know we're waiting to attach, we don't need any of this other info.
- if (start_mode != eDCGSRunLoopModeInferiorAttaching)
- {
- if (argc == 0 || g_lockdown_opt)
- {
- if (g_lockdown_opt != 0)
- {
- // Work around for SIGPIPE crashes due to posix_spawn issue. We have to close
- // STDOUT and STDERR, else the first time we try and do any, we get SIGPIPE and
- // die as posix_spawn is doing bad things with our file descriptors at the moment.
- int null = open("/dev/null", O_RDWR);
- dup2(null, STDOUT_FILENO);
- dup2(null, STDERR_FILENO);
- }
- else if (g_applist_opt != 0)
- {
-// // List all applications we are able to see
-// std::string applist_plist;
-// int err = ListApplications(applist_plist, false, false);
-// if (err == 0)
-// {
-// fputs (applist_plist.c_str(), stdout);
-// }
-// else
-// {
-// Log::STDERR ("error: ListApplications returned error %i\n", err);
-// }
-// // Exit with appropriate error if we were asked to list the applications
-// // with no other args were given (and we weren't trying to do this over
-// // lockdown)
-// return err;
- return 0;
- }
-
- //DNBLogDebug("Get args from remote protocol...");
- start_mode = eDCGSRunLoopModeGetStartModeFromRemoteProtocol;
- }
- else
- {
- start_mode = eDCGSRunLoopModeInferiorLaunching;
- // Fill in the argv array in the context from the rest of our args.
- // Skip the name of this executable and the port number
- info.remote_sp->SetArguments (argc, argv);
- }
- }
-
- if (start_mode == eDCGSRunLoopModeExit)
- return -1;
-
- info.mode = start_mode;
-
- while (info.mode != eDCGSRunLoopModeExit)
- {
- switch (info.mode)
- {
- case eDCGSRunLoopModeGetStartModeFromRemoteProtocol:
- #if defined (__arm__)
- if (g_lockdown_opt)
- {
- if (!info.remote_sp->GetCommunication()->IsConnected())
- {
- if (info.remote_sp->GetCommunication()->ConnectToService () != gdb_success)
- {
- Log::STDERR ("Failed to get connection from a remote gdb process.\n");
- info.mode = eDCGSRunLoopModeExit;
- }
- else if (g_applist_opt != 0)
- {
- // List all applications we are able to see
- std::string applist_plist;
- if (ListApplications(applist_plist, false, false) == 0)
- {
- //DNBLogDebug("Task list: %s", applist_plist.c_str());
-
- info.remote_sp->GetCommunication()->Write(applist_plist.c_str(), applist_plist.size());
- // Issue a read that will never yield any data until the other side
- // closes the socket so this process doesn't just exit and cause the
- // socket to close prematurely on the other end and cause data loss.
- std::string buf;
- info.remote_sp->GetCommunication()->Read(buf);
- }
- info.remote_sp->GetCommunication()->Disconnect(false);
- info.mode = eDCGSRunLoopModeExit;
- break;
- }
- else
- {
- // Start watching for remote packets
- info.remote_sp->StartReadRemoteDataThread();
- }
- }
- }
- else
-#endif
- {
- if (StartListening (&info, listen_port))
- Log::STDOUT ("Got a connection, waiting for process information for launching or attaching.\n");
- else
- info.mode = eDCGSRunLoopModeExit;
- }
-
- if (info.mode != eDCGSRunLoopModeExit)
- GSRunLoopGetStartModeFromRemote (&info);
- break;
-
- case eDCGSRunLoopModeInferiorAttaching:
- if (!waitfor_pid_name.empty())
- {
- // Set our end wait time if we are using a waitfor-duration
- // option that may have been specified
-
- TimeValue attach_timeout_abstime;
- if (waitfor_duration != 0)
- {
- attach_timeout_abstime = TimeValue::Now();
- attach_timeout_abstime.OffsetWithSeconds (waitfor_duration);
- }
- GSLaunchFlavor launch_flavor = g_launch_flavor;
- if (launch_flavor == eLaunchFlavorDefault)
- {
- // Our default launch method is posix spawn
- launch_flavor = eLaunchFlavorPosixSpawn;
-
-#if defined (__arm__)
- // Check if we have an app bundle, if so launch using SpringBoard.
- if (waitfor_pid_name.find (".app") != std::string::npos)
- {
- launch_flavor = eLaunchFlavorSpringBoard;
- }
-#endif
- }
-
- //ctx.SetLaunchFlavor(launch_flavor);
-
-
- lldb::pid_t pid = info.GetProcess()->Attach (waitfor_pid_name.c_str());
- if (pid == LLDB_INVALID_PROCESS_ID)
- {
- info.GetRemote()->GetLaunchError() = info.GetProcess()->GetError();
- Log::STDERR ("error: failed to attach to process named: \"%s\" %s", waitfor_pid_name.c_str(), info.GetRemote()->GetLaunchError().AsCString());
- info.mode = eDCGSRunLoopModeExit;
- }
- else
- {
- info.mode = eDCGSRunLoopModeInferiorExecuting;
- }
- }
- else if (attach_pid != LLDB_INVALID_PROCESS_ID)
- {
- Log::STDOUT ("Attaching to process %i...\n", attach_pid);
- info.mode = GSRunLoopLaunchAttaching (&info, attach_pid);
- if (info.mode != eDCGSRunLoopModeInferiorExecuting)
- {
- const char *error_str = info.GetRemote()->GetLaunchError().AsCString();
- Log::STDERR ("error: failed to attach process %i: %s\n", attach_pid, error_str ? error_str : "unknown error.");
- info.mode = eDCGSRunLoopModeExit;
- }
- }
- else if (!attach_pid_name.empty ())
- {
- lldb::pid_t pid = info.GetProcess()->Attach (waitfor_pid_name.c_str());
- if (pid == LLDB_INVALID_PROCESS_ID)
- {
- info.GetRemote()->GetLaunchError() = info.GetProcess()->GetError();
- Log::STDERR ("error: failed to attach to process named: \"%s\" %s", waitfor_pid_name.c_str(), info.GetRemote()->GetLaunchError().AsCString());
- info.mode = eDCGSRunLoopModeExit;
- }
- else
- {
- info.mode = eDCGSRunLoopModeInferiorExecuting;
- }
- }
- else
- {
- Log::STDERR ("error: asked to attach with empty name and invalid PID.");
- info.mode = eDCGSRunLoopModeExit;
- }
-
- if (info.mode != eDCGSRunLoopModeExit)
- {
- if (StartListening (&info, listen_port))
- Log::STDOUT ("Got a connection, waiting for debugger instructions for process %d.\n", attach_pid);
- else
- info.mode = eDCGSRunLoopModeExit;
- }
- break;
-
- case eDCGSRunLoopModeInferiorLaunching:
- info.mode = GSRunLoopLaunchInferior (&info);
-
- if (info.mode == eDCGSRunLoopModeInferiorExecuting)
- {
- if (StartListening (&info, listen_port))
- Log::STDOUT ("Got a connection, waiting for debugger instructions for task \"%s\".\n", argv[0]);
- else
- info.mode = eDCGSRunLoopModeExit;
- }
- else
- {
- Log::STDERR ("error: failed to launch process %s: %s\n", argv[0], info.GetRemote()->GetLaunchError().AsCString());
- }
- break;
-
- case eDCGSRunLoopModeInferiorExecuting:
- GSRunLoopInferiorExecuting (&info);
- break;
-
- case eDCGSRunLoopModeInferiorKillOrDetach:
- {
- Process *process = info.GetProcess();
- if (process && process->IsAlive())
- {
- process->Kill(SIGCONT);
- process->Kill(SIGKILL);
- }
- }
- info.mode = eDCGSRunLoopModeExit;
- break;
-
- default:
- info.mode = eDCGSRunLoopModeExit;
- case eDCGSRunLoopModeExit:
- break;
- }
- }
-
- return 0;
-}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBServerLog.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBServerLog.cpp
deleted file mode 100644
index 2d4116ebe7b..00000000000
--- a/lldb/source/Plugins/Process/gdb-remote/GDBServerLog.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-//===-- GDBServerLog.cpp ----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//----------------------------------------------------------------------
-//
-// GDBServerLog.cpp
-// liblldb
-//
-// Created by Greg Clayton on 6/19/09.
-//
-//
-//----------------------------------------------------------------------
-
-#include "GDBServerLog.h"
-
-using namespace lldb;
-
-static Log *
-LogAccessor (bool get, Log *log)
-{
- static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
- // by global constructors before other threads
- // were done with it.
- if (get)
- {
-// // Debug code below for enabling logging by default
-// if (g_log == NULL)
-// {
-// g_log = new Log("/dev/stdout", false);
-// g_log->GetMask().SetAllFlagBits(GS_LOG_ALL);
-// g_log->GetOptions().Set(LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_THREAD_NAME);
-// }
- }
- else
- {
- if (g_log)
- delete g_log;
- g_log = log;
- }
-
- return g_log;
-}
-
-Log *
-GDBServerLog::GetLogIfAllCategoriesSet (uint32_t mask)
-{
- Log *log = LogAccessor (true, NULL);
- if (log && mask)
- {
- uint32_t log_mask = log->GetMask().GetAllFlagBits();
- if ((log_mask & mask) != mask)
- return NULL;
- }
- return log;
-}
-
-void
-GDBServerLog::SetLog (Log *log)
-{
- LogAccessor (false, log);
-}
-
-
-void
-GDBServerLog::LogIf (uint32_t mask, const char *format, ...)
-{
- Log *log = GDBServerLog::GetLogIfAllCategoriesSet (mask);
- if (log)
- {
- va_list args;
- va_start (args, format);
- log->VAPrintf (format, args);
- va_end (args);
- }
-}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBServerLog.h b/lldb/source/Plugins/Process/gdb-remote/GDBServerLog.h
deleted file mode 100644
index 3dec8088cef..00000000000
--- a/lldb/source/Plugins/Process/gdb-remote/GDBServerLog.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//===-- GDBServerLog.h ------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//----------------------------------------------------------------------
-//
-// GDBServerLog.h
-// liblldb
-//
-// Created by Greg Clayton on 6/19/09.
-//
-//
-//----------------------------------------------------------------------
-
-#ifndef liblldb_GDBServerLog_h_
-#define liblldb_GDBServerLog_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-
-#include "lldb/Core/Log.h"
-
-// Project includes
-#define GS_LOG_VERBOSE (1u << 0)
-#define GS_LOG_DEBUG (1u << 1)
-#define GS_LOG_PACKETS (1u << 2)
-#define GS_LOG_EVENTS (1u << 3)
-#define GS_LOG_MINIMAL (1u << 4)
-#define GS_LOG_ALL (UINT32_MAX)
-#define GS_LOG_DEFAULT (GS_LOG_VERBOSE |\
- GS_LOG_PACKETS)
-
-namespace lldb {
-
-class GDBServerLog
-{
-public:
- static Log *
- GetLog (uint32_t mask = 0);
-
- static void
- SetLog (Log *log);
-
- static void
- LogIf (uint32_t mask, const char *format, ...);
-};
-
-} // namespace lldb
-
-#endif // liblldb_GDBServerLog_h_
diff --git a/lldb/source/Plugins/Process/gdb-remote/Makefile b/lldb/source/Plugins/Process/gdb-remote/Makefile
new file mode 100644
index 00000000000..8a9b6107787
--- /dev/null
+++ b/lldb/source/Plugins/Process/gdb-remote/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/Process/gdb-remote/Makefile -------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginProcessGDBRemote
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index f58613b62f1..fcf00270514 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -46,12 +46,11 @@
// Project includes
#include "lldb/Host/Host.h"
-#include "StringExtractorGDBRemote.h"
+#include "Utility/StringExtractorGDBRemote.h"
#include "GDBRemoteRegisterContext.h"
#include "ProcessGDBRemote.h"
#include "ProcessGDBRemoteLog.h"
#include "ThreadGDBRemote.h"
-#include "libunwind.h"
#include "MacOSXLibunwindCallbacks.h"
#if defined (__i386__) || defined (__x86_64__)
@@ -116,28 +115,29 @@ ProcessGDBRemote::CanDebug(Target &target)
ProcessGDBRemote::ProcessGDBRemote(Target& target, Listener &listener) :
Process (target, listener),
m_dynamic_loader_ap (),
- m_byte_order (eByteOrderHost),
m_flags (0),
m_stdio_communication ("gdb-remote.stdio"),
m_stdio_mutex (Mutex::eMutexTypeRecursive),
m_stdout_data (),
m_arch_spec (),
+ m_byte_order (eByteOrderHost),
m_gdb_comm(),
m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
m_debugserver_monitor (0),
+ m_last_stop_packet (),
m_register_info (),
- m_curr_tid (LLDB_INVALID_THREAD_ID),
- m_curr_tid_run (LLDB_INVALID_THREAD_ID),
m_async_broadcaster ("lldb.process.gdb-remote.async-broadcaster"),
m_async_thread (LLDB_INVALID_HOST_THREAD),
+ m_curr_tid (LLDB_INVALID_THREAD_ID),
+ m_curr_tid_run (LLDB_INVALID_THREAD_ID),
m_z0_supported (1),
m_continue_packet(),
m_dispatch_queue_offsets_addr (LLDB_INVALID_ADDRESS),
+ m_packet_timeout (1),
+ m_max_memory_size (512),
m_libunwind_target_type (UNW_TARGET_UNSPECIFIED),
m_libunwind_addr_space (NULL),
- m_waiting_for_attach (false),
- m_packet_timeout (1),
- m_max_memory_size (512)
+ m_waiting_for_attach (false)
{
}
@@ -616,7 +616,7 @@ ProcessGDBRemote::DidLaunch ()
}
Error
-ProcessGDBRemote::DoAttach (lldb::pid_t attach_pid)
+ProcessGDBRemote::DoAttachToProcessWithID (lldb::pid_t attach_pid)
{
Error error;
// Clear out and clean up from any current state
@@ -716,7 +716,7 @@ ProcessGDBRemote::AttachInputReaderCallback
}
Error
-ProcessGDBRemote::DoAttach (const char *process_name, bool wait_for_launch)
+ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait_for_launch)
{
Error error;
// Clear out and clean up from any current state
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index cd5bab0194f..79872b4db4c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -26,9 +26,9 @@
#include "lldb/Target/Thread.h"
#include "GDBRemoteCommunication.h"
-#include "StringExtractor.h"
+#include "Utility/StringExtractor.h"
#include "GDBRemoteRegisterContext.h"
-#include "libunwind.h"
+#include "libunwind/include/libunwind.h"
class ThreadGDBRemote;
@@ -94,10 +94,10 @@ public:
WillLaunchOrAttach ();
virtual lldb_private::Error
- DoAttach (lldb::pid_t pid);
+ DoAttachToProcessWithID (lldb::pid_t pid);
virtual lldb_private::Error
- DoAttach (const char *process_name, bool wait_for_launch);
+ DoAttachToProcessWithName (const char *process_name, bool wait_for_launch);
virtual void
DidAttach ();
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index 37485edf4e5..4eae1e6d41b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -22,7 +22,7 @@
#include "LibUnwindRegisterContext.h"
#include "ProcessGDBRemote.h"
#include "ProcessGDBRemoteLog.h"
-#include "StringExtractorGDBRemote.h"
+#include "Utility/StringExtractorGDBRemote.h"
#include "UnwindLibUnwind.h"
#include "UnwindMacOSXFrameBackchain.h"
@@ -104,6 +104,9 @@ ThreadGDBRemote::WillResume (StateType resume_state)
else
GetGDBProcess().m_continue_packet.Printf(";s:%4.4x", GetID());
break;
+
+ default:
+ break;
}
Thread::WillResume(resume_state);
return true;
@@ -272,8 +275,7 @@ ThreadGDBRemote::GetRawStopReason (StopInfo *stop_info)
if (m_stop_info_stop_id != m_process.GetStopID())
{
char packet[256];
- const int packet_len = snprintf(packet, sizeof(packet), "qThreadStopInfo%x", GetID());
- assert (packet_len < (sizeof(packet) - 1));
+ ::snprintf(packet, sizeof(packet), "qThreadStopInfo%x", GetID());
StringExtractorGDBRemote stop_packet;
if (GetGDBProcess().GetGDBRemote().SendPacketAndWaitForResponse(packet, stop_packet, 1, false))
{
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
index 3fa4ae09a2a..d40c2e1f6ab 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
@@ -14,8 +14,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
-#include "MachException.h"
-#include "libunwind.h"
+#include "libunwind/include/libunwind.h"
class StringExtractor;
class ProcessGDBRemote;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 54cbf42f0d6..65bf64fc06b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -153,7 +153,6 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (bool cu_die_only)
// Set the offset to that of the first DIE
uint32_t offset = GetFirstDIEOffset();
- const dw_offset_t next_cu_offset = GetNextCompileUnitOffset();
DWARFDebugInfoEntry die;
// Keep a flat array of the DIE for binary lookup by DIE offset
Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
@@ -206,7 +205,7 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (bool cu_die_only)
break; // We are done with this compile unit!
}
- assert(offset <= next_cu_offset);
+ assert(offset <= GetNextCompileUnitOffset());
}
SetDIERelations();
return m_die_array.size();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
index a3213e080c3..3e5e25a040a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
@@ -69,7 +69,7 @@ public:
DWARFDebugAranges::Range range;
range.offset = set.GetCompileUnitDIEOffset();
- for (uint32_t i=0; arange_desc_ptr = set.GetDescriptor(i); ++i)
+ for (uint32_t i=0; (arange_desc_ptr = set.GetDescriptor(i)) != NULL; ++i)
{
range.lo_pc = arange_desc_ptr->address;
range.hi_pc = arange_desc_ptr->address + arange_desc_ptr->length;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/Makefile b/lldb/source/Plugins/SymbolFile/DWARF/Makefile
new file mode 100644
index 00000000000..509065650ab
--- /dev/null
+++ b/lldb/source/Plugins/SymbolFile/DWARF/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/SymbolFile/DWARF/Makefile ------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginSymbolFileDWARF
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/Makefile b/lldb/source/Plugins/SymbolFile/Symtab/Makefile
new file mode 100644
index 00000000000..2c3dbb6d86a
--- /dev/null
+++ b/lldb/source/Plugins/SymbolFile/Symtab/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/SymbolFile/Symtab/Makefile -----------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginSymbolFileSymtab
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/Makefile b/lldb/source/Plugins/SymbolVendor/MacOSX/Makefile
new file mode 100644
index 00000000000..9f71ad669aa
--- /dev/null
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/Makefile
@@ -0,0 +1,14 @@
+##===- source/Plugins/SymbolVendor/MacOSX/Makefile ---------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../../../..
+LIBRARYNAME := lldbPluginSymbolVendorMacOSX
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index b9670d4e17c..6bb91ea6068 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -904,12 +904,6 @@ ClangASTContext::SetBaseClassesForClassType (void *class_clang_type, CXXBaseSpec
{
if (class_clang_type)
{
- ASTContext *ast_context = getASTContext();
- IdentifierTable *identifier_table = getIdentifierTable();
-
- assert (ast_context != NULL);
- assert (identifier_table != NULL);
-
Type *clang_type = QualType::getFromOpaquePtr(class_clang_type).getTypePtr();
if (clang_type)
{
@@ -1157,8 +1151,6 @@ ClangASTContext::GetChildClangTypeAtIndex
++child_idx;
}
}
- const unsigned num_fields = record_layout.getFieldCount();
-
// Make sure index is in range...
uint32_t field_idx = 0;
RecordDecl::field_iterator field, field_end;
@@ -1173,7 +1165,7 @@ ClangASTContext::GetChildClangTypeAtIndex
// Figure out the type byte size (field_type_info.first) and
// alignment (field_type_info.second) from the AST context.
std::pair<uint64_t, unsigned> field_type_info = ast_context->getTypeInfo(field->getType());
- assert(field_idx < num_fields);
+ assert(field_idx < record_layout.getFieldCount());
child_byte_size = field_type_info.first / 8;
diff --git a/lldb/source/Symbol/Makefile b/lldb/source/Symbol/Makefile
new file mode 100644
index 00000000000..ae0cef0e242
--- /dev/null
+++ b/lldb/source/Symbol/Makefile
@@ -0,0 +1,14 @@
+##===- source/Symbol/Makefile ------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbSymbol
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 4735d0560aa..a66e12a9c1a 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -393,23 +393,27 @@ lldb_private::Type::DumpSummary
{
uint32_t offset = data_byte_offset;
lldb::addr_t pointer_addresss = data.GetMaxU64(&offset, data_byte_size);
- const size_t k_max_buf_size = length ? length : 256;
- uint8_t buf[k_max_buf_size + 1];
- lldb_private::DataExtractor data(buf, k_max_buf_size, exe_ctx->process->GetByteOrder(), 4);
- buf[k_max_buf_size] = '\0';
+ std::vector<uint8_t> buf;
+ if (length > 0)
+ buf.resize (length);
+ else
+ buf.resize (256);
+
+ lldb_private::DataExtractor data(buf.data(), buf.size(), exe_ctx->process->GetByteOrder(), 4);
+ buf.back() = '\0';
size_t bytes_read;
size_t total_cstr_len = 0;
Error error;
- while ((bytes_read = exe_ctx->process->ReadMemory (pointer_addresss, buf, k_max_buf_size, error)) > 0)
+ while ((bytes_read = exe_ctx->process->ReadMemory (pointer_addresss, buf.data(), buf.size(), error)) > 0)
{
- const size_t len = strlen((const char *)buf);
+ const size_t len = strlen((const char *)buf.data());
if (len == 0)
break;
if (total_cstr_len == 0)
s->PutCString (" \"");
data.Dump(s, 0, lldb::eFormatChar, 1, len, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0);
total_cstr_len += len;
- if (len < k_max_buf_size)
+ if (len < buf.size())
break;
pointer_addresss += total_cstr_len;
}
@@ -507,8 +511,6 @@ lldb_private::Type::DumpValue
++child_idx;
}
}
- const unsigned num_fields = record_layout.getFieldCount();
-
uint32_t field_idx = 0;
clang::RecordDecl::field_iterator field, field_end;
for (field = record_decl->field_begin(), field_end = record_decl->field_end(); field != field_end; ++field, ++field_idx, ++child_idx)
@@ -529,7 +531,7 @@ lldb_private::Type::DumpValue
// Figure out the type byte size (field_type_info.first) and
// alignment (field_type_info.second) from the AST context.
std::pair<uint64_t, unsigned> field_type_info = ast_context->getTypeInfo(field_type);
- assert(field_idx < num_fields);
+ assert(field_idx < record_layout.getFieldCount());
// Figure out the field offset within the current struct/union/class type
field_bit_offset = record_layout.getFieldOffset (field_idx);
field_byte_offset = field_bit_offset / 8;
diff --git a/lldb/source/Target/Makefile b/lldb/source/Target/Makefile
new file mode 100644
index 00000000000..0d4be5449ad
--- /dev/null
+++ b/lldb/source/Target/Makefile
@@ -0,0 +1,14 @@
+##===- source/Target/Makefile ------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbTarget
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Target/ObjCObjectPrinter.cpp b/lldb/source/Target/ObjCObjectPrinter.cpp
index c302c6c3f45..4cf079f62cd 100644
--- a/lldb/source/Target/ObjCObjectPrinter.cpp
+++ b/lldb/source/Target/ObjCObjectPrinter.cpp
@@ -70,30 +70,26 @@ ObjCObjectPrinter::PrintObject (ConstString &str, Value &object_ptr, ExecutionCo
// poor man's strcpy
- size_t len = 0;
- bool keep_reading = true;
Error error;
- while (keep_reading)
+ std::vector<char> desc;
+ while (1)
{
- char byte;
-
- if (exe_ctx.process->ReadMemory(result_ptr + len, &byte, 1, error) != 1)
- return false;
+ char byte = '\0';
+ if (exe_ctx.process->ReadMemory(result_ptr + desc.size(), &byte, 1, error) != 1)
+ break;
+ desc.push_back(byte);
+
if (byte == '\0')
- keep_reading = false;
- else
- ++len;
+ break;
}
- char desc[len + 1];
-
- if (exe_ctx.process->ReadMemory(result_ptr, &desc[0], len + 1, error) != len + 1)
- return false;
-
- str.SetCString(desc);
-
- return true;
+ if (!desc.empty())
+ {
+ str.SetCString(desc.data());
+ return true;
+ }
+ return false;
}
Address *
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 1d9329188be..7bc51abb8ed 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -45,15 +45,11 @@ Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener
}
else
{
- for (uint32_t idx = 0; create_callback = PluginManager::GetProcessCreateCallbackAtIndex(idx); ++idx)
+ for (uint32_t idx = 0; (create_callback = PluginManager::GetProcessCreateCallbackAtIndex(idx)) != NULL; ++idx)
{
- create_callback = PluginManager::GetProcessCreateCallbackAtIndex (idx);
- if (create_callback)
- {
- std::auto_ptr<Process> debugger_ap(create_callback(target, listener));
- if (debugger_ap->CanDebug(target))
- return debugger_ap.release();
- }
+ std::auto_ptr<Process> debugger_ap(create_callback(target, listener));
+ if (debugger_ap->CanDebug(target))
+ return debugger_ap.release();
}
}
return NULL;
@@ -702,7 +698,8 @@ Process::DisableSoftwareBreakpoint (BreakpointSite *bp_site)
if (break_op_size > 0)
{
// Clear a software breakoint instruction
- uint8_t curr_break_op[break_op_size];
+ uint8_t curr_break_op[8];
+ assert (sizeof(curr_break_op) < break_op_size);
bool break_op_found = false;
// Read the breakpoint opcode
@@ -731,7 +728,8 @@ Process::DisableSoftwareBreakpoint (BreakpointSite *bp_site)
if (verify)
{
- uint8_t verify_opcode[break_op_size];
+ uint8_t verify_opcode[8];
+ assert (sizeof(verify_opcode) < break_op_size);
// Verify that our original opcode made it back to the inferior
if (DoReadMemory (bp_addr, verify_opcode, break_op_size, error) == break_op_size)
{
@@ -840,9 +838,9 @@ Process::WriteMemory (addr_t addr, const void *buf, size_t size, Error &error)
BreakpointSiteList::collection::const_iterator pos;
size_t bytes_written = 0;
- addr_t intersect_addr;
- size_t intersect_size;
- size_t opcode_offset;
+ addr_t intersect_addr = 0;
+ size_t intersect_size = 0;
+ size_t opcode_offset = 0;
const uint8_t *ubuf = (const uint8_t *)buf;
for (pos = iter; pos != end; ++pos)
@@ -1069,10 +1067,10 @@ Process::Attach (lldb::pid_t attach_pid)
m_target_triple.Clear();
m_abi_sp.reset();
- Error error(WillAttach (attach_pid));
+ Error error (WillAttachToProcessWithID(attach_pid));
if (error.Success())
{
- error = DoAttach (attach_pid);
+ error = DoAttachToProcessWithID (attach_pid);
if (error.Success())
{
error = CompleteAttach();
@@ -1099,11 +1097,11 @@ Process::Attach (const char *process_name, bool wait_for_launch)
m_target_triple.Clear();
m_abi_sp.reset();
- Error error (WillAttach (process_name, wait_for_launch));
+ Error error (WillAttachToProcessWithName(process_name, wait_for_launch));
if (error.Success())
{
StartPrivateStateThread();
- error = DoAttach (process_name, wait_for_launch);
+ error = DoAttachToProcessWithName (process_name, wait_for_launch);
if (error.Fail())
{
if (GetID() != LLDB_INVALID_PROCESS_ID)
@@ -1629,8 +1627,8 @@ Process::ProcessEventData::ProcessEventData () :
EventData (),
m_process_sp (),
m_state (eStateInvalid),
- m_update_state (false),
- m_restarted (false)
+ m_restarted (false),
+ m_update_state (false)
{
}
@@ -1638,8 +1636,8 @@ Process::ProcessEventData::ProcessEventData (const ProcessSP &process_sp, StateT
EventData (),
m_process_sp (process_sp),
m_state (state),
- m_update_state (false),
- m_restarted (false)
+ m_restarted (false),
+ m_update_state (false)
{
}
diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index 2790d8087b0..cba1258e088 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -34,12 +34,12 @@ using namespace lldb_private;
ThreadPlanStepRange::ThreadPlanStepRange (ThreadPlanKind kind, const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others) :
ThreadPlan (ThreadPlan::eKindGeneric, name, thread, eVoteNoOpinion, eVoteNoOpinion),
- m_address_range (range),
m_addr_context (addr_context),
+ m_address_range (range),
m_stop_others (stop_others),
m_stack_depth (0),
- m_no_more_plans (false),
m_stack_id (),
+ m_no_more_plans (false),
m_first_run_event (true)
{
m_stack_depth = m_thread.GetStackFrameCount();
diff --git a/lldb/source/Target/ThreadPlanStepUntil.cpp b/lldb/source/Target/ThreadPlanStepUntil.cpp
index d146b6ae5cd..99f1a5e4d4c 100644
--- a/lldb/source/Target/ThreadPlanStepUntil.cpp
+++ b/lldb/source/Target/ThreadPlanStepUntil.cpp
@@ -39,13 +39,15 @@ ThreadPlanStepUntil::ThreadPlanStepUntil
bool stop_others
) :
ThreadPlan (ThreadPlan::eKindStepUntil, "Step until", thread, eVoteNoOpinion, eVoteNoOpinion),
+ m_stack_depth (0),
m_step_from_insn (LLDB_INVALID_ADDRESS),
- m_return_addr (LLDB_INVALID_ADDRESS),
m_return_bp_id(LLDB_INVALID_BREAK_ID),
+ m_return_addr (LLDB_INVALID_ADDRESS),
m_stepped_out(false),
m_should_stop(false),
- m_explains_stop(false),
m_ran_analyze (false),
+ m_explains_stop(false),
+ m_until_points(),
m_stop_others (stop_others)
{
diff --git a/lldb/source/Utility/Makefile b/lldb/source/Utility/Makefile
new file mode 100644
index 00000000000..f1be07e6417
--- /dev/null
+++ b/lldb/source/Utility/Makefile
@@ -0,0 +1,14 @@
+##===- source/Utility/Makefile -----------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ../..
+LIBRARYNAME := lldbUtility
+BUILD_ARCHIVE = 1
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Utility/StringExtractor.cpp b/lldb/source/Utility/StringExtractor.cpp
index 86cd623f55c..dc1483d01cd 100644
--- a/lldb/source/Utility/StringExtractor.cpp
+++ b/lldb/source/Utility/StringExtractor.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "StringExtractor.h"
+#include "Utility/StringExtractor.h"
// C Includes
// C++ Includes
diff --git a/lldb/source/Utility/StringExtractorGDBRemote.cpp b/lldb/source/Utility/StringExtractorGDBRemote.cpp
index f7dcc4181f3..59d00aac817 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ b/lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "StringExtractorGDBRemote.h"
+#include "Utility/StringExtractorGDBRemote.h"
// C Includes
// C++ Includes
diff --git a/lldb/source/Utility/StringExtractorGDBRemote.h b/lldb/source/Utility/StringExtractorGDBRemote.h
index 813ddad2e27..6002b8bddce 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.h
+++ b/lldb/source/Utility/StringExtractorGDBRemote.h
@@ -15,7 +15,7 @@
#include <string>
// Other libraries and framework includes
// Project includes
-#include "StringExtractor.h"
+#include "Utility/StringExtractor.h"
class StringExtractorGDBRemote : public StringExtractor
{
diff --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp
index a3d1508acaf..201fc6191a1 100644
--- a/lldb/source/lldb.cpp
+++ b/lldb/source/lldb.cpp
@@ -68,7 +68,7 @@ lldb_private::Initialize ()
ObjectContainerUniversalMachO::Initialize();
ObjectFileMachO::Initialize();
ProcessGDBRemote::Initialize();
- ProcessMacOSX::Initialize();
+// ProcessMacOSX::Initialize();
#endif
}
}
@@ -96,7 +96,7 @@ lldb_private::Terminate ()
ObjectContainerUniversalMachO::Terminate();
ObjectFileMachO::Terminate();
ProcessGDBRemote::Terminate();
- ProcessMacOSX::Terminate();
+// ProcessMacOSX::Terminate();
#endif
}
diff --git a/lldb/tools/Makefile b/lldb/tools/Makefile
new file mode 100644
index 00000000000..bd0326c0510
--- /dev/null
+++ b/lldb/tools/Makefile
@@ -0,0 +1,13 @@
+##===- source/Makefile -------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLDB_LEVEL := ..
+DIRS := driver
+
+include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj
index 0bb7587f847..a2c774888e0 100644
--- a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj
+++ b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj
@@ -512,7 +512,7 @@
PREBINDING = NO;
PRODUCT_NAME = debugserver;
STRIP_INSTALLED_PRODUCT = YES;
- USER_HEADER_SEARCH_PATHS = "./source $(DERIVED_SOURCES_DIR)";
+ USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;
};
name = BuildAndIntegration;
@@ -543,7 +543,7 @@
OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
PREBINDING = NO;
PRODUCT_NAME = debugserver;
- USER_HEADER_SEARCH_PATHS = "./source $(DERIVED_SOURCES_DIR)";
+ USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;
};
name = Debug;
@@ -573,7 +573,7 @@
OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
PREBINDING = NO;
PRODUCT_NAME = debugserver;
- USER_HEADER_SEARCH_PATHS = "./source $(DERIVED_SOURCES_DIR)";
+ USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)";
ZERO_LINK = NO;
};
name = Release;
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index 3ac3ee9178f..b4d5d7841fe 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -25,7 +25,7 @@
#include "RNBContext.h"
#include "RNBServices.h"
#include "RNBSocket.h"
-#include "StringExtractor.h"
+#include "Utility/StringExtractor.h"
#include <iomanip>
#include <sstream>
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index a77775a40aa..49676ef719a 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -110,18 +110,18 @@ Driver::CloseIOChannelFile ()
}
}
-// This function takes INDENT, which tells how many spaces to output at the front of each line; SPACES, which is
-// a string that is output_max_columns long, containing spaces; and TEXT, which is the text that is to be output.
-// It outputs the text, on multiple lines if necessary, to RESULT, with INDENT spaces at the front of each line. It
-// breaks lines on spaces, tabs or newlines, shortening the line if necessary to not break in the middle of a word.
-// It assumes that each output line should contain a maximum of OUTPUT_MAX_COLUMNS characters.
+// This function takes INDENT, which tells how many spaces to output at the front
+// of each line; TEXT, which is the text that is to be output. It outputs the
+// text, on multiple lines if necessary, to RESULT, with INDENT spaces at the
+// front of each line. It breaks lines on spaces, tabs or newlines, shortening
+// the line if necessary to not break in the middle of a word. It assumes that
+// each output line should contain a maximum of OUTPUT_MAX_COLUMNS characters.
void
-OutputFormattedUsageText (FILE *out, int indent, char *spaces, const char *text, int output_max_columns)
+OutputFormattedUsageText (FILE *out, int indent, const char *text, int output_max_columns)
{
int len = strlen (text);
std::string text_string (text);
- std::string spaces_string (spaces);
// Force indentation to be reasonable.
if (indent >= output_max_columns)
@@ -131,7 +131,7 @@ OutputFormattedUsageText (FILE *out, int indent, char *spaces, const char *text,
if (len + indent < output_max_columns)
// Output as a single line
- fprintf (out, "%s%s\n", spaces_string.substr (0, indent).c_str(), text);
+ fprintf (out, "%*s%s\n", indent, "", text);
else
{
// We need to break it up into multiple lines.
@@ -159,7 +159,7 @@ OutputFormattedUsageText (FILE *out, int indent, char *spaces, const char *text,
}
sub_len = end - start;
std::string substring = text_string.substr (start, sub_len);
- fprintf (out, "%s%s\n", spaces_string.substr(0, indent).c_str(), substring.c_str());
+ fprintf (out, "%*s%s\n", indent, "", substring.c_str());
start = end + 1;
}
}
@@ -171,15 +171,7 @@ ShowUsage (FILE *out, lldb::OptionDefinition *option_table, Driver::OptionData d
uint32_t screen_width = 80;
uint32_t indent_level = 0;
const char *name = "lldb";
- char spaces[screen_width+1];
- uint32_t i;
- for (i = 0; i < screen_width; ++i)
- spaces[i] = ' ';
- spaces[i] = '\n';
-
- std::string spaces_string (spaces);
-
fprintf (out, "\nUsage:\n\n");
indent_level += 2;
@@ -202,7 +194,7 @@ ShowUsage (FILE *out, lldb::OptionDefinition *option_table, Driver::OptionData d
}
else
{
- for (int j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++)
+ for (uint32_t j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++)
{
if (this_usage_mask & 1 << j)
{
@@ -221,7 +213,7 @@ ShowUsage (FILE *out, lldb::OptionDefinition *option_table, Driver::OptionData d
if (opt_set > 0)
fprintf (out, "\n");
- fprintf (out, "%s%s", spaces_string.substr(0, indent_level).c_str(), name);
+ fprintf (out, "%*s%s", indent_level, "", name);
for (uint32_t i = 0; i < num_options; ++i)
{
@@ -271,16 +263,16 @@ ShowUsage (FILE *out, lldb::OptionDefinition *option_table, Driver::OptionData d
if (pos == options_seen.end())
{
options_seen.insert (option_table[i].short_option);
- fprintf (out, "%s-%c ", spaces_string.substr(0, indent_level).c_str(), option_table[i].short_option);
+ fprintf (out, "%*s-%c ", indent_level, "", option_table[i].short_option);
if (option_table[i].argument_name != NULL)
fprintf (out, "%s", option_table[i].argument_name);
fprintf (out, "\n");
- fprintf (out, "%s--%s ", spaces_string.substr(0, indent_level).c_str(), option_table[i].long_option);
+ fprintf (out, "%*s--%s ", indent_level, "", option_table[i].long_option);
if (option_table[i].argument_name != NULL)
fprintf (out, "%s", option_table[i].argument_name);
fprintf (out, "\n");
indent_level += 5;
- OutputFormattedUsageText (out, indent_level, spaces, option_table[i].usage_text, screen_width);
+ OutputFormattedUsageText (out, indent_level, option_table[i].usage_text, screen_width);
indent_level -= 5;
fprintf (out, "\n");
}
@@ -288,12 +280,12 @@ ShowUsage (FILE *out, lldb::OptionDefinition *option_table, Driver::OptionData d
indent_level -= 5;
- fprintf (out, "\n%s('%s <filename>' also works, to specify the file to be debugged.)\n\n",
- spaces_string.substr(0, indent_level).c_str(), name);
+ fprintf (out, "\n%*s('%s <filename>' also works, to specify the file to be debugged.)\n\n",
+ indent_level, "", name);
}
void
-BuildGetOptTable (lldb::OptionDefinition *expanded_option_table, struct option **getopt_table, int num_options)
+BuildGetOptTable (lldb::OptionDefinition *expanded_option_table, struct option **getopt_table, uint32_t num_options)
{
if (num_options == 0)
return;
@@ -303,19 +295,19 @@ BuildGetOptTable (lldb::OptionDefinition *expanded_option_table, struct option *
std::bitset<256> option_seen;
for (i = 0, j = 0; i < num_options; ++i)
- {
+ {
char short_opt = expanded_option_table[i].short_option;
-
+
if (option_seen.test(short_opt) == false)
- {
+ {
(*getopt_table)[j].name = expanded_option_table[i].long_option;
(*getopt_table)[j].has_arg = expanded_option_table[i].option_has_arg;
(*getopt_table)[j].flag = NULL;
(*getopt_table)[j].val = expanded_option_table[i].short_option;
option_seen.set(short_opt);
++j;
- }
- }
+ }
+ }
(*getopt_table)[j].name = NULL;
(*getopt_table)[j].has_arg = 0;
@@ -327,11 +319,12 @@ BuildGetOptTable (lldb::OptionDefinition *expanded_option_table, struct option *
Driver::OptionData::OptionData () :
m_filename(),
m_script_lang (lldb::eScriptLanguageDefault),
+ m_crash_log (),
m_source_command_files (),
m_debug_mode (false),
+ m_print_version (false),
m_print_help (false),
- m_print_version (false)
-
+ m_seen_options()
{
}
@@ -414,9 +407,10 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exit)
SBError error;
std::string option_string;
struct option *long_options = NULL;
- int num_options;
+ uint32_t num_options;
- for (num_options = 0; g_options[num_options].long_option != NULL; ++num_options);
+ for (num_options = 0; g_options[num_options].long_option != NULL; ++num_options)
+ /* Do Nothing. */;
if (num_options == 0)
{
@@ -468,7 +462,7 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exit)
while (1)
{
int long_options_index = -1;
- val = ::getopt_long (argc, (char * const *) argv, option_string.c_str(), long_options, &long_options_index);
+ val = ::getopt_long (argc, const_cast<char **>(argv), option_string.c_str(), long_options, &long_options_index);
if (val == -1)
break;
@@ -787,7 +781,7 @@ Driver::HandleIOEvent (const SBEvent &event)
const char *command_string = SBEvent::GetCStringFromEvent(event);
if (command_string == NULL)
- command_string == "";
+ command_string = "";
SBCommandReturnObject result;
if (m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true) != lldb::eReturnStatusQuit)
{
diff --git a/lldb/tools/driver/IOChannel.cpp b/lldb/tools/driver/IOChannel.cpp
index 52f5ba858b9..d0bea70032b 100644
--- a/lldb/tools/driver/IOChannel.cpp
+++ b/lldb/tools/driver/IOChannel.cpp
@@ -68,7 +68,7 @@ IOChannel::HandleCompletion (EditLine *e, int ch)
const LineInfo *line_info = el_line(m_edit_line);
SBStringList completions;
- size_t page_size = 40;
+ int page_size = 40;
int num_completions = m_driver->GetDebugger().GetCommandInterpreter().HandleCompletion (line_info->buffer,
line_info->cursor,
@@ -161,9 +161,12 @@ IOChannel::IOChannel
m_read_thread_should_exit (false),
m_out_file (out),
m_err_file (err),
+ m_command_queue (),
+ m_completion_key ("\t"),
m_edit_line (::el_init (SBHostOS::GetProgramFileSpec().GetFileName(), in, out, err)),
m_history (history_init()),
- m_completion_key ("\t")
+ m_history_event(),
+ m_getting_command (false)
{
assert (m_edit_line);
::el_set (m_edit_line, EL_PROMPT, el_prompt);
@@ -211,7 +214,7 @@ IOChannel::HistorySaveLoad (bool save)
{
char history_path[PATH_MAX];
::snprintf (history_path, sizeof(history_path), "~/.%s-history", SBHostOS::GetProgramFileSpec().GetFileName());
- if (SBFileSpec::ResolvePath (history_path, history_path, sizeof(history_path)) < sizeof(history_path) - 1)
+ if ((size_t)SBFileSpec::ResolvePath (history_path, history_path, sizeof(history_path)) < sizeof(history_path) - 1)
{
const char *path_ptr = history_path;
if (save)
diff --git a/lldb/tools/driver/IOChannel.h b/lldb/tools/driver/IOChannel.h
index dec7c82da29..90e76fbbc65 100644
--- a/lldb/tools/driver/IOChannel.h
+++ b/lldb/tools/driver/IOChannel.h
@@ -86,7 +86,8 @@ public:
const char *
GetPrompt ();
- static unsigned char ElCompletionFn (EditLine *e, int ch);
+ static unsigned char
+ ElCompletionFn (EditLine *e, int ch);
bool
IsGettingCommand () const;
@@ -105,9 +106,12 @@ private:
History *m_history;
HistEvent m_history_event;
bool m_getting_command;
+
void
HistorySaveLoad (bool save);
- unsigned char HandleCompletion (EditLine *e, int ch);
+
+ unsigned char
+ HandleCompletion (EditLine *e, int ch);
};
#endif // lldb_IOChannel_h_
diff --git a/lldb/tools/driver/Makefile b/lldb/tools/driver/Makefile
new file mode 100644
index 00000000000..a0191f7c639
--- /dev/null
+++ b/lldb/tools/driver/Makefile
@@ -0,0 +1,25 @@
+##===- tools/driver/Makefile -------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+LLDB_LEVEL := ../..
+
+TOOLNAME = lldb
+
+LD.Flags += -ledit -llldb -llldbUtility
+
+# # Include this here so we can get the configuration of the targets that have
+# # been configured for construction. We have to do this early so we can set up
+# # LINK_COMPONENTS before including Makefile.rules
+include $(LLDB_LEVEL)/../../Makefile.config
+
+ifeq ($(HOST_OS),Darwin)
+ LD.Flags += -Wl,-rpath,@loader_path/../lib/
+ LD.Flags += -Wl,-sectcreate -Wl,__TEXT -Wl,__info_plist -Wl,lldb-Info.plist
+endif
+
+include $(LLDB_LEVEL)/Makefile
OpenPOWER on IntegriCloud