Merged Eli Friedman's linux build changes where he added Makefile files that

enabled LLVM make style building and made this compile LLDB on Mac OS X. We
can now iterate on this to make the build work on both linux and macosx.

llvm-svn: 108009
This commit is contained in:
Greg Clayton
2010-07-09 20:39:50 +00:00
parent 2a5725b1a3
commit c982c768d2
151 changed files with 1440 additions and 1888 deletions

90
lldb/Makefile Normal file
View File

@@ -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

13
lldb/include/Makefile Normal file
View File

@@ -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

View File

@@ -69,9 +69,9 @@ public:
IsEnabled (); IsEnabled ();
void void
SetIgnoreCount (int32_t count); SetIgnoreCount (uint32_t count);
int32_t uint32_t
GetIgnoreCount () const; GetIgnoreCount () const;
void void

View File

@@ -35,11 +35,11 @@ public:
bool bool
IsEnabled (); IsEnabled ();
int32_t uint32_t
GetIgnoreCount (); GetIgnoreCount ();
void void
SetIgnoreCount (int32_t n); SetIgnoreCount (uint32_t n);
void void
SetThreadID (lldb::tid_t sb_thread_id); SetThreadID (lldb::tid_t sb_thread_id);

View File

@@ -321,14 +321,14 @@ public:
/// The number of breakpoint hits to ignore. /// The number of breakpoint hits to ignore.
//------------------------------------------------------------------ //------------------------------------------------------------------
void void
SetIgnoreCount (int32_t count); SetIgnoreCount (uint32_t count);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Return the current Ignore Count. /// Return the current Ignore Count.
/// @return /// @return
/// The number of breakpoint hits to be ignored. /// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------ //------------------------------------------------------------------
int32_t uint32_t
GetIgnoreCount () const; GetIgnoreCount () const;
//------------------------------------------------------------------ //------------------------------------------------------------------

View File

@@ -37,14 +37,14 @@ public:
virtual virtual
~BreakpointIDList (); ~BreakpointIDList ();
int size_t
Size(); GetSize();
BreakpointID & BreakpointID &
GetBreakpointIDAtIndex (int index); GetBreakpointIDAtIndex (uint32_t index);
bool bool
RemoveBreakpointIDAtIndex (int index); RemoveBreakpointIDAtIndex (uint32_t index);
void void
Clear(); Clear();
@@ -56,16 +56,16 @@ public:
AddBreakpointID (const char *bp_id); AddBreakpointID (const char *bp_id);
bool bool
FindBreakpointID (BreakpointID &bp_id, int *position); FindBreakpointID (BreakpointID &bp_id, uint32_t *position);
bool bool
FindBreakpointID (const char *bp_id, int *position); FindBreakpointID (const char *bp_id, uint32_t *position);
void void
InsertStringArray (const char **string_array, int array_size, CommandReturnObject &result); InsertStringArray (const char **string_array, uint32_t array_size, CommandReturnObject &result);
static bool 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 static void
FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, Args &new_args); FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, Args &new_args);

View File

@@ -119,7 +119,7 @@ public:
/// @return /// @return
/// The number of breakpoint hits to be ignored. /// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------ //------------------------------------------------------------------
int32_t uint32_t
GetIgnoreCount (); GetIgnoreCount ();
//------------------------------------------------------------------ //------------------------------------------------------------------
@@ -129,7 +129,7 @@ public:
/// The number of breakpoint hits to ignore. /// The number of breakpoint hits to ignore.
//------------------------------------------------------------------ //------------------------------------------------------------------
void void
SetIgnoreCount (int32_t n); SetIgnoreCount (uint32_t n);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Set the callback action invoked when the breakpoint is hit. /// Set the callback action invoked when the breakpoint is hit.

View File

@@ -53,7 +53,7 @@ public:
/// \b true if the breakpoint was in the list. /// \b true if the breakpoint was in the list.
//------------------------------------------------------------------ //------------------------------------------------------------------
bool 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 /// Returns a shared pointer to the breakpoint location with id \a
@@ -70,7 +70,7 @@ public:
/// pointer if the breakpoint doesn't exist. /// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------ //------------------------------------------------------------------
lldb::BreakpointLocationSP 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 /// Returns a shared pointer to the breakpoint location with id \a
@@ -87,7 +87,7 @@ public:
/// pointer if the breakpoint doesn't exist. /// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------ //------------------------------------------------------------------
const lldb::BreakpointLocationSP 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 /// Returns a shared pointer to the breakpoint location with index
@@ -187,10 +187,10 @@ private:
typedef std::vector<lldb::BreakpointLocationSP> collection; typedef std::vector<lldb::BreakpointLocationSP> collection;
collection::iterator 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 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; collection m_break_loc_collection;

View File

@@ -72,7 +72,7 @@ public:
/// pointer if the breakpoint doesn't exist. /// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------ //------------------------------------------------------------------
lldb::BreakpointLocationSP lldb::BreakpointLocationSP
FindByID (lldb::user_id_t breakID); FindByID (lldb::break_id_t breakID);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id /// Returns a shared pointer to the breakpoint location with id
@@ -86,7 +86,7 @@ public:
/// pointer if the breakpoint doesn't exist. /// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------ //------------------------------------------------------------------
const lldb::BreakpointLocationSP 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 /// Returns the breakpoint location id to the breakpoint location
@@ -98,7 +98,7 @@ public:
/// @result /// @result
/// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID. /// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------ //------------------------------------------------------------------
lldb::user_id_t lldb::break_id_t
FindIDByAddress (Address &addr); FindIDByAddress (Address &addr);
//------------------------------------------------------------------ //------------------------------------------------------------------
@@ -183,7 +183,7 @@ public:
/// \b true if the breakpoint \a breakID was in the list. /// \b true if the breakpoint \a breakID was in the list.
//------------------------------------------------------------------ //------------------------------------------------------------------
bool bool
Remove (lldb::user_id_t breakID); Remove (lldb::break_id_t breakID);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Enquires of the breakpoint location in this list with ID \a /// Enquires of the breakpoint location in this list with ID \a
@@ -200,7 +200,7 @@ public:
//------------------------------------------------------------------ //------------------------------------------------------------------
bool bool
ShouldStop (StoppointCallbackContext *context, ShouldStop (StoppointCallbackContext *context,
lldb::user_id_t breakID); lldb::break_id_t breakID);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list. /// Returns the number of elements in this breakpoint location list.
@@ -252,7 +252,7 @@ protected:
/// @result /// @result
/// Returns breakpoint location id. /// Returns breakpoint location id.
//------------------------------------------------------------------ //------------------------------------------------------------------
virtual lldb::user_id_t virtual lldb::break_id_t
Add (lldb::BreakpointLocationSP& bp_loc_sp); Add (lldb::BreakpointLocationSP& bp_loc_sp);
typedef std::vector<lldb::BreakpointLocationSP> collection; typedef std::vector<lldb::BreakpointLocationSP> collection;
@@ -269,10 +269,10 @@ protected:
GetNextID(); GetNextID();
collection::iterator collection::iterator
GetIDIterator(lldb::user_id_t breakID); GetIDIterator(lldb::break_id_t breakID);
collection::const_iterator collection::const_iterator
GetIDConstIterator(lldb::user_id_t breakID) const; GetIDConstIterator(lldb::break_id_t breakID) const;
collection m_locations; collection m_locations;
addr_map m_address_to_location; addr_map m_address_to_location;

View File

@@ -108,14 +108,14 @@ public:
SetEnabled (bool enabled); SetEnabled (bool enabled);
void void
SetIgnoreCount (int32_t n); SetIgnoreCount (uint32_t n);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Return the current Ignore Count. /// Return the current Ignore Count.
/// @return /// @return
/// The number of breakpoint hits to be ignored. /// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------ //------------------------------------------------------------------
int32_t uint32_t
GetIgnoreCount () const; GetIgnoreCount () const;
//------------------------------------------------------------------ //------------------------------------------------------------------
@@ -216,7 +216,7 @@ private:
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_callback_is_synchronous; bool m_callback_is_synchronous;
bool m_enabled; 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 std::auto_ptr<ThreadSpec> m_thread_spec_ap; // Thread for which this breakpoint will take
}; };

View File

@@ -243,8 +243,8 @@ private:
/// \a break_loc_id is the Breakpoint Location to remove. /// \a break_loc_id is the Breakpoint Location to remove.
//------------------------------------------------------------------ //------------------------------------------------------------------
uint32_t uint32_t
RemoveOwner (lldb::user_id_t break_id, RemoveOwner (lldb::break_id_t break_id,
lldb::user_id_t break_loc_id); lldb::break_id_t break_loc_id);
BreakpointSite::Type m_type;///< The type of this breakpoint site. 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. uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site uses trap opcodes.

View File

@@ -50,7 +50,7 @@ public:
/// @return /// @return
/// The ID of the BreakpointSite in the list. /// The ID of the BreakpointSite in the list.
//------------------------------------------------------------------ //------------------------------------------------------------------
lldb::user_id_t lldb::break_id_t
Add (const lldb::BreakpointSiteSP& bp_site_sp); Add (const lldb::BreakpointSiteSP& bp_site_sp);
//------------------------------------------------------------------ //------------------------------------------------------------------
@@ -86,7 +86,7 @@ public:
/// breakpoint doesn't exist. /// breakpoint doesn't exist.
//------------------------------------------------------------------ //------------------------------------------------------------------
lldb::BreakpointSiteSP 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. /// Returns a shared pointer to the breakpoint site with id \a breakID - const version.
@@ -99,7 +99,7 @@ public:
/// breakpoint doesn't exist. /// breakpoint doesn't exist.
//------------------------------------------------------------------ //------------------------------------------------------------------
const lldb::BreakpointSiteSP 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. /// Returns the breakpoint site id to the breakpoint site at address \a addr.
@@ -110,7 +110,7 @@ public:
/// @result /// @result
/// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID. /// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------ //------------------------------------------------------------------
lldb::user_id_t lldb::break_id_t
FindIDByAddress (lldb::addr_t addr); FindIDByAddress (lldb::addr_t addr);
//------------------------------------------------------------------ //------------------------------------------------------------------
@@ -149,7 +149,7 @@ public:
/// \b true if the breakpoint site \a breakID was in the list. /// \b true if the breakpoint site \a breakID was in the list.
//------------------------------------------------------------------ //------------------------------------------------------------------
bool bool
Remove (lldb::user_id_t breakID); Remove (lldb::break_id_t breakID);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Removes the breakpoint site at address \a addr from this list. /// Removes the breakpoint site at address \a addr from this list.
@@ -164,7 +164,7 @@ public:
RemoveByAddress (lldb::addr_t addr); RemoveByAddress (lldb::addr_t addr);
void 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); typedef void (*BreakpointSiteSPMapFunc) (lldb::BreakpointSiteSP &bp, void *baton);
@@ -182,7 +182,7 @@ public:
/// \b true if we should stop, \b false otherwise. /// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------ //------------------------------------------------------------------
bool 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. /// Returns the number of elements in the list.
@@ -197,10 +197,10 @@ protected:
typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection; typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
collection::iterator collection::iterator
GetIDIterator(lldb::user_id_t breakID); GetIDIterator(lldb::break_id_t breakID);
collection::const_iterator 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 // 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 // are places there where you want to iterate over the list, and it is less efficient

View File

@@ -82,9 +82,9 @@ protected:
//------------------------------------------------------------------ //------------------------------------------------------------------
// Classes that inherit from StoppointLocation can see and modify these // Classes that inherit from StoppointLocation can see and modify these
//------------------------------------------------------------------ //------------------------------------------------------------------
lldb::break_id_t m_loc_id; // Break ID 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 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. // 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) 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_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 uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for

View File

@@ -41,8 +41,8 @@ public:
bool WatchpointRead () const; bool WatchpointRead () const;
bool WatchpointWrite () const; bool WatchpointWrite () const;
int32_t GetIgnoreCount () const; uint32_t GetIgnoreCount () const;
void SetIgnoreCount (int32_t n); void SetIgnoreCount (uint32_t n);
void SetWatchpointType (uint32_t type); void SetWatchpointType (uint32_t type);
bool BreakpointWasHit (StoppointCallbackContext *context); bool BreakpointWasHit (StoppointCallbackContext *context);
bool SetCallback (WatchpointHitCallback callback, void *callback_baton); 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_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_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 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; WatchpointHitCallback m_callback;
void * m_callback_baton; // Callback user data to pass to callback void * m_callback_baton; // Callback user data to pass to callback

View File

@@ -451,7 +451,7 @@ public:
/// resolved path doesn't fit in dst_len, dst_len-1 characters will /// 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. /// 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); 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 /// 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. /// 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); ResolveUsername (const char *src_path, char *dst_path, size_t dst_len);

View File

@@ -15,6 +15,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <memory> #include <memory>
#include <vector>
// Other libraries and framework includes // Other libraries and framework includes
// Project includes // Project includes

View File

@@ -224,10 +224,10 @@ private:
std::string m_wrapper_function_name; std::string m_wrapper_function_name;
std::string m_wrapper_struct_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; const clang::ASTRecordLayout *m_struct_layout;
ValueList m_arg_values; 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_value_struct_size;
size_t m_return_offset; size_t m_return_offset;

View File

@@ -53,9 +53,9 @@ public:
/// constructors. /// constructors.
//------------------------------------------------------------------ //------------------------------------------------------------------
Predicate () : Predicate () :
m_value(),
m_mutex(), m_mutex(),
m_condition(), m_condition()
m_value()
{ {
} }
@@ -69,9 +69,9 @@ public:
/// The initial value for our T object. /// The initial value for our T object.
//------------------------------------------------------------------ //------------------------------------------------------------------
Predicate (T initial_value) : Predicate (T initial_value) :
m_value(initial_value),
m_mutex(), m_mutex(),
m_condition(), m_condition()
m_value(initial_value)
{ {
} }

View File

@@ -52,7 +52,7 @@ public:
struct CommonCompletionElement struct CommonCompletionElement
{ {
CommonCompletionTypes type; uint32_t type;
CompletionCallback callback; CompletionCallback callback;
}; };

View File

@@ -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

View File

@@ -466,7 +466,7 @@ public:
/// Returns an error object. /// Returns an error object.
//------------------------------------------------------------------ //------------------------------------------------------------------
virtual Error virtual Error
WillAttach (lldb::pid_t pid) WillAttachToProcessWithID (lldb::pid_t pid)
{ {
return Error(); return Error();
} }
@@ -481,7 +481,7 @@ public:
/// Returns an error object. /// Returns an error object.
//------------------------------------------------------------------ //------------------------------------------------------------------
virtual Error virtual Error
WillAttach (const char *process_name, bool wait_for_launch) WillAttachToProcessWithName (const char *process_name, bool wait_for_launch)
{ {
return Error(); return Error();
} }
@@ -497,7 +497,7 @@ public:
/// LLDB_INVALID_PROCESS_ID if attaching fails. /// LLDB_INVALID_PROCESS_ID if attaching fails.
//------------------------------------------------------------------ //------------------------------------------------------------------
virtual Error virtual Error
DoAttach (lldb::pid_t pid) = 0; DoAttachToProcessWithID (lldb::pid_t pid) = 0;
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Attach to an existing process using a partial process name. /// Attach to an existing process using a partial process name.
@@ -515,7 +515,7 @@ public:
/// LLDB_INVALID_PROCESS_ID if attaching fails. /// LLDB_INVALID_PROCESS_ID if attaching fails.
//------------------------------------------------------------------ //------------------------------------------------------------------
virtual Error virtual Error
DoAttach (const char *process_name, bool wait_for_launch) DoAttachToProcessWithName (const char *process_name, bool wait_for_launch)
{ {
Error error; Error error;
error.SetErrorString("attach by name is not supported"); error.SetErrorString("attach by name is not supported");

View File

@@ -38,7 +38,7 @@ public:
{ {
eNone = 0, eNone = 0,
eAvoidInlines = (1 << 0), eAvoidInlines = (1 << 0),
eAvoidNoDebug = (1 << 1), eAvoidNoDebug = (1 << 1)
}; };
//------------------------------------------------------------------ //------------------------------------------------------------------

View File

@@ -93,7 +93,7 @@ public:
bool bool
IndexMatches (uint32_t index) const IndexMatches (uint32_t index) const
{ {
if (m_index == -1 || index == -1) if (m_index == UINT32_MAX || index == UINT32_MAX)
return true; return true;
else else
return index == m_index; return index == m_index;

128
lldb/lib/Makefile Normal file
View File

@@ -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

View File

@@ -2773,7 +2773,7 @@
); );
PREBINDING = NO; PREBINDING = NO;
PRODUCT_NAME = LLDB; 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"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Debug; name = Debug;
@@ -2826,7 +2826,7 @@
); );
PREBINDING = NO; PREBINDING = NO;
PRODUCT_NAME = LLDB; 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"; VERSIONING_SYSTEM = "apple-generic";
ZERO_LINK = NO; ZERO_LINK = NO;
}; };
@@ -2935,7 +2935,7 @@
); );
PREBINDING = NO; PREBINDING = NO;
PRODUCT_NAME = LLDB; 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"; VERSIONING_SYSTEM = "apple-generic";
ZERO_LINK = NO; ZERO_LINK = NO;
}; };

46
lldb/scripts/generate-vers.pl Executable file
View File

@@ -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;

14
lldb/source/API/Makefile Normal file
View File

@@ -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

View File

@@ -235,13 +235,13 @@ SBBreakpoint::IsEnabled ()
} }
void void
SBBreakpoint::SetIgnoreCount (int32_t count) SBBreakpoint::SetIgnoreCount (uint32_t count)
{ {
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->SetIgnoreCount (count); m_opaque_sp->SetIgnoreCount (count);
} }
int32_t uint32_t
SBBreakpoint::GetIgnoreCount () const SBBreakpoint::GetIgnoreCount () const
{ {
if (m_opaque_sp) if (m_opaque_sp)

View File

@@ -76,7 +76,7 @@ SBBreakpointLocation::IsEnabled ()
return false; return false;
} }
int32_t uint32_t
SBBreakpointLocation::GetIgnoreCount () SBBreakpointLocation::GetIgnoreCount ()
{ {
if (m_opaque_sp) if (m_opaque_sp)
@@ -86,7 +86,7 @@ SBBreakpointLocation::GetIgnoreCount ()
} }
void void
SBBreakpointLocation::SetIgnoreCount (int32_t n) SBBreakpointLocation::SetIgnoreCount (uint32_t n)
{ {
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->SetIgnoreCount (n); m_opaque_sp->SetIgnoreCount (n);

View File

@@ -187,7 +187,7 @@ SBFrame::LookupVar (const char *var_name)
const uint32_t num_variables = variable_list.GetSize(); const uint32_t num_variables = variable_list.GetSize();
bool found = false; 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); var_sp = variable_list.GetVariableAtIndex(i);
if (var_sp if (var_sp
@@ -231,7 +231,7 @@ SBFrame::LookupVarInScope (const char *var_name, const char *scope)
const uint32_t num_variables = variable_list.GetSize(); const uint32_t num_variables = variable_list.GetSize();
bool found = false; 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); var_sp = variable_list.GetVariableAtIndex(i);
if (var_sp if (var_sp
@@ -331,6 +331,9 @@ SBFrame::GetVariables (bool arguments,
case eValueTypeVariableLocal: case eValueTypeVariableLocal:
add_variable = locals; add_variable = locals;
break; break;
default:
break;
} }
if (add_variable) if (add_variable)
{ {

View File

@@ -289,7 +289,7 @@ SBTarget::ListAllBreakpoints ()
{ {
const BreakpointList &bp_list = m_opaque_sp->GetBreakpointList(); const BreakpointList &bp_list = m_opaque_sp->GetBreakpointList();
size_t num_bps = bp_list.GetSize(); 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)); SBBreakpoint sb_breakpoint (bp_list.GetBreakpointByIndex (i));
sb_breakpoint.GetDescription (out_file, "full"); sb_breakpoint.GetDescription (out_file, "full");

View File

@@ -147,7 +147,10 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
stop_desc = exc_desc; stop_desc = exc_desc;
stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
} }
break; break;
default:
break;
} }
if (stop_desc && stop_desc[0]) if (stop_desc && stop_desc[0])
@@ -225,7 +228,7 @@ SBThread::DisplayFramesForCurrentContext (FILE *out,
{ {
uint32_t num_stack_frames = m_opaque_sp->GetStackFrameCount (); uint32_t num_stack_frames = m_opaque_sp->GetStackFrameCount ();
StackFrameSP frame_sp; 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) for (frame_idx = first_frame; frame_idx < first_frame + num_frames; ++frame_idx)
{ {

View File

@@ -153,12 +153,12 @@ Breakpoint::IsEnabled ()
} }
void void
Breakpoint::SetIgnoreCount (int32_t n) Breakpoint::SetIgnoreCount (uint32_t n)
{ {
m_options.SetIgnoreCount(n); m_options.SetIgnoreCount(n);
} }
int32_t uint32_t
Breakpoint::GetIgnoreCount () const Breakpoint::GetIgnoreCount () const
{ {
return m_options.GetIgnoreCount(); 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 // them after the locations pass. Have to do it this way because
// resolving breakpoints will add new locations potentially. // 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; bool seen = false;
ModuleSP module_sp (module_list.GetModuleAtIndex (i)); 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)) if (!m_filter_sp->ModulePasses (module_sp))
continue; 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(); const Section *section = break_loc->GetAddress().GetSection();
if (section == NULL || section->GetModule() == module) 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 // the same? Or do we need to do an equality on modules that is an
// "equivalence"??? // "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)); ModuleSP module_sp (module_list.GetModuleAtIndex (i));
if (!m_filter_sp->ModulePasses (module_sp)) if (!m_filter_sp->ModulePasses (module_sp))
continue; 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(); const Section *section = break_loc->GetAddress().GetSection();
if (section) if (section)
{ {
@@ -353,8 +353,8 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l
GetResolverDescription (s); GetResolverDescription (s);
GetFilterDescription (s); GetFilterDescription (s);
const uint32_t num_locations = GetNumLocations (); const size_t num_locations = GetNumLocations ();
const uint32_t num_resolved_locations = GetNumResolvedLocations (); const size_t num_resolved_locations = GetNumResolvedLocations ();
switch (level) switch (level)
{ {
@@ -362,9 +362,9 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l
case lldb::eDescriptionLevelFull: case lldb::eDescriptionLevelFull:
if (num_locations > 0) if (num_locations > 0)
{ {
s->Printf(", locations = %u", num_locations); s->Printf(", locations = %zu", num_locations);
if (num_resolved_locations > 0) if (num_resolved_locations > 0)
s->Printf(", resolved = %u", num_resolved_locations); s->Printf(", resolved = %zu", num_resolved_locations);
} }
else else
{ {
@@ -387,12 +387,15 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l
s->Indent(); s->Indent();
GetOptions()->GetDescription(s, level); GetOptions()->GetDescription(s, level);
break; break;
default:
break;
} }
if (show_locations) if (show_locations)
{ {
s->IndentMore(); s->IndentMore();
for (int i = 0; i < GetNumLocations(); ++i) for (size_t i = 0; i < num_locations; ++i)
{ {
BreakpointLocation *loc = GetLocationAtIndex(i).get(); BreakpointLocation *loc = GetLocationAtIndex(i).get();
loc->GetDescription(s, level); loc->GetDescription(s, level);

View File

@@ -31,14 +31,14 @@ BreakpointIDList::~BreakpointIDList ()
{ {
} }
int size_t
BreakpointIDList::Size() BreakpointIDList::GetSize()
{ {
return m_breakpoint_ids.size(); return m_breakpoint_ids.size();
} }
BreakpointID & BreakpointID &
BreakpointIDList::GetBreakpointIDAtIndex (int index) BreakpointIDList::GetBreakpointIDAtIndex (uint32_t index)
{ {
if (index < m_breakpoint_ids.size()) if (index < m_breakpoint_ids.size())
return m_breakpoint_ids[index]; return m_breakpoint_ids[index];
@@ -47,23 +47,13 @@ BreakpointIDList::GetBreakpointIDAtIndex (int index)
} }
bool bool
BreakpointIDList::RemoveBreakpointIDAtIndex (int index) BreakpointIDList::RemoveBreakpointIDAtIndex (uint32_t index)
{ {
bool success = false; if (index >= m_breakpoint_ids.size())
if (index < m_breakpoint_ids.size()) return false;
{
BreakpointIDArray::iterator pos;
int i;
for (pos = m_breakpoint_ids.begin(), i = 0; i != index && pos != m_breakpoint_ids.end(); ++pos, ++i); m_breakpoint_ids.erase (m_breakpoint_ids.begin() + index);
assert (i == index); return true;
if (pos != m_breakpoint_ids.end())
{
m_breakpoint_ids.erase (pos);
success = true;
}
}
return success;
} }
void void
@@ -99,12 +89,12 @@ BreakpointIDList::AddBreakpointID (const char *bp_id_str)
} }
bool bool
BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, int *position) BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, uint32_t *position)
{ {
bool success = false; bool success = false;
BreakpointIDArray::iterator tmp_pos; 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]; BreakpointID tmp_id = m_breakpoint_ids[i];
if (tmp_id.GetBreakpointID() == bp_id.GetBreakpointID() if (tmp_id.GetBreakpointID() == bp_id.GetBreakpointID()
@@ -120,7 +110,7 @@ BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, int *position)
} }
bool bool
BreakpointIDList::FindBreakpointID (const char *bp_id_str, int *position) BreakpointIDList::FindBreakpointID (const char *bp_id_str, uint32_t *position)
{ {
BreakpointID temp_bp_id; BreakpointID temp_bp_id;
break_id_t bp_id; break_id_t bp_id;
@@ -136,12 +126,12 @@ BreakpointIDList::FindBreakpointID (const char *bp_id_str, int *position)
} }
void 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) if (string_array == NULL)
return; 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 bp_id;
break_id_t loc_id; break_id_t loc_id;
@@ -176,24 +166,23 @@ void
BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result,
Args &new_args) Args &new_args)
{ {
char *range_start; std::string range_start;
const char *range_end; const char *range_end;
const char *current_arg; 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; bool is_range = false;
current_arg = old_args.GetArgumentAtIndex (i); current_arg = old_args.GetArgumentAtIndex (i);
int range_start_len = 0; uint32_t range_start_len = 0;
int range_end_pos = 0; uint32_t range_end_pos = 0;
if (BreakpointIDList::StringContainsIDRangeExpression (current_arg, &range_start_len, &range_end_pos)) if (BreakpointIDList::StringContainsIDRangeExpression (current_arg, &range_start_len, &range_end_pos))
{ {
is_range = true; is_range = true;
range_start = (char *) malloc (range_start_len + 1); range_start = (char *) malloc (range_start_len + 1);
strncpy (range_start, current_arg, range_start_len); range_start.assign (current_arg, range_start_len);
range_start[range_start_len] = '\0';
range_end = current_arg + range_end_pos; range_end = current_arg + range_end_pos;
} }
else if ((i + 2 < num_old_args) 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 (current_arg)
&& BreakpointID::IsValidIDExpression (old_args.GetArgumentAtIndex (i+2))) && BreakpointID::IsValidIDExpression (old_args.GetArgumentAtIndex (i+2)))
{ {
range_start = (char *) current_arg; range_start.assign (current_arg);
range_end = old_args.GetArgumentAtIndex (i+2); range_end = old_args.GetArgumentAtIndex (i+2);
is_range = true; is_range = true;
i = i+2; i = i+2;
@@ -214,14 +203,14 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
break_id_t start_loc_id; break_id_t start_loc_id;
break_id_t end_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); BreakpointID::ParseCanonicalReference (range_end, &end_bp_id, &end_loc_id);
if ((start_bp_id == LLDB_INVALID_BREAK_ID) if ((start_bp_id == LLDB_INVALID_BREAK_ID)
|| (! target->GetBreakpointByID (start_bp_id))) || (! target->GetBreakpointByID (start_bp_id)))
{ {
new_args.Clear(); 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); result.SetStatus (eReturnStatusFailed);
return; 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. // target and find all the breakpoints that fit into this range, and add them to new_args.
const BreakpointList& breakpoints = target->GetBreakpointList(); const BreakpointList& breakpoints = target->GetBreakpointList();
size_t num_breakpoints = breakpoints.GetSize(); const size_t num_breakpoints = breakpoints.GetSize();
for (int j = 0; j < num_breakpoints; ++j) for (size_t j = 0; j < num_breakpoints; ++j)
{ {
Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (j).get(); Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (j).get();
break_id_t cur_bp_id = breakpoint->GetID(); 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)) if ((cur_bp_id < start_bp_id) || (cur_bp_id > end_bp_id))
continue; 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)) 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(); BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get();
if (bp_loc->GetID() >= start_loc_id) 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)) 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(); BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get();
if (bp_loc->GetID() <= end_loc_id) if (bp_loc->GetID() <= end_loc_id)
@@ -294,19 +283,14 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman
return; return;
} }
//bool
//BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, const char **range_start,
// const **range_end)
bool 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; bool is_range_expression = false;
std::string arg_str = in_string; std::string arg_str = in_string;
std::string::size_type idx; std::string::size_type idx;
std::string::size_type start_pos = 0; std::string::size_type start_pos = 0;
//*range_start = NULL;
//*range_end = NULL;
*range_start_len = 0; *range_start_len = 0;
*range_end_pos = 0; *range_end_pos = 0;

View File

@@ -137,14 +137,14 @@ BreakpointLocation::ClearCallback ()
GetLocationOptions()->ClearCallback(); GetLocationOptions()->ClearCallback();
} }
int32_t uint32_t
BreakpointLocation::GetIgnoreCount () BreakpointLocation::GetIgnoreCount ()
{ {
return GetOptionsNoCreate()->GetIgnoreCount(); return GetOptionsNoCreate()->GetIgnoreCount();
} }
void void
BreakpointLocation::SetIgnoreCount (int32_t n) BreakpointLocation::SetIgnoreCount (uint32_t n)
{ {
GetLocationOptions()->SetIgnoreCount(n); GetLocationOptions()->SetIgnoreCount(n);
} }

View File

@@ -46,7 +46,7 @@ BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc)
} }
bool 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 collection::iterator pos = GetIDPairIterator(bp_id, bp_loc_id); // Predicate
if (pos != m_break_loc_collection.end()) 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 class BreakpointIDPairMatches
{ {
public: 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_id(break_id),
m_break_loc_id (break_loc_id) m_break_loc_id (break_loc_id)
{ {
@@ -74,26 +74,26 @@ public:
} }
private: private:
const lldb::user_id_t m_break_id; const lldb::break_id_t m_break_id;
const lldb::user_id_t m_break_loc_id; const lldb::break_id_t m_break_loc_id;
}; };
BreakpointLocationCollection::collection::iterator 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 return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range
BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
} }
BreakpointLocationCollection::collection::const_iterator 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 return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range
BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
} }
BreakpointLocationSP 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; BreakpointLocationSP stop_sp;
collection::iterator pos = GetIDPairIterator(break_id, break_loc_id); 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 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; BreakpointLocationSP stop_sp;
collection::const_iterator pos = GetIDPairConstIterator(break_id, break_loc_id); collection::const_iterator pos = GetIDPairConstIterator(break_id, break_loc_id);
@@ -118,7 +118,7 @@ BreakpointLocationSP
BreakpointLocationCollection::GetByIndex (uint32_t i) BreakpointLocationCollection::GetByIndex (uint32_t i)
{ {
BreakpointLocationSP stop_sp; 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]; stop_sp = m_break_loc_collection[i];
return stop_sp; return stop_sp;
@@ -128,7 +128,7 @@ const BreakpointLocationSP
BreakpointLocationCollection::GetByIndex (uint32_t i) const BreakpointLocationCollection::GetByIndex (uint32_t i) const
{ {
BreakpointLocationSP stop_sp; 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]; stop_sp = m_break_loc_collection[i];
return stop_sp; return stop_sp;
@@ -139,7 +139,8 @@ BreakpointLocationCollection::ShouldStop (StoppointCallbackContext *context)
{ {
bool shouldStop = false; 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); bool one_result = GetByIndex(i)->ShouldStop(context);
if (one_result) if (one_result)
shouldStop = true; shouldStop = true;

View File

@@ -32,7 +32,7 @@ BreakpointLocationList::~BreakpointLocationList()
{ {
} }
lldb::user_id_t lldb::break_id_t
BreakpointLocationList::Add (BreakpointLocationSP &bp_loc_sp) BreakpointLocationList::Add (BreakpointLocationSP &bp_loc_sp)
{ {
if (bp_loc_sp) if (bp_loc_sp)
@@ -46,7 +46,7 @@ BreakpointLocationList::Add (BreakpointLocationSP &bp_loc_sp)
} }
bool 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); BreakpointLocationSP bp = FindByID (break_id);
if (bp) if (bp)
@@ -61,7 +61,7 @@ BreakpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::use
return true; return true;
} }
lldb::user_id_t lldb::break_id_t
BreakpointLocationList::FindIDByAddress (Address &addr) BreakpointLocationList::FindIDByAddress (Address &addr)
{ {
BreakpointLocationSP bp_loc_sp = FindByAddress (addr); BreakpointLocationSP bp_loc_sp = FindByAddress (addr);
@@ -73,7 +73,7 @@ BreakpointLocationList::FindIDByAddress (Address &addr)
} }
bool bool
BreakpointLocationList::Remove (lldb::user_id_t break_id) BreakpointLocationList::Remove (lldb::break_id_t break_id)
{ {
Mutex::Locker locker (m_mutex); Mutex::Locker locker (m_mutex);
collection::iterator pos = GetIDIterator(break_id); // Predicate collection::iterator pos = GetIDIterator(break_id); // Predicate
@@ -90,7 +90,7 @@ BreakpointLocationList::Remove (lldb::user_id_t break_id)
class BreakpointLocationIDMatches class BreakpointLocationIDMatches
{ {
public: public:
BreakpointLocationIDMatches (lldb::user_id_t break_id) : BreakpointLocationIDMatches (lldb::break_id_t break_id) :
m_break_id(break_id) m_break_id(break_id)
{ {
} }
@@ -101,7 +101,7 @@ public:
} }
private: private:
const lldb::user_id_t m_break_id; const lldb::break_id_t m_break_id;
}; };
class BreakpointLocationAddressMatches class BreakpointLocationAddressMatches
@@ -122,7 +122,7 @@ private:
}; };
BreakpointLocationList::collection::iterator BreakpointLocationList::collection::iterator
BreakpointLocationList::GetIDIterator (lldb::user_id_t break_id) BreakpointLocationList::GetIDIterator (lldb::break_id_t break_id)
{ {
Mutex::Locker locker (m_mutex); Mutex::Locker locker (m_mutex);
return std::find_if (m_locations.begin(), return std::find_if (m_locations.begin(),
@@ -131,7 +131,7 @@ BreakpointLocationList::GetIDIterator (lldb::user_id_t break_id)
} }
BreakpointLocationList::collection::const_iterator 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); Mutex::Locker locker (m_mutex);
return std::find_if (m_locations.begin(), return std::find_if (m_locations.begin(),
@@ -140,7 +140,7 @@ BreakpointLocationList::GetIDConstIterator (lldb::user_id_t break_id) const
} }
BreakpointLocationSP BreakpointLocationSP
BreakpointLocationList::FindByID (lldb::user_id_t break_id) BreakpointLocationList::FindByID (lldb::break_id_t break_id)
{ {
Mutex::Locker locker (m_mutex); Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp; BreakpointLocationSP stop_sp;
@@ -152,7 +152,7 @@ BreakpointLocationList::FindByID (lldb::user_id_t break_id)
} }
const BreakpointLocationSP 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); Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp; BreakpointLocationSP stop_sp;
@@ -192,13 +192,6 @@ BreakpointLocationList::FindInModule (Module *module,
return bp_loc_list.GetSize() - orig_size; 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 const BreakpointLocationSP
BreakpointLocationList::FindByAddress (Address &addr) const BreakpointLocationList::FindByAddress (Address &addr) const
{ {
@@ -234,7 +227,7 @@ BreakpointLocationList::GetByIndex (uint32_t i)
{ {
Mutex::Locker locker (m_mutex); Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp; BreakpointLocationSP stop_sp;
if (i >= 0 && i < m_locations.size()) if (i < m_locations.size())
stop_sp = m_locations[i]; stop_sp = m_locations[i];
return stop_sp; return stop_sp;
@@ -245,7 +238,7 @@ BreakpointLocationList::GetByIndex (uint32_t i) const
{ {
Mutex::Locker locker (m_mutex); Mutex::Locker locker (m_mutex);
BreakpointLocationSP stop_sp; BreakpointLocationSP stop_sp;
if (i >= 0 && i < m_locations.size()) if (i < m_locations.size())
stop_sp = m_locations[i]; stop_sp = m_locations[i];
return stop_sp; return stop_sp;

View File

@@ -32,8 +32,8 @@ BreakpointOptions::NullCallback (void *baton, StoppointCallbackContext *context,
//---------------------------------------------------------------------- //----------------------------------------------------------------------
BreakpointOptions::BreakpointOptions() : BreakpointOptions::BreakpointOptions() :
m_callback (BreakpointOptions::NullCallback), m_callback (BreakpointOptions::NullCallback),
m_callback_is_synchronous (false),
m_callback_baton_sp (), m_callback_baton_sp (),
m_callback_is_synchronous (false),
m_enabled (true), m_enabled (true),
m_ignore_count (0), m_ignore_count (0),
m_thread_spec_ap (NULL) m_thread_spec_ap (NULL)
@@ -160,14 +160,14 @@ BreakpointOptions::SetEnabled (bool enabled)
m_enabled = enabled; m_enabled = enabled;
} }
int32_t uint32_t
BreakpointOptions::GetIgnoreCount () const BreakpointOptions::GetIgnoreCount () const
{ {
return m_ignore_count; return m_ignore_count;
} }
void void
BreakpointOptions::SetIgnoreCount (int32_t n) BreakpointOptions::SetIgnoreCount (uint32_t n)
{ {
m_ignore_count = n; m_ignore_count = n;
} }

View File

@@ -59,7 +59,7 @@ BreakpointResolverFileLine::SearchCallback
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); 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); 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; SymbolContext sc;
if (sc_list.GetContextAtIndex(i, sc)) if (sc_list.GetContextAtIndex(i, sc))

View File

@@ -40,7 +40,8 @@ BreakpointSite::BreakpointSite
BreakpointSite::~BreakpointSite() BreakpointSite::~BreakpointSite()
{ {
BreakpointLocationSP bp_loc_sp; 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(); m_owners.GetByIndex(i)->ClearBreakpointSite();
} }
@@ -66,7 +67,8 @@ BreakpointSite::ShouldStop (StoppointCallbackContext *context)
bool bool
BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id) 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) if (m_owners.GetByIndex(i)->GetBreakpoint().GetID() == bp_id)
return true; return true;
@@ -158,7 +160,7 @@ BreakpointSite::AddOwner (BreakpointLocationSP &owner)
} }
uint32_t 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); m_owners.Remove(break_id, break_loc_id);
return m_owners.GetSize(); return m_owners.GetSize();

View File

@@ -31,7 +31,7 @@ BreakpointSiteList::~BreakpointSiteList()
// Add breakpoint site to the list. However, if the element already exists in the // 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. // 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) BreakpointSiteList::Add(const BreakpointSiteSP &bp)
{ {
lldb::addr_t bp_site_load_addr = bp->GetLoadAddress(); lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
@@ -49,7 +49,7 @@ BreakpointSiteList::Add(const BreakpointSiteSP &bp)
} }
bool 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); BreakpointSiteSP bp = FindByID (break_id);
if (bp) if (bp)
@@ -63,7 +63,7 @@ BreakpointSiteList::ShouldStop (StoppointCallbackContext *context, lldb::user_id
// doesn't exist. // doesn't exist.
return true; return true;
} }
lldb::user_id_t lldb::break_id_t
BreakpointSiteList::FindIDByAddress (lldb::addr_t addr) BreakpointSiteList::FindIDByAddress (lldb::addr_t addr)
{ {
BreakpointSiteSP bp = FindByAddress (addr); BreakpointSiteSP bp = FindByAddress (addr);
@@ -77,7 +77,7 @@ BreakpointSiteList::FindIDByAddress (lldb::addr_t addr)
} }
bool bool
BreakpointSiteList::Remove (lldb::user_id_t break_id) BreakpointSiteList::Remove (lldb::break_id_t break_id)
{ {
collection::iterator pos = GetIDIterator(break_id); // Predicate collection::iterator pos = GetIDIterator(break_id); // Predicate
if (pos != m_bp_site_list.end()) if (pos != m_bp_site_list.end())
@@ -103,7 +103,7 @@ BreakpointSiteList::RemoveByAddress (lldb::addr_t address)
class BreakpointSiteIDMatches class BreakpointSiteIDMatches
{ {
public: public:
BreakpointSiteIDMatches (lldb::user_id_t break_id) : BreakpointSiteIDMatches (lldb::break_id_t break_id) :
m_break_id(break_id) m_break_id(break_id)
{ {
} }
@@ -114,25 +114,25 @@ public:
} }
private: private:
const lldb::user_id_t m_break_id; const lldb::break_id_t m_break_id;
}; };
BreakpointSiteList::collection::iterator 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 return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate BreakpointSiteIDMatches(break_id)); // Predicate
} }
BreakpointSiteList::collection::const_iterator 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 return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range
BreakpointSiteIDMatches(break_id)); // Predicate BreakpointSiteIDMatches(break_id)); // Predicate
} }
BreakpointSiteSP BreakpointSiteSP
BreakpointSiteList::FindByID (lldb::user_id_t break_id) BreakpointSiteList::FindByID (lldb::break_id_t break_id)
{ {
BreakpointSiteSP stop_sp; BreakpointSiteSP stop_sp;
collection::iterator pos = GetIDIterator(break_id); collection::iterator pos = GetIDIterator(break_id);
@@ -143,7 +143,7 @@ BreakpointSiteList::FindByID (lldb::user_id_t break_id)
} }
const BreakpointSiteSP const BreakpointSiteSP
BreakpointSiteList::FindByID (lldb::user_id_t break_id) const BreakpointSiteList::FindByID (lldb::break_id_t break_id) const
{ {
BreakpointSiteSP stop_sp; BreakpointSiteSP stop_sp;
collection::const_iterator pos = GetIDConstIterator(break_id); collection::const_iterator pos = GetIDConstIterator(break_id);
@@ -210,7 +210,7 @@ BreakpointSiteList::GetByIndex (uint32_t i) const
} }
void 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 end = m_bp_site_list.end();
collection::iterator pos; collection::iterator pos;

View File

@@ -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

View File

@@ -22,21 +22,21 @@ using namespace lldb_private;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, bool hardware) : StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, bool hardware) :
m_loc_id(bid), m_loc_id(bid),
m_byte_size(0),
m_addr(addr), m_addr(addr),
m_hit_count(0),
m_hw_preferred(hardware), 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) : StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, size_t size, bool hardware) :
m_loc_id(bid), m_loc_id(bid),
m_byte_size(size),
m_addr(addr), m_addr(addr),
m_hit_count(0),
m_hw_preferred(hardware), m_hw_preferred(hardware),
m_hw_index(LLDB_INVALID_INDEX32) m_hw_index(LLDB_INVALID_INDEX32),
m_byte_size(size),
m_hit_count(0)
{ {
} }

View File

@@ -123,14 +123,14 @@ WatchpointLocation::WatchpointWrite () const
{ {
return m_watch_write != 0; return m_watch_write != 0;
} }
int32_t uint32_t
WatchpointLocation::GetIgnoreCount () const WatchpointLocation::GetIgnoreCount () const
{ {
return m_ignore_count; return m_ignore_count;
} }
void void
WatchpointLocation::SetIgnoreCount (int32_t n) WatchpointLocation::SetIgnoreCount (uint32_t n)
{ {
m_ignore_count = n; m_ignore_count = n;
} }

View File

@@ -161,7 +161,7 @@ DiskFilesOrDirectories
// but for completeness sake we'll resolve the user name and only put a slash // but for completeness sake we'll resolve the user name and only put a slash
// on the end if it exists. // on the end if it exists.
char resolved_username[PATH_MAX]; 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)); sizeof (resolved_username));
// Not sure how this would happen, a username longer than PATH_MAX? Still... // Not sure how this would happen, a username longer than PATH_MAX? Still...
@@ -238,7 +238,7 @@ DiskFilesOrDirectories
if (*partial_name_copy == '~') 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... // User name doesn't exist, we're not getting any further...
if (resolved_username_len == 0 || resolved_username_len >= sizeof (containing_part)) if (resolved_username_len == 0 || resolved_username_len >= sizeof (containing_part))
return matches.GetSize(); return matches.GetSize();
@@ -591,7 +591,7 @@ CommandCompletions::SymbolCompleter::SearchCallback (
SymbolContext sc; SymbolContext sc;
// Now add the functions & symbols to the list - only add if unique: // 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)) 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)) if (sym_list.GetContextAtIndex(i, sc))
{ {

View File

@@ -73,7 +73,7 @@ CommandObjectAppend::Execute
{ {
if (var->GetType() == StateVariable::eTypeString) 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)); var->AppendStringValue (command.GetArgumentAtIndex(i));
result.SetStatus (eReturnStatusSuccessFinishNoResult); result.SetStatus (eReturnStatusSuccessFinishNoResult);
} }

View File

@@ -69,14 +69,14 @@ CommandObjectApropos::Execute
result.AppendMessageWithFormat ("The following commands may relate to '%s':\n", search_word); result.AppendMessageWithFormat ("The following commands may relate to '%s':\n", search_word);
size_t max_len = 0; 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) if (len > max_len)
max_len = 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(), interpreter.OutputFormattedHelpText (result.GetOutputStream(),
commands_found.GetStringAtIndex(i), commands_found.GetStringAtIndex(i),
"--", commands_help. "--", commands_help.

View File

@@ -56,11 +56,11 @@ CommandObjectBreakpointSet::CommandOptions::CommandOptions() :
m_func_regexp (), m_func_regexp (),
m_modules (), m_modules (),
m_load_addr(), m_load_addr(),
m_ignore_count (0),
m_thread_id(LLDB_INVALID_THREAD_ID), m_thread_id(LLDB_INVALID_THREAD_ID),
m_thread_index (-1), m_thread_index (UINT32_MAX),
m_thread_name(), m_thread_name(),
m_queue_name(), m_queue_name()
m_ignore_count (-1)
{ {
} }
@@ -190,8 +190,8 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (int option_idx, cons
} }
case 'k': case 'k':
{ {
m_ignore_count = Args::StringToSInt32(optarg, -1, 0); m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0);
if (m_ignore_count == -1) if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg);
} }
break; break;
@@ -210,8 +210,8 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (int option_idx, cons
break; break;
case 'x': case 'x':
{ {
m_thread_index = Args::StringToUInt64(optarg, -1, 0); m_thread_index = Args::StringToUInt32(optarg, UINT32_MAX, 0);
if (m_thread_id == -1) if (m_thread_id == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg); error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg);
} }
@@ -237,9 +237,9 @@ CommandObjectBreakpointSet::CommandOptions::ResetOptionValues ()
m_func_regexp.clear(); m_func_regexp.clear();
m_load_addr = LLDB_INVALID_ADDRESS; m_load_addr = LLDB_INVALID_ADDRESS;
m_modules.clear(); m_modules.clear();
m_ignore_count = -1; m_ignore_count = 0;
m_thread_id = LLDB_INVALID_THREAD_ID; m_thread_id = LLDB_INVALID_THREAD_ID;
m_thread_index = -1; m_thread_index = UINT32_MAX;
m_thread_name.clear(); m_thread_name.clear();
m_queue_name.clear(); m_queue_name.clear();
} }
@@ -469,7 +469,7 @@ CommandObjectBreakpointSet::Execute
if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
bp->SetThreadID (m_options.m_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); bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
if (!m_options.m_thread_name.empty()) if (!m_options.m_thread_name.empty())
@@ -478,7 +478,7 @@ CommandObjectBreakpointSet::Execute
if (!m_options.m_queue_name.empty()) if (!m_options.m_queue_name.empty())
bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); 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); 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: // 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 // At this point, all of the breakpoint ids that the user passed in have been converted to breakpoint IDs
// and put into valid_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 // 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. // 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); BreakpointID cur_bp_id = valid_ids->GetBreakpointIDAtIndex (i);
Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get(); 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) if (cur_bp_id.GetLocationID() > num_locations)
{ {
StreamString id_str; StreamString id_str;
BreakpointID::GetCanonicalReference (&id_str, cur_bp_id.GetBreakpointID(), BreakpointID::GetCanonicalReference (&id_str,
cur_bp_id.GetLocationID()); cur_bp_id.GetBreakpointID(),
i = valid_ids->Size() + 1; cur_bp_id.GetLocationID());
i = valid_ids->GetSize() + 1;
result.AppendErrorWithFormat ("'%s' is not a currently valid breakpoint/location id.\n", result.AppendErrorWithFormat ("'%s' is not a currently valid breakpoint/location id.\n",
id_str.GetData()); id_str.GetData());
result.SetStatus (eReturnStatusFailed); result.SetStatus (eReturnStatusFailed);
@@ -588,7 +590,7 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
} }
else 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.AppendErrorWithFormat ("'%d' is not a currently valid breakpoint id.\n", cur_bp_id.GetBreakpointID());
result.SetStatus (eReturnStatusFailed); result.SetStatus (eReturnStatusFailed);
} }
@@ -731,7 +733,7 @@ CommandObjectBreakpointList::Execute
{ {
// No breakpoint selected; show info about all currently set breakpoints. // No breakpoint selected; show info about all currently set breakpoints.
result.AppendMessage ("Current 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(); Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (i).get();
AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level); AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level);
@@ -746,7 +748,7 @@ CommandObjectBreakpointList::Execute
if (result.Succeeded()) 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); BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get(); Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
@@ -834,7 +836,8 @@ CommandObjectBreakpointEnable::Execute
{ {
int enable_count = 0; int enable_count = 0;
int loc_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); BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
@@ -933,7 +936,8 @@ CommandObjectBreakpointDisable::Execute
{ {
int disable_count = 0; int disable_count = 0;
int loc_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); BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
@@ -1035,7 +1039,8 @@ CommandObjectBreakpointDelete::Execute
{ {
int delete_count = 0; int delete_count = 0;
int disable_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); BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
@@ -1074,12 +1079,15 @@ CommandObjectBreakpointDelete::Execute
CommandObjectBreakpointModify::CommandOptions::CommandOptions() : CommandObjectBreakpointModify::CommandOptions::CommandOptions() :
Options (), Options (),
m_ignore_count (0),
m_thread_id(LLDB_INVALID_THREAD_ID), m_thread_id(LLDB_INVALID_THREAD_ID),
m_thread_index (-1), m_thread_index (UINT32_MAX),
m_thread_name(), m_thread_name(),
m_queue_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; break;
case 'k': case 'k':
{ {
m_ignore_count = Args::StringToSInt32(optarg, -1, 0); m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0);
if (m_ignore_count == -1) if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg);
} }
break; break;
@@ -1167,8 +1175,8 @@ CommandObjectBreakpointModify::CommandOptions::SetOptionValue (int option_idx, c
break; break;
case 'x': case 'x':
{ {
m_thread_index = Args::StringToUInt64(optarg, -1, 0); m_thread_index = Args::StringToUInt32 (optarg, UINT32_MAX, 0);
if (m_thread_id == -1) if (m_thread_id == UINT32_MAX)
error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg); error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg);
} }
@@ -1186,9 +1194,9 @@ CommandObjectBreakpointModify::CommandOptions::ResetOptionValues ()
{ {
Options::ResetOptionValues(); Options::ResetOptionValues();
m_ignore_count = -1; m_ignore_count = 0;
m_thread_id = LLDB_INVALID_THREAD_ID; m_thread_id = LLDB_INVALID_THREAD_ID;
m_thread_index = -1; m_thread_index = UINT32_MAX;
m_thread_name.clear(); m_thread_name.clear();
m_queue_name.clear(); m_queue_name.clear();
m_enable_passed = false; m_enable_passed = false;
@@ -1249,7 +1257,8 @@ CommandObjectBreakpointModify::Execute
if (result.Succeeded()) 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); 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) if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
location->SetThreadID (m_options.m_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); location->GetLocationOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
if (m_options.m_name_passed) if (m_options.m_name_passed)
@@ -1273,7 +1282,7 @@ CommandObjectBreakpointModify::Execute
if (m_options.m_queue_passed) if (m_options.m_queue_passed)
location->GetLocationOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); 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); location->GetLocationOptions()->SetIgnoreCount(m_options.m_ignore_count);
if (m_options.m_enable_passed) if (m_options.m_enable_passed)
@@ -1285,7 +1294,7 @@ CommandObjectBreakpointModify::Execute
if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
bp->SetThreadID (m_options.m_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); bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
if (m_options.m_name_passed) if (m_options.m_name_passed)
@@ -1294,7 +1303,7 @@ CommandObjectBreakpointModify::Execute
if (m_options.m_queue_passed) if (m_options.m_queue_passed)
bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); 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); bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count);
if (m_options.m_enable_passed) if (m_options.m_enable_passed)

View File

@@ -104,9 +104,9 @@ public:
std::string m_func_name; std::string m_func_name;
uint32_t m_func_name_type_mask; uint32_t m_func_name_type_mask;
std::string m_func_regexp; std::string m_func_regexp;
lldb::addr_t m_load_addr;
STLStringArray m_modules; 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; lldb::tid_t m_thread_id;
uint32_t m_thread_index; uint32_t m_thread_index;
std::string m_thread_name; std::string m_thread_name;
@@ -164,7 +164,7 @@ public:
// Instance variables to hold the values for command options. // 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; lldb::tid_t m_thread_id;
uint32_t m_thread_index; uint32_t m_thread_index;
std::string m_thread_name; std::string m_thread_name;

View File

@@ -244,7 +244,8 @@ CommandObjectBreakpointCommandAdd::Execute
if (result.Succeeded()) 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); BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
@@ -441,7 +442,8 @@ CommandObjectBreakpointCommandRemove::Execute
if (result.Succeeded()) 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); BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
@@ -526,7 +528,8 @@ CommandObjectBreakpointCommandList::Execute
if (result.Succeeded()) 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); BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)

View File

@@ -205,14 +205,14 @@ public:
CommandReturnObject &result CommandReturnObject &result
) )
{ {
const int argc = args.GetArgumentCount(); const size_t argc = args.GetArgumentCount();
if (argc < 2) if (argc < 2)
{ {
result.AppendError ("'alias' requires at least two arguments"); result.AppendError ("'alias' requires at least two arguments");
result.SetStatus (eReturnStatusFailed); result.SetStatus (eReturnStatusFailed);
return false; return false;
} }
const std::string alias_command = args.GetArgumentAtIndex(0); const std::string alias_command = args.GetArgumentAtIndex(0);
const std::string actual_command = args.GetArgumentAtIndex(1); const std::string actual_command = args.GetArgumentAtIndex(1);
@@ -236,7 +236,7 @@ public:
if (command_obj_sp.get()) if (command_obj_sp.get())
{ {
CommandObject *cmd_obj = 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); OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector);
OptionArgVector *option_arg_vector = option_arg_vector_sp.get(); OptionArgVector *option_arg_vector = option_arg_vector_sp.get();
@@ -299,7 +299,7 @@ public:
} }
else else
{ {
for (int i = 0; i < args.GetArgumentCount(); ++i) for (size_t i = 0; i < argc; ++i)
option_arg_vector->push_back (OptionArgPair ("<argument>", option_arg_vector->push_back (OptionArgPair ("<argument>",
std::string (args.GetArgumentAtIndex (i)))); std::string (args.GetArgumentAtIndex (i))));
} }

View File

@@ -74,7 +74,8 @@ CommandObjectCrossref::GenerateHelpText (CommandReturnObject &result)
{ {
result.AppendMessage ("This command can be called on the following types of objects:"); 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); const char *obj_name = m_crossref_object_types.GetArgumentAtIndex(i);
result.AppendMessageWithFormat (" %s (e.g. '%s %s')\n", obj_name, result.AppendMessageWithFormat (" %s (e.g. '%s %s')\n", obj_name,

View File

@@ -27,8 +27,8 @@ using namespace lldb_private;
CommandObjectHelp::CommandObjectHelp () : CommandObjectHelp::CommandObjectHelp () :
CommandObject ("help", CommandObject ("help",
"Shows a list of all debugger commands, or give details about specific commands.", "Shows a list of all debugger commands, or give details about specific commands.",
"help [<cmd-name>]") "help [<cmd-name>]")
{ {
} }
@@ -123,7 +123,8 @@ CommandObjectHelp::Execute (CommandInterpreter &interpreter, Args& command, Comm
{ {
Stream &output_strm = result.GetOutputStream(); Stream &output_strm = result.GetOutputStream();
output_strm.Printf("Help requested with ambiguous command name, possible completions:\n"); 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)); output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i));
} }

View File

@@ -469,7 +469,7 @@ public:
OptionElementVector &opt_element_vector, OptionElementVector &opt_element_vector,
int match_start_point, int match_start_point,
int max_return_elements, int max_return_elements,
bool word_complete, bool &word_complete,
StringList &matches) StringList &matches)
{ {
// Arguments are the standard source file completer. // Arguments are the standard source file completer.

View File

@@ -462,11 +462,20 @@ public:
return false; return false;
} }
size_t item_byte_size = m_options.m_byte_size ? m_options.m_byte_size : 1;
StreamString buffer (Stream::eBinary, StreamString buffer (Stream::eBinary,
process->GetAddressByteSize(), process->GetAddressByteSize(),
process->GetByteOrder()); 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); lldb::addr_t addr = Args::StringToUInt64(command.GetArgumentAtIndex(0), LLDB_INVALID_ADDRESS, 0);
if (addr == LLDB_INVALID_ADDRESS) if (addr == LLDB_INVALID_ADDRESS)
@@ -513,6 +522,8 @@ public:
case eFormatDefault: case eFormatDefault:
case eFormatBytes: case eFormatBytes:
case eFormatHex: case eFormatHex:
case eFormatPointer:
// Decode hex bytes // Decode hex bytes
uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 16, &success); uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 16, &success);
if (!success) if (!success)

View File

@@ -40,54 +40,12 @@ CommandObjectSyntax::~CommandObjectSyntax()
bool bool
CommandObjectSyntax::OldExecute CommandObjectSyntax::Execute
( (
CommandInterpreter &interpreter,
Args& command, Args& command,
Debugger *context,
CommandInterpreter *interpreter,
CommandReturnObject &result 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::CommandMap::iterator pos;
CommandObject *cmd_obj; CommandObject *cmd_obj;
@@ -95,7 +53,7 @@ CommandObjectSyntax::Execute (Args &command, Debugger *context, CommandInterpret
if (argc > 0) if (argc > 0)
{ {
cmd_obj = interpreter->GetCommandObject (command.GetArgumentAtIndex(0)); cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex(0));
bool all_okay = true; bool all_okay = true;
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {

View File

@@ -30,17 +30,10 @@ public:
virtual virtual
~CommandObjectSyntax (); ~CommandObjectSyntax ();
bool
OldExecute (Args& command,
Debugger *context,
CommandInterpreter *interpreter,
CommandReturnObject &result);
virtual bool virtual bool
Execute (Args& command, Execute (CommandInterpreter &interpreter,
Debugger *context, Args& command,
CommandInterpreter *interpreter,
CommandReturnObject &result); CommandReturnObject &result);

View File

@@ -173,7 +173,7 @@ lldb_private::DisplayFramesForExecutionContext
strm.IndentMore(); strm.IndentMore();
StackFrameSP frame_sp; StackFrameSP frame_sp;
int frame_idx = 0; uint32_t frame_idx = 0;
if (ascending) if (ascending)
{ {

View File

@@ -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

View File

@@ -241,24 +241,28 @@ ReadCStringFromMemory (ExecutionContextScope *exe_scope, const Address &address,
} }
Address::Address () : Address::Address () :
SymbolContextScope(),
m_section (NULL), m_section (NULL),
m_offset (LLDB_INVALID_ADDRESS) m_offset (LLDB_INVALID_ADDRESS)
{ {
} }
Address::Address (const Address& rhs) : Address::Address (const Address& rhs) :
SymbolContextScope(rhs),
m_section (rhs.m_section), m_section (rhs.m_section),
m_offset (rhs.m_offset) m_offset (rhs.m_offset)
{ {
} }
Address::Address (const Section* section, addr_t offset) : Address::Address (const Section* section, addr_t offset) :
SymbolContextScope(),
m_section (section), m_section (section),
m_offset (offset) m_offset (offset)
{ {
} }
Address::Address (addr_t address, const SectionList * sections) : Address::Address (addr_t address, const SectionList * sections) :
SymbolContextScope(),
m_section (NULL), m_section (NULL),
m_offset (LLDB_INVALID_ADDRESS) m_offset (LLDB_INVALID_ADDRESS)
{ {
@@ -430,6 +434,9 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
lldb_private::Address so_addr; lldb_private::Address so_addr;
switch (style) switch (style)
{ {
case DumpStyleInvalid:
return false;
case DumpStyleSectionNameOffset: case DumpStyleSectionNameOffset:
if (m_section != NULL) if (m_section != NULL)
{ {
@@ -637,6 +644,9 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
} }
} }
break; break;
default:
break;
} }
} }

View File

@@ -146,6 +146,9 @@ AddressRange::Dump(Stream *s, Process *process, Address::DumpStyle style, Addres
switch (style) switch (style)
{ {
default:
break;
case Address::DumpStyleSectionNameOffset: case Address::DumpStyleSectionNameOffset:
case Address::DumpStyleSectionPointerOffset: case Address::DumpStyleSectionPointerOffset:
s->PutChar ('['); s->PutChar ('[');

View File

@@ -54,7 +54,7 @@ AddressResolverFileLine::SearchCallback
sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything,
sc_list); sc_list);
for (int i = 0; i < sc_list_size; i++) for (uint32_t i = 0; i < sc_list_size; i++)
{ {
SymbolContext sc; SymbolContext sc;
if (sc_list.GetContextAtIndex(i, sc)) if (sc_list.GetContextAtIndex(i, sc))

View File

@@ -239,6 +239,7 @@ ArchSpec::AsCString (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t su
switch (arch_type) switch (arch_type)
{ {
case kNumArchTypes:
case eArchTypeInvalid: case eArchTypeInvalid:
break; break;
@@ -334,6 +335,7 @@ ArchSpec::GetGenericCPUType () const
{ {
switch (m_type) switch (m_type)
{ {
case kNumArchTypes:
case eArchTypeInvalid: case eArchTypeInvalid:
break; break;
@@ -990,7 +992,7 @@ enum
eRegNumPPC_GCC_vscr = 110, eRegNumPPC_GCC_vscr = 110,
eRegNumPPC_GCC_spe_acc = 111, eRegNumPPC_GCC_spe_acc = 111,
eRegNumPPC_GCC_spefscr = 112, eRegNumPPC_GCC_spefscr = 112,
eRegNumPPC_GCC_sfp = 113, eRegNumPPC_GCC_sfp = 113
}; };
static const char * g_arm_gcc_reg_names[] = { static const char * g_arm_gcc_reg_names[] = {
@@ -1605,6 +1607,7 @@ ArchSpec::GetAddressByteSize() const
{ {
switch (m_type) switch (m_type)
{ {
case kNumArchTypes:
case eArchTypeInvalid: case eArchTypeInvalid:
break; break;
@@ -1702,6 +1705,9 @@ ArchSpec::SetArch (const char *arch_name)
} }
} }
break; break;
case kNumArchTypes:
break;
} }
const char *str = arch_name; const char *str = arch_name;

View File

@@ -85,10 +85,7 @@ public:
Mutex::Locker locker (m_mutex); Mutex::Locker locker (m_mutex);
llvm::StringRef string_ref (cstr, cstr_len); llvm::StringRef string_ref (cstr, cstr_len);
llvm::StringMapEntry<uint32_t>& entry = m_string_map.GetOrCreateValue (string_ref); llvm::StringMapEntry<uint32_t>& entry = m_string_map.GetOrCreateValue (string_ref);
const char *ccstr = entry.getKeyData(); return entry.getKeyData();
llvm::StringMapEntry<uint32_t>&reconstituted_entry = GetStringMapEntryFromKeyData (ccstr);
assert (&entry == &reconstituted_entry);
return ccstr;
} }
return NULL; return NULL;
} }

View File

@@ -154,12 +154,16 @@ DataBufferMemoryMap::MemoryMapFromFileDescriptor (int fd, off_t offset, size_t l
{ {
if ((stat.st_mode & S_IFREG) && (stat.st_size > offset)) if ((stat.st_mode & S_IFREG) && (stat.st_size > offset))
{ {
const size_t max_bytes_available = stat.st_size - offset;
if (length == SIZE_MAX) if (length == SIZE_MAX)
length = stat.st_size - offset; {
length = max_bytes_available;
// Cap the length if too much data was requested }
if (length > stat.st_size - offset) else if (length > max_bytes_available)
length = stat.st_size - offset; {
// Cap the length if too much data was requested
length = max_bytes_available;
}
if (length > 0) if (length > 0)
{ {

View File

@@ -1088,7 +1088,7 @@ DataExtractor::GetSLEB128 (uint32_t *offset_ptr) const
int size = sizeof (uint32_t) * 8; int size = sizeof (uint32_t) * 8;
const uint8_t *src = m_start + *offset_ptr; const uint8_t *src = m_start + *offset_ptr;
uint8_t byte; uint8_t byte = 0;
int bytecount = 0; int bytecount = 0;
while (src < m_end) 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)); s->Address(GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset), sizeof (addr_t));
break; break;
default:
case eFormatDefault:
case eFormatHex: case eFormatHex:
if (item_byte_size <= 8) if (item_byte_size <= 8)
{ {

View File

@@ -334,7 +334,7 @@ Error::SetErrorStringWithVarArg (const char *format, va_list args)
// allocated buffer above // allocated buffer above
va_list copy_args; va_list copy_args;
va_copy (copy_args, 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()) if (length >= buf.size())
{ {
// The error formatted string didn't fit into our buffer, resize it // The error formatted string didn't fit into our buffer, resize it

View File

@@ -58,7 +58,7 @@ GetCachedGlobTildeSlash()
// Returns 0 if there WAS a ~ in the path but the username couldn't be resolved. // 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 // Otherwise returns the number of characters copied into dst_path. If the return
// is >= dst_len, then the resolved path is too long... // 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) FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len)
{ {
char user_home[PATH_MAX]; 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 there's no ~, then just copy src_path straight to dst_path (they may be the same string...)
if (src_path[0] != '~') if (src_path[0] != '~')
{ {
int len = strlen (src_path); size_t len = strlen (src_path);
if (len >= dst_len) if (len >= dst_len)
{ {
::bcopy (src_path, dst_path, dst_len - 1); ::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... // User name of "" means the current user...
struct passwd *user_entry; struct passwd *user_entry;
const char *home_dir; const char *home_dir = NULL;
if (user_name[0] == '\0') 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); 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) FileSpec::Resolve (const char *src_path, char *dst_path, size_t dst_len)
{ {
if (src_path == NULL || src_path[0] == '\0') 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]; char unglobbed_path[PATH_MAX];
if (src_path[0] == '~') 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, // If we couldn't find the user referred to, or the resultant path was too long,
// then just copy over the src_path. // 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]) 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 else
{ {
strncpy (path, dirname, max_path_length); ::strncpy (path, dirname, max_path_length);
} }
} }
else if (filename) else if (filename)
{ {
strncpy (path, filename, max_path_length); ::strncpy (path, filename, max_path_length);
} }
else 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 // Make sure we read exactly what we asked for and if we got
// less, adjust the array // less, adjust the array
if (bytesRead < data_heap_ap->GetByteSize()) if ((size_t)bytesRead < data_heap_ap->GetByteSize())
data_heap_ap->SetByteSize(bytesRead); data_heap_ap->SetByteSize(bytesRead);
data_sp.reset(data_heap_ap.release()); data_sp.reset(data_heap_ap.release());
} }

View File

@@ -48,7 +48,7 @@ g_languages[] =
{ { "python" , NULL , "Python" } } { { "python" , NULL , "Python" } }
}; };
static const uint32_t static const size_t
g_num_languages = sizeof(g_languages)/sizeof(LanguageStrings); g_num_languages = sizeof(g_languages)/sizeof(LanguageStrings);
Language::Language(Language::Type language) : Language::Language(Language::Type language) :

14
lldb/source/Core/Makefile Normal file
View File

@@ -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

View File

@@ -154,9 +154,9 @@ SearchFilter::SearchInModuleList (Searcher &searcher, ModuleList &modules)
searcher.SearchCallback (*this, empty_sc, NULL, false); searcher.SearchCallback (*this, empty_sc, NULL, false);
else 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)); ModuleSP module_sp(modules.GetModuleAtIndex(i));
if (ModulePasses(module_sp)) if (ModulePasses(module_sp))
@@ -186,7 +186,7 @@ SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searche
if (!context.module_sp) if (!context.module_sp)
{ {
size_t n_modules = m_target_sp->GetImages().GetSize(); 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, // If this is the last level supplied, then call the callback directly,
// otherwise descend. // otherwise descend.
@@ -395,8 +395,8 @@ SearchFilterByModule::Search (Searcher &searcher)
// find the ones that match the file name. // find the ones that match the file name.
ModuleList matching_modules; ModuleList matching_modules;
// const size_t num_matching_modules = m_target_sp->GetImages().FindModules(&m_module_spec, NULL, NULL, NULL, matching_modules); const size_t num_modules = m_target_sp->GetImages().GetSize ();
for (int i = 0; i < m_target_sp->GetImages().GetSize (); i++) for (size_t i = 0; i < num_modules; i++)
{ {
Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i); Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0) if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0)

View File

@@ -67,12 +67,10 @@ Stream::PutSLEB128 (int64_t sval)
if (m_flags.IsSet(eBinary)) if (m_flags.IsSet(eBinary))
{ {
bool more = true; bool more = true;
bool negative = (sval < 0);
while (more) while (more)
{ {
uint8_t byte = sval & 0x7fu; uint8_t byte = sval & 0x7fu;
sval >>= 7; sval >>= 7;
assert((!negative && sval >= 0) || (negative && sval < 0));
/* sign bit of byte is 2nd high order bit (0x40) */ /* sign bit of byte is 2nd high order bit (0x40) */
if ((sval == 0 && !(byte & 0x40)) || if ((sval == 0 && !(byte & 0x40)) ||
(sval == -1 && (byte & 0x40)) ) (sval == -1 && (byte & 0x40)) )
@@ -209,7 +207,7 @@ Stream::PrintfVarArg (const char *format, va_list args)
int bytes_written = 0; int bytes_written = 0;
// Try and format our string into a fixed buffer first and see if it fits // 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)) if (length < sizeof(str))
{ {
va_end (args); va_end (args);
@@ -479,16 +477,15 @@ Stream::PrintfAsRawHex8 (const char *format, ...)
va_start (args, format); va_start (args, format);
va_copy (args, args_copy); // Copy this so we va_copy (args, args_copy); // Copy this so we
int i;
char str[1024]; char str[1024];
int bytes_written = 0; int bytes_written = 0;
// Try and format our string into a fixed buffer first and see if it fits // 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)) if (length < sizeof(str))
{ {
// The formatted string fit into our stack based buffer, so we can just // The formatted string fit into our stack based buffer, so we can just
// append that to our packet // 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); bytes_written += _PutHex8 (str[i], false);
} }
else else
@@ -499,7 +496,7 @@ Stream::PrintfAsRawHex8 (const char *format, ...)
length = ::vasprintf (&str_ptr, format, args_copy); length = ::vasprintf (&str_ptr, format, args_copy);
if (str_ptr) if (str_ptr)
{ {
for (i=0; i<length; ++i) for (size_t i=0; i<length; ++i)
bytes_written += _PutHex8 (str_ptr[i], false); bytes_written += _PutHex8 (str_ptr[i], false);
::free (str_ptr); ::free (str_ptr);
} }
@@ -514,7 +511,7 @@ int
Stream::PutNHex8 (size_t n, uint8_t uvalue) Stream::PutNHex8 (size_t n, uint8_t uvalue)
{ {
int bytes_written = 0; 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)); bytes_written += _PutHex8 (uvalue, m_flags.IsSet(eAddPrefix));
return bytes_written; return bytes_written;
} }
@@ -555,15 +552,14 @@ Stream::PutHex16 (uint16_t uvalue, ByteOrder byte_order)
bool add_prefix = m_flags.IsSet(eAddPrefix); bool add_prefix = m_flags.IsSet(eAddPrefix);
int bytes_written = 0; int bytes_written = 0;
int byte;
if (byte_order == eByteOrderLittle) 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); bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
} }
else 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); bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
} }
return bytes_written; return bytes_written;
@@ -577,15 +573,14 @@ Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order)
bool add_prefix = m_flags.IsSet(eAddPrefix); bool add_prefix = m_flags.IsSet(eAddPrefix);
int bytes_written = 0; int bytes_written = 0;
int byte;
if (byte_order == eByteOrderLittle) 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); bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
} }
else 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); bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
} }
return bytes_written; return bytes_written;
@@ -599,15 +594,14 @@ Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order)
bool add_prefix = m_flags.IsSet(eAddPrefix); bool add_prefix = m_flags.IsSet(eAddPrefix);
int bytes_written = 0; int bytes_written = 0;
int byte;
if (byte_order == eByteOrderLittle) 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); bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
} }
else 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); bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix);
} }
return bytes_written; 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; int bytes_written = 0;
const uint8_t *src = (const uint8_t *)s; const uint8_t *src = (const uint8_t *)s;
int i;
bool binary_is_clear = m_flags.IsClear (eBinary); bool binary_is_clear = m_flags.IsClear (eBinary);
m_flags.Set (eBinary); m_flags.Set (eBinary);
if (src_byte_order == dst_byte_order) 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); bytes_written += _PutHex8 (src[i], false);
} }
else 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); bytes_written += _PutHex8 (src[i], false);
} }
if (binary_is_clear) 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; int bytes_written = 0;
const uint8_t *src = (const uint8_t *)s; const uint8_t *src = (const uint8_t *)s;
int i;
bool binary_is_set = m_flags.IsSet(eBinary); bool binary_is_set = m_flags.IsSet(eBinary);
m_flags.Clear(eBinary); m_flags.Clear(eBinary);
if (src_byte_order == dst_byte_order) 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); bytes_written += _PutHex8 (src[i], false);
} }
else 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); bytes_written += _PutHex8 (src[i], false);
} }
if (binary_is_set) if (binary_is_set)

View File

@@ -24,32 +24,32 @@ using namespace lldb_private;
StreamFile::StreamFile () : StreamFile::StreamFile () :
Stream (), Stream (),
m_file (NULL), 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) : StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, FILE *f) :
Stream (flags, addr_size, byte_order), Stream (flags, addr_size, byte_order),
m_file(f), m_file(f),
m_path_name (), m_close_file(false),
m_close_file(false) m_path_name ()
{ {
} }
StreamFile::StreamFile(FILE *f) : StreamFile::StreamFile(FILE *f) :
Stream (), Stream (),
m_file(f), 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) : StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, const char *path, const char *permissions) :
Stream (flags, addr_size, byte_order), Stream (flags, addr_size, byte_order),
m_file (NULL), m_file (NULL),
m_path_name (path), m_close_file(false),
m_close_file(false) m_path_name (path)
{ {
Open(path, permissions); 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) : StreamFile::StreamFile(const char *path, const char *permissions) :
Stream (), Stream (),
m_file (NULL), m_file (NULL),
m_path_name (path), m_close_file(false),
m_close_file(false) m_path_name (path)
{ {
Open(path, permissions); Open(path, permissions);
} }

View File

@@ -68,7 +68,7 @@ StringList::AppendList (StringList strings)
{ {
uint32_t len = strings.GetSize(); 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)); m_strings.push_back (strings.GetStringAtIndex(i));
} }
@@ -106,7 +106,7 @@ StringList::LongestCommonPrefix (std::string &common_prefix)
for (++pos; pos != end; ++pos) 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: // First trim common_prefix if it is longer than the current element:
if (common_prefix.size() > new_size) if (common_prefix.size() > new_size)
@@ -114,7 +114,7 @@ StringList::LongestCommonPrefix (std::string &common_prefix)
// Then trim it at the first disparity: // 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]) if (m_strings[pos][i] != common_prefix[i])
{ {
@@ -189,7 +189,7 @@ StringList::RemoveBlankLines ()
if (GetSize() == 0) if (GetSize() == 0)
return; return;
int idx = 0; size_t idx = 0;
while (idx < m_strings.size()) while (idx < m_strings.size())
{ {
if (m_strings[idx].empty()) if (m_strings[idx].empty())

View File

@@ -616,7 +616,7 @@ Value::GetValueAsData (ExecutionContext *exe_ctx, clang::ASTContext *ast_context
data.SetData(data_sp); 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 (dst != NULL)
{ {
if (address_type == eAddressTypeHost) if (address_type == eAddressTypeHost)
@@ -677,6 +677,10 @@ Value::ResolveValue(ExecutionContext *exe_ctx, clang::ASTContext *ast_context)
case eValueTypeScalar: // raw scalar value case eValueTypeScalar: // raw scalar value
break; break;
case eContextTypeValue:
m_value.Clear(); // TODO: Sean, fill this in
break;
default: default:
case eValueTypeFileAddress: case eValueTypeFileAddress:
m_value.Clear(); m_value.Clear();
@@ -757,6 +761,7 @@ Value::GetContextTypeAsCString (ContextType context_type)
case eContextTypeDCRegisterInfo: return "RegisterInfo *"; case eContextTypeDCRegisterInfo: return "RegisterInfo *";
case eContextTypeDCType: return "Type *"; case eContextTypeDCType: return "Type *";
case eContextTypeDCVariable: return "Variable *"; case eContextTypeDCVariable: return "Variable *";
case eContextTypeValue: return "Value"; // TODO: Sean, more description here?
}; };
return "???"; return "???";
} }

View File

@@ -516,6 +516,9 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope)
} }
} }
break; break;
default:
break;
} }
} }
} }
@@ -579,7 +582,7 @@ ValueObject::SetValueFromCString (ExecutionContextScope *exe_scope, const char *
{ {
const size_t byte_size = GetByteSize(); const size_t byte_size = GetByteSize();
const off_t byte_offset = GetByteOffset(); 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) if (dst != NULL)
{ {
// We are decoding a float into host byte order below, so make // We are decoding a float into host byte order below, so make

View File

@@ -111,9 +111,9 @@ ValueObjectChild::GetTypeName()
const char *clang_type_name = m_type_name.AsCString(); const char *clang_type_name = m_type_name.AsCString();
if (clang_type_name) if (clang_type_name)
{ {
char bitfield_type_name[strlen(clang_type_name) + 32]; std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0);
::snprintf (bitfield_type_name, sizeof(bitfield_type_name), "%s:%u", clang_type_name, m_bitfield_bit_size); ::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); m_type_name.SetCString(bitfield_type_name.data());
} }
} }
} }

View File

@@ -195,9 +195,12 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
ClangExpression::ClangExpression(const char *target_triple, ClangExpression::ClangExpression(const char *target_triple,
ClangExpressionDeclMap *decl_map) : ClangExpressionDeclMap *decl_map) :
m_target_triple (), m_target_triple (),
m_jit_mm_ptr (NULL), m_decl_map (decl_map),
m_clang_ap (),
m_code_generator_ptr (NULL), 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]) if (target_triple && target_triple[0])
m_target_triple = target_triple; m_target_triple = target_triple;

View File

@@ -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) : ClangFunction::ClangFunction(const char *target_triple, ClangASTContext *ast_context, void *return_qualtype, const Address& functionAddress, const ValueList &arg_value_list) :
ClangExpression (target_triple, NULL), ClangExpression (target_triple, NULL),
m_function_addr (functionAddress),
m_function_ptr (NULL), m_function_ptr (NULL),
m_arg_values (arg_value_list), m_function_addr (functionAddress),
m_clang_ast_context (ast_context),
m_function_return_qual_type(return_qualtype), m_function_return_qual_type(return_qualtype),
m_clang_ast_context (ast_context),
m_wrapper_function_name ("__lldb_caller_function"), m_wrapper_function_name ("__lldb_caller_function"),
m_wrapper_struct_name ("__lldb_caller_struct"), 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_offset(0),
m_return_size (0),
m_compiled (false), m_compiled (false),
m_JITted (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) : ClangFunction::ClangFunction(const char *target_triple, Function &function, ClangASTContext *ast_context, const ValueList &arg_value_list) :
ClangExpression (target_triple, NULL), ClangExpression (target_triple, NULL),
m_function_ptr (&function), 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_clang_ast_context (ast_context),
m_function_return_qual_type (NULL),
m_wrapper_function_name ("__lldb_function_caller"), m_wrapper_function_name ("__lldb_function_caller"),
m_wrapper_struct_name ("__lldb_caller_struct"), 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_compiled (false),
m_JITted (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 // to pull the defined arguments out of the function, then add the types from the
// arguments list for the variable arguments. // arguments list for the variable arguments.
size_t num_args = -1; uint32_t num_args = UINT32_MAX;
bool trust_function = false; bool trust_function = false;
// GetArgumentCount returns -1 for an unprototyped function. // GetArgumentCount returns -1 for an unprototyped function.
if (m_function_ptr) if (m_function_ptr)
{ {
num_args = m_function_ptr->GetArgumentCount(); int num_func_args = m_function_ptr->GetArgumentCount();
if (num_args != -1) if (num_func_args >= 0)
trust_function = true; trust_function = true;
else
num_args = num_func_args;
} }
if (num_args == -1) if (num_args == UINT32_MAX)
num_args = m_arg_values.GetSize(); 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_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. 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; const char *type_string;
std::string type_stdstr; std::string type_stdstr;
@@ -157,7 +170,7 @@ ClangFunction::CompileFunction (Stream &errors)
char arg_buf[32]; char arg_buf[32];
args_buffer.append (" "); args_buffer.append (" ");
args_buffer.append (type_string); 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.push_back (' ');
args_buffer.append (arg_buf); args_buffer.append (arg_buf);
args_buffer.append (";\n"); args_buffer.append (";\n");
@@ -253,8 +266,8 @@ ClangFunction::WriteFunctionWrapper (ExecutionContext &exc_context, Stream &erro
} }
// Next get the call address for the function: // Next get the call address for the function:
m_wrapper_fun_addr = GetFunctionAddress (m_wrapper_function_name.c_str()); m_wrapper_function_addr = GetFunctionAddress (m_wrapper_function_name.c_str());
if (m_wrapper_fun_addr == LLDB_INVALID_ADDRESS) if (m_wrapper_function_addr == LLDB_INVALID_ADDRESS)
return false; return false;
return true; return true;
@@ -322,7 +335,7 @@ ClangFunction::WriteFunctionArguments (ExecutionContext &exc_context, lldb::addr
return false; 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. // 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); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log) 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; return true;
} }
@@ -386,7 +399,7 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exc_context, lldb:
// Okay, now run the function: // 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, ThreadPlan *new_plan = new ThreadPlanCallFunction (*exc_context.thread,
wrapper_address, wrapper_address,
args_addr, args_addr,

View File

@@ -37,6 +37,9 @@ GetScalarTypeForClangType (clang::ASTContext &ast_context, clang::QualType clang
switch (clang_type->getTypeClass()) switch (clang_type->getTypeClass())
{ {
default:
break;
case clang::Type::FunctionNoProto: case clang::Type::FunctionNoProto:
case clang::Type::FunctionProto: case clang::Type::FunctionProto:
break; break;
@@ -135,8 +138,8 @@ lldb_private::ClangStmtVisitor::ClangStmtVisitor
lldb_private::StreamString &strm lldb_private::StreamString &strm
) : ) :
m_ast_context (ast_context), m_ast_context (ast_context),
m_variable_list (variable_list),
m_decl_map (decl_map), m_decl_map (decl_map),
m_variable_list (variable_list),
m_stream (strm) m_stream (strm)
{ {
} }
@@ -477,22 +480,10 @@ lldb_private::ClangStmtVisitor::VisitStringLiteral (clang::StringLiteral *Str)
bool is_wide = Str->isWide(); bool is_wide = Str->isWide();
size_t new_length = byte_length + (is_wide ? 1 : 2); 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]; Value *val = new Value((uint8_t*)null_terminated_string.c_str(), 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);
val->SetContext(Value::eContextTypeOpaqueClangQualType, Str->getType().getAsOpaquePtr()); val->SetContext(Value::eContextTypeOpaqueClangQualType, Str->getType().getAsOpaquePtr());
uint32_t val_idx = m_variable_list.AppendValue(val); uint32_t val_idx = m_variable_list.AppendValue(val);

View File

@@ -303,6 +303,9 @@ DWARFExpression::DumpLocation (Stream *s, uint32_t offset, uint32_t length, lldb
switch (level) switch (level)
{ {
default:
break;
case lldb::eDescriptionLevelBrief: case lldb::eDescriptionLevelBrief:
if (offset > start_offset) if (offset > start_offset)
s->PutChar(' '); s->PutChar(' ');

View File

@@ -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

View File

@@ -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

20
lldb/source/Host/Makefile Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -23,9 +23,9 @@
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#include "CFCBundle.h" #include "cfcpp/CFCBundle.h"
#include "CFCReleaser.h" #include "cfcpp/CFCReleaser.h"
#include "CFCString.h" #include "cfcpp/CFCString.h"
#include "lldb/Host/Host.h" #include "lldb/Host/Host.h"
#include "lldb/Core/ArchSpec.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 // Set the pthread name if possible
if (pid == curr_pid && tid == curr_tid) if (pid == curr_pid && tid == curr_tid)
{ {
::pthread_setname_np (name) == 0; ::pthread_setname_np (name);
} }
#endif #endif
ThreadNameAccessor (false, pid, tid, name); ThreadNameAccessor (false, pid, tid, name);
@@ -446,21 +446,22 @@ Host::GetProgramFileSpec ()
static FileSpec g_program_filepsec; static FileSpec g_program_filepsec;
if (!g_program_filepsec) if (!g_program_filepsec)
{ {
std::string program_fullpath; char program_fullpath[PATH_MAX];
program_fullpath.resize (PATH_MAX);
// If DST is NULL, then return the number of bytes needed. // If DST is NULL, then return the number of bytes needed.
uint32_t len = program_fullpath.size(); uint32_t len = sizeof(program_fullpath);
int err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len); int err = _NSGetExecutablePath (program_fullpath, &len);
if (err < 0)
{
// 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);
}
if (err == 0) if (err == 0)
g_program_filepsec.SetFile(program_fullpath.data()); g_program_filepsec.SetFile (program_fullpath);
else if (err == -1)
{
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);
}
} }
return g_program_filepsec; return g_program_filepsec;
} }
@@ -505,7 +506,7 @@ Host::ResolveExecutableInBundle (FileSpec *file)
struct MonitorInfo struct MonitorInfo
{ {
int handle; uint32_t handle;
pthread_t thread; pthread_t thread;
Host::MonitorChildProcessCallback callback; Host::MonitorChildProcessCallback callback;
void *callback_baton; void *callback_baton;

View File

@@ -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

View File

@@ -19,20 +19,23 @@
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
// Project includes // Project includes
#include "CFCReleaser.h"
#include "lldb/Core/ArchSpec.h" #include "lldb/Core/ArchSpec.h"
#include "lldb/Core/DataBuffer.h" #include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataExtractor.h" #include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Timer.h" #include "lldb/Core/Timer.h"
#include "lldb/Core/UUID.h" #include "lldb/Core/UUID.h"
#include "Host/macosx/cfcpp/CFCReleaser.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private; using namespace lldb_private;
extern "C" { extern "C" {
CFURLRef DBGCopyFullDSYMURLForUUID (CFUUIDRef uuid, CFURLRef exec_url); CFURLRef DBGCopyFullDSYMURLForUUID (CFUUIDRef uuid, CFURLRef exec_url);
CFDictionaryRef DBGCopyDSYMPropertyLists (CFURLRef dsym_url); CFDictionaryRef DBGCopyDSYMPropertyLists (CFURLRef dsym_url);
};
}
static bool static bool
SkinnyMachOFileContainsArchAndUUID SkinnyMachOFileContainsArchAndUUID

View File

@@ -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

View File

@@ -779,7 +779,7 @@ Args::LongestCommonPrefix (std::string &common_prefix)
for (++pos; pos != end; ++pos) 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: // First trim common_prefix if it is longer than the current element:
if (common_prefix.size() > new_size) if (common_prefix.size() > new_size)
@@ -787,7 +787,7 @@ Args::LongestCommonPrefix (std::string &common_prefix)
// Then trim it at the first disparity: // 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]) 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 // So we have to build another Arg and pass that to getopt_long so it doesn't
// change the one we have. // 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; bool failed_once = false;
uint32_t dash_dash_pos = -1; uint32_t dash_dash_pos = -1;
@@ -1009,7 +1009,10 @@ Args::ParseArgsForCompletion
int parse_start = optind; int parse_start = optind;
int long_options_index = -1; 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); &long_options_index);
if (val == -1) if (val == -1)

View File

@@ -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)"

20
lldb/source/Makefile Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -376,8 +376,7 @@ DisassemblerLLVM::DisassemblerLLVM(const ArchSpec &arch) :
char triple[256]; char triple[256];
if (TripleForArchSpec (arch, triple, sizeof(triple))) if (TripleForArchSpec (arch, triple, sizeof(triple)))
{ {
EDAssemblySyntax_t syntax = SyntaxForArchSpec (arch); assert(!EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch)) && "No disassembler created!");
assert(!EDGetDisassembler(&m_disassembler, triple, syntax) && "No disassembler created!");
} }
} }

View File

@@ -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

View File

@@ -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

View File

@@ -16,7 +16,6 @@
#include <string> #include <string>
// Other libraries and framework includes // Other libraries and framework includes
// Project includes // Project includes
#include "lldb.h"
#include "lldb/Expression/ClangExpression.h" #include "lldb/Expression/ClangExpression.h"
#include "lldb/Expression/ClangFunction.h" #include "lldb/Expression/ClangFunction.h"
#include "lldb/Host/Mutex.h" #include "lldb/Host/Mutex.h"
@@ -128,6 +127,6 @@ private:
}; };
}; // using namespace lldb_private } // using namespace lldb_private
#endif // lldb_ObjCTrampolineHandler_h_ #endif // lldb_ObjCTrampolineHandler_h_

View File

@@ -14,8 +14,8 @@
// C++ Includes // C++ Includes
// Other libraries and framework includes // Other libraries and framework includes
// Project includes // Project includes
#include "lldb-types.h" #include "lldb/lldb-types.h"
#include "lldb-enumerations.h" #include "lldb/lldb-enumerations.h"
#include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlan.h"
#include "ObjCTrampolineHandler.h" #include "ObjCTrampolineHandler.h"
@@ -90,5 +90,6 @@ private:
lldb::addr_t m_sel_ptr; lldb::addr_t m_sel_ptr;
}; };
}; // namespace lldb_private } // namespace lldb_private
#endif // lldb_ThreadPlanStepThroughObjCTrampoline_h_ #endif // lldb_ThreadPlanStepThroughObjCTrampoline_h_

View File

@@ -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

Some files were not shown because too many files have changed in this diff Show More