From echristo at apple.com Mon Jul 5 14:13:24 2010 From: echristo at apple.com (Eric Christopher) Date: Mon, 05 Jul 2010 19:13:24 -0000 Subject: [Lldb-commits] [lldb] r107623 - /lldb/trunk/source/Symbol/LineEntry.cpp Message-ID: <20100705191324.1AE582A6C12C@llvm.org> Author: echristo Date: Mon Jul 5 14:13:23 2010 New Revision: 107623 URL: http://llvm.org/viewvc/llvm-project?rev=107623&view=rev Log: Change order of initialization. Patch by Stephen Wilson! Modified: lldb/trunk/source/Symbol/LineEntry.cpp Modified: lldb/trunk/source/Symbol/LineEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineEntry.cpp?rev=107623&r1=107622&r2=107623&view=diff ============================================================================== --- lldb/trunk/source/Symbol/LineEntry.cpp (original) +++ lldb/trunk/source/Symbol/LineEntry.cpp Mon Jul 5 14:13:23 2010 @@ -20,9 +20,9 @@ column(0), is_start_of_statement(0), is_start_of_basic_block(0), - is_terminal_entry(0), is_prologue_end(0), - is_epilogue_begin(0) + is_epilogue_begin(0), + is_terminal_entry(0) { } From gclayton at apple.com Tue Jul 6 11:11:44 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 06 Jul 2010 16:11:44 -0000 Subject: [Lldb-commits] [lldb] r107671 - /lldb/trunk/source/Commands/CommandCompletions.cpp Message-ID: <20100706161144.896DA2A6C12C@llvm.org> Author: gclayton Date: Tue Jul 6 11:11:44 2010 New Revision: 107671 URL: http://llvm.org/viewvc/llvm-project?rev=107671&view=rev Log: Jean-Daniel Dupas patch that fixes a bad if statement with assignment. Modified: lldb/trunk/source/Commands/CommandCompletions.cpp Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=107671&r1=107670&r2=107671&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Tue Jul 6 11:11:44 2010 @@ -240,7 +240,7 @@ { int resolved_username_len = FileSpec::ResolveUsername(containing_part, containing_part, sizeof (containing_part)); // User name doesn't exist, we're not getting any further... - if (resolved_username_len = 0 || resolved_username_len >= sizeof (containing_part)) + if (resolved_username_len == 0 || resolved_username_len >= sizeof (containing_part)) return matches.GetSize(); } From gclayton at apple.com Tue Jul 6 11:16:14 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 06 Jul 2010 16:16:14 -0000 Subject: [Lldb-commits] [lldb] r107672 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj tools/debugserver/debugserver.xcodeproj/project.pbxproj Message-ID: <20100706161615.0264F2A6C12C@llvm.org> Author: gclayton Date: Tue Jul 6 11:16:14 2010 New Revision: 107672 URL: http://llvm.org/viewvc/llvm-project?rev=107672&view=rev Log: Added "-Wparentheses" so we catch possible errors like: if (a = 0) instead of: if (a == 0) Thanks to Jean-Daniel Dupas. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107672&r1=107671&r2=107672&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jul 6 11:16:14 2010 @@ -2759,6 +2759,7 @@ OTHER_CFLAGS = ( "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", + "-Wparentheses", ); OTHER_CPLUSPLUSFLAGS = ( "-fno-rtti", @@ -2811,6 +2812,7 @@ OTHER_CFLAGS = ( "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", + "-Wparentheses", ); OTHER_CPLUSPLUSFLAGS = ( "-fno-rtti", @@ -2871,6 +2873,7 @@ INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", __TEXT, @@ -2918,6 +2921,7 @@ OTHER_CFLAGS = ( "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", + "-Wparentheses", ); OTHER_CPLUSPLUSFLAGS = ( "-fno-rtti", @@ -2959,6 +2963,7 @@ INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", __TEXT, @@ -2996,6 +3001,7 @@ INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", __TEXT, Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=107672&r1=107671&r2=107672&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Tue Jul 6 11:16:14 2010 @@ -501,6 +501,7 @@ GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER; INSTALL_PATH = /Developer/usr/bin; LLDB_DEBUGSERVER = 1; + OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", __TEXT, @@ -532,6 +533,7 @@ GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER; INSTALL_PATH = /Developer/usr/bin; LLDB_DEBUGSERVER = 1; + OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", __TEXT, @@ -561,6 +563,7 @@ GCC_PREPROCESSOR_DEFINITIONS = LLDB_DEBUGSERVER; INSTALL_PATH = /Developer/usr/bin; LLDB_DEBUGSERVER = 1; + OTHER_CFLAGS = "-Wparentheses"; OTHER_LDFLAGS = ( "-sectcreate", __TEXT, From gclayton at apple.com Tue Jul 6 15:27:01 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 06 Jul 2010 20:27:01 -0000 Subject: [Lldb-commits] [lldb] r107692 - in /lldb/trunk/source: Host/macosx/Host.mm Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Message-ID: <20100706202701.1F2792A6C12C@llvm.org> Author: gclayton Date: Tue Jul 6 15:27:00 2010 New Revision: 107692 URL: http://llvm.org/viewvc/llvm-project?rev=107692&view=rev Log: Applied pid.patch from Jean-Daniel Dupas. Modified: lldb/trunk/source/Host/macosx/Host.mm lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Modified: lldb/trunk/source/Host/macosx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=107692&r1=107691&r2=107692&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/Host.mm Tue Jul 6 15:27:00 2010 @@ -554,7 +554,7 @@ Mutex::Locker locker(&g_monitor_map_mutex); if (!g_monitor_thread) { - pid_t wait_pid = -1; + lldb::pid_t wait_pid = -1; g_monitor_thread = ThreadCreate ("", MonitorChildProcessThreadFunction, &wait_pid, @@ -640,7 +640,7 @@ if (log) log->Printf ("%s (arg = %p) thread starting...", function, arg); - const pid_t wait_pid = -1;//*((pid_t*)arg); + const lldb::pid_t wait_pid = -1;//*((pid_t*)arg); int status = -1; const int options = 0; struct rusage *rusage = NULL; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=107692&r1=107691&r2=107692&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jul 6 15:27:00 2010 @@ -616,7 +616,7 @@ } Error -ProcessGDBRemote::DoAttach (pid_t attach_pid) +ProcessGDBRemote::DoAttach (lldb::pid_t attach_pid) { Error error; // Clear out and clean up from any current state From gclayton at apple.com Tue Jul 6 15:29:25 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 06 Jul 2010 20:29:25 -0000 Subject: [Lldb-commits] [lldb] r107693 - /lldb/trunk/source/Plugins/Process/Utility/libunwind/src/RemoteUnwindProfile.h Message-ID: <20100706202925.F28FB2A6C12C@llvm.org> Author: gclayton Date: Tue Jul 6 15:29:25 2010 New Revision: 107693 URL: http://llvm.org/viewvc/llvm-project?rev=107693&view=rev Log: Avoid duplicate names (something else that clang++ really doesn't like) in function prototype (from Jean-Daniel Dupas). Modified: lldb/trunk/source/Plugins/Process/Utility/libunwind/src/RemoteUnwindProfile.h Modified: lldb/trunk/source/Plugins/Process/Utility/libunwind/src/RemoteUnwindProfile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/libunwind/src/RemoteUnwindProfile.h?rev=107693&r1=107692&r2=107693&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/libunwind/src/RemoteUnwindProfile.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/libunwind/src/RemoteUnwindProfile.h Tue Jul 6 15:29:25 2010 @@ -59,7 +59,7 @@ class RemoteProcInfo; -bool AssemblyParse (RemoteProcInfo *procinfo, unw_accessors_t *as, unw_addr_space_t as, uint64_t start, uint64_t end, RemoteUnwindProfile &profile, void *arg); +bool AssemblyParse (RemoteProcInfo *procinfo, unw_accessors_t *accessor, unw_addr_space_t as, uint64_t start, uint64_t end, RemoteUnwindProfile &profile, void *arg); class FuncBounds { From gclayton at apple.com Tue Jul 6 15:30:35 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 06 Jul 2010 20:30:35 -0000 Subject: [Lldb-commits] [lldb] r107694 - in /lldb/trunk/source: Core/DataExtractor.cpp Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Message-ID: <20100706203036.066EF2A6C12C@llvm.org> Author: gclayton Date: Tue Jul 6 15:30:35 2010 New Revision: 107694 URL: http://llvm.org/viewvc/llvm-project?rev=107694&view=rev Log: Remove extraneous semicolon after if condition (from Jean-Daniel Dupas). Modified: lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=107694&r1=107693&r2=107694&view=diff ============================================================================== --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Tue Jul 6 15:30:35 2010 @@ -1279,17 +1279,17 @@ break; case eFormatDecimal: - if (item_byte_size <= 8); + if (item_byte_size <= 8) s->Printf ("%lld", GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); break; case eFormatUnsigned: - if (item_byte_size <= 8); + if (item_byte_size <= 8) s->Printf ("%llu", GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); break; case eFormatOctal: - if (item_byte_size <= 8); + if (item_byte_size <= 8) s->Printf ("0%llo", GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); break; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp?rev=107694&r1=107693&r2=107694&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Tue Jul 6 15:30:35 2010 @@ -196,7 +196,7 @@ m_prev_abbr_offset_pos = pos; } - if (pos != m_abbrevCollMap.end()); + if (pos != m_abbrevCollMap.end()) return &(pos->second); return NULL; } From jmolenda at apple.com Tue Jul 6 17:38:03 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 06 Jul 2010 22:38:03 -0000 Subject: [Lldb-commits] [lldb] r107716 - in /lldb/trunk: include/lldb/Core/dwarf.h lldb.xcodeproj/project.pbxproj source/Core/DataExtractor.cpp source/Core/ValueObjectChild.cpp source/Expression/ClangExpression.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/SymbolFile/DWARF/DWARFDefines.c source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp source/Plugins/SymbolFile/DWARF/DWARFDefines.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/ClangASTContext.cpp source/Symbol/DWARFCallFrameInfo.cpp Message-ID: <20100706223803.B317D2A6C12C@llvm.org> Author: jmolenda Date: Tue Jul 6 17:38:03 2010 New Revision: 107716 URL: http://llvm.org/viewvc/llvm-project?rev=107716&view=rev Log: Switch over to using llvm's dwarf constants file. Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp - copied, changed from r106035, lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c Removed: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c Modified: lldb/trunk/include/lldb/Core/dwarf.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/Core/ValueObjectChild.cpp lldb/trunk/source/Expression/ClangExpression.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Modified: lldb/trunk/include/lldb/Core/dwarf.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/dwarf.h?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/dwarf.h (original) +++ lldb/trunk/include/lldb/Core/dwarf.h Tue Jul 6 17:38:03 2010 @@ -13,6 +13,11 @@ #include #include +// Get the DWARF constant defintions from llvm +#include "llvm/Support/Dwarf.h" +// and stuff them in our default namespace +using namespace llvm::dwarf; + typedef uint32_t dw_uleb128_t; typedef int32_t dw_sleb128_t; typedef uint16_t dw_attr_t; @@ -33,372 +38,15 @@ #define DW_INVALID_OFFSET (~(dw_offset_t)0) #define DW_INVALID_INDEX 0xFFFFFFFFul +// #define DW_ADDR_none 0x0 -/* [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ - -#define DW_TAG_array_type 0x1 -#define DW_TAG_class_type 0x2 -#define DW_TAG_entry_point 0x3 -#define DW_TAG_enumeration_type 0x4 -#define DW_TAG_formal_parameter 0x5 -#define DW_TAG_imported_declaration 0x8 -#define DW_TAG_label 0xA -#define DW_TAG_lexical_block 0xB -#define DW_TAG_member 0xD -#define DW_TAG_pointer_type 0xF -#define DW_TAG_reference_type 0x10 -#define DW_TAG_compile_unit 0x11 -#define DW_TAG_string_type 0x12 -#define DW_TAG_structure_type 0x13 -#define DW_TAG_subroutine_type 0x15 -#define DW_TAG_typedef 0x16 -#define DW_TAG_union_type 0x17 -#define DW_TAG_unspecified_parameters 0x18 -#define DW_TAG_variant 0x19 -#define DW_TAG_common_block 0x1A -#define DW_TAG_common_inclusion 0x1B -#define DW_TAG_inheritance 0x1C -#define DW_TAG_inlined_subroutine 0x1D -#define DW_TAG_module 0x1E -#define DW_TAG_ptr_to_member_type 0x1F -#define DW_TAG_set_type 0x20 -#define DW_TAG_subrange_type 0x21 -#define DW_TAG_with_stmt 0x22 -#define DW_TAG_access_declaration 0x23 -#define DW_TAG_base_type 0x24 -#define DW_TAG_catch_block 0x25 -#define DW_TAG_const_type 0x26 -#define DW_TAG_constant 0x27 -#define DW_TAG_enumerator 0x28 -#define DW_TAG_file_type 0x29 -#define DW_TAG_friend 0x2A -#define DW_TAG_namelist 0x2B -#define DW_TAG_namelist_item 0x2C -#define DW_TAG_packed_type 0x2D -#define DW_TAG_subprogram 0x2E -#define DW_TAG_template_type_parameter 0x2F -#define DW_TAG_template_value_parameter 0x30 -#define DW_TAG_thrown_type 0x31 -#define DW_TAG_try_block 0x32 -#define DW_TAG_variant_part 0x33 -#define DW_TAG_variable 0x34 -#define DW_TAG_volatile_type 0x35 -#define DW_TAG_dwarf_procedure 0x36 -#define DW_TAG_restrict_type 0x37 -#define DW_TAG_interface_type 0x38 -#define DW_TAG_namespace 0x39 -#define DW_TAG_imported_module 0x3A -#define DW_TAG_unspecified_type 0x3B -#define DW_TAG_partial_unit 0x3C -#define DW_TAG_imported_unit 0x3D -#define DW_TAG_condition 0x3F -#define DW_TAG_shared_type 0x40 -#define DW_TAG_lo_user 0x4080 -#define DW_TAG_hi_user 0xFFFF - -/* [7.5.4] Figure 17 "Child determination encodings" (p. 128) in DWARFv3 draft 8 */ - -#define DW_CHILDREN_no 0x0 -#define DW_CHILDREN_yes 0x1 - -/* [7.5.4] Figure 18 "Attribute encodings" (pp. 129-132) in DWARFv3 draft 8 */ - -#define DW_AT_sibling 0x1 -#define DW_AT_location 0x2 -#define DW_AT_name 0x3 -#define DW_AT_ordering 0x9 -#define DW_AT_byte_size 0xB -#define DW_AT_bit_offset 0xC -#define DW_AT_bit_size 0xD -#define DW_AT_stmt_list 0x10 -#define DW_AT_low_pc 0x11 -#define DW_AT_high_pc 0x12 -#define DW_AT_language 0x13 -#define DW_AT_discr 0x15 -#define DW_AT_discr_value 0x16 -#define DW_AT_visibility 0x17 -#define DW_AT_import 0x18 -#define DW_AT_string_length 0x19 -#define DW_AT_common_reference 0x1A -#define DW_AT_comp_dir 0x1B -#define DW_AT_const_value 0x1C -#define DW_AT_containing_type 0x1D -#define DW_AT_default_value 0x1E -#define DW_AT_inline 0x20 -#define DW_AT_is_optional 0x21 -#define DW_AT_lower_bound 0x22 -#define DW_AT_producer 0x25 -#define DW_AT_prototyped 0x27 -#define DW_AT_return_addr 0x2A -#define DW_AT_start_scope 0x2C -#define DW_AT_bit_stride 0x2E -#define DW_AT_upper_bound 0x2F -#define DW_AT_abstract_origin 0x31 -#define DW_AT_accessibility 0x32 -#define DW_AT_address_class 0x33 -#define DW_AT_artificial 0x34 -#define DW_AT_base_types 0x35 -#define DW_AT_calling_convention 0x36 -#define DW_AT_count 0x37 -#define DW_AT_data_member_location 0x38 -#define DW_AT_decl_column 0x39 -#define DW_AT_decl_file 0x3A -#define DW_AT_decl_line 0x3B -#define DW_AT_declaration 0x3C -#define DW_AT_discr_list 0x3D -#define DW_AT_encoding 0x3E -#define DW_AT_external 0x3F -#define DW_AT_frame_base 0x40 -#define DW_AT_friend 0x41 -#define DW_AT_identifier_case 0x42 -#define DW_AT_macro_info 0x43 -#define DW_AT_namelist_item 0x44 -#define DW_AT_priority 0x45 -#define DW_AT_segment 0x46 -#define DW_AT_specification 0x47 -#define DW_AT_static_link 0x48 -#define DW_AT_type 0x49 -#define DW_AT_use_location 0x4A -#define DW_AT_variable_parameter 0x4B -#define DW_AT_virtuality 0x4C -#define DW_AT_vtable_elem_location 0x4D -#define DW_AT_allocated 0x4E -#define DW_AT_associated 0x4F -#define DW_AT_data_location 0x50 -#define DW_AT_byte_stride 0x51 -#define DW_AT_entry_pc 0x52 -#define DW_AT_use_UTF8 0x53 -#define DW_AT_extension 0x54 -#define DW_AT_ranges 0x55 -#define DW_AT_trampoline 0x56 -#define DW_AT_call_column 0x57 -#define DW_AT_call_file 0x58 -#define DW_AT_call_line 0x59 -#define DW_AT_description 0x5A -#define DW_AT_binary_scale 0x5B -#define DW_AT_decimal_scale 0x5C -#define DW_AT_small 0x5D -#define DW_AT_decimal_sign 0x5E -#define DW_AT_digit_count 0x5F -#define DW_AT_picture_string 0x60 -#define DW_AT_mutable 0x61 -#define DW_AT_threads_scaled 0x62 -#define DW_AT_explicit 0x63 -#define DW_AT_object_pointer 0x64 -#define DW_AT_endianity 0x65 -#define DW_AT_elemental 0x66 -#define DW_AT_pure 0x67 -#define DW_AT_recursive 0x68 -#define DW_AT_lo_user 0x2000 -#define DW_AT_hi_user 0x3FFF -#define DW_AT_MIPS_fde 0x2001 -#define DW_AT_MIPS_loop_begin 0x2002 -#define DW_AT_MIPS_tail_loop_begin 0x2003 -#define DW_AT_MIPS_epilog_begin 0x2004 -#define DW_AT_MIPS_loop_unroll_factor 0x2005 -#define DW_AT_MIPS_software_pipeline_depth 0x2006 -#define DW_AT_MIPS_linkage_name 0x2007 -#define DW_AT_MIPS_stride 0x2008 -#define DW_AT_MIPS_abstract_name 0x2009 -#define DW_AT_MIPS_clone_origin 0x200A -#define DW_AT_MIPS_has_inlines 0x200B -/* GNU extensions. */ -#define DW_AT_sf_names 0x2101 -#define DW_AT_src_info 0x2102 -#define DW_AT_mac_info 0x2103 -#define DW_AT_src_coords 0x2104 -#define DW_AT_body_begin 0x2105 -#define DW_AT_body_end 0x2106 -#define DW_AT_GNU_vector 0x2107 +#define DW_EH_PE_MASK_ENCODING 0x0F -#define DW_AT_APPLE_repository_file 0x2501 -#define DW_AT_APPLE_repository_type 0x2502 -#define DW_AT_APPLE_repository_name 0x2503 -#define DW_AT_APPLE_repository_specification 0x2504 -#define DW_AT_APPLE_repository_import 0x2505 -#define DW_AT_APPLE_repository_abstract_origin 0x2506 -#define DW_AT_APPLE_optimized 0x3FE1 -#define DW_AT_APPLE_flags 0x3FE2 -#define DW_AT_APPLE_isa 0x3FE3 -#define DW_AT_APPLE_block 0x3FE4 +// The following are used only internally within lldb - don't +// document them in the llvm Dwarf.h header file, we won't see +// them in executable files anywhere. +// These constants fit between DW_OP_lo_user (0xe0) and DW_OP_hi_user (0xff). -/* [7.5.4] Figure 19 "Attribute form encodings" (pp. 133-134) in DWARFv3 draft 8 */ - -#define DW_FORM_addr 0x1 -#define DW_FORM_block2 0x3 -#define DW_FORM_block4 0x4 -#define DW_FORM_data2 0x5 -#define DW_FORM_data4 0x6 -#define DW_FORM_data8 0x7 -#define DW_FORM_string 0x8 -#define DW_FORM_block 0x9 -#define DW_FORM_block1 0xA -#define DW_FORM_data1 0xB -#define DW_FORM_flag 0xC -#define DW_FORM_sdata 0xD -#define DW_FORM_strp 0xE -#define DW_FORM_udata 0xF -#define DW_FORM_ref_addr 0x10 -#define DW_FORM_ref1 0x11 -#define DW_FORM_ref2 0x12 -#define DW_FORM_ref4 0x13 -#define DW_FORM_ref8 0x14 -#define DW_FORM_ref_udata 0x15 -#define DW_FORM_indirect 0x16 // cf section 7.5.3, "Abbreviations Tables", p. 119 DWARFv3 draft 8 -#define DW_FORM_APPLE_db_str 0x50 // read same as udata, but refers to string in repository - -/* [7.7.1] Figure 22 "DWARF operation encodings" (pp. 136-139) in DWARFv3 draft 8 */ - -#define DW_OP_addr 0x3 // constant address (size target specific) -#define DW_OP_deref 0x6 -#define DW_OP_const1u 0x8 // 1-byte constant -#define DW_OP_const1s 0x9 // 1-byte constant -#define DW_OP_const2u 0xA // 2-byte constant -#define DW_OP_const2s 0xB // 2-byte constant -#define DW_OP_const4u 0xC // 4-byte constant -#define DW_OP_const4s 0xD // 4-byte constant -#define DW_OP_const8u 0xE // 8-byte constant -#define DW_OP_const8s 0xF // 8-byte constant -#define DW_OP_constu 0x10 // ULEB128 constant -#define DW_OP_consts 0x11 // SLEB128 constant -#define DW_OP_dup 0x12 -#define DW_OP_drop 0x13 -#define DW_OP_over 0x14 -#define DW_OP_pick 0x15 // 1-byte stack index -#define DW_OP_swap 0x16 -#define DW_OP_rot 0x17 -#define DW_OP_xderef 0x18 -#define DW_OP_abs 0x19 -#define DW_OP_and 0x1A -#define DW_OP_div 0x1B -#define DW_OP_minus 0x1C -#define DW_OP_mod 0x1D -#define DW_OP_mul 0x1E -#define DW_OP_neg 0x1F -#define DW_OP_not 0x20 -#define DW_OP_or 0x21 -#define DW_OP_plus 0x22 -#define DW_OP_plus_uconst 0x23 // ULEB128 addend -#define DW_OP_shl 0x24 -#define DW_OP_shr 0x25 -#define DW_OP_shra 0x26 -#define DW_OP_xor 0x27 -#define DW_OP_skip 0x2F // signed 2-byte constant -#define DW_OP_bra 0x28 // signed 2-byte constant -#define DW_OP_eq 0x29 -#define DW_OP_ge 0x2A -#define DW_OP_gt 0x2B -#define DW_OP_le 0x2C -#define DW_OP_lt 0x2D -#define DW_OP_ne 0x2E -#define DW_OP_lit0 0x30 // Literal 0 -#define DW_OP_lit1 0x31 // Literal 1 -#define DW_OP_lit2 0x32 // Literal 2 -#define DW_OP_lit3 0x33 // Literal 3 -#define DW_OP_lit4 0x34 // Literal 4 -#define DW_OP_lit5 0x35 // Literal 5 -#define DW_OP_lit6 0x36 // Literal 6 -#define DW_OP_lit7 0x37 // Literal 7 -#define DW_OP_lit8 0x38 // Literal 8 -#define DW_OP_lit9 0x39 // Literal 9 -#define DW_OP_lit10 0x3A // Literal 10 -#define DW_OP_lit11 0x3B // Literal 11 -#define DW_OP_lit12 0x3C // Literal 12 -#define DW_OP_lit13 0x3D // Literal 13 -#define DW_OP_lit14 0x3E // Literal 14 -#define DW_OP_lit15 0x3F // Literal 15 -#define DW_OP_lit16 0x40 // Literal 16 -#define DW_OP_lit17 0x41 // Literal 17 -#define DW_OP_lit18 0x42 // Literal 18 -#define DW_OP_lit19 0x43 // Literal 19 -#define DW_OP_lit20 0x44 // Literal 20 -#define DW_OP_lit21 0x45 // Literal 21 -#define DW_OP_lit22 0x46 // Literal 22 -#define DW_OP_lit23 0x47 // Literal 23 -#define DW_OP_lit24 0x48 // Literal 24 -#define DW_OP_lit25 0x49 // Literal 25 -#define DW_OP_lit26 0x4A // Literal 26 -#define DW_OP_lit27 0x4B // Literal 27 -#define DW_OP_lit28 0x4C // Literal 28 -#define DW_OP_lit29 0x4D // Literal 29 -#define DW_OP_lit30 0x4E // Literal 30 -#define DW_OP_lit31 0x4F // Literal 31 -#define DW_OP_reg0 0x50 // Contents of reg0 -#define DW_OP_reg1 0x51 // Contents of reg1 -#define DW_OP_reg2 0x52 // Contents of reg2 -#define DW_OP_reg3 0x53 // Contents of reg3 -#define DW_OP_reg4 0x54 // Contents of reg4 -#define DW_OP_reg5 0x55 // Contents of reg5 -#define DW_OP_reg6 0x56 // Contents of reg6 -#define DW_OP_reg7 0x57 // Contents of reg7 -#define DW_OP_reg8 0x58 // Contents of reg8 -#define DW_OP_reg9 0x59 // Contents of reg9 -#define DW_OP_reg10 0x5A // Contents of reg10 -#define DW_OP_reg11 0x5B // Contents of reg11 -#define DW_OP_reg12 0x5C // Contents of reg12 -#define DW_OP_reg13 0x5D // Contents of reg13 -#define DW_OP_reg14 0x5E // Contents of reg14 -#define DW_OP_reg15 0x5F // Contents of reg15 -#define DW_OP_reg16 0x60 // Contents of reg16 -#define DW_OP_reg17 0x61 // Contents of reg17 -#define DW_OP_reg18 0x62 // Contents of reg18 -#define DW_OP_reg19 0x63 // Contents of reg19 -#define DW_OP_reg20 0x64 // Contents of reg20 -#define DW_OP_reg21 0x65 // Contents of reg21 -#define DW_OP_reg22 0x66 // Contents of reg22 -#define DW_OP_reg23 0x67 // Contents of reg23 -#define DW_OP_reg24 0x68 // Contents of reg24 -#define DW_OP_reg25 0x69 // Contents of reg25 -#define DW_OP_reg26 0x6A // Contents of reg26 -#define DW_OP_reg27 0x6B // Contents of reg27 -#define DW_OP_reg28 0x6C // Contents of reg28 -#define DW_OP_reg29 0x6D // Contents of reg29 -#define DW_OP_reg30 0x6E // Contents of reg30 -#define DW_OP_reg31 0x6F // Contents of reg31 -#define DW_OP_breg0 0x70 // base register 0 + SLEB128 offset -#define DW_OP_breg1 0x71 // base register 1 + SLEB128 offset -#define DW_OP_breg2 0x72 // base register 2 + SLEB128 offset -#define DW_OP_breg3 0x73 // base register 3 + SLEB128 offset -#define DW_OP_breg4 0x74 // base register 4 + SLEB128 offset -#define DW_OP_breg5 0x75 // base register 5 + SLEB128 offset -#define DW_OP_breg6 0x76 // base register 6 + SLEB128 offset -#define DW_OP_breg7 0x77 // base register 7 + SLEB128 offset -#define DW_OP_breg8 0x78 // base register 8 + SLEB128 offset -#define DW_OP_breg9 0x79 // base register 9 + SLEB128 offset -#define DW_OP_breg10 0x7A // base register 10 + SLEB128 offset -#define DW_OP_breg11 0x7B // base register 11 + SLEB128 offset -#define DW_OP_breg12 0x7C // base register 12 + SLEB128 offset -#define DW_OP_breg13 0x7D // base register 13 + SLEB128 offset -#define DW_OP_breg14 0x7E // base register 14 + SLEB128 offset -#define DW_OP_breg15 0x7F // base register 15 + SLEB128 offset -#define DW_OP_breg16 0x80 // base register 16 + SLEB128 offset -#define DW_OP_breg17 0x81 // base register 17 + SLEB128 offset -#define DW_OP_breg18 0x82 // base register 18 + SLEB128 offset -#define DW_OP_breg19 0x83 // base register 19 + SLEB128 offset -#define DW_OP_breg20 0x84 // base register 20 + SLEB128 offset -#define DW_OP_breg21 0x85 // base register 21 + SLEB128 offset -#define DW_OP_breg22 0x86 // base register 22 + SLEB128 offset -#define DW_OP_breg23 0x87 // base register 23 + SLEB128 offset -#define DW_OP_breg24 0x88 // base register 24 + SLEB128 offset -#define DW_OP_breg25 0x89 // base register 25 + SLEB128 offset -#define DW_OP_breg26 0x8A // base register 26 + SLEB128 offset -#define DW_OP_breg27 0x8B // base register 27 + SLEB128 offset -#define DW_OP_breg28 0x8C // base register 28 + SLEB128 offset -#define DW_OP_breg29 0x8D // base register 29 + SLEB128 offset -#define DW_OP_breg30 0x8E // base register 30 + SLEB128 offset -#define DW_OP_breg31 0x8F // base register 31 + SLEB128 offset -#define DW_OP_regx 0x90 // ULEB128 register -#define DW_OP_fbreg 0x91 // SLEB128 offset -#define DW_OP_bregx 0x92 // ULEB128 register followed by SLEB128 offset -#define DW_OP_piece 0x93 // ULEB128 size of piece addressed -#define DW_OP_deref_size 0x94 // 1-byte size of data retrieved -#define DW_OP_xderef_size 0x95 // 1-byte size of data retrieved -#define DW_OP_nop 0x96 -#define DW_OP_push_object_address 0x97 -#define DW_OP_call2 0x98 // 2-byte offset of DIE -#define DW_OP_call4 0x99 // 4-byte offset of DIE -#define DW_OP_call_ref 0x9A // 4- or 8-byte offset of DIE -#define DW_OP_lo_user 0xE0 #define DW_OP_APPLE_array_ref 0xEE // first pops index, then pops array; pushes array[index] #define DW_OP_APPLE_extern 0xEF // ULEB128 index of external object (i.e., an entity from the program that was used in the expression) #define DW_OP_APPLE_uninit 0xF0 @@ -412,179 +60,6 @@ #define DW_OP_APPLE_clang_cast 0xF8 // pointer size clang::Type * off the stack and cast top stack item to this type #define DW_OP_APPLE_clear 0xFE // clears the entire expression stack, ok if the stack is empty #define DW_OP_APPLE_error 0xFF // Stops expression evaluation and returns an error (no args) -#define DW_OP_hi_user 0xFF - -/* [7.8] Figure 23 "Base type encoding values" (pp. 140-141) in DWARFv3 draft 8 */ - -#define DW_ATE_address 0x1 -#define DW_ATE_boolean 0x2 -#define DW_ATE_complex_float 0x3 -#define DW_ATE_float 0x4 -#define DW_ATE_signed 0x5 -#define DW_ATE_signed_char 0x6 -#define DW_ATE_unsigned 0x7 -#define DW_ATE_unsigned_char 0x8 -#define DW_ATE_imaginary_float 0x9 -#define DW_ATE_lo_user 0x80 -#define DW_ATE_hi_user 0xFF - -/* [7.9] Figure 24 "Accessibility encodings" (p. 141) in DWARFv3 draft 8 */ - -#define DW_ACCESS_public 0x1 -#define DW_ACCESS_protected 0x2 -#define DW_ACCESS_private 0x3 - -/* [7.10] Figure 25 "Visibility encodings" (p. 142) in DWARFv3 draft 8 */ - -#define DW_VIS_local 0x1 -#define DW_VIS_exported 0x2 -#define DW_VIS_qualified 0x3 - -/* [7.11] Figure 26 "Virtuality encodings" (p. 142) in DWARFv3 draft 8 */ - -#define DW_VIRTUALITY_none 0x0 -#define DW_VIRTUALITY_virtual 0x1 -#define DW_VIRTUALITY_pure_virtual 0x2 - - -/* [7.12] Figure 27 "Language encodings" (p. 143) in DWARFv3 draft 8 */ - -#define DW_LANG_C89 0x1 -#define DW_LANG_C 0x2 -#define DW_LANG_Ada83 0x3 -#define DW_LANG_C_plus_plus 0x4 -#define DW_LANG_Cobol74 0x5 -#define DW_LANG_Cobol85 0x6 -#define DW_LANG_Fortran77 0x7 -#define DW_LANG_Fortran90 0x8 -#define DW_LANG_Pascal83 0x9 -#define DW_LANG_Modula2 0xA -#define DW_LANG_Java 0xB -#define DW_LANG_C99 0xC -#define DW_LANG_Ada95 0xD -#define DW_LANG_Fortran95 0xE -#define DW_LANG_PLI 0xF -#define DW_LANG_lo_user 0x8000 -#define DW_LANG_hi_user 0xFFFF -#define DW_LANG_MIPS_Assembler 0x8001 - -/* [7.13], "Address Class Encodings" (p. 144) in DWARFv3 draft 8 */ - -#define DW_ADDR_none 0x0 - -/* [7.14] Figure 28 "Identifier case encodings" (p. 144) in DWARFv3 draft 8 */ - -#define DW_ID_case_sensitive 0x0 -#define DW_ID_up_case 0x1 -#define DW_ID_down_case 0x2 -#define DW_ID_case_insensitive 0x3 - -/* [7.15] Figure 29 "Calling convention encodings" (p. 144) in DWARFv3 draft 8 */ - -#define DW_CC_normal 0x1 -#define DW_CC_program 0x2 -#define DW_CC_nocall 0x3 -#define DW_CC_lo_user 0x40 -#define DW_CC_hi_user 0xFF - -/* [7.16] Figure 30 "Inline encodings" (p. 145) in DWARFv3 draft 8 */ - -#define DW_INL_not_inlined 0x0 -#define DW_INL_inlined 0x1 -#define DW_INL_declared_not_inlined 0x2 -#define DW_INL_declared_inlined 0x3 - -/* [7.17] Figure 31 "Ordering encodings" (p. 145) in DWARFv3 draft 8 */ - -#define DW_ORD_row_major 0x0 -#define DW_ORD_col_major 0x1 - -/* [7.18] Figure 32 "Discriminant descriptor encodings" (p. 146) in DWARFv3 draft 8 */ - -#define DW_DSC_label 0x0 -#define DW_DSC_range 0x1 - -/* [7.21] Figure 33 "Line Number Standard Opcode Encodings" (pp. 148-149) in DWARFv3 draft 8 */ - -#define DW_LNS_copy 0x1 -#define DW_LNS_advance_pc 0x2 -#define DW_LNS_advance_line 0x3 -#define DW_LNS_set_file 0x4 -#define DW_LNS_set_column 0x5 -#define DW_LNS_negate_stmt 0x6 -#define DW_LNS_set_basic_block 0x7 -#define DW_LNS_const_add_pc 0x8 -#define DW_LNS_fixed_advance_pc 0x9 -#define DW_LNS_set_prologue_end 0xA -#define DW_LNS_set_epilogue_begin 0xB -#define DW_LNS_set_isa 0xC - -/* [7.21] Figure 34 "Line Number Extended Opcode Encodings" (p. 149) in DWARFv3 draft 8 */ - -#define DW_LNE_end_sequence 0x1 -#define DW_LNE_set_address 0x2 -#define DW_LNE_define_file 0x3 -#define DW_LNE_lo_user 0x80 -#define DW_LNE_hi_user 0xFF - -/* [7.22] Figure 35 "Macinfo Type Encodings" (p. 150) in DWARFv3 draft 8 */ - -#define DW_MACINFO_define 0x1 -#define DW_MACINFO_undef 0x2 -#define DW_MACINFO_start_file 0x3 -#define DW_MACINFO_end_file 0x4 -#define DW_MACINFO_vendor_ext 0xFF - -/* [7.23] Figure 36 "Call frame instruction encodings" (pp. 151-152) in DWARFv3 draft 8 */ - -#define DW_CFA_advance_loc 0x40 // high 2 bits are 0x1, lower 6 bits are delta -#define DW_CFA_offset 0x80 // high 2 bits are 0x2, lower 6 bits are register -#define DW_CFA_restore 0xC0 // high 2 bits are 0x3, lower 6 bits are register -#define DW_CFA_nop 0x0 -#define DW_CFA_set_loc 0x1 -#define DW_CFA_advance_loc1 0x2 -#define DW_CFA_advance_loc2 0x3 -#define DW_CFA_advance_loc4 0x4 -#define DW_CFA_offset_extended 0x5 -#define DW_CFA_restore_extended 0x6 -#define DW_CFA_undefined 0x7 -#define DW_CFA_same_value 0x8 -#define DW_CFA_register 0x9 -#define DW_CFA_remember_state 0xA -#define DW_CFA_restore_state 0xB -#define DW_CFA_def_cfa 0xC -#define DW_CFA_def_cfa_register 0xD -#define DW_CFA_def_cfa_offset 0xE -#define DW_CFA_def_cfa_expression 0xF -#define DW_CFA_expression 0x10 -#define DW_CFA_offset_extended_sf 0x11 -#define DW_CFA_def_cfa_sf 0x12 -#define DW_CFA_def_cfa_offset_sf 0x13 -#define DW_CFA_val_offset 0x14 -#define DW_CFA_val_offset_sf 0x15 -#define DW_CFA_val_expression 0x16 -#define DW_CFA_lo_user 0x1C -#define DW_CFA_hi_user 0x3F - -/* FSF exception handling Pointer-Encoding constants (CFI augmentation) -- "DW_EH_PE_..." in the FSF sources */ -#define DW_GNU_EH_PE_absptr 0x0 -#define DW_GNU_EH_PE_uleb128 0x1 -#define DW_GNU_EH_PE_udata2 0x2 -#define DW_GNU_EH_PE_udata4 0x3 -#define DW_GNU_EH_PE_udata8 0x4 -#define DW_GNU_EH_PE_sleb128 0x9 -#define DW_GNU_EH_PE_sdata2 0xA -#define DW_GNU_EH_PE_sdata4 0xB -#define DW_GNU_EH_PE_sdata8 0xC -#define DW_GNU_EH_PE_signed 0x8 -#define DW_GNU_EH_PE_MASK_ENCODING 0x0F -#define DW_GNU_EH_PE_pcrel 0x10 -#define DW_GNU_EH_PE_textrel 0x20 -#define DW_GNU_EH_PE_datarel 0x30 -#define DW_GNU_EH_PE_funcrel 0x40 -#define DW_GNU_EH_PE_aligned 0x50 -#define DW_GNU_EH_PE_indirect 0x80 -#define DW_GNU_EH_PE_omit 0xFF #endif // DebugBase_dwarf_h_ Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jul 6 17:38:03 2010 @@ -231,7 +231,7 @@ 26D5B11111B07550009A862E /* DWARFDebugPubnames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89C910F57C5600BB2B04 /* DWARFDebugPubnames.cpp */; }; 26D5B11211B07550009A862E /* DWARFDebugPubnamesSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89CB10F57C5600BB2B04 /* DWARFDebugPubnamesSet.cpp */; }; 26D5B11311B07550009A862E /* DWARFDebugRanges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89CD10F57C5600BB2B04 /* DWARFDebugRanges.cpp */; }; - 26D5B11411B07550009A862E /* DWARFDefines.c in Sources */ = {isa = PBXBuildFile; fileRef = 260C89CF10F57C5600BB2B04 /* DWARFDefines.c */; }; + 26D5B11411B07550009A862E /* DWARFDefines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89CF10F57C5600BB2B04 /* DWARFDefines.cpp */; }; 26D5B11511B07550009A862E /* DWARFDIECollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89D110F57C5600BB2B04 /* DWARFDIECollection.cpp */; }; 26D5B11611B07550009A862E /* DWARFFormValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89D310F57C5600BB2B04 /* DWARFFormValue.cpp */; }; 26D5B11711B07550009A862E /* DWARFLocationDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89D510F57C5600BB2B04 /* DWARFLocationDescription.cpp */; }; @@ -479,7 +479,7 @@ 260C89CC10F57C5600BB2B04 /* DWARFDebugPubnamesSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFDebugPubnamesSet.h; sourceTree = ""; }; 260C89CD10F57C5600BB2B04 /* DWARFDebugRanges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFDebugRanges.cpp; sourceTree = ""; }; 260C89CE10F57C5600BB2B04 /* DWARFDebugRanges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFDebugRanges.h; sourceTree = ""; }; - 260C89CF10F57C5600BB2B04 /* DWARFDefines.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DWARFDefines.c; sourceTree = ""; }; + 260C89CF10F57C5600BB2B04 /* DWARFDefines.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = DWARFDefines.cpp; sourceTree = ""; }; 260C89D010F57C5600BB2B04 /* DWARFDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFDefines.h; sourceTree = ""; }; 260C89D110F57C5600BB2B04 /* DWARFDIECollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFDIECollection.cpp; sourceTree = ""; }; 260C89D210F57C5600BB2B04 /* DWARFDIECollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFDIECollection.h; sourceTree = ""; }; @@ -1328,7 +1328,7 @@ 260C89CC10F57C5600BB2B04 /* DWARFDebugPubnamesSet.h */, 260C89CD10F57C5600BB2B04 /* DWARFDebugRanges.cpp */, 260C89CE10F57C5600BB2B04 /* DWARFDebugRanges.h */, - 260C89CF10F57C5600BB2B04 /* DWARFDefines.c */, + 260C89CF10F57C5600BB2B04 /* DWARFDefines.cpp */, 260C89D010F57C5600BB2B04 /* DWARFDefines.h */, 260C89D110F57C5600BB2B04 /* DWARFDIECollection.cpp */, 260C89D210F57C5600BB2B04 /* DWARFDIECollection.h */, @@ -2535,7 +2535,7 @@ 26D5B11111B07550009A862E /* DWARFDebugPubnames.cpp in Sources */, 26D5B11211B07550009A862E /* DWARFDebugPubnamesSet.cpp in Sources */, 26D5B11311B07550009A862E /* DWARFDebugRanges.cpp in Sources */, - 26D5B11411B07550009A862E /* DWARFDefines.c in Sources */, + 26D5B11411B07550009A862E /* DWARFDefines.cpp in Sources */, 26D5B11511B07550009A862E /* DWARFDIECollection.cpp in Sources */, 26D5B11611B07550009A862E /* DWARFFormValue.cpp in Sources */, 26D5B11711B07550009A862E /* DWARFLocationDescription.cpp in Sources */, Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Tue Jul 6 17:38:03 2010 @@ -836,7 +836,7 @@ uint64_t DataExtractor::GetGNUEHPointer (uint32_t *offset_ptr, uint32_t eh_ptr_enc, lldb::addr_t pc_rel_addr, lldb::addr_t text_addr, lldb::addr_t data_addr)//, BSDRelocs *data_relocs) const { - if (eh_ptr_enc == DW_GNU_EH_PE_omit) + if (eh_ptr_enc == DW_EH_PE_omit) return ULONG_LONG_MAX; // Value isn't in the buffer... uint64_t baseAddress = 0; @@ -847,7 +847,7 @@ // Decode the base part or adjust our offset switch (eh_ptr_enc & 0x70) { - case DW_GNU_EH_PE_pcrel: + case DW_EH_PE_pcrel: signExtendValue = true; baseAddress = *offset_ptr; if (pc_rel_addr != LLDB_INVALID_ADDRESS) @@ -856,7 +856,7 @@ // Log::GlobalWarning ("PC relative pointer encoding found with invalid pc relative address."); break; - case DW_GNU_EH_PE_textrel: + case DW_EH_PE_textrel: signExtendValue = true; if (text_addr != LLDB_INVALID_ADDRESS) baseAddress = text_addr; @@ -864,7 +864,7 @@ // Log::GlobalWarning ("text relative pointer encoding being decoded with invalid text section address, setting base address to zero."); break; - case DW_GNU_EH_PE_datarel: + case DW_EH_PE_datarel: signExtendValue = true; if (data_addr != LLDB_INVALID_ADDRESS) baseAddress = data_addr; @@ -872,11 +872,11 @@ // Log::GlobalWarning ("data relative pointer encoding being decoded with invalid data section address, setting base address to zero."); break; - case DW_GNU_EH_PE_funcrel: + case DW_EH_PE_funcrel: signExtendValue = true; break; - case DW_GNU_EH_PE_aligned: + case DW_EH_PE_aligned: { // SetPointerSize should be called prior to extracting these so the // pointer size is cached @@ -896,23 +896,23 @@ } // Decode the value part - switch (eh_ptr_enc & DW_GNU_EH_PE_MASK_ENCODING) + switch (eh_ptr_enc & DW_EH_PE_MASK_ENCODING) { - case DW_GNU_EH_PE_absptr : + case DW_EH_PE_absptr : { addressValue = GetAddress (offset_ptr); // if (data_relocs) // addressValue = data_relocs->Relocate(*offset_ptr - addr_size, *this, addressValue); } break; - case DW_GNU_EH_PE_uleb128 : addressValue = GetULEB128(offset_ptr); break; - case DW_GNU_EH_PE_udata2 : addressValue = GetU16(offset_ptr); break; - case DW_GNU_EH_PE_udata4 : addressValue = GetU32(offset_ptr); break; - case DW_GNU_EH_PE_udata8 : addressValue = GetU64(offset_ptr); break; - case DW_GNU_EH_PE_sleb128 : addressValue = GetSLEB128(offset_ptr); break; - case DW_GNU_EH_PE_sdata2 : addressValue = (int16_t)GetU16(offset_ptr); break; - case DW_GNU_EH_PE_sdata4 : addressValue = (int32_t)GetU32(offset_ptr); break; - case DW_GNU_EH_PE_sdata8 : addressValue = (int64_t)GetU64(offset_ptr); break; + case DW_EH_PE_uleb128 : addressValue = GetULEB128(offset_ptr); break; + case DW_EH_PE_udata2 : addressValue = GetU16(offset_ptr); break; + case DW_EH_PE_udata4 : addressValue = GetU32(offset_ptr); break; + case DW_EH_PE_udata8 : addressValue = GetU64(offset_ptr); break; + case DW_EH_PE_sleb128 : addressValue = GetSLEB128(offset_ptr); break; + case DW_EH_PE_sdata2 : addressValue = (int16_t)GetU16(offset_ptr); break; + case DW_EH_PE_sdata4 : addressValue = (int32_t)GetU32(offset_ptr); break; + case DW_EH_PE_sdata8 : addressValue = (int64_t)GetU64(offset_ptr); break; default: // Unhandled encoding type assert(eh_ptr_enc); Modified: lldb/trunk/source/Core/ValueObjectChild.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp (original) +++ lldb/trunk/source/Core/ValueObjectChild.cpp Tue Jul 6 17:38:03 2010 @@ -9,7 +9,6 @@ #include "lldb/Core/ValueObjectChild.h" -#include "lldb/Core/dwarf.h" #include "lldb/Core/Module.h" #include "lldb/Core/ValueObjectList.h" Modified: lldb/trunk/source/Expression/ClangExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpression.cpp?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangExpression.cpp Tue Jul 6 17:38:03 2010 @@ -67,7 +67,6 @@ #include "lldb/Core/StreamString.h" #include "lldb/Host/Mutex.h" -#include "lldb/Core/dwarf.h" using namespace lldb_private; Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Jul 6 17:38:03 2010 @@ -572,7 +572,7 @@ if (symtab_load_command.cmd == LC_SYMTAB) { // Read in the rest of the symtab load command - if (m_data.GetU32(&offset, &symtab_load_command.symoff, 4)) + if (m_data.GetU32(&offset, &symtab_load_command.symoff, 4)) // fill in symoff, nsyms, stroff, strsize fields { Symtab *symtab = m_symtab_ap.get(); SectionList *section_list = GetSectionList(); @@ -673,7 +673,7 @@ type = eSymbolTypeFunction; break; - case N_FUN: // procedure: name,,n_sect,linenumber,address + case N_FUN: // procedure: name,,n_sect,linenumber,address if (symbol_name) { type = eSymbolTypeFunction; @@ -692,7 +692,7 @@ // to hunt for it later symtab->SymbolAtIndex(N_FUN_indexes.back())->SetByteSize(nlist.n_value); N_FUN_indexes.pop_back(); - // We dont' really need the end function STAB as it contains the size which + // We don't really need the end function STAB as it contains the size which // we already placed with the original symbol, so don't add it if we want a // minimal symbol table if (minimize) Removed: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c?rev=107715&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c (removed) @@ -1,2224 +0,0 @@ -//===-- DWARFDefines.c ------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "DWARFDefines.h" -#include - -#define DW_TAG_PREFIX "TAG_" -#define DW_AT_PREFIX " AT_" -#define DW_FORM_PREFIX "FORM_" - -/* [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ - -const char * -DW_TAG_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0000: return DW_TAG_PREFIX "NULL"; - case 0x0001: return DW_TAG_PREFIX "array_type"; - case 0x0002: return DW_TAG_PREFIX "class_type"; - case 0x0003: return DW_TAG_PREFIX "entry_point"; - case 0x0004: return DW_TAG_PREFIX "enumeration_type"; - case 0x0005: return DW_TAG_PREFIX "formal_parameter"; - case 0x0008: return DW_TAG_PREFIX "imported_declaration"; - case 0x000a: return DW_TAG_PREFIX "label"; - case 0x000b: return DW_TAG_PREFIX "lexical_block"; - case 0x000d: return DW_TAG_PREFIX "member"; - case 0x000f: return DW_TAG_PREFIX "pointer_type"; - case 0x0010: return DW_TAG_PREFIX "reference_type"; - case 0x0011: return DW_TAG_PREFIX "compile_unit"; - case 0x0012: return DW_TAG_PREFIX "string_type"; - case 0x0013: return DW_TAG_PREFIX "structure_type"; - case 0x0015: return DW_TAG_PREFIX "subroutine_type"; - case 0x0016: return DW_TAG_PREFIX "typedef"; - case 0x0017: return DW_TAG_PREFIX "union_type"; - case 0x0018: return DW_TAG_PREFIX "unspecified_parameters"; - case 0x0019: return DW_TAG_PREFIX "variant"; - case 0x001a: return DW_TAG_PREFIX "common_block"; - case 0x001b: return DW_TAG_PREFIX "common_inclusion"; - case 0x001c: return DW_TAG_PREFIX "inheritance"; - case 0x001d: return DW_TAG_PREFIX "inlined_subroutine"; - case 0x001e: return DW_TAG_PREFIX "module"; - case 0x001f: return DW_TAG_PREFIX "ptr_to_member_type"; - case 0x0020: return DW_TAG_PREFIX "set_type"; - case 0x0021: return DW_TAG_PREFIX "subrange_type"; - case 0x0022: return DW_TAG_PREFIX "with_stmt"; - case 0x0023: return DW_TAG_PREFIX "access_declaration"; - case 0x0024: return DW_TAG_PREFIX "base_type"; - case 0x0025: return DW_TAG_PREFIX "catch_block"; - case 0x0026: return DW_TAG_PREFIX "const_type"; - case 0x0027: return DW_TAG_PREFIX "constant"; - case 0x0028: return DW_TAG_PREFIX "enumerator"; - case 0x0029: return DW_TAG_PREFIX "file_type"; - case 0x002a: return DW_TAG_PREFIX "friend"; - case 0x002b: return DW_TAG_PREFIX "namelist"; - case 0x002c: return DW_TAG_PREFIX "namelist_item"; - case 0x002d: return DW_TAG_PREFIX "packed_type"; - case 0x002e: return DW_TAG_PREFIX "subprogram"; - case 0x002f: return DW_TAG_PREFIX "template_type_parameter"; - case 0x0030: return DW_TAG_PREFIX "template_value_parameter"; - case 0x0031: return DW_TAG_PREFIX "thrown_type"; - case 0x0032: return DW_TAG_PREFIX "try_block"; - case 0x0033: return DW_TAG_PREFIX "variant_part"; - case 0x0034: return DW_TAG_PREFIX "variable"; - case 0x0035: return DW_TAG_PREFIX "volatile_type"; - case 0x0036: return DW_TAG_PREFIX "dwarf_procedure"; - case 0x0037: return DW_TAG_PREFIX "restrict_type"; - case 0x0038: return DW_TAG_PREFIX "interface_type"; - case 0x0039: return DW_TAG_PREFIX "namespace"; - case 0x003a: return DW_TAG_PREFIX "imported_module"; - case 0x003b: return DW_TAG_PREFIX "unspecified_type"; - case 0x003c: return DW_TAG_PREFIX "partial_unit"; - case 0x003d: return DW_TAG_PREFIX "imported_unit"; -// case 0x003d: return DW_TAG_PREFIX "condition"; - case 0x0040: return DW_TAG_PREFIX "shared_type"; - case 0x4080: return DW_TAG_PREFIX "lo_user"; - case 0xffff: return DW_TAG_PREFIX "hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_TAG constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_TAG_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0001: return "array type"; - case 0x0002: return "class type"; - case 0x0003: return "entry point"; - case 0x0004: return "enumeration type"; - case 0x0005: return "formal parameter"; - case 0x0008: return "imported declaration"; - case 0x000a: return "label"; - case 0x000b: return "lexical block"; - case 0x000d: return "member"; - case 0x000f: return "pointer type"; - case 0x0010: return "reference type"; - case 0x0011: return "file"; - case 0x0012: return "string type"; - case 0x0013: return "structure type"; - case 0x0015: return "subroutine type"; - case 0x0016: return "typedef"; - case 0x0017: return "union type"; - case 0x0018: return "unspecified parameters"; - case 0x0019: return "variant"; - case 0x001a: return "common block"; - case 0x001b: return "common inclusion"; - case 0x001c: return "inheritance"; - case 0x001d: return "inlined subroutine"; - case 0x001e: return "module"; - case 0x001f: return "ptr to member type"; - case 0x0020: return "set type"; - case 0x0021: return "subrange type"; - case 0x0022: return "with stmt"; - case 0x0023: return "access declaration"; - case 0x0024: return "base type"; - case 0x0025: return "catch block"; - case 0x0026: return "const type"; - case 0x0027: return "constant"; - case 0x0028: return "enumerator"; - case 0x0029: return "file type"; - case 0x002a: return "friend"; - case 0x002b: return "namelist"; - case 0x002c: return "namelist item"; - case 0x002d: return "packed type"; - case 0x002e: return "function"; - case 0x002f: return "template type parameter"; - case 0x0030: return "template value parameter"; - case 0x0031: return "thrown type"; - case 0x0032: return "try block"; - case 0x0033: return "variant part"; - case 0x0034: return "variable"; - case 0x0035: return "volatile type"; - case 0x0036: return "dwarf procedure"; - case 0x0037: return "restrict type"; - case 0x0038: return "interface type"; - case 0x0039: return "namespace"; - case 0x003a: return "imported module"; - case 0x003b: return "unspecified type"; - case 0x003c: return "partial unit"; - case 0x003d: return "imported unit"; -// case 0x003d: return "condition"; - case 0x0040: return "shared type"; - case 0x4080: return "lo user"; - case 0xffff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_TAG constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_TAG_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0001: return 0; - case 0x0002: return 0; - case 0x0003: return 0; - case 0x0004: return 0; - case 0x0005: return 0; - case 0x0008: return 0; - case 0x000a: return 0; - case 0x000b: return 0; - case 0x000d: return 0; - case 0x000f: return 0; - case 0x0010: return 0; - case 0x0011: return 0; - case 0x0012: return 0; - case 0x0013: return 0; - case 0x0015: return 0; - case 0x0016: return 0; - case 0x0017: return 0; - case 0x0018: return 0; - case 0x0019: return 0; - case 0x001a: return 0; - case 0x001b: return 0; - case 0x001c: return 0; - case 0x001d: return 0; - case 0x001e: return 0; - case 0x001f: return 0; - case 0x0020: return 0; - case 0x0021: return 0; - case 0x0022: return 0; - case 0x0023: return 0; - case 0x0024: return 0; - case 0x0025: return 0; - case 0x0026: return 0; - case 0x0027: return 0; - case 0x0028: return 0; - case 0x0029: return 0; - case 0x002a: return 0; - case 0x002b: return 0; - case 0x002c: return 0; - case 0x002d: return 0; - case 0x002e: return 0; - case 0x002f: return 0; - case 0x0030: return 0; - case 0x0031: return 0; - case 0x0032: return 0; - case 0x0033: return 0; - case 0x0034: return 0; - case 0x0035: return 0; - case 0x0036: return DRC_DWARFv3; - case 0x0037: return DRC_DWARFv3; - case 0x0038: return DRC_DWARFv3; - case 0x0039: return DRC_DWARFv3; - case 0x003a: return DRC_DWARFv3; - case 0x003b: return DRC_DWARFv3; - case 0x003c: return DRC_DWARFv3; - case 0x003d: return DRC_DWARFv3; -// case 0x003d: return DRC_DWARFv3; - case 0x0040: return DRC_DWARFv3; - case 0x4080: return 0; - case 0xffff: return 0; - default: return 0; - } -} - -/* [7.5.4] Figure 17 "Child determination encodings" (p. 128) in DWARFv3 draft 8 */ - -const char * -DW_CHILDREN_value_to_name (uint8_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_CHILDREN_no"; - case 0x1: return "DW_CHILDREN_yes"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CHILDREN constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_CHILDREN_value_to_englishy_name (uint8_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "no"; - case 0x1: return "yes"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CHILDREN constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_CHILDREN_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - default: return 0; - } -} - -/* [7.5.4] Figure 18 "Attribute encodings" (pp. 129-132) in DWARFv3 draft 8 */ - -const char * -DW_AT_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0001: return DW_AT_PREFIX "sibling"; - case 0x0002: return DW_AT_PREFIX "location"; - case 0x0003: return DW_AT_PREFIX "name"; - case 0x0009: return DW_AT_PREFIX "ordering"; - case 0x000b: return DW_AT_PREFIX "byte_size"; - case 0x000c: return DW_AT_PREFIX "bit_offset"; - case 0x000d: return DW_AT_PREFIX "bit_size"; - case 0x0010: return DW_AT_PREFIX "stmt_list"; - case 0x0011: return DW_AT_PREFIX "low_pc"; - case 0x0012: return DW_AT_PREFIX "high_pc"; - case 0x0013: return DW_AT_PREFIX "language"; - case 0x0015: return DW_AT_PREFIX "discr"; - case 0x0016: return DW_AT_PREFIX "discr_value"; - case 0x0017: return DW_AT_PREFIX "visibility"; - case 0x0018: return DW_AT_PREFIX "import"; - case 0x0019: return DW_AT_PREFIX "string_length"; - case 0x001a: return DW_AT_PREFIX "common_reference"; - case 0x001b: return DW_AT_PREFIX "comp_dir"; - case 0x001c: return DW_AT_PREFIX "const_value"; - case 0x001d: return DW_AT_PREFIX "containing_type"; - case 0x001e: return DW_AT_PREFIX "default_value"; - case 0x0020: return DW_AT_PREFIX "inline"; - case 0x0021: return DW_AT_PREFIX "is_optional"; - case 0x0022: return DW_AT_PREFIX "lower_bound"; - case 0x0025: return DW_AT_PREFIX "producer"; - case 0x0027: return DW_AT_PREFIX "prototyped"; - case 0x002a: return DW_AT_PREFIX "return_addr"; - case 0x002c: return DW_AT_PREFIX "start_scope"; - case 0x002e: return DW_AT_PREFIX "bit_stride"; - case 0x002f: return DW_AT_PREFIX "upper_bound"; - case 0x0031: return DW_AT_PREFIX "abstract_origin"; - case 0x0032: return DW_AT_PREFIX "accessibility"; - case 0x0033: return DW_AT_PREFIX "address_class"; - case 0x0034: return DW_AT_PREFIX "artificial"; - case 0x0035: return DW_AT_PREFIX "base_types"; - case 0x0036: return DW_AT_PREFIX "calling_convention"; - case 0x0037: return DW_AT_PREFIX "count"; - case 0x0038: return DW_AT_PREFIX "data_member_location"; - case 0x0039: return DW_AT_PREFIX "decl_column"; - case 0x003a: return DW_AT_PREFIX "decl_file"; - case 0x003b: return DW_AT_PREFIX "decl_line"; - case 0x003c: return DW_AT_PREFIX "declaration"; - case 0x003d: return DW_AT_PREFIX "discr_list"; - case 0x003e: return DW_AT_PREFIX "encoding"; - case 0x003f: return DW_AT_PREFIX "external"; - case 0x0040: return DW_AT_PREFIX "frame_base"; - case 0x0041: return DW_AT_PREFIX "friend"; - case 0x0042: return DW_AT_PREFIX "identifier_case"; - case 0x0043: return DW_AT_PREFIX "macro_info"; - case 0x0044: return DW_AT_PREFIX "namelist_item"; - case 0x0045: return DW_AT_PREFIX "priority"; - case 0x0046: return DW_AT_PREFIX "segment"; - case 0x0047: return DW_AT_PREFIX "specification"; - case 0x0048: return DW_AT_PREFIX "static_link"; - case 0x0049: return DW_AT_PREFIX "type"; - case 0x004a: return DW_AT_PREFIX "use_location"; - case 0x004b: return DW_AT_PREFIX "variable_parameter"; - case 0x004c: return DW_AT_PREFIX "virtuality"; - case 0x004d: return DW_AT_PREFIX "vtable_elem_location"; - case 0x004e: return DW_AT_PREFIX "allocated"; - case 0x004f: return DW_AT_PREFIX "associated"; - case 0x0050: return DW_AT_PREFIX "data_location"; - case 0x0051: return DW_AT_PREFIX "byte_stride"; - case 0x0052: return DW_AT_PREFIX "entry_pc"; - case 0x0053: return DW_AT_PREFIX "use_UTF8"; - case 0x0054: return DW_AT_PREFIX "extension"; - case 0x0055: return DW_AT_PREFIX "ranges"; - case 0x0056: return DW_AT_PREFIX "trampoline"; - case 0x0057: return DW_AT_PREFIX "call_column"; - case 0x0058: return DW_AT_PREFIX "call_file"; - case 0x0059: return DW_AT_PREFIX "call_line"; - case 0x005a: return DW_AT_PREFIX "description"; - case 0x005b: return DW_AT_PREFIX "binary_scale"; - case 0x005c: return DW_AT_PREFIX "decimal_scale"; - case 0x005d: return DW_AT_PREFIX "small"; - case 0x005e: return DW_AT_PREFIX "decimal_sign"; - case 0x005f: return DW_AT_PREFIX "digit_count"; - case 0x0060: return DW_AT_PREFIX "picture_string"; - case 0x0061: return DW_AT_PREFIX "mutable"; - case 0x0062: return DW_AT_PREFIX "threads_scaled"; - case 0x0063: return DW_AT_PREFIX "explicit"; - case 0x0064: return DW_AT_PREFIX "object_pointer"; - case 0x0065: return DW_AT_PREFIX "endianity"; - case 0x0066: return DW_AT_PREFIX "elemental"; - case 0x0067: return DW_AT_PREFIX "pure"; - case 0x0068: return DW_AT_PREFIX "recursive"; - case 0x2000: return DW_AT_PREFIX "lo_user"; - case 0x3fff: return DW_AT_PREFIX "hi_user"; - case 0x2001: return DW_AT_PREFIX "MIPS_fde"; - case 0x2002: return DW_AT_PREFIX "MIPS_loop_begin"; - case 0x2003: return DW_AT_PREFIX "MIPS_tail_loop_begin"; - case 0x2004: return DW_AT_PREFIX "MIPS_epilog_begin"; - case 0x2005: return DW_AT_PREFIX "MIPS_loop_unroll_factor"; - case 0x2006: return DW_AT_PREFIX "MIPS_software_pipeline_depth"; - case 0x2007: return DW_AT_PREFIX "MIPS_linkage_name"; - case 0x2008: return DW_AT_PREFIX "MIPS_stride"; - case 0x2009: return DW_AT_PREFIX "MIPS_abstract_name"; - case 0x200a: return DW_AT_PREFIX "MIPS_clone_origin"; - case 0x200b: return DW_AT_PREFIX "MIPS_has_inlines"; - case 0x2101: return DW_AT_PREFIX "sf_names"; - case 0x2102: return DW_AT_PREFIX "src_info"; - case 0x2103: return DW_AT_PREFIX "mac_info"; - case 0x2104: return DW_AT_PREFIX "src_coords"; - case 0x2105: return DW_AT_PREFIX "body_begin"; - case 0x2106: return DW_AT_PREFIX "body_end"; - case 0x2107: return DW_AT_PREFIX "GNU_vector"; - case 0x2501: return DW_AT_PREFIX "APPLE_repository_file"; - case 0x2502: return DW_AT_PREFIX "APPLE_repository_type"; - case 0x2503: return DW_AT_PREFIX "APPLE_repository_name"; - case 0x2504: return DW_AT_PREFIX "APPLE_repository_specification"; - case 0x2505: return DW_AT_PREFIX "APPLE_repository_import"; - case 0x2506: return DW_AT_PREFIX "APPLE_repository_abstract_origin"; - case DW_AT_APPLE_flags: return DW_AT_PREFIX "APPLE_flags"; - case DW_AT_APPLE_optimized: return DW_AT_PREFIX "APPLE_optimized"; - case DW_AT_APPLE_isa: return DW_AT_PREFIX "APPLE_isa"; - case DW_AT_APPLE_block: return DW_AT_PREFIX "APPLE_block"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_AT constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_AT_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0001: return "sibling"; - case 0x0002: return "location"; - case 0x0003: return "name"; - case 0x0009: return "ordering"; - case 0x000b: return "byte size"; - case 0x000c: return "bit offset"; - case 0x000d: return "bit size"; - case 0x0010: return "stmt list"; - case 0x0011: return "low pc"; - case 0x0012: return "high pc"; - case 0x0013: return "language"; - case 0x0015: return "discr"; - case 0x0016: return "discr value"; - case 0x0017: return "visibility"; - case 0x0018: return "import"; - case 0x0019: return "string length"; - case 0x001a: return "common reference"; - case 0x001b: return "comp dir"; - case 0x001c: return "const value"; - case 0x001d: return "containing type"; - case 0x001e: return "default value"; - case 0x0020: return "inline"; - case 0x0021: return "is optional"; - case 0x0022: return "lower bound"; - case 0x0025: return "producer"; - case 0x0027: return "prototyped"; - case 0x002a: return "return addr"; - case 0x002c: return "start scope"; - case 0x002e: return "bit stride"; - case 0x002f: return "upper bound"; - case 0x0031: return "abstract origin"; - case 0x0032: return "accessibility"; - case 0x0033: return "address class"; - case 0x0034: return "artificial"; - case 0x0035: return "base types"; - case 0x0036: return "calling convention"; - case 0x0037: return "count"; - case 0x0038: return "data member location"; - case 0x0039: return "decl column"; - case 0x003a: return "decl file"; - case 0x003b: return "decl line"; - case 0x003c: return "declaration"; - case 0x003d: return "discr list"; - case 0x003e: return "encoding"; - case 0x003f: return "external"; - case 0x0040: return "frame base"; - case 0x0041: return "friend"; - case 0x0042: return "identifier case"; - case 0x0043: return "macro info"; - case 0x0044: return "namelist item"; - case 0x0045: return "priority"; - case 0x0046: return "segment"; - case 0x0047: return "specification"; - case 0x0048: return "static link"; - case 0x0049: return "type"; - case 0x004a: return "use location"; - case 0x004b: return "variable parameter"; - case 0x004c: return "virtuality"; - case 0x004d: return "vtable elem location"; - case 0x004e: return "allocated"; - case 0x004f: return "associated"; - case 0x0050: return "data location"; - case 0x0051: return "byte stride"; - case 0x0052: return "entry pc"; - case 0x0053: return "use UTF8"; - case 0x0054: return "extension"; - case 0x0055: return "ranges"; - case 0x0056: return "trampoline"; - case 0x0057: return "call column"; - case 0x0058: return "call file"; - case 0x0059: return "call line"; - case 0x005a: return "description"; - case 0x005b: return "binary scale"; - case 0x005c: return "decimal scale"; - case 0x005d: return "small"; - case 0x005e: return "decimal sign"; - case 0x005f: return "digit count"; - case 0x0060: return "picture string"; - case 0x0061: return "mutable"; - case 0x0062: return "threads scaled"; - case 0x0063: return "explicit"; - case 0x0064: return "object pointer"; - case 0x0065: return "endianity"; - case 0x0066: return "elemental"; - case 0x0067: return "pure"; - case 0x0068: return "recursive"; - case 0x2000: return "lo user"; - case 0x3fff: return "hi user"; - case 0x2001: return "MIPS fde"; - case 0x2002: return "MIPS loop begin"; - case 0x2003: return "MIPS tail loop begin"; - case 0x2004: return "MIPS epilog begin"; - case 0x2005: return "MIPS loop unroll factor"; - case 0x2006: return "MIPS software pipeline depth"; - case 0x2007: return "MIPS linkage name"; - case 0x2008: return "MIPS stride"; - case 0x2009: return "MIPS abstract name"; - case 0x200a: return "MIPS clone origin"; - case 0x200b: return "MIPS has inlines"; - case 0x2101: return "source file names"; - case 0x2102: return "source info"; - case 0x2103: return "macro info"; - case 0x2104: return "source coordinates"; - case 0x2105: return "body begin"; - case 0x2106: return "body end"; - case 0x2107: return "GNU vector"; - case 0x2501: return "repository file"; - case 0x2502: return "repository type"; - case 0x2503: return "repository name"; - case 0x2504: return "repository specification"; - case 0x2505: return "repository import"; - case 0x2506: return "repository abstract origin"; - case DW_AT_APPLE_flags: return "Apple gcc compiler flags"; - case DW_AT_APPLE_optimized: return "APPLE optimized"; - case DW_AT_APPLE_isa: return "APPLE instruction set architecture"; - case DW_AT_APPLE_block: return "APPLE block"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_AT constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_AT_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0001: return DRC_REFERENCE; - case 0x0002: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0003: return DRC_STRING; - case 0x0009: return DRC_CONSTANT; - case 0x000b: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x000c: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x000d: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0010: return DRC_LINEPTR; - case 0x0011: return DRC_ADDRESS; - case 0x0012: return DRC_ADDRESS; - case 0x0013: return DRC_CONSTANT; - case 0x0015: return DRC_REFERENCE; - case 0x0016: return DRC_CONSTANT; - case 0x0017: return DRC_CONSTANT; - case 0x0018: return DRC_REFERENCE; - case 0x0019: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x001a: return DRC_REFERENCE; - case 0x001b: return DRC_STRING; - case 0x001c: return DRC_BLOCK | DRC_CONSTANT | DRC_STRING; - case 0x001d: return DRC_REFERENCE; - case 0x001e: return DRC_REFERENCE; - case 0x0020: return DRC_CONSTANT; - case 0x0021: return DRC_FLAG; - case 0x0022: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0025: return DRC_STRING; - case 0x0027: return DRC_FLAG; - case 0x002a: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x002c: return DRC_CONSTANT; - case 0x002e: return DRC_CONSTANT; - case 0x002f: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0031: return DRC_REFERENCE; - case 0x0032: return DRC_CONSTANT; - case 0x0033: return DRC_CONSTANT; - case 0x0034: return DRC_FLAG; - case 0x0035: return DRC_REFERENCE; - case 0x0036: return DRC_CONSTANT; - case 0x0037: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0038: return DRC_BLOCK | DRC_CONSTANT | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0039: return DRC_CONSTANT; - case 0x003a: return DRC_CONSTANT; - case 0x003b: return DRC_CONSTANT; - case 0x003c: return DRC_FLAG; - case 0x003d: return DRC_BLOCK; - case 0x003e: return DRC_CONSTANT; - case 0x003f: return DRC_FLAG; - case 0x0040: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0041: return DRC_REFERENCE; - case 0x0042: return DRC_CONSTANT; - case 0x0043: return DRC_MACPTR; - case 0x0044: return DRC_BLOCK; - case 0x0045: return DRC_REFERENCE; - case 0x0046: return DRC_BLOCK | DRC_CONSTANT; - case 0x0047: return DRC_REFERENCE; - case 0x0048: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0049: return DRC_REFERENCE; - case 0x004a: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x004b: return DRC_FLAG; - case 0x004c: return DRC_CONSTANT; - case 0x004d: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x004e: return DRC_BLOCK | DRC_CONSTANT | DRC_DWARFv3 | DRC_REFERENCE; - case 0x004f: return DRC_BLOCK | DRC_CONSTANT | DRC_DWARFv3 | DRC_REFERENCE; - case 0x0050: return DRC_BLOCK | DRC_DWARFv3; - case 0x0051: return DRC_BLOCK | DRC_CONSTANT | DRC_DWARFv3 | DRC_REFERENCE; - case 0x0052: return DRC_ADDRESS | DRC_DWARFv3; - case 0x0053: return DRC_DWARFv3 | DRC_FLAG; - case 0x0054: return DRC_DWARFv3 | DRC_REFERENCE; - case 0x0055: return DRC_DWARFv3 | DRC_RANGELISTPTR; - case 0x0056: return DRC_ADDRESS | DRC_DWARFv3 | DRC_FLAG | DRC_REFERENCE | DRC_STRING; - case 0x0057: return DRC_CONSTANT | DRC_DWARFv3; - case 0x0058: return DRC_CONSTANT | DRC_DWARFv3; - case 0x0059: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005a: return DRC_DWARFv3 | DRC_STRING; - case 0x005b: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005c: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005d: return DRC_DWARFv3 | DRC_REFERENCE; - case 0x005e: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005f: return DRC_CONSTANT | DRC_DWARFv3; - case 0x0060: return DRC_DWARFv3 | DRC_STRING; - case 0x0061: return DRC_DWARFv3 | DRC_FLAG; - case 0x0062: return DRC_DWARFv3 | DRC_FLAG; - case 0x0063: return DRC_DWARFv3 | DRC_FLAG; - case 0x0064: return DRC_DWARFv3 | DRC_REFERENCE; - case 0x0065: return DRC_0x65 | DRC_CONSTANT | DRC_DWARFv3; - case 0x0066: return DRC_DWARFv3 | DRC_FLAG; - case 0x0067: return DRC_DWARFv3 | DRC_FLAG; - case 0x0068: return DRC_DWARFv3 | DRC_FLAG; - case 0x2000: return 0; - case 0x3fff: return 0; - case 0x2001: return DRC_VENDOR_MIPS; - case 0x2002: return DRC_VENDOR_MIPS; - case 0x2003: return DRC_VENDOR_MIPS; - case 0x2004: return DRC_VENDOR_MIPS; - case 0x2005: return DRC_VENDOR_MIPS; - case 0x2006: return DRC_VENDOR_MIPS; - case 0x2007: return DRC_STRING | DRC_VENDOR_MIPS; - case 0x2008: return DRC_VENDOR_MIPS; - case 0x2009: return DRC_VENDOR_MIPS; - case 0x200a: return DRC_VENDOR_MIPS; - case 0x200b: return DRC_VENDOR_MIPS; - default: return 0; - } -} - -/* [7.5.4] Figure 19 "Attribute form encodings" (pp. 133-134) in DWARFv3 draft 8 */ - -const char * -DW_FORM_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return DW_FORM_PREFIX "addr"; - case 0x03: return DW_FORM_PREFIX "block2"; - case 0x04: return DW_FORM_PREFIX "block4"; - case 0x05: return DW_FORM_PREFIX "data2"; - case 0x06: return DW_FORM_PREFIX "data4"; - case 0x07: return DW_FORM_PREFIX "data8"; - case 0x08: return DW_FORM_PREFIX "string"; - case 0x09: return DW_FORM_PREFIX "block"; - case 0x0a: return DW_FORM_PREFIX "block1"; - case 0x0b: return DW_FORM_PREFIX "data1"; - case 0x0c: return DW_FORM_PREFIX "flag"; - case 0x0d: return DW_FORM_PREFIX "sdata"; - case 0x0e: return DW_FORM_PREFIX "strp"; - case 0x0f: return DW_FORM_PREFIX "udata"; - case 0x10: return DW_FORM_PREFIX "ref_addr"; - case 0x11: return DW_FORM_PREFIX "ref1"; - case 0x12: return DW_FORM_PREFIX "ref2"; - case 0x13: return DW_FORM_PREFIX "ref4"; - case 0x14: return DW_FORM_PREFIX "ref8"; - case 0x15: return DW_FORM_PREFIX "ref_udata"; - case 0x16: return DW_FORM_PREFIX "indirect"; -// case DW_FORM_APPLE_db_str: return DW_FORM_PREFIX "APPLE_db_str"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_FORM constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_FORM_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "addr"; - case 0x03: return "block2"; - case 0x04: return "block4"; - case 0x05: return "data2"; - case 0x06: return "data4"; - case 0x07: return "data8"; - case 0x08: return "string"; - case 0x09: return "block"; - case 0x0a: return "block1"; - case 0x0b: return "data1"; - case 0x0c: return "flag"; - case 0x0d: return "sdata"; - case 0x0e: return "strp"; - case 0x0f: return "udata"; - case 0x10: return "ref addr"; - case 0x11: return "ref1"; - case 0x12: return "ref2"; - case 0x13: return "ref4"; - case 0x14: return "ref8"; - case 0x15: return "ref udata"; - case 0x16: return "indirect"; -// case DW_FORM_APPLE_db_str: return "repository str"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_FORM constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_FORM_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return DRC_ADDRESS; - case 0x03: return DRC_BLOCK | DRC_LOCEXPR; - case 0x04: return DRC_BLOCK | DRC_LOCEXPR; - case 0x05: return DRC_CONSTANT; - case 0x06: return DRC_CONSTANT | DRC_LINEPTR | DRC_LOCLISTPTR | DRC_MACPTR | DRC_RANGELISTPTR; - case 0x07: return DRC_CONSTANT | DRC_LINEPTR | DRC_LOCLISTPTR | DRC_MACPTR | DRC_RANGELISTPTR; - case 0x08: return DRC_STRING; - case 0x09: return DRC_BLOCK | DRC_LOCEXPR; - case 0x0a: return DRC_BLOCK | DRC_LOCEXPR; - case 0x0b: return DRC_CONSTANT; - case 0x0c: return DRC_FLAG; - case 0x0d: return DRC_CONSTANT; - case 0x0e: return DRC_STRING; - case 0x0f: return DRC_CONSTANT; - case 0x10: return DRC_REFERENCE; - case 0x11: return DRC_REFERENCE; - case 0x12: return DRC_REFERENCE; - case 0x13: return DRC_REFERENCE; - case 0x14: return DRC_REFERENCE; - case 0x15: return DRC_REFERENCE; - case 0x16: return DRC_INDIRECT_SPECIAL; - default: return 0; - } -} - -/* [7.7.1] Figure 22 "DWARF operation encodings" (pp. 136-139) in DWARFv3 draft 8 */ - -const char * -DW_OP_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x03: return "DW_OP_addr"; - case 0x06: return "DW_OP_deref"; - case 0x08: return "DW_OP_const1u"; - case 0x09: return "DW_OP_const1s"; - case 0x0a: return "DW_OP_const2u"; - case 0x0b: return "DW_OP_const2s"; - case 0x0c: return "DW_OP_const4u"; - case 0x0d: return "DW_OP_const4s"; - case 0x0e: return "DW_OP_const8u"; - case 0x0f: return "DW_OP_const8s"; - case 0x10: return "DW_OP_constu"; - case 0x11: return "DW_OP_consts"; - case 0x12: return "DW_OP_dup"; - case 0x13: return "DW_OP_drop"; - case 0x14: return "DW_OP_over"; - case 0x15: return "DW_OP_pick"; - case 0x16: return "DW_OP_swap"; - case 0x17: return "DW_OP_rot"; - case 0x18: return "DW_OP_xderef"; - case 0x19: return "DW_OP_abs"; - case 0x1a: return "DW_OP_and"; - case 0x1b: return "DW_OP_div"; - case 0x1c: return "DW_OP_minus"; - case 0x1d: return "DW_OP_mod"; - case 0x1e: return "DW_OP_mul"; - case 0x1f: return "DW_OP_neg"; - case 0x20: return "DW_OP_not"; - case 0x21: return "DW_OP_or"; - case 0x22: return "DW_OP_plus"; - case 0x23: return "DW_OP_plus_uconst"; - case 0x24: return "DW_OP_shl"; - case 0x25: return "DW_OP_shr"; - case 0x26: return "DW_OP_shra"; - case 0x27: return "DW_OP_xor"; - case 0x2f: return "DW_OP_skip"; - case 0x28: return "DW_OP_bra"; - case 0x29: return "DW_OP_eq"; - case 0x2a: return "DW_OP_ge"; - case 0x2b: return "DW_OP_gt"; - case 0x2c: return "DW_OP_le"; - case 0x2d: return "DW_OP_lt"; - case 0x2e: return "DW_OP_ne"; - case 0x30: return "DW_OP_lit0"; - case 0x31: return "DW_OP_lit1"; - case 0x32: return "DW_OP_lit2"; - case 0x33: return "DW_OP_lit3"; - case 0x34: return "DW_OP_lit4"; - case 0x35: return "DW_OP_lit5"; - case 0x36: return "DW_OP_lit6"; - case 0x37: return "DW_OP_lit7"; - case 0x38: return "DW_OP_lit8"; - case 0x39: return "DW_OP_lit9"; - case 0x3a: return "DW_OP_lit10"; - case 0x3b: return "DW_OP_lit11"; - case 0x3c: return "DW_OP_lit12"; - case 0x3d: return "DW_OP_lit13"; - case 0x3e: return "DW_OP_lit14"; - case 0x3f: return "DW_OP_lit15"; - case 0x40: return "DW_OP_lit16"; - case 0x41: return "DW_OP_lit17"; - case 0x42: return "DW_OP_lit18"; - case 0x43: return "DW_OP_lit19"; - case 0x44: return "DW_OP_lit20"; - case 0x45: return "DW_OP_lit21"; - case 0x46: return "DW_OP_lit22"; - case 0x47: return "DW_OP_lit23"; - case 0x48: return "DW_OP_lit24"; - case 0x49: return "DW_OP_lit25"; - case 0x4a: return "DW_OP_lit26"; - case 0x4b: return "DW_OP_lit27"; - case 0x4c: return "DW_OP_lit28"; - case 0x4d: return "DW_OP_lit29"; - case 0x4e: return "DW_OP_lit30"; - case 0x4f: return "DW_OP_lit31"; - case 0x50: return "DW_OP_reg0"; - case 0x51: return "DW_OP_reg1"; - case 0x52: return "DW_OP_reg2"; - case 0x53: return "DW_OP_reg3"; - case 0x54: return "DW_OP_reg4"; - case 0x55: return "DW_OP_reg5"; - case 0x56: return "DW_OP_reg6"; - case 0x57: return "DW_OP_reg7"; - case 0x58: return "DW_OP_reg8"; - case 0x59: return "DW_OP_reg9"; - case 0x5a: return "DW_OP_reg10"; - case 0x5b: return "DW_OP_reg11"; - case 0x5c: return "DW_OP_reg12"; - case 0x5d: return "DW_OP_reg13"; - case 0x5e: return "DW_OP_reg14"; - case 0x5f: return "DW_OP_reg15"; - case 0x60: return "DW_OP_reg16"; - case 0x61: return "DW_OP_reg17"; - case 0x62: return "DW_OP_reg18"; - case 0x63: return "DW_OP_reg19"; - case 0x64: return "DW_OP_reg20"; - case 0x65: return "DW_OP_reg21"; - case 0x66: return "DW_OP_reg22"; - case 0x67: return "DW_OP_reg23"; - case 0x68: return "DW_OP_reg24"; - case 0x69: return "DW_OP_reg25"; - case 0x6a: return "DW_OP_reg26"; - case 0x6b: return "DW_OP_reg27"; - case 0x6c: return "DW_OP_reg28"; - case 0x6d: return "DW_OP_reg29"; - case 0x6e: return "DW_OP_reg30"; - case 0x6f: return "DW_OP_reg31"; - case 0x70: return "DW_OP_breg0"; - case 0x71: return "DW_OP_breg1"; - case 0x72: return "DW_OP_breg2"; - case 0x73: return "DW_OP_breg3"; - case 0x74: return "DW_OP_breg4"; - case 0x75: return "DW_OP_breg5"; - case 0x76: return "DW_OP_breg6"; - case 0x77: return "DW_OP_breg7"; - case 0x78: return "DW_OP_breg8"; - case 0x79: return "DW_OP_breg9"; - case 0x7a: return "DW_OP_breg10"; - case 0x7b: return "DW_OP_breg11"; - case 0x7c: return "DW_OP_breg12"; - case 0x7d: return "DW_OP_breg13"; - case 0x7e: return "DW_OP_breg14"; - case 0x7f: return "DW_OP_breg15"; - case 0x80: return "DW_OP_breg16"; - case 0x81: return "DW_OP_breg17"; - case 0x82: return "DW_OP_breg18"; - case 0x83: return "DW_OP_breg19"; - case 0x84: return "DW_OP_breg20"; - case 0x85: return "DW_OP_breg21"; - case 0x86: return "DW_OP_breg22"; - case 0x87: return "DW_OP_breg23"; - case 0x88: return "DW_OP_breg24"; - case 0x89: return "DW_OP_breg25"; - case 0x8a: return "DW_OP_breg26"; - case 0x8b: return "DW_OP_breg27"; - case 0x8c: return "DW_OP_breg28"; - case 0x8d: return "DW_OP_breg29"; - case 0x8e: return "DW_OP_breg30"; - case 0x8f: return "DW_OP_breg31"; - case 0x90: return "DW_OP_regx"; - case 0x91: return "DW_OP_fbreg"; - case 0x92: return "DW_OP_bregx"; - case 0x93: return "DW_OP_piece"; - case 0x94: return "DW_OP_deref_size"; - case 0x95: return "DW_OP_xderef_size"; - case 0x96: return "DW_OP_nop"; - case 0x97: return "DW_OP_push_object_address"; - case 0x98: return "DW_OP_call2"; - case 0x99: return "DW_OP_call4"; - case 0x9a: return "DW_OP_call_ref"; - case 0xf0: return "DW_OP_APPLE_uninit"; - case 0xe0: return "DW_OP_lo_user"; - case 0xff: return "DW_OP_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_OP constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_OP_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x03: return "addr"; - case 0x06: return "deref"; - case 0x08: return "const1u"; - case 0x09: return "const1s"; - case 0x0a: return "const2u"; - case 0x0b: return "const2s"; - case 0x0c: return "const4u"; - case 0x0d: return "const4s"; - case 0x0e: return "const8u"; - case 0x0f: return "const8s"; - case 0x10: return "constu"; - case 0x11: return "consts"; - case 0x12: return "dup"; - case 0x13: return "drop"; - case 0x14: return "over"; - case 0x15: return "pick"; - case 0x16: return "swap"; - case 0x17: return "rot"; - case 0x18: return "xderef"; - case 0x19: return "abs"; - case 0x1a: return "and"; - case 0x1b: return "div"; - case 0x1c: return "minus"; - case 0x1d: return "mod"; - case 0x1e: return "mul"; - case 0x1f: return "neg"; - case 0x20: return "not"; - case 0x21: return "or"; - case 0x22: return "plus"; - case 0x23: return "plus uconst"; - case 0x24: return "shl"; - case 0x25: return "shr"; - case 0x26: return "shra"; - case 0x27: return "xor"; - case 0x2f: return "skip"; - case 0x28: return "bra"; - case 0x29: return "eq"; - case 0x2a: return "ge"; - case 0x2b: return "gt"; - case 0x2c: return "le"; - case 0x2d: return "lt"; - case 0x2e: return "ne"; - case 0x30: return "lit0"; - case 0x31: return "lit1"; - case 0x32: return "lit2"; - case 0x33: return "lit3"; - case 0x34: return "lit4"; - case 0x35: return "lit5"; - case 0x36: return "lit6"; - case 0x37: return "lit7"; - case 0x38: return "lit8"; - case 0x39: return "lit9"; - case 0x3a: return "lit10"; - case 0x3b: return "lit11"; - case 0x3c: return "lit12"; - case 0x3d: return "lit13"; - case 0x3e: return "lit14"; - case 0x3f: return "lit15"; - case 0x40: return "lit16"; - case 0x41: return "lit17"; - case 0x42: return "lit18"; - case 0x43: return "lit19"; - case 0x44: return "lit20"; - case 0x45: return "lit21"; - case 0x46: return "lit22"; - case 0x47: return "lit23"; - case 0x48: return "lit24"; - case 0x49: return "lit25"; - case 0x4a: return "lit26"; - case 0x4b: return "lit27"; - case 0x4c: return "lit28"; - case 0x4d: return "lit29"; - case 0x4e: return "lit30"; - case 0x4f: return "lit31"; - case 0x50: return "reg0"; - case 0x51: return "reg1"; - case 0x52: return "reg2"; - case 0x53: return "reg3"; - case 0x54: return "reg4"; - case 0x55: return "reg5"; - case 0x56: return "reg6"; - case 0x57: return "reg7"; - case 0x58: return "reg8"; - case 0x59: return "reg9"; - case 0x5a: return "reg10"; - case 0x5b: return "reg11"; - case 0x5c: return "reg12"; - case 0x5d: return "reg13"; - case 0x5e: return "reg14"; - case 0x5f: return "reg15"; - case 0x60: return "reg16"; - case 0x61: return "reg17"; - case 0x62: return "reg18"; - case 0x63: return "reg19"; - case 0x64: return "reg20"; - case 0x65: return "reg21"; - case 0x66: return "reg22"; - case 0x67: return "reg23"; - case 0x68: return "reg24"; - case 0x69: return "reg25"; - case 0x6a: return "reg26"; - case 0x6b: return "reg27"; - case 0x6c: return "reg28"; - case 0x6d: return "reg29"; - case 0x6e: return "reg30"; - case 0x6f: return "reg31"; - case 0x70: return "breg0"; - case 0x71: return "breg1"; - case 0x72: return "breg2"; - case 0x73: return "breg3"; - case 0x74: return "breg4"; - case 0x75: return "breg5"; - case 0x76: return "breg6"; - case 0x77: return "breg7"; - case 0x78: return "breg8"; - case 0x79: return "breg9"; - case 0x7a: return "breg10"; - case 0x7b: return "breg11"; - case 0x7c: return "breg12"; - case 0x7d: return "breg13"; - case 0x7e: return "breg14"; - case 0x7f: return "breg15"; - case 0x80: return "breg16"; - case 0x81: return "breg17"; - case 0x82: return "breg18"; - case 0x83: return "breg19"; - case 0x84: return "breg20"; - case 0x85: return "breg21"; - case 0x86: return "breg22"; - case 0x87: return "breg23"; - case 0x88: return "breg24"; - case 0x89: return "breg25"; - case 0x8a: return "breg26"; - case 0x8b: return "breg27"; - case 0x8c: return "breg28"; - case 0x8d: return "breg29"; - case 0x8e: return "breg30"; - case 0x8f: return "breg31"; - case 0x90: return "regx"; - case 0x91: return "fbreg"; - case 0x92: return "bregx"; - case 0x93: return "piece"; - case 0x94: return "deref size"; - case 0x95: return "xderef size"; - case 0x96: return "nop"; - case 0x97: return "push object address"; - case 0x98: return "call2"; - case 0x99: return "call4"; - case 0x9a: return "call ref"; - case 0xf0: return "uninitialized"; - case 0xe0: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_OP constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_OP_value_to_class (uint32_t val) -{ - switch (val) { - case 0x03: return DRC_ONEOPERAND; - case 0x06: return DRC_ZEROOPERANDS; - case 0x08: return DRC_ONEOPERAND; - case 0x09: return DRC_ONEOPERAND; - case 0x0a: return DRC_ONEOPERAND; - case 0x0b: return DRC_ONEOPERAND; - case 0x0c: return DRC_ONEOPERAND; - case 0x0d: return DRC_ONEOPERAND; - case 0x0e: return DRC_ONEOPERAND; - case 0x0f: return DRC_ONEOPERAND; - case 0x10: return DRC_ONEOPERAND; - case 0x11: return DRC_ONEOPERAND; - case 0x12: return DRC_ZEROOPERANDS; - case 0x13: return DRC_ZEROOPERANDS; - case 0x14: return DRC_ZEROOPERANDS; - case 0x15: return DRC_ONEOPERAND; - case 0x16: return DRC_ZEROOPERANDS; - case 0x17: return DRC_ZEROOPERANDS; - case 0x18: return DRC_ZEROOPERANDS; - case 0x19: return DRC_ZEROOPERANDS; - case 0x1a: return DRC_ZEROOPERANDS; - case 0x1b: return DRC_ZEROOPERANDS; - case 0x1c: return DRC_ZEROOPERANDS; - case 0x1d: return DRC_ZEROOPERANDS; - case 0x1e: return DRC_ZEROOPERANDS; - case 0x1f: return DRC_ZEROOPERANDS; - case 0x20: return DRC_ZEROOPERANDS; - case 0x21: return DRC_ZEROOPERANDS; - case 0x22: return DRC_ZEROOPERANDS; - case 0x23: return DRC_ONEOPERAND; - case 0x24: return DRC_ZEROOPERANDS; - case 0x25: return DRC_ZEROOPERANDS; - case 0x26: return DRC_ZEROOPERANDS; - case 0x27: return DRC_ZEROOPERANDS; - case 0x2f: return DRC_ONEOPERAND; - case 0x28: return DRC_ONEOPERAND; - case 0x29: return DRC_ZEROOPERANDS; - case 0x2a: return DRC_ZEROOPERANDS; - case 0x2b: return DRC_ZEROOPERANDS; - case 0x2c: return DRC_ZEROOPERANDS; - case 0x2d: return DRC_ZEROOPERANDS; - case 0x2e: return DRC_ZEROOPERANDS; - case 0x30: return DRC_ZEROOPERANDS; - case 0x31: return DRC_ZEROOPERANDS; - case 0x32: return DRC_ZEROOPERANDS; - case 0x33: return DRC_ZEROOPERANDS; - case 0x34: return DRC_ZEROOPERANDS; - case 0x35: return DRC_ZEROOPERANDS; - case 0x36: return DRC_ZEROOPERANDS; - case 0x37: return DRC_ZEROOPERANDS; - case 0x38: return DRC_ZEROOPERANDS; - case 0x39: return DRC_ZEROOPERANDS; - case 0x3a: return DRC_ZEROOPERANDS; - case 0x3b: return DRC_ZEROOPERANDS; - case 0x3c: return DRC_ZEROOPERANDS; - case 0x3d: return DRC_ZEROOPERANDS; - case 0x3e: return DRC_ZEROOPERANDS; - case 0x3f: return DRC_ZEROOPERANDS; - case 0x40: return DRC_ZEROOPERANDS; - case 0x41: return DRC_ZEROOPERANDS; - case 0x42: return DRC_ZEROOPERANDS; - case 0x43: return DRC_ZEROOPERANDS; - case 0x44: return DRC_ZEROOPERANDS; - case 0x45: return DRC_ZEROOPERANDS; - case 0x46: return DRC_ZEROOPERANDS; - case 0x47: return DRC_ZEROOPERANDS; - case 0x48: return DRC_ZEROOPERANDS; - case 0x49: return DRC_ZEROOPERANDS; - case 0x4a: return DRC_ZEROOPERANDS; - case 0x4b: return DRC_ZEROOPERANDS; - case 0x4c: return DRC_ZEROOPERANDS; - case 0x4d: return DRC_ZEROOPERANDS; - case 0x4e: return DRC_ZEROOPERANDS; - case 0x4f: return DRC_ZEROOPERANDS; - case 0x50: return DRC_ZEROOPERANDS; - case 0x51: return DRC_ZEROOPERANDS; - case 0x52: return DRC_ZEROOPERANDS; - case 0x53: return DRC_ZEROOPERANDS; - case 0x54: return DRC_ZEROOPERANDS; - case 0x55: return DRC_ZEROOPERANDS; - case 0x56: return DRC_ZEROOPERANDS; - case 0x57: return DRC_ZEROOPERANDS; - case 0x58: return DRC_ZEROOPERANDS; - case 0x59: return DRC_ZEROOPERANDS; - case 0x5a: return DRC_ZEROOPERANDS; - case 0x5b: return DRC_ZEROOPERANDS; - case 0x5c: return DRC_ZEROOPERANDS; - case 0x5d: return DRC_ZEROOPERANDS; - case 0x5e: return DRC_ZEROOPERANDS; - case 0x5f: return DRC_ZEROOPERANDS; - case 0x60: return DRC_ZEROOPERANDS; - case 0x61: return DRC_ZEROOPERANDS; - case 0x62: return DRC_ZEROOPERANDS; - case 0x63: return DRC_ZEROOPERANDS; - case 0x64: return DRC_ZEROOPERANDS; - case 0x65: return DRC_ZEROOPERANDS; - case 0x66: return DRC_ZEROOPERANDS; - case 0x67: return DRC_ZEROOPERANDS; - case 0x68: return DRC_ZEROOPERANDS; - case 0x69: return DRC_ZEROOPERANDS; - case 0x6a: return DRC_ZEROOPERANDS; - case 0x6b: return DRC_ZEROOPERANDS; - case 0x6c: return DRC_ZEROOPERANDS; - case 0x6d: return DRC_ZEROOPERANDS; - case 0x6e: return DRC_ZEROOPERANDS; - case 0x6f: return DRC_ZEROOPERANDS; - case 0x70: return DRC_ONEOPERAND; - case 0x71: return DRC_ONEOPERAND; - case 0x72: return DRC_ONEOPERAND; - case 0x73: return DRC_ONEOPERAND; - case 0x74: return DRC_ONEOPERAND; - case 0x75: return DRC_ONEOPERAND; - case 0x76: return DRC_ONEOPERAND; - case 0x77: return DRC_ONEOPERAND; - case 0x78: return DRC_ONEOPERAND; - case 0x79: return DRC_ONEOPERAND; - case 0x7a: return DRC_ONEOPERAND; - case 0x7b: return DRC_ONEOPERAND; - case 0x7c: return DRC_ONEOPERAND; - case 0x7d: return DRC_ONEOPERAND; - case 0x7e: return DRC_ONEOPERAND; - case 0x7f: return DRC_ONEOPERAND; - case 0x80: return DRC_ONEOPERAND; - case 0x81: return DRC_ONEOPERAND; - case 0x82: return DRC_ONEOPERAND; - case 0x83: return DRC_ONEOPERAND; - case 0x84: return DRC_ONEOPERAND; - case 0x85: return DRC_ONEOPERAND; - case 0x86: return DRC_ONEOPERAND; - case 0x87: return DRC_ONEOPERAND; - case 0x88: return DRC_ONEOPERAND; - case 0x89: return DRC_ONEOPERAND; - case 0x8a: return DRC_ONEOPERAND; - case 0x8b: return DRC_ONEOPERAND; - case 0x8c: return DRC_ONEOPERAND; - case 0x8d: return DRC_ONEOPERAND; - case 0x8e: return DRC_ONEOPERAND; - case 0x8f: return DRC_ONEOPERAND; - case 0x90: return DRC_ONEOPERAND; - case 0x91: return DRC_ONEOPERAND; - case 0x92: return DRC_TWOOPERANDS; - case 0x93: return DRC_ONEOPERAND; - case 0x94: return DRC_ONEOPERAND; - case 0x95: return DRC_ONEOPERAND; - case 0x96: return DRC_ZEROOPERANDS; - case 0x97: return DRC_DWARFv3 | DRC_ZEROOPERANDS; - case 0x98: return DRC_DWARFv3 | DRC_ONEOPERAND; - case 0x99: return DRC_DWARFv3 | DRC_ONEOPERAND; - case 0x9a: return DRC_DWARFv3 | DRC_ONEOPERAND; - case 0xf0: return DRC_ZEROOPERANDS; /* DW_OP_APPLE_uninit */ - case 0xe0: return 0; - case 0xff: return 0; - default: return 0; - } -} - -/* [7.8] Figure 23 "Base type encoding values" (pp. 140-141) in DWARFv3 draft 8 */ - -const char * -DW_ATE_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "DW_ATE_address"; - case 0x02: return "DW_ATE_boolean"; - case 0x03: return "DW_ATE_complex_float"; - case 0x04: return "DW_ATE_float"; - case 0x05: return "DW_ATE_signed"; - case 0x06: return "DW_ATE_signed_char"; - case 0x07: return "DW_ATE_unsigned"; - case 0x08: return "DW_ATE_unsigned_char"; - case 0x09: return "DW_ATE_imaginary_float"; - case 0x80: return "DW_ATE_lo_user"; - case 0xff: return "DW_ATE_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ATE constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ATE_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "address"; - case 0x02: return "boolean"; - case 0x03: return "complex float"; - case 0x04: return "float"; - case 0x05: return "signed"; - case 0x06: return "signed char"; - case 0x07: return "unsigned"; - case 0x08: return "unsigned char"; - case 0x09: return "imaginary float"; - case 0x80: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ATE constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ATE_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x04: return 0; - case 0x05: return 0; - case 0x06: return 0; - case 0x07: return 0; - case 0x08: return 0; - case 0x09: return DRC_DWARFv3; - case 0x80: return 0; - case 0xff: return 0; - default: return 0; - } -} - -/* [7.9] Figure 24 "Accessibility encodings" (p. 141) in DWARFv3 draft 8 */ - -const char * -DW_ACCESS_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "DW_ACCESS_public"; - case 0x2: return "DW_ACCESS_protected"; - case 0x3: return "DW_ACCESS_private"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ACCESS constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ACCESS_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "public"; - case 0x2: return "protected"; - case 0x3: return "private"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ACCESS constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ACCESS_value_to_class (uint32_t val) -{ - switch (val) { - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; - } -} - -/* [7.10] Figure 25 "Visibility encodings" (p. 142) in DWARFv3 draft 8 */ - -const char * -DW_VIS_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "DW_VIS_local"; - case 0x2: return "DW_VIS_exported"; - case 0x3: return "DW_VIS_qualified"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIS constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_VIS_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "local"; - case 0x2: return "exported"; - case 0x3: return "qualified"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIS constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_VIS_value_to_class (uint32_t val) -{ - switch (val) { - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; - } -} - -/* [7.11] Figure 26 "Virtuality encodings" (p. 142) in DWARFv3 draft 8 */ - -const char * -DW_VIRTUALITY_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_VIRTUALITY_none"; - case 0x1: return "DW_VIRTUALITY_virtual"; - case 0x2: return "DW_VIRTUALITY_pure_virtual"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIRTUALITY constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_VIRTUALITY_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "none"; - case 0x1: return "virtual"; - case 0x2: return "pure virtual"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIRTUALITY constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_VIRTUALITY_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - case 0x2: return 0; - default: return 0; - } -} - -/* [7.12] Figure 27 "Language encodings" (p. 143) in DWARFv3 draft 8 */ - -const char * -DW_LANG_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0001: return "DW_LANG_C89"; - case 0x0002: return "DW_LANG_C"; - case 0x0003: return "DW_LANG_Ada83"; - case 0x0004: return "DW_LANG_C_plus_plus"; - case 0x0005: return "DW_LANG_Cobol74"; - case 0x0006: return "DW_LANG_Cobol85"; - case 0x0007: return "DW_LANG_Fortran77"; - case 0x0008: return "DW_LANG_Fortran90"; - case 0x0009: return "DW_LANG_Pascal83"; - case 0x000a: return "DW_LANG_Modula2"; - case 0x000b: return "DW_LANG_Java"; - case 0x000c: return "DW_LANG_C99"; - case 0x000d: return "DW_LANG_Ada95"; - case 0x000e: return "DW_LANG_Fortran95"; - case 0x000f: return "DW_LANG_PLI"; - case 0x0010: return "DW_LANG_ObjC"; - case 0x0011: return "DW_LANG_ObjC_plus_plus"; - case 0x0012: return "DW_LANG_UPC"; - case 0x0013: return "DW_LANG_D"; - case 0x8000: return "DW_LANG_lo_user"; - case 0x8001: return "DW_LANG_Mips_Assembler"; - case 0x8765: return "DW_LANG_Upc"; - case 0xffff: return "DW_LANG_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LANG constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_LANG_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0001: return "C89"; - case 0x0002: return "C"; - case 0x0003: return "Ada83"; - case 0x0004: return "C++"; - case 0x0005: return "Cobol74"; - case 0x0006: return "Cobol85"; - case 0x0007: return "Fortran77"; - case 0x0008: return "Fortran90"; - case 0x0009: return "Pascal83"; - case 0x000a: return "Modula2"; - case 0x000b: return "Java"; - case 0x000c: return "C99"; - case 0x000d: return "Ada95"; - case 0x000e: return "Fortran95"; - case 0x000f: return "PLI"; - case 0x0010: return "Objective C"; - case 0x0011: return "Objective C++"; - case 0x0012: return "UPC"; - case 0x0013: return "D"; - case 0x8000: return "lo user"; - case 0x8001: return "MIPS Assembler"; - case 0x8765: return "UPC"; - case 0xffff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LANG constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_LANG_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0001: return 0; - case 0x0002: return 0; - case 0x0003: return 0; - case 0x0004: return 0; - case 0x0005: return 0; - case 0x0006: return 0; - case 0x0007: return 0; - case 0x0008: return 0; - case 0x0009: return 0; - case 0x000a: return 0; - case 0x000b: return DRC_DWARFv3; - case 0x000c: return DRC_DWARFv3; - case 0x000d: return DRC_DWARFv3; - case 0x000e: return DRC_DWARFv3; - case 0x000f: return DRC_DWARFv3; - case 0x0010: return DRC_DWARFv3; - case 0x0011: return DRC_DWARFv3; - case 0x0012: return DRC_DWARFv3; - case 0x0013: return DRC_DWARFv3; - case 0x8000: return 0; - case 0x8001: return 0; - case 0x8765: return 0; - case 0xffff: return 0; - default: return 0; - } -} - -/* [7.13], "Address Class Encodings" (p. 144) in DWARFv3 draft 8 */ - -const char * -DW_ADDR_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_ADDR_none"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ADDR constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ADDR_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "none"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ADDR constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ADDR_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - default: return 0; - } -} - -/* [7.14] Figure 28 "Identifier case encodings" (p. 144) in DWARFv3 draft 8 */ - -const char * -DW_ID_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_ID_case_sensitive"; - case 0x1: return "DW_ID_up_case"; - case 0x2: return "DW_ID_down_case"; - case 0x3: return "DW_ID_case_insensitive"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ID constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ID_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "case sensitive"; - case 0x1: return "up case"; - case 0x2: return "down case"; - case 0x3: return "case insensitive"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ID constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ID_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; - } -} - -/* [7.15] Figure 29 "Calling convention encodings" (p. 144) in DWARFv3 draft 8 */ - -const char * -DW_CC_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "DW_CC_normal"; - case 0x02: return "DW_CC_program"; - case 0x03: return "DW_CC_nocall"; - case 0x40: return "DW_CC_lo_user"; - case 0xff: return "DW_CC_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CC constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_CC_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "normal"; - case 0x02: return "program"; - case 0x03: return "nocall"; - case 0x40: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CC constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_CC_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x40: return 0; - case 0xff: return 0; - default: return 0; - } -} - -/* [7.16] Figure 30 "Inline encodings" (p. 145) in DWARFv3 draft 8 */ - -const char * -DW_INL_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_INL_not_inlined"; - case 0x1: return "DW_INL_inlined"; - case 0x2: return "DW_INL_declared_not_inlined"; - case 0x3: return "DW_INL_declared_inlined"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_INL constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_INL_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "not inlined"; - case 0x1: return "inlined"; - case 0x2: return "declared not inlined"; - case 0x3: return "declared inlined"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_INL constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_INL_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; - } -} - -/* [7.17] Figure 31 "Ordering encodings" (p. 145) in DWARFv3 draft 8 */ - -const char * -DW_ORD_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_ORD_row_major"; - case 0x1: return "DW_ORD_col_major"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ORD constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ORD_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "row major"; - case 0x1: return "col major"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ORD constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ORD_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - default: return 0; - } -} - -/* [7.18] Figure 32 "Discriminant descriptor encodings" (p. 146) in DWARFv3 draft 8 */ - -const char * -DW_DSC_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_DSC_label"; - case 0x1: return "DW_DSC_range"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_DSC constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_DSC_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "label"; - case 0x1: return "range"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_DSC constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_DSC_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - default: return 0; - } -} - -/* [7.21] Figure 33 "Line Number Standard Opcode Encodings" (pp. 148-149) in DWARFv3 draft 8 */ - -const char * -DW_LNS_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "DW_LNS_copy"; - case 0x2: return "DW_LNS_advance_pc"; - case 0x3: return "DW_LNS_advance_line"; - case 0x4: return "DW_LNS_set_file"; - case 0x5: return "DW_LNS_set_column"; - case 0x6: return "DW_LNS_negate_stmt"; - case 0x7: return "DW_LNS_set_basic_block"; - case 0x8: return "DW_LNS_const_add_pc"; - case 0x9: return "DW_LNS_fixed_advance_pc"; - case 0xa: return "DW_LNS_set_prologue_end"; - case 0xb: return "DW_LNS_set_epilogue_begin"; - case 0xc: return "DW_LNS_set_isa"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNS constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_LNS_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "copy"; - case 0x2: return "advance pc"; - case 0x3: return "advance line"; - case 0x4: return "set file"; - case 0x5: return "set column"; - case 0x6: return "negate stmt"; - case 0x7: return "set basic block"; - case 0x8: return "const add pc"; - case 0x9: return "fixed advance pc"; - case 0xa: return "set prologue end"; - case 0xb: return "set epilogue begin"; - case 0xc: return "set isa"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNS constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_LNS_value_to_class (uint32_t val) -{ - switch (val) { - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - case 0x4: return 0; - case 0x5: return 0; - case 0x6: return 0; - case 0x7: return 0; - case 0x8: return 0; - case 0x9: return 0; - case 0xa: return DRC_DWARFv3; - case 0xb: return DRC_DWARFv3; - case 0xc: return DRC_DWARFv3; - default: return 0; - } -} - -/* [7.21] Figure 34 "Line Number Extended Opcode Encodings" (p. 149) in DWARFv3 draft 8 */ - -const char * -DW_LNE_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "DW_LNE_end_sequence"; - case 0x02: return "DW_LNE_set_address"; - case 0x03: return "DW_LNE_define_file"; - case 0x80: return "DW_LNE_lo_user"; - case 0xff: return "DW_LNE_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNE constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_LNE_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "end sequence"; - case 0x02: return "set address"; - case 0x03: return "define file"; - case 0x80: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNE constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_LNE_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x80: return DRC_DWARFv3; - case 0xff: return DRC_DWARFv3; - default: return 0; - } -} - -/* [7.22] Figure 35 "Macinfo Type Encodings" (p. 150) in DWARFv3 draft 8 */ - -const char * -DW_MACINFO_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "DW_MACINFO_define"; - case 0x02: return "DW_MACINFO_undef"; - case 0x03: return "DW_MACINFO_start_file"; - case 0x04: return "DW_MACINFO_end_file"; - case 0xff: return "DW_MACINFO_vendor_ext"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_MACINFO constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_MACINFO_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "define"; - case 0x02: return "undef"; - case 0x03: return "start file"; - case 0x04: return "end file"; - case 0xff: return "vendor ext"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_MACINFO constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_MACINFO_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x04: return 0; - case 0xff: return 0; - default: return 0; - } -} - -/* [7.23] Figure 36 "Call frame instruction encodings" (pp. 151-152) in DWARFv3 draft 8 */ - -const char * -DW_CFA_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x40: return "DW_CFA_advance_loc"; - case 0x80: return "DW_CFA_offset"; - case 0xc0: return "DW_CFA_restore"; - case 0x00: return "DW_CFA_nop"; - case 0x01: return "DW_CFA_set_loc"; - case 0x02: return "DW_CFA_advance_loc1"; - case 0x03: return "DW_CFA_advance_loc2"; - case 0x04: return "DW_CFA_advance_loc4"; - case 0x05: return "DW_CFA_offset_extended"; - case 0x06: return "DW_CFA_restore_extended"; - case 0x07: return "DW_CFA_undefined"; - case 0x08: return "DW_CFA_same_value"; - case 0x09: return "DW_CFA_register"; - case 0x0a: return "DW_CFA_remember_state"; - case 0x0b: return "DW_CFA_restore_state"; - case 0x0c: return "DW_CFA_def_cfa"; - case 0x0d: return "DW_CFA_def_cfa_register"; - case 0x0e: return "DW_CFA_def_cfa_offset"; - case 0x0f: return "DW_CFA_def_cfa_expression"; - case 0x10: return "DW_CFA_expression"; - case 0x11: return "DW_CFA_offset_extended_sf"; - case 0x12: return "DW_CFA_def_cfa_sf"; - case 0x13: return "DW_CFA_def_cfa_offset_sf"; - case 0x1c: return "DW_CFA_lo_user"; - case 0x3f: return "DW_CFA_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CFA constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_CFA_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x40: return "advance loc"; - case 0x80: return "offset"; - case 0xc0: return "restore"; - case 0x00: return "nop"; - case 0x01: return "set loc"; - case 0x02: return "advance loc1"; - case 0x03: return "advance loc2"; - case 0x04: return "advance loc4"; - case 0x05: return "offset extended"; - case 0x06: return "restore extended"; - case 0x07: return "undefined"; - case 0x08: return "same value"; - case 0x09: return "register"; - case 0x0a: return "remember state"; - case 0x0b: return "restore state"; - case 0x0c: return "def cfa"; - case 0x0d: return "def cfa register"; - case 0x0e: return "def cfa offset"; - case 0x0f: return "def cfa expression"; - case 0x10: return "expression"; - case 0x11: return "offset extended sf"; - case 0x12: return "def cfa sf"; - case 0x13: return "def cfa offset sf"; - case 0x1c: return "lo user"; - case 0x3f: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CFA constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_CFA_value_to_class (uint32_t val) -{ - switch (val) { - case 0x40: return DRC_ZEROOPERANDS; - case 0x80: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_OFFSET; - case 0xc0: return DRC_ZEROOPERANDS; - case 0x00: return DRC_ZEROOPERANDS; - case 0x01: return DRC_ONEOPERAND | DRC_OPERANDONE_ADDRESS; - case 0x02: return DRC_ONEOPERAND | DRC_OPERANDONE_1BYTE_DELTA; - case 0x03: return DRC_ONEOPERAND | DRC_OPERANDONE_2BYTE_DELTA; - case 0x04: return DRC_ONEOPERAND | DRC_OPERANDONE_4BYTE_DELTA; - case 0x05: return DRC_OPERANDTWO_ULEB128_OFFSET | DRC_OPERNADONE_ULEB128_REGISTER | DRC_TWOOPERANDS; - case 0x06: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x07: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x08: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x09: return DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_ULEB128_REGISTER | DRC_TWOOPERANDS; - case 0x0a: return DRC_ZEROOPERANDS; - case 0x0b: return DRC_ZEROOPERANDS; - case 0x0c: return DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_ULEB128_OFFSET | DRC_TWOOPERANDS; - case 0x0d: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x0e: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_OFFSET; - case 0x0f: return DRC_DWARFv3 | DRC_ONEOPERAND | DRC_OPERANDONE_BLOCK; - case 0x10: return DRC_DWARFv3 | DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_BLOCK | DRC_TWOOPERANDS; - case 0x11: return DRC_DWARFv3 | DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_SLEB128_OFFSET | DRC_TWOOPERANDS; - case 0x12: return DRC_DWARFv3 | DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_SLEB128_OFFSET | DRC_TWOOPERANDS; - case 0x13: return DRC_DWARFv3 | DRC_ONEOPERAND | DRC_OPERANDONE_SLEB128_OFFSET; - case 0x1c: return 0; - case 0x3f: return 0; - default: return 0; - } -} - -/* FSF exception handling Pointer-Encoding constants (CFI augmentation) -- "DW_EH_PE_..." in the FSF sources */ - -const char * -DW_GNU_EH_PE_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x00: return "DW_GNU_EH_PE_absptr"; - case 0x01: return "DW_GNU_EH_PE_uleb128"; - case 0x02: return "DW_GNU_EH_PE_udata2"; - case 0x03: return "DW_GNU_EH_PE_udata4"; - case 0x04: return "DW_GNU_EH_PE_udata8"; - case 0x09: return "DW_GNU_EH_PE_sleb128"; - case 0x0a: return "DW_GNU_EH_PE_sdata2"; - case 0x0b: return "DW_GNU_EH_PE_sdata4"; - case 0x0c: return "DW_GNU_EH_PE_sdata8"; - case 0x08: return "DW_GNU_EH_PE_signed"; - case 0x10: return "DW_GNU_EH_PE_pcrel"; - case 0x20: return "DW_GNU_EH_PE_textrel"; - case 0x30: return "DW_GNU_EH_PE_datarel"; - case 0x40: return "DW_GNU_EH_PE_funcrel"; - case 0x50: return "DW_GNU_EH_PE_aligned"; - case 0x80: return "DW_GNU_EH_PE_indirect"; - case 0xff: return "DW_GNU_EH_PE_omit"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_GNU_EH_PE constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_GNU_EH_PE_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x00: return "absptr"; - case 0x01: return "uleb128"; - case 0x02: return "udata2"; - case 0x03: return "udata4"; - case 0x04: return "udata8"; - case 0x09: return "sleb128"; - case 0x0a: return "sdata2"; - case 0x0b: return "sdata4"; - case 0x0c: return "sdata8"; - case 0x08: return "signed"; - case 0x10: return "pcrel"; - case 0x20: return "textrel"; - case 0x30: return "datarel"; - case 0x40: return "funcrel"; - case 0x50: return "aligned"; - case 0x80: return "indirect"; - case 0xff: return "omit"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_GNU_EH_PE constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_GNU_EH_PE_value_to_class (uint32_t val) -{ - switch (val) { - case 0x00: return DRC_VENDOR_GNU; - case 0x01: return DRC_VENDOR_GNU; - case 0x02: return DRC_VENDOR_GNU; - case 0x03: return DRC_VENDOR_GNU; - case 0x04: return DRC_VENDOR_GNU; - case 0x09: return DRC_VENDOR_GNU; - case 0x0a: return DRC_VENDOR_GNU; - case 0x0b: return DRC_VENDOR_GNU; - case 0x0c: return DRC_VENDOR_GNU; - case 0x08: return DRC_VENDOR_GNU; - case 0x10: return DRC_VENDOR_GNU; - case 0x20: return DRC_VENDOR_GNU; - case 0x30: return DRC_VENDOR_GNU; - case 0x40: return DRC_VENDOR_GNU; - case 0x50: return DRC_VENDOR_GNU; - case 0x80: return DRC_VENDOR_GNU; - case 0xff: return DRC_VENDOR_GNU; - default: return 0; - } -} - -bool -is_type_tag (uint16_t tag) -{ - switch (tag) - { - case DW_TAG_array_type: - case DW_TAG_base_type: - case DW_TAG_class_type: - case DW_TAG_const_type: - case DW_TAG_enumeration_type: - case DW_TAG_file_type: - case DW_TAG_interface_type: - case DW_TAG_packed_type: - case DW_TAG_pointer_type: - case DW_TAG_ptr_to_member_type: - case DW_TAG_reference_type: - case DW_TAG_restrict_type: - case DW_TAG_set_type: - case DW_TAG_shared_type: - case DW_TAG_string_type: - case DW_TAG_structure_type: - case DW_TAG_subrange_type: - case DW_TAG_subroutine_type: - case DW_TAG_thrown_type: - case DW_TAG_union_type: - case DW_TAG_unspecified_type: - case DW_TAG_volatile_type: - return true; - default: - return false; - } -} - -bool -is_pubtype_tag (uint16_t tag) -{ - switch (tag) - { - case DW_TAG_array_type: - case DW_TAG_class_type: - case DW_TAG_enumeration_type: - case DW_TAG_file_type: - case DW_TAG_interface_type: - case DW_TAG_set_type: - case DW_TAG_string_type: - case DW_TAG_structure_type: - case DW_TAG_subrange_type: - case DW_TAG_subroutine_type: - case DW_TAG_thrown_type: - case DW_TAG_typedef: - case DW_TAG_union_type: - case DW_TAG_unspecified_type: - return true; - default: - break; - } - return false; -} - -DW_TAG_CategoryEnum -get_tag_category (uint16_t tag) -{ - switch (tag) - { - case DW_TAG_array_type : return TagCategoryType; - case DW_TAG_class_type : return TagCategoryType; - case DW_TAG_entry_point : return TagCategoryProgram; - case DW_TAG_enumeration_type : return TagCategoryType; - case DW_TAG_formal_parameter : return TagCategoryVariable; - case DW_TAG_imported_declaration : return TagCategoryProgram; - case DW_TAG_label : return TagCategoryProgram; - case DW_TAG_lexical_block : return TagCategoryProgram; - case DW_TAG_member : return TagCategoryType; - case DW_TAG_pointer_type : return TagCategoryType; - case DW_TAG_reference_type : return TagCategoryType; - case DW_TAG_compile_unit : return TagCategoryProgram; - case DW_TAG_string_type : return TagCategoryType; - case DW_TAG_structure_type : return TagCategoryType; - case DW_TAG_subroutine_type : return TagCategoryType; - case DW_TAG_typedef : return TagCategoryType; - case DW_TAG_union_type : return TagCategoryType; - case DW_TAG_unspecified_parameters : return TagCategoryVariable; - case DW_TAG_variant : return TagCategoryType; - case DW_TAG_common_block : return TagCategoryProgram; - case DW_TAG_common_inclusion : return TagCategoryProgram; - case DW_TAG_inheritance : return TagCategoryType; - case DW_TAG_inlined_subroutine : return TagCategoryProgram; - case DW_TAG_module : return TagCategoryProgram; - case DW_TAG_ptr_to_member_type : return TagCategoryType; - case DW_TAG_set_type : return TagCategoryType; - case DW_TAG_subrange_type : return TagCategoryType; - case DW_TAG_with_stmt : return TagCategoryProgram; - case DW_TAG_access_declaration : return TagCategoryProgram; - case DW_TAG_base_type : return TagCategoryType; - case DW_TAG_catch_block : return TagCategoryProgram; - case DW_TAG_const_type : return TagCategoryType; - case DW_TAG_constant : return TagCategoryVariable; - case DW_TAG_enumerator : return TagCategoryType; - case DW_TAG_file_type : return TagCategoryType; - case DW_TAG_friend : return TagCategoryType; - case DW_TAG_namelist : return TagCategoryVariable; - case DW_TAG_namelist_item : return TagCategoryVariable; - case DW_TAG_packed_type : return TagCategoryType; - case DW_TAG_subprogram : return TagCategoryProgram; - case DW_TAG_template_type_parameter : return TagCategoryType; - case DW_TAG_template_value_parameter : return TagCategoryType; - case DW_TAG_thrown_type : return TagCategoryType; - case DW_TAG_try_block : return TagCategoryProgram; - case DW_TAG_variant_part : return TagCategoryType; - case DW_TAG_variable : return TagCategoryVariable; - case DW_TAG_volatile_type : return TagCategoryType; - case DW_TAG_dwarf_procedure : return TagCategoryProgram; - case DW_TAG_restrict_type : return TagCategoryType; - case DW_TAG_interface_type : return TagCategoryType; - case DW_TAG_namespace : return TagCategoryProgram; - case DW_TAG_imported_module : return TagCategoryProgram; - case DW_TAG_unspecified_type : return TagCategoryType; - case DW_TAG_partial_unit : return TagCategoryProgram; - case DW_TAG_imported_unit : return TagCategoryProgram; - case DW_TAG_shared_type : return TagCategoryType; - default: break; - } - return TagCategoryProgram; -} - Copied: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp (from r106035, lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp?p2=lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp&p1=lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c&r1=106035&r2=107716&rev=107716&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.c (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp Tue Jul 6 17:38:03 2010 @@ -9,1045 +9,171 @@ #include "DWARFDefines.h" #include +#include +#include "lldb/Core/ConstString.h" -#define DW_TAG_PREFIX "TAG_" -#define DW_AT_PREFIX " AT_" -#define DW_FORM_PREFIX "FORM_" - -/* [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ +namespace lldb_private { const char * DW_TAG_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0000: return DW_TAG_PREFIX "NULL"; - case 0x0001: return DW_TAG_PREFIX "array_type"; - case 0x0002: return DW_TAG_PREFIX "class_type"; - case 0x0003: return DW_TAG_PREFIX "entry_point"; - case 0x0004: return DW_TAG_PREFIX "enumeration_type"; - case 0x0005: return DW_TAG_PREFIX "formal_parameter"; - case 0x0008: return DW_TAG_PREFIX "imported_declaration"; - case 0x000a: return DW_TAG_PREFIX "label"; - case 0x000b: return DW_TAG_PREFIX "lexical_block"; - case 0x000d: return DW_TAG_PREFIX "member"; - case 0x000f: return DW_TAG_PREFIX "pointer_type"; - case 0x0010: return DW_TAG_PREFIX "reference_type"; - case 0x0011: return DW_TAG_PREFIX "compile_unit"; - case 0x0012: return DW_TAG_PREFIX "string_type"; - case 0x0013: return DW_TAG_PREFIX "structure_type"; - case 0x0015: return DW_TAG_PREFIX "subroutine_type"; - case 0x0016: return DW_TAG_PREFIX "typedef"; - case 0x0017: return DW_TAG_PREFIX "union_type"; - case 0x0018: return DW_TAG_PREFIX "unspecified_parameters"; - case 0x0019: return DW_TAG_PREFIX "variant"; - case 0x001a: return DW_TAG_PREFIX "common_block"; - case 0x001b: return DW_TAG_PREFIX "common_inclusion"; - case 0x001c: return DW_TAG_PREFIX "inheritance"; - case 0x001d: return DW_TAG_PREFIX "inlined_subroutine"; - case 0x001e: return DW_TAG_PREFIX "module"; - case 0x001f: return DW_TAG_PREFIX "ptr_to_member_type"; - case 0x0020: return DW_TAG_PREFIX "set_type"; - case 0x0021: return DW_TAG_PREFIX "subrange_type"; - case 0x0022: return DW_TAG_PREFIX "with_stmt"; - case 0x0023: return DW_TAG_PREFIX "access_declaration"; - case 0x0024: return DW_TAG_PREFIX "base_type"; - case 0x0025: return DW_TAG_PREFIX "catch_block"; - case 0x0026: return DW_TAG_PREFIX "const_type"; - case 0x0027: return DW_TAG_PREFIX "constant"; - case 0x0028: return DW_TAG_PREFIX "enumerator"; - case 0x0029: return DW_TAG_PREFIX "file_type"; - case 0x002a: return DW_TAG_PREFIX "friend"; - case 0x002b: return DW_TAG_PREFIX "namelist"; - case 0x002c: return DW_TAG_PREFIX "namelist_item"; - case 0x002d: return DW_TAG_PREFIX "packed_type"; - case 0x002e: return DW_TAG_PREFIX "subprogram"; - case 0x002f: return DW_TAG_PREFIX "template_type_parameter"; - case 0x0030: return DW_TAG_PREFIX "template_value_parameter"; - case 0x0031: return DW_TAG_PREFIX "thrown_type"; - case 0x0032: return DW_TAG_PREFIX "try_block"; - case 0x0033: return DW_TAG_PREFIX "variant_part"; - case 0x0034: return DW_TAG_PREFIX "variable"; - case 0x0035: return DW_TAG_PREFIX "volatile_type"; - case 0x0036: return DW_TAG_PREFIX "dwarf_procedure"; - case 0x0037: return DW_TAG_PREFIX "restrict_type"; - case 0x0038: return DW_TAG_PREFIX "interface_type"; - case 0x0039: return DW_TAG_PREFIX "namespace"; - case 0x003a: return DW_TAG_PREFIX "imported_module"; - case 0x003b: return DW_TAG_PREFIX "unspecified_type"; - case 0x003c: return DW_TAG_PREFIX "partial_unit"; - case 0x003d: return DW_TAG_PREFIX "imported_unit"; -// case 0x003d: return DW_TAG_PREFIX "condition"; - case 0x0040: return DW_TAG_PREFIX "shared_type"; - case 0x4080: return DW_TAG_PREFIX "lo_user"; - case 0xffff: return DW_TAG_PREFIX "hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_TAG constant: 0x%x", val); - return invalid; + + if (val == 0) + return "NULL"; + + const char *llvmstr = TagString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_TAG constant: 0x%x", val); + return invalid; } -} + return llvmstr; +} const char * DW_TAG_value_to_englishy_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0001: return "array type"; - case 0x0002: return "class type"; - case 0x0003: return "entry point"; - case 0x0004: return "enumeration type"; - case 0x0005: return "formal parameter"; - case 0x0008: return "imported declaration"; - case 0x000a: return "label"; - case 0x000b: return "lexical block"; - case 0x000d: return "member"; - case 0x000f: return "pointer type"; - case 0x0010: return "reference type"; - case 0x0011: return "file"; - case 0x0012: return "string type"; - case 0x0013: return "structure type"; - case 0x0015: return "subroutine type"; - case 0x0016: return "typedef"; - case 0x0017: return "union type"; - case 0x0018: return "unspecified parameters"; - case 0x0019: return "variant"; - case 0x001a: return "common block"; - case 0x001b: return "common inclusion"; - case 0x001c: return "inheritance"; - case 0x001d: return "inlined subroutine"; - case 0x001e: return "module"; - case 0x001f: return "ptr to member type"; - case 0x0020: return "set type"; - case 0x0021: return "subrange type"; - case 0x0022: return "with stmt"; - case 0x0023: return "access declaration"; - case 0x0024: return "base type"; - case 0x0025: return "catch block"; - case 0x0026: return "const type"; - case 0x0027: return "constant"; - case 0x0028: return "enumerator"; - case 0x0029: return "file type"; - case 0x002a: return "friend"; - case 0x002b: return "namelist"; - case 0x002c: return "namelist item"; - case 0x002d: return "packed type"; - case 0x002e: return "function"; - case 0x002f: return "template type parameter"; - case 0x0030: return "template value parameter"; - case 0x0031: return "thrown type"; - case 0x0032: return "try block"; - case 0x0033: return "variant part"; - case 0x0034: return "variable"; - case 0x0035: return "volatile type"; - case 0x0036: return "dwarf procedure"; - case 0x0037: return "restrict type"; - case 0x0038: return "interface type"; - case 0x0039: return "namespace"; - case 0x003a: return "imported module"; - case 0x003b: return "unspecified type"; - case 0x003c: return "partial unit"; - case 0x003d: return "imported unit"; -// case 0x003d: return "condition"; - case 0x0040: return "shared type"; - case 0x4080: return "lo user"; - case 0xffff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_TAG constant: 0x%x", val); - return invalid; - } -} -DRC_class -DW_TAG_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0001: return 0; - case 0x0002: return 0; - case 0x0003: return 0; - case 0x0004: return 0; - case 0x0005: return 0; - case 0x0008: return 0; - case 0x000a: return 0; - case 0x000b: return 0; - case 0x000d: return 0; - case 0x000f: return 0; - case 0x0010: return 0; - case 0x0011: return 0; - case 0x0012: return 0; - case 0x0013: return 0; - case 0x0015: return 0; - case 0x0016: return 0; - case 0x0017: return 0; - case 0x0018: return 0; - case 0x0019: return 0; - case 0x001a: return 0; - case 0x001b: return 0; - case 0x001c: return 0; - case 0x001d: return 0; - case 0x001e: return 0; - case 0x001f: return 0; - case 0x0020: return 0; - case 0x0021: return 0; - case 0x0022: return 0; - case 0x0023: return 0; - case 0x0024: return 0; - case 0x0025: return 0; - case 0x0026: return 0; - case 0x0027: return 0; - case 0x0028: return 0; - case 0x0029: return 0; - case 0x002a: return 0; - case 0x002b: return 0; - case 0x002c: return 0; - case 0x002d: return 0; - case 0x002e: return 0; - case 0x002f: return 0; - case 0x0030: return 0; - case 0x0031: return 0; - case 0x0032: return 0; - case 0x0033: return 0; - case 0x0034: return 0; - case 0x0035: return 0; - case 0x0036: return DRC_DWARFv3; - case 0x0037: return DRC_DWARFv3; - case 0x0038: return DRC_DWARFv3; - case 0x0039: return DRC_DWARFv3; - case 0x003a: return DRC_DWARFv3; - case 0x003b: return DRC_DWARFv3; - case 0x003c: return DRC_DWARFv3; - case 0x003d: return DRC_DWARFv3; -// case 0x003d: return DRC_DWARFv3; - case 0x0040: return DRC_DWARFv3; - case 0x4080: return 0; - case 0xffff: return 0; - default: return 0; - } -} + if (val == 0) + return "NULL"; -/* [7.5.4] Figure 17 "Child determination encodings" (p. 128) in DWARFv3 draft 8 */ + const char *llvmstr = TagString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_TAG constant: 0x%x", val); + return invalid; + } + + std::string str; + if (strncmp (llvmstr, "DW_TAG_", 7) == 0) + llvmstr += 7; + + for (const char *i = llvmstr; *i != '\0'; i++) + str += *i == '_' ? ' ' : *i; -const char * -DW_CHILDREN_value_to_name (uint8_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_CHILDREN_no"; - case 0x1: return "DW_CHILDREN_yes"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CHILDREN constant: 0x%x", val); - return invalid; - } + ConstString const_str (str.c_str()); + + return const_str.GetCString(); } const char * -DW_CHILDREN_value_to_englishy_name (uint8_t val) +DW_CHILDREN_value_to_name (uint8_t val) { static char invalid[100]; - switch (val) { - case 0x0: return "no"; - case 0x1: return "yes"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CHILDREN constant: 0x%x", val); + const char *llvmstr = ChildrenString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_CHILDREN constant: 0x%x", val); return invalid; } + return llvmstr; } -DRC_class -DW_CHILDREN_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - default: return 0; - } -} - -/* [7.5.4] Figure 18 "Attribute encodings" (pp. 129-132) in DWARFv3 draft 8 */ - const char * DW_AT_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0001: return DW_AT_PREFIX "sibling"; - case 0x0002: return DW_AT_PREFIX "location"; - case 0x0003: return DW_AT_PREFIX "name"; - case 0x0009: return DW_AT_PREFIX "ordering"; - case 0x000b: return DW_AT_PREFIX "byte_size"; - case 0x000c: return DW_AT_PREFIX "bit_offset"; - case 0x000d: return DW_AT_PREFIX "bit_size"; - case 0x0010: return DW_AT_PREFIX "stmt_list"; - case 0x0011: return DW_AT_PREFIX "low_pc"; - case 0x0012: return DW_AT_PREFIX "high_pc"; - case 0x0013: return DW_AT_PREFIX "language"; - case 0x0015: return DW_AT_PREFIX "discr"; - case 0x0016: return DW_AT_PREFIX "discr_value"; - case 0x0017: return DW_AT_PREFIX "visibility"; - case 0x0018: return DW_AT_PREFIX "import"; - case 0x0019: return DW_AT_PREFIX "string_length"; - case 0x001a: return DW_AT_PREFIX "common_reference"; - case 0x001b: return DW_AT_PREFIX "comp_dir"; - case 0x001c: return DW_AT_PREFIX "const_value"; - case 0x001d: return DW_AT_PREFIX "containing_type"; - case 0x001e: return DW_AT_PREFIX "default_value"; - case 0x0020: return DW_AT_PREFIX "inline"; - case 0x0021: return DW_AT_PREFIX "is_optional"; - case 0x0022: return DW_AT_PREFIX "lower_bound"; - case 0x0025: return DW_AT_PREFIX "producer"; - case 0x0027: return DW_AT_PREFIX "prototyped"; - case 0x002a: return DW_AT_PREFIX "return_addr"; - case 0x002c: return DW_AT_PREFIX "start_scope"; - case 0x002e: return DW_AT_PREFIX "bit_stride"; - case 0x002f: return DW_AT_PREFIX "upper_bound"; - case 0x0031: return DW_AT_PREFIX "abstract_origin"; - case 0x0032: return DW_AT_PREFIX "accessibility"; - case 0x0033: return DW_AT_PREFIX "address_class"; - case 0x0034: return DW_AT_PREFIX "artificial"; - case 0x0035: return DW_AT_PREFIX "base_types"; - case 0x0036: return DW_AT_PREFIX "calling_convention"; - case 0x0037: return DW_AT_PREFIX "count"; - case 0x0038: return DW_AT_PREFIX "data_member_location"; - case 0x0039: return DW_AT_PREFIX "decl_column"; - case 0x003a: return DW_AT_PREFIX "decl_file"; - case 0x003b: return DW_AT_PREFIX "decl_line"; - case 0x003c: return DW_AT_PREFIX "declaration"; - case 0x003d: return DW_AT_PREFIX "discr_list"; - case 0x003e: return DW_AT_PREFIX "encoding"; - case 0x003f: return DW_AT_PREFIX "external"; - case 0x0040: return DW_AT_PREFIX "frame_base"; - case 0x0041: return DW_AT_PREFIX "friend"; - case 0x0042: return DW_AT_PREFIX "identifier_case"; - case 0x0043: return DW_AT_PREFIX "macro_info"; - case 0x0044: return DW_AT_PREFIX "namelist_item"; - case 0x0045: return DW_AT_PREFIX "priority"; - case 0x0046: return DW_AT_PREFIX "segment"; - case 0x0047: return DW_AT_PREFIX "specification"; - case 0x0048: return DW_AT_PREFIX "static_link"; - case 0x0049: return DW_AT_PREFIX "type"; - case 0x004a: return DW_AT_PREFIX "use_location"; - case 0x004b: return DW_AT_PREFIX "variable_parameter"; - case 0x004c: return DW_AT_PREFIX "virtuality"; - case 0x004d: return DW_AT_PREFIX "vtable_elem_location"; - case 0x004e: return DW_AT_PREFIX "allocated"; - case 0x004f: return DW_AT_PREFIX "associated"; - case 0x0050: return DW_AT_PREFIX "data_location"; - case 0x0051: return DW_AT_PREFIX "byte_stride"; - case 0x0052: return DW_AT_PREFIX "entry_pc"; - case 0x0053: return DW_AT_PREFIX "use_UTF8"; - case 0x0054: return DW_AT_PREFIX "extension"; - case 0x0055: return DW_AT_PREFIX "ranges"; - case 0x0056: return DW_AT_PREFIX "trampoline"; - case 0x0057: return DW_AT_PREFIX "call_column"; - case 0x0058: return DW_AT_PREFIX "call_file"; - case 0x0059: return DW_AT_PREFIX "call_line"; - case 0x005a: return DW_AT_PREFIX "description"; - case 0x005b: return DW_AT_PREFIX "binary_scale"; - case 0x005c: return DW_AT_PREFIX "decimal_scale"; - case 0x005d: return DW_AT_PREFIX "small"; - case 0x005e: return DW_AT_PREFIX "decimal_sign"; - case 0x005f: return DW_AT_PREFIX "digit_count"; - case 0x0060: return DW_AT_PREFIX "picture_string"; - case 0x0061: return DW_AT_PREFIX "mutable"; - case 0x0062: return DW_AT_PREFIX "threads_scaled"; - case 0x0063: return DW_AT_PREFIX "explicit"; - case 0x0064: return DW_AT_PREFIX "object_pointer"; - case 0x0065: return DW_AT_PREFIX "endianity"; - case 0x0066: return DW_AT_PREFIX "elemental"; - case 0x0067: return DW_AT_PREFIX "pure"; - case 0x0068: return DW_AT_PREFIX "recursive"; - case 0x2000: return DW_AT_PREFIX "lo_user"; - case 0x3fff: return DW_AT_PREFIX "hi_user"; - case 0x2001: return DW_AT_PREFIX "MIPS_fde"; - case 0x2002: return DW_AT_PREFIX "MIPS_loop_begin"; - case 0x2003: return DW_AT_PREFIX "MIPS_tail_loop_begin"; - case 0x2004: return DW_AT_PREFIX "MIPS_epilog_begin"; - case 0x2005: return DW_AT_PREFIX "MIPS_loop_unroll_factor"; - case 0x2006: return DW_AT_PREFIX "MIPS_software_pipeline_depth"; - case 0x2007: return DW_AT_PREFIX "MIPS_linkage_name"; - case 0x2008: return DW_AT_PREFIX "MIPS_stride"; - case 0x2009: return DW_AT_PREFIX "MIPS_abstract_name"; - case 0x200a: return DW_AT_PREFIX "MIPS_clone_origin"; - case 0x200b: return DW_AT_PREFIX "MIPS_has_inlines"; - case 0x2101: return DW_AT_PREFIX "sf_names"; - case 0x2102: return DW_AT_PREFIX "src_info"; - case 0x2103: return DW_AT_PREFIX "mac_info"; - case 0x2104: return DW_AT_PREFIX "src_coords"; - case 0x2105: return DW_AT_PREFIX "body_begin"; - case 0x2106: return DW_AT_PREFIX "body_end"; - case 0x2107: return DW_AT_PREFIX "GNU_vector"; - case 0x2501: return DW_AT_PREFIX "APPLE_repository_file"; - case 0x2502: return DW_AT_PREFIX "APPLE_repository_type"; - case 0x2503: return DW_AT_PREFIX "APPLE_repository_name"; - case 0x2504: return DW_AT_PREFIX "APPLE_repository_specification"; - case 0x2505: return DW_AT_PREFIX "APPLE_repository_import"; - case 0x2506: return DW_AT_PREFIX "APPLE_repository_abstract_origin"; - case DW_AT_APPLE_flags: return DW_AT_PREFIX "APPLE_flags"; - case DW_AT_APPLE_optimized: return DW_AT_PREFIX "APPLE_optimized"; - case DW_AT_APPLE_isa: return DW_AT_PREFIX "APPLE_isa"; - case DW_AT_APPLE_block: return DW_AT_PREFIX "APPLE_block"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_AT constant: 0x%x", val); - return invalid; + const char *llvmstr = AttributeString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_AT constant: 0x%x", val); + return invalid; } + return llvmstr; } const char * DW_AT_value_to_englishy_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0001: return "sibling"; - case 0x0002: return "location"; - case 0x0003: return "name"; - case 0x0009: return "ordering"; - case 0x000b: return "byte size"; - case 0x000c: return "bit offset"; - case 0x000d: return "bit size"; - case 0x0010: return "stmt list"; - case 0x0011: return "low pc"; - case 0x0012: return "high pc"; - case 0x0013: return "language"; - case 0x0015: return "discr"; - case 0x0016: return "discr value"; - case 0x0017: return "visibility"; - case 0x0018: return "import"; - case 0x0019: return "string length"; - case 0x001a: return "common reference"; - case 0x001b: return "comp dir"; - case 0x001c: return "const value"; - case 0x001d: return "containing type"; - case 0x001e: return "default value"; - case 0x0020: return "inline"; - case 0x0021: return "is optional"; - case 0x0022: return "lower bound"; - case 0x0025: return "producer"; - case 0x0027: return "prototyped"; - case 0x002a: return "return addr"; - case 0x002c: return "start scope"; - case 0x002e: return "bit stride"; - case 0x002f: return "upper bound"; - case 0x0031: return "abstract origin"; - case 0x0032: return "accessibility"; - case 0x0033: return "address class"; - case 0x0034: return "artificial"; - case 0x0035: return "base types"; - case 0x0036: return "calling convention"; - case 0x0037: return "count"; - case 0x0038: return "data member location"; - case 0x0039: return "decl column"; - case 0x003a: return "decl file"; - case 0x003b: return "decl line"; - case 0x003c: return "declaration"; - case 0x003d: return "discr list"; - case 0x003e: return "encoding"; - case 0x003f: return "external"; - case 0x0040: return "frame base"; - case 0x0041: return "friend"; - case 0x0042: return "identifier case"; - case 0x0043: return "macro info"; - case 0x0044: return "namelist item"; - case 0x0045: return "priority"; - case 0x0046: return "segment"; - case 0x0047: return "specification"; - case 0x0048: return "static link"; - case 0x0049: return "type"; - case 0x004a: return "use location"; - case 0x004b: return "variable parameter"; - case 0x004c: return "virtuality"; - case 0x004d: return "vtable elem location"; - case 0x004e: return "allocated"; - case 0x004f: return "associated"; - case 0x0050: return "data location"; - case 0x0051: return "byte stride"; - case 0x0052: return "entry pc"; - case 0x0053: return "use UTF8"; - case 0x0054: return "extension"; - case 0x0055: return "ranges"; - case 0x0056: return "trampoline"; - case 0x0057: return "call column"; - case 0x0058: return "call file"; - case 0x0059: return "call line"; - case 0x005a: return "description"; - case 0x005b: return "binary scale"; - case 0x005c: return "decimal scale"; - case 0x005d: return "small"; - case 0x005e: return "decimal sign"; - case 0x005f: return "digit count"; - case 0x0060: return "picture string"; - case 0x0061: return "mutable"; - case 0x0062: return "threads scaled"; - case 0x0063: return "explicit"; - case 0x0064: return "object pointer"; - case 0x0065: return "endianity"; - case 0x0066: return "elemental"; - case 0x0067: return "pure"; - case 0x0068: return "recursive"; - case 0x2000: return "lo user"; - case 0x3fff: return "hi user"; - case 0x2001: return "MIPS fde"; - case 0x2002: return "MIPS loop begin"; - case 0x2003: return "MIPS tail loop begin"; - case 0x2004: return "MIPS epilog begin"; - case 0x2005: return "MIPS loop unroll factor"; - case 0x2006: return "MIPS software pipeline depth"; - case 0x2007: return "MIPS linkage name"; - case 0x2008: return "MIPS stride"; - case 0x2009: return "MIPS abstract name"; - case 0x200a: return "MIPS clone origin"; - case 0x200b: return "MIPS has inlines"; - case 0x2101: return "source file names"; - case 0x2102: return "source info"; - case 0x2103: return "macro info"; - case 0x2104: return "source coordinates"; - case 0x2105: return "body begin"; - case 0x2106: return "body end"; - case 0x2107: return "GNU vector"; - case 0x2501: return "repository file"; - case 0x2502: return "repository type"; - case 0x2503: return "repository name"; - case 0x2504: return "repository specification"; - case 0x2505: return "repository import"; - case 0x2506: return "repository abstract origin"; - case DW_AT_APPLE_flags: return "Apple gcc compiler flags"; - case DW_AT_APPLE_optimized: return "APPLE optimized"; - case DW_AT_APPLE_isa: return "APPLE instruction set architecture"; - case DW_AT_APPLE_block: return "APPLE block"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_AT constant: 0x%x", val); - return invalid; - } -} + const char *llvmstr = AttributeString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_AT constant: 0x%x", val); + return invalid; + } + + std::string str; + if (strncmp (llvmstr, "DW_AT_", 6) == 0) + llvmstr += 6; -DRC_class -DW_AT_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0001: return DRC_REFERENCE; - case 0x0002: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0003: return DRC_STRING; - case 0x0009: return DRC_CONSTANT; - case 0x000b: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x000c: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x000d: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0010: return DRC_LINEPTR; - case 0x0011: return DRC_ADDRESS; - case 0x0012: return DRC_ADDRESS; - case 0x0013: return DRC_CONSTANT; - case 0x0015: return DRC_REFERENCE; - case 0x0016: return DRC_CONSTANT; - case 0x0017: return DRC_CONSTANT; - case 0x0018: return DRC_REFERENCE; - case 0x0019: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x001a: return DRC_REFERENCE; - case 0x001b: return DRC_STRING; - case 0x001c: return DRC_BLOCK | DRC_CONSTANT | DRC_STRING; - case 0x001d: return DRC_REFERENCE; - case 0x001e: return DRC_REFERENCE; - case 0x0020: return DRC_CONSTANT; - case 0x0021: return DRC_FLAG; - case 0x0022: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0025: return DRC_STRING; - case 0x0027: return DRC_FLAG; - case 0x002a: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x002c: return DRC_CONSTANT; - case 0x002e: return DRC_CONSTANT; - case 0x002f: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0031: return DRC_REFERENCE; - case 0x0032: return DRC_CONSTANT; - case 0x0033: return DRC_CONSTANT; - case 0x0034: return DRC_FLAG; - case 0x0035: return DRC_REFERENCE; - case 0x0036: return DRC_CONSTANT; - case 0x0037: return DRC_BLOCK | DRC_CONSTANT | DRC_REFERENCE; - case 0x0038: return DRC_BLOCK | DRC_CONSTANT | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0039: return DRC_CONSTANT; - case 0x003a: return DRC_CONSTANT; - case 0x003b: return DRC_CONSTANT; - case 0x003c: return DRC_FLAG; - case 0x003d: return DRC_BLOCK; - case 0x003e: return DRC_CONSTANT; - case 0x003f: return DRC_FLAG; - case 0x0040: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0041: return DRC_REFERENCE; - case 0x0042: return DRC_CONSTANT; - case 0x0043: return DRC_MACPTR; - case 0x0044: return DRC_BLOCK; - case 0x0045: return DRC_REFERENCE; - case 0x0046: return DRC_BLOCK | DRC_CONSTANT; - case 0x0047: return DRC_REFERENCE; - case 0x0048: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x0049: return DRC_REFERENCE; - case 0x004a: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x004b: return DRC_FLAG; - case 0x004c: return DRC_CONSTANT; - case 0x004d: return DRC_BLOCK | DRC_LOCEXPR | DRC_LOCLISTPTR; - case 0x004e: return DRC_BLOCK | DRC_CONSTANT | DRC_DWARFv3 | DRC_REFERENCE; - case 0x004f: return DRC_BLOCK | DRC_CONSTANT | DRC_DWARFv3 | DRC_REFERENCE; - case 0x0050: return DRC_BLOCK | DRC_DWARFv3; - case 0x0051: return DRC_BLOCK | DRC_CONSTANT | DRC_DWARFv3 | DRC_REFERENCE; - case 0x0052: return DRC_ADDRESS | DRC_DWARFv3; - case 0x0053: return DRC_DWARFv3 | DRC_FLAG; - case 0x0054: return DRC_DWARFv3 | DRC_REFERENCE; - case 0x0055: return DRC_DWARFv3 | DRC_RANGELISTPTR; - case 0x0056: return DRC_ADDRESS | DRC_DWARFv3 | DRC_FLAG | DRC_REFERENCE | DRC_STRING; - case 0x0057: return DRC_CONSTANT | DRC_DWARFv3; - case 0x0058: return DRC_CONSTANT | DRC_DWARFv3; - case 0x0059: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005a: return DRC_DWARFv3 | DRC_STRING; - case 0x005b: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005c: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005d: return DRC_DWARFv3 | DRC_REFERENCE; - case 0x005e: return DRC_CONSTANT | DRC_DWARFv3; - case 0x005f: return DRC_CONSTANT | DRC_DWARFv3; - case 0x0060: return DRC_DWARFv3 | DRC_STRING; - case 0x0061: return DRC_DWARFv3 | DRC_FLAG; - case 0x0062: return DRC_DWARFv3 | DRC_FLAG; - case 0x0063: return DRC_DWARFv3 | DRC_FLAG; - case 0x0064: return DRC_DWARFv3 | DRC_REFERENCE; - case 0x0065: return DRC_0x65 | DRC_CONSTANT | DRC_DWARFv3; - case 0x0066: return DRC_DWARFv3 | DRC_FLAG; - case 0x0067: return DRC_DWARFv3 | DRC_FLAG; - case 0x0068: return DRC_DWARFv3 | DRC_FLAG; - case 0x2000: return 0; - case 0x3fff: return 0; - case 0x2001: return DRC_VENDOR_MIPS; - case 0x2002: return DRC_VENDOR_MIPS; - case 0x2003: return DRC_VENDOR_MIPS; - case 0x2004: return DRC_VENDOR_MIPS; - case 0x2005: return DRC_VENDOR_MIPS; - case 0x2006: return DRC_VENDOR_MIPS; - case 0x2007: return DRC_STRING | DRC_VENDOR_MIPS; - case 0x2008: return DRC_VENDOR_MIPS; - case 0x2009: return DRC_VENDOR_MIPS; - case 0x200a: return DRC_VENDOR_MIPS; - case 0x200b: return DRC_VENDOR_MIPS; - default: return 0; - } -} + for (const char *i = llvmstr; *i != '\0'; i++) + str += *i == '_' ? ' ' : *i; -/* [7.5.4] Figure 19 "Attribute form encodings" (pp. 133-134) in DWARFv3 draft 8 */ + ConstString const_str (str.c_str()); + return const_str.GetCString(); +} const char * DW_FORM_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x01: return DW_FORM_PREFIX "addr"; - case 0x03: return DW_FORM_PREFIX "block2"; - case 0x04: return DW_FORM_PREFIX "block4"; - case 0x05: return DW_FORM_PREFIX "data2"; - case 0x06: return DW_FORM_PREFIX "data4"; - case 0x07: return DW_FORM_PREFIX "data8"; - case 0x08: return DW_FORM_PREFIX "string"; - case 0x09: return DW_FORM_PREFIX "block"; - case 0x0a: return DW_FORM_PREFIX "block1"; - case 0x0b: return DW_FORM_PREFIX "data1"; - case 0x0c: return DW_FORM_PREFIX "flag"; - case 0x0d: return DW_FORM_PREFIX "sdata"; - case 0x0e: return DW_FORM_PREFIX "strp"; - case 0x0f: return DW_FORM_PREFIX "udata"; - case 0x10: return DW_FORM_PREFIX "ref_addr"; - case 0x11: return DW_FORM_PREFIX "ref1"; - case 0x12: return DW_FORM_PREFIX "ref2"; - case 0x13: return DW_FORM_PREFIX "ref4"; - case 0x14: return DW_FORM_PREFIX "ref8"; - case 0x15: return DW_FORM_PREFIX "ref_udata"; - case 0x16: return DW_FORM_PREFIX "indirect"; -// case DW_FORM_APPLE_db_str: return DW_FORM_PREFIX "APPLE_db_str"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_FORM constant: 0x%x", val); - return invalid; + const char *llvmstr = FormEncodingString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_FORM constant: 0x%x", val); + return invalid; } + return llvmstr; } const char * DW_FORM_value_to_englishy_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x01: return "addr"; - case 0x03: return "block2"; - case 0x04: return "block4"; - case 0x05: return "data2"; - case 0x06: return "data4"; - case 0x07: return "data8"; - case 0x08: return "string"; - case 0x09: return "block"; - case 0x0a: return "block1"; - case 0x0b: return "data1"; - case 0x0c: return "flag"; - case 0x0d: return "sdata"; - case 0x0e: return "strp"; - case 0x0f: return "udata"; - case 0x10: return "ref addr"; - case 0x11: return "ref1"; - case 0x12: return "ref2"; - case 0x13: return "ref4"; - case 0x14: return "ref8"; - case 0x15: return "ref udata"; - case 0x16: return "indirect"; -// case DW_FORM_APPLE_db_str: return "repository str"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_FORM constant: 0x%x", val); - return invalid; - } -} + const char *llvmstr = FormEncodingString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_FORM constant: 0x%x", val); + return invalid; + } + + std::string str; + if (strncmp (llvmstr, "DW_FORM_", 8) == 0) + llvmstr += 8; -DRC_class -DW_FORM_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return DRC_ADDRESS; - case 0x03: return DRC_BLOCK | DRC_LOCEXPR; - case 0x04: return DRC_BLOCK | DRC_LOCEXPR; - case 0x05: return DRC_CONSTANT; - case 0x06: return DRC_CONSTANT | DRC_LINEPTR | DRC_LOCLISTPTR | DRC_MACPTR | DRC_RANGELISTPTR; - case 0x07: return DRC_CONSTANT | DRC_LINEPTR | DRC_LOCLISTPTR | DRC_MACPTR | DRC_RANGELISTPTR; - case 0x08: return DRC_STRING; - case 0x09: return DRC_BLOCK | DRC_LOCEXPR; - case 0x0a: return DRC_BLOCK | DRC_LOCEXPR; - case 0x0b: return DRC_CONSTANT; - case 0x0c: return DRC_FLAG; - case 0x0d: return DRC_CONSTANT; - case 0x0e: return DRC_STRING; - case 0x0f: return DRC_CONSTANT; - case 0x10: return DRC_REFERENCE; - case 0x11: return DRC_REFERENCE; - case 0x12: return DRC_REFERENCE; - case 0x13: return DRC_REFERENCE; - case 0x14: return DRC_REFERENCE; - case 0x15: return DRC_REFERENCE; - case 0x16: return DRC_INDIRECT_SPECIAL; - default: return 0; - } -} + for (const char *i = llvmstr; *i != '\0'; i++) + str += *i == '_' ? ' ' : *i; -/* [7.7.1] Figure 22 "DWARF operation encodings" (pp. 136-139) in DWARFv3 draft 8 */ + ConstString const_str (str.c_str()); + return const_str.GetCString(); +} const char * DW_OP_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x03: return "DW_OP_addr"; - case 0x06: return "DW_OP_deref"; - case 0x08: return "DW_OP_const1u"; - case 0x09: return "DW_OP_const1s"; - case 0x0a: return "DW_OP_const2u"; - case 0x0b: return "DW_OP_const2s"; - case 0x0c: return "DW_OP_const4u"; - case 0x0d: return "DW_OP_const4s"; - case 0x0e: return "DW_OP_const8u"; - case 0x0f: return "DW_OP_const8s"; - case 0x10: return "DW_OP_constu"; - case 0x11: return "DW_OP_consts"; - case 0x12: return "DW_OP_dup"; - case 0x13: return "DW_OP_drop"; - case 0x14: return "DW_OP_over"; - case 0x15: return "DW_OP_pick"; - case 0x16: return "DW_OP_swap"; - case 0x17: return "DW_OP_rot"; - case 0x18: return "DW_OP_xderef"; - case 0x19: return "DW_OP_abs"; - case 0x1a: return "DW_OP_and"; - case 0x1b: return "DW_OP_div"; - case 0x1c: return "DW_OP_minus"; - case 0x1d: return "DW_OP_mod"; - case 0x1e: return "DW_OP_mul"; - case 0x1f: return "DW_OP_neg"; - case 0x20: return "DW_OP_not"; - case 0x21: return "DW_OP_or"; - case 0x22: return "DW_OP_plus"; - case 0x23: return "DW_OP_plus_uconst"; - case 0x24: return "DW_OP_shl"; - case 0x25: return "DW_OP_shr"; - case 0x26: return "DW_OP_shra"; - case 0x27: return "DW_OP_xor"; - case 0x2f: return "DW_OP_skip"; - case 0x28: return "DW_OP_bra"; - case 0x29: return "DW_OP_eq"; - case 0x2a: return "DW_OP_ge"; - case 0x2b: return "DW_OP_gt"; - case 0x2c: return "DW_OP_le"; - case 0x2d: return "DW_OP_lt"; - case 0x2e: return "DW_OP_ne"; - case 0x30: return "DW_OP_lit0"; - case 0x31: return "DW_OP_lit1"; - case 0x32: return "DW_OP_lit2"; - case 0x33: return "DW_OP_lit3"; - case 0x34: return "DW_OP_lit4"; - case 0x35: return "DW_OP_lit5"; - case 0x36: return "DW_OP_lit6"; - case 0x37: return "DW_OP_lit7"; - case 0x38: return "DW_OP_lit8"; - case 0x39: return "DW_OP_lit9"; - case 0x3a: return "DW_OP_lit10"; - case 0x3b: return "DW_OP_lit11"; - case 0x3c: return "DW_OP_lit12"; - case 0x3d: return "DW_OP_lit13"; - case 0x3e: return "DW_OP_lit14"; - case 0x3f: return "DW_OP_lit15"; - case 0x40: return "DW_OP_lit16"; - case 0x41: return "DW_OP_lit17"; - case 0x42: return "DW_OP_lit18"; - case 0x43: return "DW_OP_lit19"; - case 0x44: return "DW_OP_lit20"; - case 0x45: return "DW_OP_lit21"; - case 0x46: return "DW_OP_lit22"; - case 0x47: return "DW_OP_lit23"; - case 0x48: return "DW_OP_lit24"; - case 0x49: return "DW_OP_lit25"; - case 0x4a: return "DW_OP_lit26"; - case 0x4b: return "DW_OP_lit27"; - case 0x4c: return "DW_OP_lit28"; - case 0x4d: return "DW_OP_lit29"; - case 0x4e: return "DW_OP_lit30"; - case 0x4f: return "DW_OP_lit31"; - case 0x50: return "DW_OP_reg0"; - case 0x51: return "DW_OP_reg1"; - case 0x52: return "DW_OP_reg2"; - case 0x53: return "DW_OP_reg3"; - case 0x54: return "DW_OP_reg4"; - case 0x55: return "DW_OP_reg5"; - case 0x56: return "DW_OP_reg6"; - case 0x57: return "DW_OP_reg7"; - case 0x58: return "DW_OP_reg8"; - case 0x59: return "DW_OP_reg9"; - case 0x5a: return "DW_OP_reg10"; - case 0x5b: return "DW_OP_reg11"; - case 0x5c: return "DW_OP_reg12"; - case 0x5d: return "DW_OP_reg13"; - case 0x5e: return "DW_OP_reg14"; - case 0x5f: return "DW_OP_reg15"; - case 0x60: return "DW_OP_reg16"; - case 0x61: return "DW_OP_reg17"; - case 0x62: return "DW_OP_reg18"; - case 0x63: return "DW_OP_reg19"; - case 0x64: return "DW_OP_reg20"; - case 0x65: return "DW_OP_reg21"; - case 0x66: return "DW_OP_reg22"; - case 0x67: return "DW_OP_reg23"; - case 0x68: return "DW_OP_reg24"; - case 0x69: return "DW_OP_reg25"; - case 0x6a: return "DW_OP_reg26"; - case 0x6b: return "DW_OP_reg27"; - case 0x6c: return "DW_OP_reg28"; - case 0x6d: return "DW_OP_reg29"; - case 0x6e: return "DW_OP_reg30"; - case 0x6f: return "DW_OP_reg31"; - case 0x70: return "DW_OP_breg0"; - case 0x71: return "DW_OP_breg1"; - case 0x72: return "DW_OP_breg2"; - case 0x73: return "DW_OP_breg3"; - case 0x74: return "DW_OP_breg4"; - case 0x75: return "DW_OP_breg5"; - case 0x76: return "DW_OP_breg6"; - case 0x77: return "DW_OP_breg7"; - case 0x78: return "DW_OP_breg8"; - case 0x79: return "DW_OP_breg9"; - case 0x7a: return "DW_OP_breg10"; - case 0x7b: return "DW_OP_breg11"; - case 0x7c: return "DW_OP_breg12"; - case 0x7d: return "DW_OP_breg13"; - case 0x7e: return "DW_OP_breg14"; - case 0x7f: return "DW_OP_breg15"; - case 0x80: return "DW_OP_breg16"; - case 0x81: return "DW_OP_breg17"; - case 0x82: return "DW_OP_breg18"; - case 0x83: return "DW_OP_breg19"; - case 0x84: return "DW_OP_breg20"; - case 0x85: return "DW_OP_breg21"; - case 0x86: return "DW_OP_breg22"; - case 0x87: return "DW_OP_breg23"; - case 0x88: return "DW_OP_breg24"; - case 0x89: return "DW_OP_breg25"; - case 0x8a: return "DW_OP_breg26"; - case 0x8b: return "DW_OP_breg27"; - case 0x8c: return "DW_OP_breg28"; - case 0x8d: return "DW_OP_breg29"; - case 0x8e: return "DW_OP_breg30"; - case 0x8f: return "DW_OP_breg31"; - case 0x90: return "DW_OP_regx"; - case 0x91: return "DW_OP_fbreg"; - case 0x92: return "DW_OP_bregx"; - case 0x93: return "DW_OP_piece"; - case 0x94: return "DW_OP_deref_size"; - case 0x95: return "DW_OP_xderef_size"; - case 0x96: return "DW_OP_nop"; - case 0x97: return "DW_OP_push_object_address"; - case 0x98: return "DW_OP_call2"; - case 0x99: return "DW_OP_call4"; - case 0x9a: return "DW_OP_call_ref"; - case 0xf0: return "DW_OP_APPLE_uninit"; - case 0xe0: return "DW_OP_lo_user"; - case 0xff: return "DW_OP_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_OP constant: 0x%x", val); - return invalid; + const char *llvmstr = OperationEncodingString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_OP constant: 0x%x", val); + return invalid; } + return llvmstr; } const char * DW_OP_value_to_englishy_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x03: return "addr"; - case 0x06: return "deref"; - case 0x08: return "const1u"; - case 0x09: return "const1s"; - case 0x0a: return "const2u"; - case 0x0b: return "const2s"; - case 0x0c: return "const4u"; - case 0x0d: return "const4s"; - case 0x0e: return "const8u"; - case 0x0f: return "const8s"; - case 0x10: return "constu"; - case 0x11: return "consts"; - case 0x12: return "dup"; - case 0x13: return "drop"; - case 0x14: return "over"; - case 0x15: return "pick"; - case 0x16: return "swap"; - case 0x17: return "rot"; - case 0x18: return "xderef"; - case 0x19: return "abs"; - case 0x1a: return "and"; - case 0x1b: return "div"; - case 0x1c: return "minus"; - case 0x1d: return "mod"; - case 0x1e: return "mul"; - case 0x1f: return "neg"; - case 0x20: return "not"; - case 0x21: return "or"; - case 0x22: return "plus"; - case 0x23: return "plus uconst"; - case 0x24: return "shl"; - case 0x25: return "shr"; - case 0x26: return "shra"; - case 0x27: return "xor"; - case 0x2f: return "skip"; - case 0x28: return "bra"; - case 0x29: return "eq"; - case 0x2a: return "ge"; - case 0x2b: return "gt"; - case 0x2c: return "le"; - case 0x2d: return "lt"; - case 0x2e: return "ne"; - case 0x30: return "lit0"; - case 0x31: return "lit1"; - case 0x32: return "lit2"; - case 0x33: return "lit3"; - case 0x34: return "lit4"; - case 0x35: return "lit5"; - case 0x36: return "lit6"; - case 0x37: return "lit7"; - case 0x38: return "lit8"; - case 0x39: return "lit9"; - case 0x3a: return "lit10"; - case 0x3b: return "lit11"; - case 0x3c: return "lit12"; - case 0x3d: return "lit13"; - case 0x3e: return "lit14"; - case 0x3f: return "lit15"; - case 0x40: return "lit16"; - case 0x41: return "lit17"; - case 0x42: return "lit18"; - case 0x43: return "lit19"; - case 0x44: return "lit20"; - case 0x45: return "lit21"; - case 0x46: return "lit22"; - case 0x47: return "lit23"; - case 0x48: return "lit24"; - case 0x49: return "lit25"; - case 0x4a: return "lit26"; - case 0x4b: return "lit27"; - case 0x4c: return "lit28"; - case 0x4d: return "lit29"; - case 0x4e: return "lit30"; - case 0x4f: return "lit31"; - case 0x50: return "reg0"; - case 0x51: return "reg1"; - case 0x52: return "reg2"; - case 0x53: return "reg3"; - case 0x54: return "reg4"; - case 0x55: return "reg5"; - case 0x56: return "reg6"; - case 0x57: return "reg7"; - case 0x58: return "reg8"; - case 0x59: return "reg9"; - case 0x5a: return "reg10"; - case 0x5b: return "reg11"; - case 0x5c: return "reg12"; - case 0x5d: return "reg13"; - case 0x5e: return "reg14"; - case 0x5f: return "reg15"; - case 0x60: return "reg16"; - case 0x61: return "reg17"; - case 0x62: return "reg18"; - case 0x63: return "reg19"; - case 0x64: return "reg20"; - case 0x65: return "reg21"; - case 0x66: return "reg22"; - case 0x67: return "reg23"; - case 0x68: return "reg24"; - case 0x69: return "reg25"; - case 0x6a: return "reg26"; - case 0x6b: return "reg27"; - case 0x6c: return "reg28"; - case 0x6d: return "reg29"; - case 0x6e: return "reg30"; - case 0x6f: return "reg31"; - case 0x70: return "breg0"; - case 0x71: return "breg1"; - case 0x72: return "breg2"; - case 0x73: return "breg3"; - case 0x74: return "breg4"; - case 0x75: return "breg5"; - case 0x76: return "breg6"; - case 0x77: return "breg7"; - case 0x78: return "breg8"; - case 0x79: return "breg9"; - case 0x7a: return "breg10"; - case 0x7b: return "breg11"; - case 0x7c: return "breg12"; - case 0x7d: return "breg13"; - case 0x7e: return "breg14"; - case 0x7f: return "breg15"; - case 0x80: return "breg16"; - case 0x81: return "breg17"; - case 0x82: return "breg18"; - case 0x83: return "breg19"; - case 0x84: return "breg20"; - case 0x85: return "breg21"; - case 0x86: return "breg22"; - case 0x87: return "breg23"; - case 0x88: return "breg24"; - case 0x89: return "breg25"; - case 0x8a: return "breg26"; - case 0x8b: return "breg27"; - case 0x8c: return "breg28"; - case 0x8d: return "breg29"; - case 0x8e: return "breg30"; - case 0x8f: return "breg31"; - case 0x90: return "regx"; - case 0x91: return "fbreg"; - case 0x92: return "bregx"; - case 0x93: return "piece"; - case 0x94: return "deref size"; - case 0x95: return "xderef size"; - case 0x96: return "nop"; - case 0x97: return "push object address"; - case 0x98: return "call2"; - case 0x99: return "call4"; - case 0x9a: return "call ref"; - case 0xf0: return "uninitialized"; - case 0xe0: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_OP constant: 0x%x", val); - return invalid; - } + const char *llvmstr = OperationEncodingString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_OP constant: 0x%x", val); + return invalid; + } + + std::string str; + if (strncmp (llvmstr, "DW_OP_", 6) == 0) + llvmstr += 6; + + for (const char *i = llvmstr; *i != '\0'; i++) + str += *i == '_' ? ' ' : *i; + + ConstString const_str (str.c_str()); + return const_str.GetCString(); } DRC_class @@ -1210,950 +336,187 @@ } } -/* [7.8] Figure 23 "Base type encoding values" (pp. 140-141) in DWARFv3 draft 8 */ - const char * DW_ATE_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x01: return "DW_ATE_address"; - case 0x02: return "DW_ATE_boolean"; - case 0x03: return "DW_ATE_complex_float"; - case 0x04: return "DW_ATE_float"; - case 0x05: return "DW_ATE_signed"; - case 0x06: return "DW_ATE_signed_char"; - case 0x07: return "DW_ATE_unsigned"; - case 0x08: return "DW_ATE_unsigned_char"; - case 0x09: return "DW_ATE_imaginary_float"; - case 0x80: return "DW_ATE_lo_user"; - case 0xff: return "DW_ATE_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ATE constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ATE_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "address"; - case 0x02: return "boolean"; - case 0x03: return "complex float"; - case 0x04: return "float"; - case 0x05: return "signed"; - case 0x06: return "signed char"; - case 0x07: return "unsigned"; - case 0x08: return "unsigned char"; - case 0x09: return "imaginary float"; - case 0x80: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ATE constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ATE_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x04: return 0; - case 0x05: return 0; - case 0x06: return 0; - case 0x07: return 0; - case 0x08: return 0; - case 0x09: return DRC_DWARFv3; - case 0x80: return 0; - case 0xff: return 0; - default: return 0; + const char *llvmstr = AttributeEncodingString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_ATE constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.9] Figure 24 "Accessibility encodings" (p. 141) in DWARFv3 draft 8 */ - const char * DW_ACCESS_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x1: return "DW_ACCESS_public"; - case 0x2: return "DW_ACCESS_protected"; - case 0x3: return "DW_ACCESS_private"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ACCESS constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ACCESS_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "public"; - case 0x2: return "protected"; - case 0x3: return "private"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ACCESS constant: 0x%x", val); - return invalid; - } -} -DRC_class -DW_ACCESS_value_to_class (uint32_t val) -{ - switch (val) { - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; + const char *llvmstr = AccessibilityString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_ACCESS constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.10] Figure 25 "Visibility encodings" (p. 142) in DWARFv3 draft 8 */ - const char * DW_VIS_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x1: return "DW_VIS_local"; - case 0x2: return "DW_VIS_exported"; - case 0x3: return "DW_VIS_qualified"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIS constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_VIS_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "local"; - case 0x2: return "exported"; - case 0x3: return "qualified"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIS constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_VIS_value_to_class (uint32_t val) -{ - switch (val) { - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; + const char *llvmstr = VisibilityString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_VIS constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.11] Figure 26 "Virtuality encodings" (p. 142) in DWARFv3 draft 8 */ - const char * DW_VIRTUALITY_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0: return "DW_VIRTUALITY_none"; - case 0x1: return "DW_VIRTUALITY_virtual"; - case 0x2: return "DW_VIRTUALITY_pure_virtual"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIRTUALITY constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_VIRTUALITY_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "none"; - case 0x1: return "virtual"; - case 0x2: return "pure virtual"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_VIRTUALITY constant: 0x%x", val); - return invalid; + const char *llvmstr = VirtualityString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_VIRTUALITY constant: 0x%x", val); + return invalid; } + return llvmstr; } -DRC_class -DW_VIRTUALITY_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - case 0x2: return 0; - default: return 0; - } -} - -/* [7.12] Figure 27 "Language encodings" (p. 143) in DWARFv3 draft 8 */ - const char * DW_LANG_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0001: return "DW_LANG_C89"; - case 0x0002: return "DW_LANG_C"; - case 0x0003: return "DW_LANG_Ada83"; - case 0x0004: return "DW_LANG_C_plus_plus"; - case 0x0005: return "DW_LANG_Cobol74"; - case 0x0006: return "DW_LANG_Cobol85"; - case 0x0007: return "DW_LANG_Fortran77"; - case 0x0008: return "DW_LANG_Fortran90"; - case 0x0009: return "DW_LANG_Pascal83"; - case 0x000a: return "DW_LANG_Modula2"; - case 0x000b: return "DW_LANG_Java"; - case 0x000c: return "DW_LANG_C99"; - case 0x000d: return "DW_LANG_Ada95"; - case 0x000e: return "DW_LANG_Fortran95"; - case 0x000f: return "DW_LANG_PLI"; - case 0x0010: return "DW_LANG_ObjC"; - case 0x0011: return "DW_LANG_ObjC_plus_plus"; - case 0x0012: return "DW_LANG_UPC"; - case 0x0013: return "DW_LANG_D"; - case 0x8000: return "DW_LANG_lo_user"; - case 0x8001: return "DW_LANG_Mips_Assembler"; - case 0x8765: return "DW_LANG_Upc"; - case 0xffff: return "DW_LANG_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LANG constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_LANG_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0001: return "C89"; - case 0x0002: return "C"; - case 0x0003: return "Ada83"; - case 0x0004: return "C++"; - case 0x0005: return "Cobol74"; - case 0x0006: return "Cobol85"; - case 0x0007: return "Fortran77"; - case 0x0008: return "Fortran90"; - case 0x0009: return "Pascal83"; - case 0x000a: return "Modula2"; - case 0x000b: return "Java"; - case 0x000c: return "C99"; - case 0x000d: return "Ada95"; - case 0x000e: return "Fortran95"; - case 0x000f: return "PLI"; - case 0x0010: return "Objective C"; - case 0x0011: return "Objective C++"; - case 0x0012: return "UPC"; - case 0x0013: return "D"; - case 0x8000: return "lo user"; - case 0x8001: return "MIPS Assembler"; - case 0x8765: return "UPC"; - case 0xffff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LANG constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_LANG_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0001: return 0; - case 0x0002: return 0; - case 0x0003: return 0; - case 0x0004: return 0; - case 0x0005: return 0; - case 0x0006: return 0; - case 0x0007: return 0; - case 0x0008: return 0; - case 0x0009: return 0; - case 0x000a: return 0; - case 0x000b: return DRC_DWARFv3; - case 0x000c: return DRC_DWARFv3; - case 0x000d: return DRC_DWARFv3; - case 0x000e: return DRC_DWARFv3; - case 0x000f: return DRC_DWARFv3; - case 0x0010: return DRC_DWARFv3; - case 0x0011: return DRC_DWARFv3; - case 0x0012: return DRC_DWARFv3; - case 0x0013: return DRC_DWARFv3; - case 0x8000: return 0; - case 0x8001: return 0; - case 0x8765: return 0; - case 0xffff: return 0; - default: return 0; - } -} - -/* [7.13], "Address Class Encodings" (p. 144) in DWARFv3 draft 8 */ - -const char * -DW_ADDR_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "DW_ADDR_none"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ADDR constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ADDR_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "none"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ADDR constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ADDR_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - default: return 0; + const char *llvmstr = LanguageString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_LANG constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.14] Figure 28 "Identifier case encodings" (p. 144) in DWARFv3 draft 8 */ - const char * DW_ID_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0: return "DW_ID_case_sensitive"; - case 0x1: return "DW_ID_up_case"; - case 0x2: return "DW_ID_down_case"; - case 0x3: return "DW_ID_case_insensitive"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ID constant: 0x%x", val); - return invalid; + const char *llvmstr = CaseString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_ID constant: 0x%x", val); + return invalid; } + return llvmstr; } const char * -DW_ID_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "case sensitive"; - case 0x1: return "up case"; - case 0x2: return "down case"; - case 0x3: return "case insensitive"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ID constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ID_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; - } -} - -/* [7.15] Figure 29 "Calling convention encodings" (p. 144) in DWARFv3 draft 8 */ - -const char * DW_CC_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x01: return "DW_CC_normal"; - case 0x02: return "DW_CC_program"; - case 0x03: return "DW_CC_nocall"; - case 0x40: return "DW_CC_lo_user"; - case 0xff: return "DW_CC_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CC constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_CC_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "normal"; - case 0x02: return "program"; - case 0x03: return "nocall"; - case 0x40: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CC constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_CC_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x40: return 0; - case 0xff: return 0; - default: return 0; + const char *llvmstr = ConventionString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_CC constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.16] Figure 30 "Inline encodings" (p. 145) in DWARFv3 draft 8 */ - const char * DW_INL_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0: return "DW_INL_not_inlined"; - case 0x1: return "DW_INL_inlined"; - case 0x2: return "DW_INL_declared_not_inlined"; - case 0x3: return "DW_INL_declared_inlined"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_INL constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_INL_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "not inlined"; - case 0x1: return "inlined"; - case 0x2: return "declared not inlined"; - case 0x3: return "declared inlined"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_INL constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_INL_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - default: return 0; + const char *llvmstr = InlineCodeString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_INL constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.17] Figure 31 "Ordering encodings" (p. 145) in DWARFv3 draft 8 */ - const char * DW_ORD_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0: return "DW_ORD_row_major"; - case 0x1: return "DW_ORD_col_major"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ORD constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_ORD_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "row major"; - case 0x1: return "col major"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_ORD constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_ORD_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - default: return 0; + const char *llvmstr = ArrayOrderString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_ORD constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.18] Figure 32 "Discriminant descriptor encodings" (p. 146) in DWARFv3 draft 8 */ - const char * DW_DSC_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x0: return "DW_DSC_label"; - case 0x1: return "DW_DSC_range"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_DSC constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_DSC_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x0: return "label"; - case 0x1: return "range"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_DSC constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_DSC_value_to_class (uint32_t val) -{ - switch (val) { - case 0x0: return 0; - case 0x1: return 0; - default: return 0; + const char *llvmstr = DiscriminantString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_DSC constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.21] Figure 33 "Line Number Standard Opcode Encodings" (pp. 148-149) in DWARFv3 draft 8 */ - const char * DW_LNS_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x1: return "DW_LNS_copy"; - case 0x2: return "DW_LNS_advance_pc"; - case 0x3: return "DW_LNS_advance_line"; - case 0x4: return "DW_LNS_set_file"; - case 0x5: return "DW_LNS_set_column"; - case 0x6: return "DW_LNS_negate_stmt"; - case 0x7: return "DW_LNS_set_basic_block"; - case 0x8: return "DW_LNS_const_add_pc"; - case 0x9: return "DW_LNS_fixed_advance_pc"; - case 0xa: return "DW_LNS_set_prologue_end"; - case 0xb: return "DW_LNS_set_epilogue_begin"; - case 0xc: return "DW_LNS_set_isa"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNS constant: 0x%x", val); - return invalid; + const char *llvmstr = LNStandardString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_LNS constant: 0x%x", val); + return invalid; } + return llvmstr; } const char * -DW_LNS_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x1: return "copy"; - case 0x2: return "advance pc"; - case 0x3: return "advance line"; - case 0x4: return "set file"; - case 0x5: return "set column"; - case 0x6: return "negate stmt"; - case 0x7: return "set basic block"; - case 0x8: return "const add pc"; - case 0x9: return "fixed advance pc"; - case 0xa: return "set prologue end"; - case 0xb: return "set epilogue begin"; - case 0xc: return "set isa"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNS constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_LNS_value_to_class (uint32_t val) -{ - switch (val) { - case 0x1: return 0; - case 0x2: return 0; - case 0x3: return 0; - case 0x4: return 0; - case 0x5: return 0; - case 0x6: return 0; - case 0x7: return 0; - case 0x8: return 0; - case 0x9: return 0; - case 0xa: return DRC_DWARFv3; - case 0xb: return DRC_DWARFv3; - case 0xc: return DRC_DWARFv3; - default: return 0; - } -} - -/* [7.21] Figure 34 "Line Number Extended Opcode Encodings" (p. 149) in DWARFv3 draft 8 */ - -const char * DW_LNE_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x01: return "DW_LNE_end_sequence"; - case 0x02: return "DW_LNE_set_address"; - case 0x03: return "DW_LNE_define_file"; - case 0x80: return "DW_LNE_lo_user"; - case 0xff: return "DW_LNE_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNE constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_LNE_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "end sequence"; - case 0x02: return "set address"; - case 0x03: return "define file"; - case 0x80: return "lo user"; - case 0xff: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_LNE constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_LNE_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x80: return DRC_DWARFv3; - case 0xff: return DRC_DWARFv3; - default: return 0; + const char *llvmstr = LNExtendedString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_LNE constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.22] Figure 35 "Macinfo Type Encodings" (p. 150) in DWARFv3 draft 8 */ - const char * DW_MACINFO_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x01: return "DW_MACINFO_define"; - case 0x02: return "DW_MACINFO_undef"; - case 0x03: return "DW_MACINFO_start_file"; - case 0x04: return "DW_MACINFO_end_file"; - case 0xff: return "DW_MACINFO_vendor_ext"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_MACINFO constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_MACINFO_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x01: return "define"; - case 0x02: return "undef"; - case 0x03: return "start file"; - case 0x04: return "end file"; - case 0xff: return "vendor ext"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_MACINFO constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_MACINFO_value_to_class (uint32_t val) -{ - switch (val) { - case 0x01: return 0; - case 0x02: return 0; - case 0x03: return 0; - case 0x04: return 0; - case 0xff: return 0; - default: return 0; + const char *llvmstr = MacinfoString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_MACINFO constant: 0x%x", val); + return invalid; } + return llvmstr; } -/* [7.23] Figure 36 "Call frame instruction encodings" (pp. 151-152) in DWARFv3 draft 8 */ - const char * DW_CFA_value_to_name (uint32_t val) { static char invalid[100]; - switch (val) { - case 0x40: return "DW_CFA_advance_loc"; - case 0x80: return "DW_CFA_offset"; - case 0xc0: return "DW_CFA_restore"; - case 0x00: return "DW_CFA_nop"; - case 0x01: return "DW_CFA_set_loc"; - case 0x02: return "DW_CFA_advance_loc1"; - case 0x03: return "DW_CFA_advance_loc2"; - case 0x04: return "DW_CFA_advance_loc4"; - case 0x05: return "DW_CFA_offset_extended"; - case 0x06: return "DW_CFA_restore_extended"; - case 0x07: return "DW_CFA_undefined"; - case 0x08: return "DW_CFA_same_value"; - case 0x09: return "DW_CFA_register"; - case 0x0a: return "DW_CFA_remember_state"; - case 0x0b: return "DW_CFA_restore_state"; - case 0x0c: return "DW_CFA_def_cfa"; - case 0x0d: return "DW_CFA_def_cfa_register"; - case 0x0e: return "DW_CFA_def_cfa_offset"; - case 0x0f: return "DW_CFA_def_cfa_expression"; - case 0x10: return "DW_CFA_expression"; - case 0x11: return "DW_CFA_offset_extended_sf"; - case 0x12: return "DW_CFA_def_cfa_sf"; - case 0x13: return "DW_CFA_def_cfa_offset_sf"; - case 0x1c: return "DW_CFA_lo_user"; - case 0x3f: return "DW_CFA_hi_user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CFA constant: 0x%x", val); - return invalid; + const char *llvmstr = CallFrameString (val); + if (llvmstr == NULL) + { + snprintf (invalid, sizeof (invalid), "Unknown DW_CFA constant: 0x%x", val); + return invalid; } -} - -const char * -DW_CFA_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x40: return "advance loc"; - case 0x80: return "offset"; - case 0xc0: return "restore"; - case 0x00: return "nop"; - case 0x01: return "set loc"; - case 0x02: return "advance loc1"; - case 0x03: return "advance loc2"; - case 0x04: return "advance loc4"; - case 0x05: return "offset extended"; - case 0x06: return "restore extended"; - case 0x07: return "undefined"; - case 0x08: return "same value"; - case 0x09: return "register"; - case 0x0a: return "remember state"; - case 0x0b: return "restore state"; - case 0x0c: return "def cfa"; - case 0x0d: return "def cfa register"; - case 0x0e: return "def cfa offset"; - case 0x0f: return "def cfa expression"; - case 0x10: return "expression"; - case 0x11: return "offset extended sf"; - case 0x12: return "def cfa sf"; - case 0x13: return "def cfa offset sf"; - case 0x1c: return "lo user"; - case 0x3f: return "hi user"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_CFA constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_CFA_value_to_class (uint32_t val) -{ - switch (val) { - case 0x40: return DRC_ZEROOPERANDS; - case 0x80: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_OFFSET; - case 0xc0: return DRC_ZEROOPERANDS; - case 0x00: return DRC_ZEROOPERANDS; - case 0x01: return DRC_ONEOPERAND | DRC_OPERANDONE_ADDRESS; - case 0x02: return DRC_ONEOPERAND | DRC_OPERANDONE_1BYTE_DELTA; - case 0x03: return DRC_ONEOPERAND | DRC_OPERANDONE_2BYTE_DELTA; - case 0x04: return DRC_ONEOPERAND | DRC_OPERANDONE_4BYTE_DELTA; - case 0x05: return DRC_OPERANDTWO_ULEB128_OFFSET | DRC_OPERNADONE_ULEB128_REGISTER | DRC_TWOOPERANDS; - case 0x06: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x07: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x08: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x09: return DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_ULEB128_REGISTER | DRC_TWOOPERANDS; - case 0x0a: return DRC_ZEROOPERANDS; - case 0x0b: return DRC_ZEROOPERANDS; - case 0x0c: return DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_ULEB128_OFFSET | DRC_TWOOPERANDS; - case 0x0d: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_REGISTER; - case 0x0e: return DRC_ONEOPERAND | DRC_OPERANDONE_ULEB128_OFFSET; - case 0x0f: return DRC_DWARFv3 | DRC_ONEOPERAND | DRC_OPERANDONE_BLOCK; - case 0x10: return DRC_DWARFv3 | DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_BLOCK | DRC_TWOOPERANDS; - case 0x11: return DRC_DWARFv3 | DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_SLEB128_OFFSET | DRC_TWOOPERANDS; - case 0x12: return DRC_DWARFv3 | DRC_OPERANDONE_ULEB128_REGISTER | DRC_OPERANDTWO_SLEB128_OFFSET | DRC_TWOOPERANDS; - case 0x13: return DRC_DWARFv3 | DRC_ONEOPERAND | DRC_OPERANDONE_SLEB128_OFFSET; - case 0x1c: return 0; - case 0x3f: return 0; - default: return 0; - } -} - -/* FSF exception handling Pointer-Encoding constants (CFI augmentation) -- "DW_EH_PE_..." in the FSF sources */ - -const char * -DW_GNU_EH_PE_value_to_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x00: return "DW_GNU_EH_PE_absptr"; - case 0x01: return "DW_GNU_EH_PE_uleb128"; - case 0x02: return "DW_GNU_EH_PE_udata2"; - case 0x03: return "DW_GNU_EH_PE_udata4"; - case 0x04: return "DW_GNU_EH_PE_udata8"; - case 0x09: return "DW_GNU_EH_PE_sleb128"; - case 0x0a: return "DW_GNU_EH_PE_sdata2"; - case 0x0b: return "DW_GNU_EH_PE_sdata4"; - case 0x0c: return "DW_GNU_EH_PE_sdata8"; - case 0x08: return "DW_GNU_EH_PE_signed"; - case 0x10: return "DW_GNU_EH_PE_pcrel"; - case 0x20: return "DW_GNU_EH_PE_textrel"; - case 0x30: return "DW_GNU_EH_PE_datarel"; - case 0x40: return "DW_GNU_EH_PE_funcrel"; - case 0x50: return "DW_GNU_EH_PE_aligned"; - case 0x80: return "DW_GNU_EH_PE_indirect"; - case 0xff: return "DW_GNU_EH_PE_omit"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_GNU_EH_PE constant: 0x%x", val); - return invalid; - } -} - -const char * -DW_GNU_EH_PE_value_to_englishy_name (uint32_t val) -{ - static char invalid[100]; - switch (val) { - case 0x00: return "absptr"; - case 0x01: return "uleb128"; - case 0x02: return "udata2"; - case 0x03: return "udata4"; - case 0x04: return "udata8"; - case 0x09: return "sleb128"; - case 0x0a: return "sdata2"; - case 0x0b: return "sdata4"; - case 0x0c: return "sdata8"; - case 0x08: return "signed"; - case 0x10: return "pcrel"; - case 0x20: return "textrel"; - case 0x30: return "datarel"; - case 0x40: return "funcrel"; - case 0x50: return "aligned"; - case 0x80: return "indirect"; - case 0xff: return "omit"; - default: - snprintf (invalid, sizeof(invalid), "Unknown DW_GNU_EH_PE constant: 0x%x", val); - return invalid; - } -} - -DRC_class -DW_GNU_EH_PE_value_to_class (uint32_t val) -{ - switch (val) { - case 0x00: return DRC_VENDOR_GNU; - case 0x01: return DRC_VENDOR_GNU; - case 0x02: return DRC_VENDOR_GNU; - case 0x03: return DRC_VENDOR_GNU; - case 0x04: return DRC_VENDOR_GNU; - case 0x09: return DRC_VENDOR_GNU; - case 0x0a: return DRC_VENDOR_GNU; - case 0x0b: return DRC_VENDOR_GNU; - case 0x0c: return DRC_VENDOR_GNU; - case 0x08: return DRC_VENDOR_GNU; - case 0x10: return DRC_VENDOR_GNU; - case 0x20: return DRC_VENDOR_GNU; - case 0x30: return DRC_VENDOR_GNU; - case 0x40: return DRC_VENDOR_GNU; - case 0x50: return DRC_VENDOR_GNU; - case 0x80: return DRC_VENDOR_GNU; - case 0xff: return DRC_VENDOR_GNU; - default: return 0; - } -} - -bool -is_type_tag (uint16_t tag) -{ - switch (tag) - { - case DW_TAG_array_type: - case DW_TAG_base_type: - case DW_TAG_class_type: - case DW_TAG_const_type: - case DW_TAG_enumeration_type: - case DW_TAG_file_type: - case DW_TAG_interface_type: - case DW_TAG_packed_type: - case DW_TAG_pointer_type: - case DW_TAG_ptr_to_member_type: - case DW_TAG_reference_type: - case DW_TAG_restrict_type: - case DW_TAG_set_type: - case DW_TAG_shared_type: - case DW_TAG_string_type: - case DW_TAG_structure_type: - case DW_TAG_subrange_type: - case DW_TAG_subroutine_type: - case DW_TAG_thrown_type: - case DW_TAG_union_type: - case DW_TAG_unspecified_type: - case DW_TAG_volatile_type: - return true; - default: - return false; - } -} - -bool -is_pubtype_tag (uint16_t tag) -{ - switch (tag) - { - case DW_TAG_array_type: - case DW_TAG_class_type: - case DW_TAG_enumeration_type: - case DW_TAG_file_type: - case DW_TAG_interface_type: - case DW_TAG_set_type: - case DW_TAG_string_type: - case DW_TAG_structure_type: - case DW_TAG_subrange_type: - case DW_TAG_subroutine_type: - case DW_TAG_thrown_type: - case DW_TAG_typedef: - case DW_TAG_union_type: - case DW_TAG_unspecified_type: - return true; - default: - break; - } - return false; + return llvmstr; } DW_TAG_CategoryEnum @@ -2222,3 +585,5 @@ return TagCategoryProgram; } +} // namespace lldb_private + Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h Tue Jul 6 17:38:03 2010 @@ -10,21 +10,14 @@ #ifndef liblldb_DWARFDefines_h_ #define liblldb_DWARFDefines_h_ -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include "lldb/Core/dwarf.h" -/* DWARF constants generated on Wed Sep 7 16:41:50 2005 */ +namespace lldb_private { typedef uint32_t DRC_class; // Holds DRC_* class bitfields -/* [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ - - enum DW_TAG_Category { TagCategoryVariable, @@ -36,171 +29,49 @@ typedef enum DW_TAG_Category DW_TAG_CategoryEnum; const char *DW_TAG_value_to_name (uint32_t val); const char *DW_TAG_value_to_englishy_name (uint32_t val); -DRC_class DW_TAG_value_to_class (uint32_t val); DW_TAG_CategoryEnum get_tag_category (uint16_t tag); -#define DW_TAG_MAX_NAME_LENGTH 31 - - -/* [7.5.4] Figure 17 "Child determination encodings" (p. 128) in DWARFv3 draft 8 */ const char *DW_CHILDREN_value_to_name (uint8_t val); -const char *DW_CHILDREN_value_to_englishy_name (uint8_t val); -DRC_class DW_CHILDREN_value_to_class (uint32_t val); -#define DW_CHILDREN_MAX_NAME_LENGTH 15 - - -/* [7.5.4] Figure 18 "Attribute encodings" (pp. 129-132) in DWARFv3 draft 8 */ - const char *DW_AT_value_to_name (uint32_t val); const char *DW_AT_value_to_englishy_name (uint32_t val); -DRC_class DW_AT_value_to_class (uint32_t val); -#define DW_AT_MAX_NAME_LENGTH 34 - - -/* [7.5.4] Figure 19 "Attribute form encodings" (pp. 133-134) in DWARFv3 draft 8 */ const char *DW_FORM_value_to_name (uint32_t val); const char *DW_FORM_value_to_englishy_name (uint32_t val); -DRC_class DW_FORM_value_to_class (uint32_t val); -#define DW_FORM_MAX_NAME_LENGTH 17 - - -/* [7.7.1] Figure 22 "DWARF operation encodings" (pp. 136-139) in DWARFv3 draft 8 */ const char *DW_OP_value_to_name (uint32_t val); const char *DW_OP_value_to_englishy_name (uint32_t val); DRC_class DW_OP_value_to_class (uint32_t val); -#define DW_OP_MAX_NAME_LENGTH 25 - - -/* [7.8] Figure 23 "Base type encoding values" (pp. 140-141) in DWARFv3 draft 8 */ const char *DW_ATE_value_to_name (uint32_t val); -const char *DW_ATE_value_to_englishy_name (uint32_t val); -DRC_class DW_ATE_value_to_class (uint32_t val); -#define DW_ATE_MAX_NAME_LENGTH 22 - - -/* [7.9] Figure 24 "Accessibility encodings" (p. 141) in DWARFv3 draft 8 */ const char *DW_ACCESS_value_to_name (uint32_t val); -const char *DW_ACCESS_value_to_englishy_name (uint32_t val); -DRC_class DW_ACCESS_value_to_class (uint32_t val); -#define DW_ACCESS_MAX_NAME_LENGTH 19 - - -/* [7.10] Figure 25 "Visibility encodings" (p. 142) in DWARFv3 draft 8 */ const char *DW_VIS_value_to_name (uint32_t val); -const char *DW_VIS_value_to_englishy_name (uint32_t val); -DRC_class DW_VIS_value_to_class (uint32_t val); -#define DW_VIS_MAX_NAME_LENGTH 16 - - -/* [7.11] Figure 26 "Virtuality encodings" (p. 142) in DWARFv3 draft 8 */ const char *DW_VIRTUALITY_value_to_name (uint32_t val); -const char *DW_VIRTUALITY_value_to_englishy_name (uint32_t val); -DRC_class DW_VIRTUALITY_value_to_class (uint32_t val); -#define DW_VIRTUALITY_MAX_NAME_LENGTH 26 - - -/* [7.12] Figure 27 "Language encodings" (p. 143) in DWARFv3 draft 8 */ const char *DW_LANG_value_to_name (uint32_t val); -const char *DW_LANG_value_to_englishy_name (uint32_t val); -DRC_class DW_LANG_value_to_class (uint32_t val); -#define DW_LANG_MAX_NAME_LENGTH 19 - - -/* [7.13], "Address Class Encodings" (p. 144) in DWARFv3 draft 8 */ - -const char *DW_ADDR_value_to_name (uint32_t val); -const char *DW_ADDR_value_to_englishy_name (uint32_t val); -DRC_class DW_ADDR_value_to_class (uint32_t val); -#define DW_ADDR_MAX_NAME_LENGTH 12 - - -/* [7.14] Figure 28 "Identifier case encodings" (p. 144) in DWARFv3 draft 8 */ const char *DW_ID_value_to_name (uint32_t val); -const char *DW_ID_value_to_englishy_name (uint32_t val); -DRC_class DW_ID_value_to_class (uint32_t val); -#define DW_ID_MAX_NAME_LENGTH 22 - - -/* [7.15] Figure 29 "Calling convention encodings" (p. 144) in DWARFv3 draft 8 */ const char *DW_CC_value_to_name (uint32_t val); -const char *DW_CC_value_to_englishy_name (uint32_t val); -DRC_class DW_CC_value_to_class (uint32_t val); -#define DW_CC_MAX_NAME_LENGTH 13 - - -/* [7.16] Figure 30 "Inline encodings" (p. 145) in DWARFv3 draft 8 */ const char *DW_INL_value_to_name (uint32_t val); -const char *DW_INL_value_to_englishy_name (uint32_t val); -DRC_class DW_INL_value_to_class (uint32_t val); -#define DW_INL_MAX_NAME_LENGTH 27 - - -/* [7.17] Figure 31 "Ordering encodings" (p. 145) in DWARFv3 draft 8 */ const char *DW_ORD_value_to_name (uint32_t val); -const char *DW_ORD_value_to_englishy_name (uint32_t val); -DRC_class DW_ORD_value_to_class (uint32_t val); -#define DW_ORD_MAX_NAME_LENGTH 16 - - -/* [7.18] Figure 32 "Discriminant descriptor encodings" (p. 146) in DWARFv3 draft 8 */ const char *DW_DSC_value_to_name (uint32_t val); -const char *DW_DSC_value_to_englishy_name (uint32_t val); -DRC_class DW_DSC_value_to_class (uint32_t val); -#define DW_DSC_MAX_NAME_LENGTH 12 - - -/* [7.21] Figure 33 "Line Number Standard Opcode Encodings" (pp. 148-149) in DWARFv3 draft 8 */ const char *DW_LNS_value_to_name (uint32_t val); -const char *DW_LNS_value_to_englishy_name (uint32_t val); -DRC_class DW_LNS_value_to_class (uint32_t val); -#define DW_LNS_MAX_NAME_LENGTH 25 - - -/* [7.21] Figure 34 "Line Number Extended Opcode Encodings" (p. 149) in DWARFv3 draft 8 */ const char *DW_LNE_value_to_name (uint32_t val); -const char *DW_LNE_value_to_englishy_name (uint32_t val); -DRC_class DW_LNE_value_to_class (uint32_t val); -#define DW_LNE_MAX_NAME_LENGTH 19 - - -/* [7.22] Figure 35 "Macinfo Type Encodings" (p. 150) in DWARFv3 draft 8 */ const char *DW_MACINFO_value_to_name (uint32_t val); -const char *DW_MACINFO_value_to_englishy_name (uint32_t val); -DRC_class DW_MACINFO_value_to_class (uint32_t val); -#define DW_MACINFO_MAX_NAME_LENGTH 21 - - -/* [7.23] Figure 36 "Call frame instruction encodings" (pp. 151-152) in DWARFv3 draft 8 */ const char *DW_CFA_value_to_name (uint32_t val); -const char *DW_CFA_value_to_englishy_name (uint32_t val); -DRC_class DW_CFA_value_to_class (uint32_t val); -#define DW_CFA_MAX_NAME_LENGTH 25 - - -/* FSF exception handling Pointer-Encoding constants (CFI augmentation) -- "DW_EH_PE_..." in the FSF sources */ const char *DW_GNU_EH_PE_value_to_name (uint32_t val); -const char *DW_GNU_EH_PE_value_to_englishy_name (uint32_t val); -DRC_class DW_GNU_EH_PE_value_to_class (uint32_t val); -#define DW_GNU_EH_PE_MAX_NAME_LENGTH 21 - /* These DRC are entirely our own construction, although they are derived from various comments in the DWARF standard. @@ -240,13 +111,7 @@ #define DRC_VENDOR_MIPS 0x40000000 #define DRC_ZEROOPERANDS 0x80000000 -bool is_type_tag (uint16_t tag); -bool is_pubtype_tag (uint16_t tag); - - -#ifdef __cplusplus -} -#endif +} // namespace lldb_private #endif // liblldb_DWARFDefines_h_ Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Jul 6 17:38:03 2010 @@ -21,6 +21,7 @@ #include "llvm/ADT/DenseMap.h" #include "lldb/Core/ConstString.h" +#include "lldb/Core/dwarf.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Flags.h" #include "lldb/Core/UniqueCStringMap.h" Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Jul 6 17:38:03 2010 @@ -27,7 +27,6 @@ #include "clang/Frontend/FrontendOptions.h" #include "clang/Frontend/LangStandard.h" -// Project includes #include "lldb/Core/dwarf.h" #include @@ -36,7 +35,6 @@ using namespace llvm; using namespace clang; - static void ParseLangArgs ( Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=107716&r1=107715&r2=107716&view=diff ============================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original) +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Tue Jul 6 17:38:03 2010 @@ -353,7 +353,7 @@ return_addr_reg_num (0), inst_offset (0), inst_length (0), - ptr_encoding (DW_GNU_EH_PE_absptr) + ptr_encoding (DW_EH_PE_absptr) { } @@ -456,7 +456,7 @@ // cie.offset = cie_offset; // cie.length = length; // cie.cieID = cieID; - cie_sp->ptr_encoding = DW_GNU_EH_PE_absptr; + cie_sp->ptr_encoding = DW_EH_PE_absptr; cie_sp->version = m_cfi_data.GetU8(&offset); for (i=0; iptr_encoding, pc_rel_addr, text_addr, data_addr); - lldb::addr_t range_len = m_cfi_data.GetGNUEHPointer(&offset, cie->ptr_encoding & DW_GNU_EH_PE_MASK_ENCODING, pc_rel_addr, text_addr, data_addr); + lldb::addr_t range_len = m_cfi_data.GetGNUEHPointer(&offset, cie->ptr_encoding & DW_EH_PE_MASK_ENCODING, pc_rel_addr, text_addr, data_addr); if (cie->augmentation[0] == 'z') { @@ -680,7 +680,7 @@ const CIE* cie = GetCIE(cie_offset); assert(cie); lldb::addr_t addr = m_cfi_data.GetGNUEHPointer(&offset, cie->ptr_encoding, pc_rel_addr, text_addr, data_addr); - lldb::addr_t length = m_cfi_data.GetGNUEHPointer(&offset, cie->ptr_encoding & DW_GNU_EH_PE_MASK_ENCODING, pc_rel_addr, text_addr, data_addr); + lldb::addr_t length = m_cfi_data.GetGNUEHPointer(&offset, cie->ptr_encoding & DW_EH_PE_MASK_ENCODING, pc_rel_addr, text_addr, data_addr); m_fde_map[VMRange(addr, addr + length)] = FDEInfo(curr_offset); } From jingham at apple.com Tue Jul 6 17:46:59 2010 From: jingham at apple.com (Jim Ingham) Date: Tue, 06 Jul 2010 22:46:59 -0000 Subject: [Lldb-commits] [lldb] r107718 - in /lldb/trunk: include/lldb/Interpreter/CommandInterpreter.h include/lldb/Interpreter/CommandObject.h source/Commands/CommandObjectAlias.cpp source/Commands/CommandObjectHelp.cpp source/Interpreter/CommandInterpreter.cpp source/Interpreter/CommandObject.cpp Message-ID: <20100706224659.6AAF42A6C12C@llvm.org> Author: jingham Date: Tue Jul 6 17:46:59 2010 New Revision: 107718 URL: http://llvm.org/viewvc/llvm-project?rev=107718&view=rev Log: Hide the logic for command resolution for commands, aliases & user commands behind a single interface so everybody does it the same way. Add an "exact" lookup for internal uses. Fix up a few little cases where we weren't reporting command lookup errors correctly. Added "b" as an alias for "breakpoint" so it doesn't collide with "bt". Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h lldb/trunk/include/lldb/Interpreter/CommandObject.h lldb/trunk/source/Commands/CommandObjectAlias.cpp lldb/trunk/source/Commands/CommandObjectHelp.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/CommandObject.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=107718&r1=107717&r2=107718&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Tue Jul 6 17:46:59 2010 @@ -51,10 +51,13 @@ ~CommandInterpreter (); lldb::CommandObjectSP - GetCommandSP (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL); + GetCommandSPExact (const char *cmd, bool include_aliases); + + CommandObject * + GetCommandObjectExact (const char *cmd_cstr, bool include_aliases); CommandObject * - GetCommandObject (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL); + GetCommandObject (const char *cmd, StringList *matches = NULL); StateVariable * GetStateVariable(const char *name); @@ -243,6 +246,9 @@ void SetSynchronous (bool value); + lldb::CommandObjectSP + GetCommandSP (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL); + private: Debugger &m_debugger; // The debugger session that this interpreter is associated with Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=107718&r1=107717&r2=107718&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue Jul 6 17:46:59 2010 @@ -65,6 +65,12 @@ virtual bool IsCrossRefObject () { return false; } + + bool + IsAlias () { return m_is_alias; } + + void + SetIsAlias (bool value) { m_is_alias = value; } virtual bool IsMultiwordObject () { return false; } @@ -252,6 +258,7 @@ std::string m_cmd_help_short; std::string m_cmd_help_long; std::string m_cmd_syntax; + bool m_is_alias; Flags m_flags; }; Modified: lldb/trunk/source/Commands/CommandObjectAlias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAlias.cpp?rev=107718&r1=107717&r2=107718&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectAlias.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectAlias.cpp Tue Jul 6 17:46:59 2010 @@ -121,7 +121,7 @@ } else { - CommandObjectSP command_obj_sp(interpreter.GetCommandSP (actual_command.c_str())); + CommandObjectSP command_obj_sp(interpreter.GetCommandSPExact (actual_command.c_str(), true)); CommandObjectSP subcommand_obj_sp; bool use_subcommand = false; if (command_obj_sp.get()) Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=107718&r1=107717&r2=107718&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Tue Jul 6 17:46:59 2010 @@ -54,12 +54,8 @@ else { // Get command object for the first command argument. Only search built-in command dictionary. - cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), false, false); - if (cmd_obj == NULL) - { - // That failed, so now search in the aliases dictionary, too. - cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), true, false); - } + StringList matches; + cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches); if (cmd_obj != NULL) { @@ -123,6 +119,15 @@ } } } + else if (matches.GetSize() > 0) + { + Stream &output_strm = result.GetOutputStream(); + output_strm.Printf("Help requested with ambiguous command name, possible completions:\n"); + for (int i = 0; i < matches.GetSize(); i++) + { + output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i)); + } + } else { result.AppendErrorWithFormat @@ -156,7 +161,7 @@ } else { - CommandObject *cmd_obj = interpreter.GetCommandObject (input.GetArgumentAtIndex(0), true, false); + CommandObject *cmd_obj = interpreter.GetCommandObject (input.GetArgumentAtIndex(0)); input.Shift(); cursor_index--; return cmd_obj->HandleCompletion (interpreter, input, cursor_index, cursor_char_position, match_start_point, Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=107718&r1=107717&r2=107718&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jul 6 17:46:59 2010 @@ -91,6 +91,7 @@ result.Clear(); HandleCommand ("alias continue process continue", false, result); result.Clear(); HandleCommand ("alias expr expression", false, result); result.Clear(); HandleCommand ("alias exit quit", false, result); + result.Clear(); HandleCommand ("alias b breakpoint", false, result); result.Clear(); HandleCommand ("alias bt thread backtrace", false, result); result.Clear(); HandleCommand ("alias si thread step-inst", false, result); result.Clear(); HandleCommand ("alias step thread step-in", false, result); @@ -296,13 +297,21 @@ if (!exact && ret_val == NULL) { + // We will only get into here if we didn't find any exact matches. + + CommandObjectSP user_match_sp, alias_match_sp, real_match_sp; + StringList local_matches; if (matches == NULL) matches = &local_matches; - int num_cmd_matches = 0; - int num_alias_matches = 0; - int num_user_matches = 0; + unsigned int num_cmd_matches = 0; + unsigned int num_alias_matches = 0; + unsigned int num_user_matches = 0; + + // Look through the command dictionaries one by one, and if we get only one match from any of + // them in toto, then return that, otherwise return an empty CommandObjectSP and the list of matches. + if (HasCommands()) { num_cmd_matches = CommandObject::AddNamesMatchingPartialString (m_command_dict, cmd_cstr, *matches); @@ -313,7 +322,7 @@ cmd.assign(matches->GetStringAtIndex(0)); pos = m_command_dict.find(cmd); if (pos != m_command_dict.end()) - ret_val = pos->second; + real_match_sp = pos->second; } if (include_aliases && HasAliases()) @@ -322,17 +331,12 @@ } - if (num_alias_matches == 1 && num_cmd_matches == 0) + if (num_alias_matches == 1) { cmd.assign(matches->GetStringAtIndex (num_cmd_matches)); pos = m_alias_dict.find(cmd); if (pos != m_alias_dict.end()) - { - matches->Clear(); - matches->AppendString (cmd.c_str()); - - ret_val = pos->second; - } + alias_match_sp = pos->second; } if (HasUserCommands()) @@ -340,33 +344,68 @@ num_user_matches = CommandObject::AddNamesMatchingPartialString (m_user_dict, cmd_cstr, *matches); } - if (num_user_matches == 1 && num_alias_matches == 0 && num_cmd_matches == 0) + if (num_user_matches == 1) { cmd.assign (matches->GetStringAtIndex (num_cmd_matches + num_alias_matches)); pos = m_user_dict.find (cmd); if (pos != m_user_dict.end()) - { - matches->Clear(); - matches->AppendString (cmd.c_str()); - - ret_val = pos->second; - } + user_match_sp = pos->second; + } + + // If we got exactly one match, return that, otherwise return the match list. + + if (num_user_matches + num_cmd_matches + num_alias_matches == 1) + { + if (num_cmd_matches) + return real_match_sp; + else if (num_alias_matches) + return alias_match_sp; + else + return user_match_sp; } } - else { - if (matches) - matches->AppendString (cmd_cstr); + else if (matches && ret_val != NULL) + { + matches->AppendString (cmd_cstr); } return ret_val; } +CommandObjectSP +CommandInterpreter::GetCommandSPExact (const char *cmd_cstr, bool include_aliases) +{ + return GetCommandSP(cmd_cstr, include_aliases, true, NULL); +} + CommandObject * -CommandInterpreter::GetCommandObject (const char *cmd_cstr, bool include_aliases, bool exact, StringList *matches) +CommandInterpreter::GetCommandObjectExact (const char *cmd_cstr, bool include_aliases) { - return GetCommandSP (cmd_cstr, include_aliases, exact, matches).get(); + return GetCommandSPExact (cmd_cstr, include_aliases).get(); +} + +CommandObject * +CommandInterpreter::GetCommandObject (const char *cmd_cstr, StringList *matches) +{ + CommandObject *command_obj = GetCommandSP (cmd_cstr, false, true, matches).get(); + + // If we didn't find an exact match to the command string in the commands, look in + // the aliases. + + if (command_obj == NULL) + { + command_obj = GetCommandSP (cmd_cstr, true, true, matches).get(); + } + + // Finally, if there wasn't an exact match among the aliases, look for an inexact match + // in both the commands and the aliases. + + if (command_obj == NULL) + command_obj = GetCommandSP(cmd_cstr, true, false, matches).get(); + + return command_obj; } bool @@ -390,6 +429,7 @@ void CommandInterpreter::AddAlias (const char *alias_name, CommandObjectSP& command_obj_sp) { + command_obj_sp->SetIsAlias (true); m_alias_dict[alias_name] = command_obj_sp; } @@ -602,30 +642,17 @@ // We're looking up the command object here. So first find an exact match to the // command in the commands. - - CommandObject *command_obj = GetCommandObject (command_cstr, false, true); - - // If we didn't find an exact match to the command string in the commands, look in - // the aliases. - - if (command_obj == NULL) + CommandObject *command_obj = GetCommandObject(command_cstr); + + if (command_obj != NULL) { - command_obj = GetCommandObject (command_cstr, true, true); - if (command_obj != NULL) + if (command_obj->IsAlias()) { BuildAliasCommandArgs (command_obj, command_cstr, command_args, result); if (!result.Succeeded()) return false; } - } - - // Finally, if there wasn't an exact match among the aliases, look for an inexact match. - if (command_obj == NULL) - command_obj = GetCommandObject(command_cstr, false, false); - - if (command_obj) - { if (command_obj->WantsRawCommandString()) { const char *stripped_command = ::strstr (command_line, command_cstr); @@ -649,10 +676,11 @@ } else { + // We didn't find the first command object, so complete the first argument. StringList matches; int num_matches; - int cursor_index = command_args.GetArgumentCount() - 1; - int cursor_char_position = strlen (command_args.GetArgumentAtIndex(command_args.GetArgumentCount() - 1)); + int cursor_index = 0; + int cursor_char_position = strlen (command_args.GetArgumentAtIndex(0)); bool word_complete; num_matches = HandleCompletionMatches (command_args, cursor_index, @@ -698,7 +726,6 @@ StringList &matches) { int num_command_matches = 0; - bool include_aliases = true; bool look_for_subcommand = false; // For any of the command completions a unique match will be a complete word. @@ -707,13 +734,13 @@ if (cursor_index == -1) { // We got nothing on the command line, so return the list of commands + bool include_aliases = true; num_command_matches = GetCommandNamesMatchingPartialString ("", include_aliases, matches); } else if (cursor_index == 0) { // The cursor is in the first argument, so just do a lookup in the dictionary. - CommandObject *cmd_obj = GetCommandObject (parsed_line.GetArgumentAtIndex(0), include_aliases, false, - &matches); + CommandObject *cmd_obj = GetCommandObject (parsed_line.GetArgumentAtIndex(0), &matches); num_command_matches = matches.GetSize(); if (num_command_matches == 1 @@ -735,7 +762,7 @@ // We are completing further on into a commands arguments, so find the command and tell it // to complete the command. // First see if there is a matching initial command: - CommandObject *command_object = GetCommandObject (parsed_line.GetArgumentAtIndex(0), include_aliases, false); + CommandObject *command_object = GetCommandObject (parsed_line.GetArgumentAtIndex(0)); if (command_object == NULL) { return 0; @@ -910,7 +937,7 @@ void CommandInterpreter::CrossRegisterCommand (const char * dest_cmd, const char * object_type) { - CommandObjectSP cmd_obj_sp = GetCommandSP (dest_cmd); + CommandObjectSP cmd_obj_sp = GetCommandSPExact (dest_cmd, true); if (cmd_obj_sp != NULL) { Modified: lldb/trunk/source/Interpreter/CommandObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=107718&r1=107717&r2=107718&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue Jul 6 17:46:59 2010 @@ -43,6 +43,7 @@ m_cmd_help_short (), m_cmd_help_long (), m_cmd_syntax (), + m_is_alias (false), m_flags (flags) { if (help && help[0]) From johnny.chen at apple.com Tue Jul 6 17:52:00 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 06 Jul 2010 22:52:00 -0000 Subject: [Lldb-commits] [lldb] r107719 - in /lldb/trunk/test/dead-strip: TestDeadStrip.py main.c Message-ID: <20100706225200.AFBED2A6C12C@llvm.org> Author: johnny Date: Tue Jul 6 17:52:00 2010 New Revision: 107719 URL: http://llvm.org/viewvc/llvm-project?rev=107719&view=rev Log: Test that breakpoint works correctly in the presence of dead-code stripping. Added: lldb/trunk/test/dead-strip/TestDeadStrip.py Modified: lldb/trunk/test/dead-strip/main.c Added: lldb/trunk/test/dead-strip/TestDeadStrip.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dead-strip/TestDeadStrip.py?rev=107719&view=auto ============================================================================== --- lldb/trunk/test/dead-strip/TestDeadStrip.py (added) +++ lldb/trunk/test/dead-strip/TestDeadStrip.py Tue Jul 6 17:52:00 2010 @@ -0,0 +1,89 @@ +""" +Test that breakpoint works correctly in the presence of dead-code stripping. +""" + +import os, time +import unittest +import lldb +import lldbtest + +class TestClassTypes(lldbtest.TestBase): + + mydir = "dead-strip" + + def test_dead_strip(self): + """Test breakpoint works correctly with dead-code stripping.""" + res = self.res + exe = os.path.join(os.getcwd(), "a.out") + self.ci.HandleCommand("file " + exe, res) + self.assertTrue(res.Succeeded()) + + # Break by function name f1 (live code). + self.ci.HandleCommand("breakpoint set -s a.out -n f1", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 1: name = 'f1', module = a.out, locations = 1" + )) + + # Break by function name f2 (dead code). + self.ci.HandleCommand("breakpoint set -s a.out -n f2", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 2: name = 'f2', module = a.out, locations = 0 " + "(pending)")) + + # Break by function name f3 (live code). + self.ci.HandleCommand("breakpoint set -s a.out -n f3", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 3: name = 'f3', module = a.out, locations = 1" + )) + + self.ci.HandleCommand("run", res) + time.sleep(0.1) + self.assertTrue(res.Succeeded()) + + # The stop reason of the thread should be breakpoint (breakpoint #1). + self.ci.HandleCommand("thread list", res) + output = res.GetOutput() + self.assertTrue(res.Succeeded()) + self.assertTrue(output.find('state is Stopped') > 0 and + output.find('main.c:20') > 0 and + output.find('where = a.out`f1') > 0 and + output.find('stop reason = breakpoint') > 0) + + # The breakpoint should have a hit count of 1. + self.ci.HandleCommand("breakpoint list 1", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0) + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + + # The stop reason of the thread should be breakpoint (breakpoint #3). + self.ci.HandleCommand("thread list", res) + output = res.GetOutput() + self.assertTrue(res.Succeeded()) + self.assertTrue(output.find('state is Stopped') > 0 and + # TODO: + # + # Uncomment 'main.c:40' line when rdar://problem/8163668 + # is fixed. + # + #output.find('main.c:40') > 0 and + output.find('where = a.out`f3') > 0 and + output.find('stop reason = breakpoint') > 0) + + # The breakpoint should have a hit count of 1. + self.ci.HandleCommand("breakpoint list 3", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0) + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + + +if __name__ == '__main__': + lldb.SBDebugger.Initialize() + unittest.main() + lldb.SBDebugger.Terminate() Modified: lldb/trunk/test/dead-strip/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dead-strip/main.c?rev=107719&r1=107718&r2=107719&view=diff ============================================================================== --- lldb/trunk/test/dead-strip/main.c (original) +++ lldb/trunk/test/dead-strip/main.c Tue Jul 6 17:52:00 2010 @@ -14,7 +14,7 @@ int f3 (char *s); -// We want f1 to start on line 10 +// We want f1 to start on line 20 int f1 (char *s) { return printf("f1: %s\n", s); @@ -24,7 +24,7 @@ -// We want f2 to start on line 20, this should get stripped +// We want f2 to start on line 30, this should get stripped int f2 (char *s) { return printf("f2: %s\n", s); @@ -34,7 +34,7 @@ -// We want f3 to start on line 30 +// We want f3 to start on line 40 int f3 (char *s) { return printf("f3: %s\n", s); @@ -44,7 +44,7 @@ -// We want main to start on line 40 +// We want main to start on line 50 int main (int argc, const char * argv[]) { f1("carp"); From johnny.chen at apple.com Tue Jul 6 18:26:16 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 06 Jul 2010 23:26:16 -0000 Subject: [Lldb-commits] [lldb] r107724 - in /lldb/trunk/test: array_types/TestArrayTypes.py class_types/TestClassTypes.py function_types/TestFunctionTypes.py global_variables/TestGlobalVariables.py Message-ID: <20100706232616.E94162A6C12C@llvm.org> Author: johnny Date: Tue Jul 6 18:26:16 2010 New Revision: 107724 URL: http://llvm.org/viewvc/llvm-project?rev=107724&view=rev Log: if -1 => evaluates to True oops! Modified: lldb/trunk/test/array_types/TestArrayTypes.py lldb/trunk/test/class_types/TestClassTypes.py lldb/trunk/test/function_types/TestFunctionTypes.py lldb/trunk/test/global_variables/TestGlobalVariables.py Modified: lldb/trunk/test/array_types/TestArrayTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=107724&r1=107723&r2=107724&view=diff ============================================================================== --- lldb/trunk/test/array_types/TestArrayTypes.py (original) +++ lldb/trunk/test/array_types/TestArrayTypes.py Tue Jul 6 18:26:16 2010 @@ -30,13 +30,13 @@ self.ci.HandleCommand("thread list", res) print "thread list ->", res.GetOutput() self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find('state is Stopped') and - res.GetOutput().find('stop reason = breakpoint')) + self.assertTrue(res.GetOutput().find('state is Stopped') > 0 and + res.GetOutput().find('stop reason = breakpoint') > 0) # The breakpoint should have a hit count of 1. self.ci.HandleCommand("breakpoint list", res) self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find('resolved, hit count = 1')) + self.assertTrue(res.GetOutput().find('resolved, hit count = 1') > 0) # Issue 'variable list' command on several array-type variables. @@ -44,19 +44,19 @@ self.assertTrue(res.Succeeded()) output = res.GetOutput() self.assertTrue(output.startswith('(char *[4])') and - output.find('(char *) strings[0]') and - output.find('(char *) strings[1]') and - output.find('(char *) strings[2]') and - output.find('(char *) strings[3]') and - output.find('Hello') and - output.find('Hola') and - output.find('Bonjour') and - output.find('Guten Tag')) + output.find('(char *) strings[0]') > 0 and + output.find('(char *) strings[1]') > 0 and + output.find('(char *) strings[2]') > 0 and + output.find('(char *) strings[3]') > 0 and + output.find('Hello') > 0 and + output.find('Hola') > 0 and + output.find('Bonjour') > 0 and + output.find('Guten Tag') > 0) self.ci.HandleCommand("variable list char_16", res); self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find('(char) char_16[0]') and - res.GetOutput().find('(char) char_16[15]')) + self.assertTrue(res.GetOutput().find('(char) char_16[0]') > 0 and + res.GetOutput().find('(char) char_16[15]') > 0) self.ci.HandleCommand("variable list ushort_matrix", res); self.assertTrue(res.Succeeded()) Modified: lldb/trunk/test/class_types/TestClassTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=107724&r1=107723&r2=107724&view=diff ============================================================================== --- lldb/trunk/test/class_types/TestClassTypes.py (original) +++ lldb/trunk/test/class_types/TestClassTypes.py Tue Jul 6 18:26:16 2010 @@ -30,13 +30,13 @@ self.ci.HandleCommand("thread list", res) print "thread list ->", res.GetOutput() self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find('state is Stopped') and - res.GetOutput().find('stop reason = breakpoint')) + self.assertTrue(res.GetOutput().find('state is Stopped') > 0 and + res.GetOutput().find('stop reason = breakpoint') > 0) # The breakpoint should have a hit count of 1. self.ci.HandleCommand("breakpoint list", res) self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find(' resolved, hit count = 1')) + self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0) # We should be stopped on the ctor function of class C. self.ci.HandleCommand("variable list this", res); Modified: lldb/trunk/test/function_types/TestFunctionTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/function_types/TestFunctionTypes.py?rev=107724&r1=107723&r2=107724&view=diff ============================================================================== --- lldb/trunk/test/function_types/TestFunctionTypes.py (original) +++ lldb/trunk/test/function_types/TestFunctionTypes.py Tue Jul 6 18:26:16 2010 @@ -30,13 +30,13 @@ self.ci.HandleCommand("thread list", res) print "thread list ->", res.GetOutput() self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find('state is Stopped') and - res.GetOutput().find('stop reason = breakpoint')) + self.assertTrue(res.GetOutput().find('state is Stopped') > 0 and + res.GetOutput().find('stop reason = breakpoint') > 0) # The breakpoint should have a hit count of 1. self.ci.HandleCommand("breakpoint list", res) self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find(' resolved, hit count = 1')) + self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0) # Check that the 'callback' variable display properly. self.ci.HandleCommand("variable list callback", res); @@ -55,9 +55,9 @@ self.assertTrue(res.Succeeded()) output = res.GetOutput() #print "process status =", output - self.assertTrue(output.find('where = a.out`string_not_empty') and - output.find('main.c:12') and - output.find('stop reason = breakpoint')) + self.assertTrue(output.find('where = a.out`string_not_empty') > 0 and + output.find('main.c:12') > 0 and + output.find('stop reason = breakpoint') > 0) self.ci.HandleCommand("continue", res) self.assertTrue(res.Succeeded()) Modified: lldb/trunk/test/global_variables/TestGlobalVariables.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/global_variables/TestGlobalVariables.py?rev=107724&r1=107723&r2=107724&view=diff ============================================================================== --- lldb/trunk/test/global_variables/TestGlobalVariables.py (original) +++ lldb/trunk/test/global_variables/TestGlobalVariables.py Tue Jul 6 18:26:16 2010 @@ -30,24 +30,24 @@ self.ci.HandleCommand("thread list", res) print "thread list ->", res.GetOutput() self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find('state is Stopped') and - res.GetOutput().find('stop reason = breakpoint')) + self.assertTrue(res.GetOutput().find('state is Stopped') > 0 and + res.GetOutput().find('stop reason = breakpoint') > 0) # The breakpoint should have a hit count of 1. self.ci.HandleCommand("breakpoint list", res) self.assertTrue(res.Succeeded()) - self.assertTrue(res.GetOutput().find(' resolved, hit count = 1')) + self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0) # Check that GLOBAL scopes are indicated for the variables. self.ci.HandleCommand("variable list -s -a", res); self.assertTrue(res.Succeeded()) output = res.GetOutput() - self.assertTrue(output.find('GLOBAL: g_file_static_cstr') and - output.find('g_file_static_cstr') and - output.find('GLOBAL: g_file_global_int') and - output.find('(int) 42') and - output.find('GLOBAL: g_file_global_cstr') and - output.find('g_file_global_cstr')) + self.assertTrue(output.find('GLOBAL: g_file_static_cstr') > 0 and + output.find('g_file_static_cstr') > 0 and + output.find('GLOBAL: g_file_global_int') > 0 and + output.find('(int) 42') > 0 and + output.find('GLOBAL: g_file_global_cstr') > 0 and + output.find('g_file_global_cstr') > 0) self.ci.HandleCommand("continue", res) self.assertTrue(res.Succeeded()) From gclayton at apple.com Tue Jul 6 18:34:08 2010 From: gclayton at apple.com (Greg Clayton) Date: Tue, 06 Jul 2010 23:34:08 -0000 Subject: [Lldb-commits] [lldb] r107729 - /lldb/trunk/source/Symbol/LineTable.cpp Message-ID: <20100706233408.DC82E2A6C12C@llvm.org> Author: gclayton Date: Tue Jul 6 18:34:08 2010 New Revision: 107729 URL: http://llvm.org/viewvc/llvm-project?rev=107729&view=rev Log: Fixed an issue with looking up line table entries by address where internal line table entries that were termination entries (ones that define the bounds of the previous entry) could be found when looking up line table entries. We now properly skip these termination entries and check the next entry to try for a match. Modified: lldb/trunk/source/Symbol/LineTable.cpp Modified: lldb/trunk/source/Symbol/LineTable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineTable.cpp?rev=107729&r1=107728&r2=107729&view=diff ============================================================================== --- lldb/trunk/source/Symbol/LineTable.cpp (original) +++ lldb/trunk/source/Symbol/LineTable.cpp Tue Jul 6 18:34:08 2010 @@ -194,22 +194,50 @@ --pos; else if (pos->sect_offset == search_entry.sect_offset) { - while (pos != begin_pos) + // If this is a termination entry, it should't match since + // entries with the "is_terminal_entry" member set to true + // are termination entries that define the range for the + // previous entry. + if (pos->is_terminal_entry) { - entry_collection::const_iterator prev_pos = pos - 1; - if (prev_pos->sect_idx == search_entry.sect_idx && - prev_pos->sect_offset == search_entry.sect_offset) - --pos; - else - break; + // The matching entry is a terminal entry, so we skip + // ahead to the next entry to see if there is another + // entry following this one whose section/offset matches. + ++pos; + if (pos != end_pos) + { + if (pos->sect_offset != search_entry.sect_offset) + pos = end_pos; + } + } + + if (pos != end_pos) + { + // While in the same section/offset backup to find the first + // line entry that matches the address in case there are + // multiple + while (pos != begin_pos) + { + entry_collection::const_iterator prev_pos = pos - 1; + if (prev_pos->sect_idx == search_entry.sect_idx && + prev_pos->sect_offset == search_entry.sect_offset && + prev_pos->is_terminal_entry == false) + --pos; + else + break; + } } } } - uint32_t match_idx = std::distance (begin_pos, pos); - success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry); - if (index_ptr != NULL && success) - *index_ptr = match_idx; + + if (pos != end_pos) + { + uint32_t match_idx = std::distance (begin_pos, pos); + success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry); + if (index_ptr != NULL && success) + *index_ptr = match_idx; + } } } return success; From johnny.chen at apple.com Tue Jul 6 18:41:17 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 06 Jul 2010 23:41:17 -0000 Subject: [Lldb-commits] [lldb] r107733 - /lldb/trunk/test/dead-strip/TestDeadStrip.py Message-ID: <20100706234117.C6EDD2A6C12C@llvm.org> Author: johnny Date: Tue Jul 6 18:41:17 2010 New Revision: 107733 URL: http://llvm.org/viewvc/llvm-project?rev=107733&view=rev Log: Enable a test clause since rdar://problem/8163668 is fixed by http://llvm.org/viewvc/llvm-project?rev=107729&view=rev. Modified: lldb/trunk/test/dead-strip/TestDeadStrip.py Modified: lldb/trunk/test/dead-strip/TestDeadStrip.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dead-strip/TestDeadStrip.py?rev=107733&r1=107732&r2=107733&view=diff ============================================================================== --- lldb/trunk/test/dead-strip/TestDeadStrip.py (original) +++ lldb/trunk/test/dead-strip/TestDeadStrip.py Tue Jul 6 18:41:17 2010 @@ -65,12 +65,7 @@ output = res.GetOutput() self.assertTrue(res.Succeeded()) self.assertTrue(output.find('state is Stopped') > 0 and - # TODO: - # - # Uncomment 'main.c:40' line when rdar://problem/8163668 - # is fixed. - # - #output.find('main.c:40') > 0 and + output.find('main.c:40') > 0 and output.find('where = a.out`f3') > 0 and output.find('stop reason = breakpoint') > 0) From jingham at apple.com Tue Jul 6 18:48:33 2010 From: jingham at apple.com (Jim Ingham) Date: Tue, 06 Jul 2010 23:48:33 -0000 Subject: [Lldb-commits] [lldb] r107736 - in /lldb/trunk: include/lldb/Interpreter/CommandInterpreter.h include/lldb/Interpreter/CommandObject.h source/Commands/CommandObjectSourceFile.h source/Interpreter/CommandInterpreter.cpp Message-ID: <20100706234833.9DDBB2A6C12C@llvm.org> Author: jingham Date: Tue Jul 6 18:48:33 2010 New Revision: 107736 URL: http://llvm.org/viewvc/llvm-project?rev=107736&view=rev Log: Added a "GetRepeatCommand" to the command object. The Interpreter uses this instead of the last history item to provide a command for the "empty" command. Use this in the source-file command to make continue the listing rather than relist the first listing... Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h lldb/trunk/include/lldb/Interpreter/CommandObject.h lldb/trunk/source/Commands/CommandObjectSourceFile.h lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=107736&r1=107735&r2=107736&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Tue Jul 6 18:48:33 2010 @@ -260,6 +260,7 @@ VariableMap m_variables; OptionArgMap m_alias_options; // Stores any options (with or without arguments) that go with any alias. std::vector m_command_history; + std::string m_repeat_command; // Stores the command that will be executed for an empty command string. }; Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=107736&r1=107735&r2=107736&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue Jul 6 18:48:33 2010 @@ -252,6 +252,21 @@ //------------------------------------------------------------------ const Flags& GetFlags() const; + + //------------------------------------------------------------------ + /// Get the command that appropriate for a "repeat" of the current command. + /// + /// @param[in] current_command_line + /// The complete current command line. + /// + /// @return + /// NULL if the command is not to be repeated. + /// Otherwise a pointer to the command to be repeated. + //------------------------------------------------------------------ + virtual const char *GetRepeatCommand (const char *current_command_line) + { + return current_command_line; + } protected: std::string m_cmd_name; Modified: lldb/trunk/source/Commands/CommandObjectSourceFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.h?rev=107736&r1=107735&r2=107736&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSourceFile.h (original) +++ lldb/trunk/source/Commands/CommandObjectSourceFile.h Tue Jul 6 18:48:33 2010 @@ -69,6 +69,13 @@ virtual Options * GetOptions (); + + virtual const char *GetRepeatCommand (const char *current_command_line) + { + printf("\nReturning: \"%s\"\n", m_cmd_name.c_str()); + return m_cmd_name.c_str(); + } + protected: CommandOptions m_options; Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=107736&r1=107735&r2=107736&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jul 6 18:48:33 2010 @@ -627,7 +627,13 @@ } else { - command_line = m_command_history.back().c_str(); + command_line = m_repeat_command.c_str(); + if (m_repeat_command.empty()) + { + result.AppendError(""); + result.SetStatus (eReturnStatusFailed); + return false; + } } add_to_history = false; } @@ -653,6 +659,18 @@ return false; } + if (add_to_history) + { + const char *repeat_command = command_obj->GetRepeatCommand(command_line); + if (repeat_command) + m_repeat_command.assign(repeat_command); + else + m_repeat_command.clear(); + + m_command_history.push_back (command_line); + } + + if (command_obj->WantsRawCommandString()) { const char *stripped_command = ::strstr (command_line, command_cstr); @@ -666,9 +684,6 @@ } else { - if (add_to_history) - m_command_history.push_back (command_line); - // Remove the command from the args. command_args.Shift(); command_obj->ExecuteWithOptions (*this, command_args, result); From jingham at apple.com Tue Jul 6 22:36:20 2010 From: jingham at apple.com (Jim Ingham) Date: Wed, 07 Jul 2010 03:36:20 -0000 Subject: [Lldb-commits] [lldb] r107751 - in /lldb/trunk: include/lldb/Interpreter/ lldb.xcodeproj/ source/Commands/ source/Interpreter/ Message-ID: <20100707033620.EFEC02A6C12C@llvm.org> Author: jingham Date: Tue Jul 6 22:36:20 2010 New Revision: 107751 URL: http://llvm.org/viewvc/llvm-project?rev=107751&view=rev Log: Fix GetRepeatCommand so it works with multi-word commands. Move the "source", "alias", and "unalias" commands to "commands *". Move "source-file" to "source list". Added a "source info" command but it isn't implemented yet. Added: lldb/trunk/source/Commands/CommandObjectCommands.cpp lldb/trunk/source/Commands/CommandObjectCommands.h Removed: lldb/trunk/source/Commands/CommandObjectAlias.cpp lldb/trunk/source/Commands/CommandObjectAlias.h lldb/trunk/source/Commands/CommandObjectSourceFile.cpp lldb/trunk/source/Commands/CommandObjectSourceFile.h lldb/trunk/source/Commands/CommandObjectUnalias.cpp lldb/trunk/source/Commands/CommandObjectUnalias.h Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Commands/CommandObjectApropos.cpp lldb/trunk/source/Commands/CommandObjectMultiword.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectSource.cpp lldb/trunk/source/Commands/CommandObjectSource.h lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue Jul 6 22:36:20 2010 @@ -260,12 +260,13 @@ /// The complete current command line. /// /// @return - /// NULL if the command is not to be repeated. - /// Otherwise a pointer to the command to be repeated. + /// NULL if there is no special repeat command - it will use the current command line. + /// Otherwise a pointer to the command to be repeated. + /// If the returned string is the empty string, the command won't be repeated. //------------------------------------------------------------------ - virtual const char *GetRepeatCommand (const char *current_command_line) + virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index) { - return current_command_line; + return NULL; } protected: Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h Tue Jul 6 22:36:20 2010 @@ -67,6 +67,8 @@ bool &word_complete, StringList &matches); + virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index); + CommandObject::CommandMap m_subcommand_dict; }; Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jul 6 22:36:20 2010 @@ -76,7 +76,6 @@ 26D5B07211B07550009A862E /* Stoppoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1610F1B83100F91463 /* Stoppoint.cpp */; }; 26D5B07311B07550009A862E /* StoppointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */; }; 26D5B07411B07550009A862E /* WatchpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */; }; - 26D5B07511B07550009A862E /* CommandObjectAlias.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E2A10F1B84700F91463 /* CommandObjectAlias.cpp */; }; 26D5B07611B07550009A862E /* CommandObjectAppend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E2B10F1B84700F91463 /* CommandObjectAppend.cpp */; }; 26D5B07711B07550009A862E /* CommandObjectBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */; }; 26D5B07811B07550009A862E /* CommandObjectDelete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E2F10F1B84700F91463 /* CommandObjectDelete.cpp */; }; @@ -96,7 +95,6 @@ 26D5B08611B07550009A862E /* CommandObjectSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4010F1B84700F91463 /* CommandObjectSettings.cpp */; }; 26D5B08711B07550009A862E /* CommandObjectShow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4110F1B84700F91463 /* CommandObjectShow.cpp */; }; 26D5B08811B07550009A862E /* CommandObjectSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */; }; - 26D5B08911B07550009A862E /* CommandObjectSourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */; }; 26D5B08B11B07550009A862E /* CommandObjectSyntax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */; }; 26D5B08C11B07550009A862E /* CommandObjectThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */; }; 26D5B08D11B07550009A862E /* CommandObjectVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4810F1B84700F91463 /* CommandObjectVariable.cpp */; }; @@ -240,7 +238,6 @@ 26D5B11A11B07550009A862E /* SymbolFileDWARFDebugMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89DB10F57C5600BB2B04 /* SymbolFileDWARFDebugMap.cpp */; }; 26D5B11B11B07550009A862E /* SymbolFileSymtab.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89DE10F57C5600BB2B04 /* SymbolFileSymtab.cpp */; }; 26D5B11C11B07550009A862E /* SymbolVendorMacOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C89E210F57C5600BB2B04 /* SymbolVendorMacOSX.cpp */; }; - 26D5B11D11B07550009A862E /* CommandObjectUnalias.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A8B4EA310FD516400C68FF2 /* CommandObjectUnalias.cpp */; }; 26D5B11E11B07550009A862E /* ScriptInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A82010B10FFB49800182560 /* ScriptInterpreter.cpp */; }; 26D5B11F11B07550009A862E /* BreakpointResolverAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D0DD5310FE555900271C65 /* BreakpointResolverAddress.cpp */; }; 26D5B12011B07550009A862E /* BreakpointResolverFileLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D0DD5410FE555900271C65 /* BreakpointResolverFileLine.cpp */; }; @@ -340,6 +337,8 @@ 49F1A74A11B338AE003ED505 /* ClangExpressionDeclMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 49F1A74911B338AE003ED505 /* ClangExpressionDeclMap.h */; }; 4C08CDE811C81EF8001610A8 /* ThreadSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */; }; 4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */; }; + 4C5DBBC811E3FEC60035160F /* CommandObjectCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */; }; + 4C5DBBC911E3FEC60035160F /* CommandObjectCommands.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */; }; 4CA9637B11B6E99A00780E28 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; }; 9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; }; @@ -594,7 +593,6 @@ 26BC7CFA10F1B71400F91463 /* Stoppoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stoppoint.h; path = include/lldb/Breakpoint/Stoppoint.h; sourceTree = ""; }; 26BC7CFB10F1B71400F91463 /* StoppointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StoppointLocation.h; path = include/lldb/Breakpoint/StoppointLocation.h; sourceTree = ""; }; 26BC7CFC10F1B71400F91463 /* WatchpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WatchpointLocation.h; path = include/lldb/Breakpoint/WatchpointLocation.h; sourceTree = ""; }; - 26BC7D1110F1B76300F91463 /* CommandObjectAlias.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectAlias.h; path = source/Commands/CommandObjectAlias.h; sourceTree = ""; }; 26BC7D1210F1B76300F91463 /* CommandObjectAppend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectAppend.h; path = source/Commands/CommandObjectAppend.h; sourceTree = ""; }; 26BC7D1410F1B76300F91463 /* CommandObjectBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectBreakpoint.h; path = source/Commands/CommandObjectBreakpoint.h; sourceTree = ""; }; 26BC7D1610F1B76300F91463 /* CommandObjectDelete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectDelete.h; path = source/Commands/CommandObjectDelete.h; sourceTree = ""; }; @@ -614,7 +612,6 @@ 26BC7D2710F1B76300F91463 /* CommandObjectSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSettings.h; path = source/Commands/CommandObjectSettings.h; sourceTree = ""; }; 26BC7D2810F1B76300F91463 /* CommandObjectShow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectShow.h; path = source/Commands/CommandObjectShow.h; sourceTree = ""; }; 26BC7D2910F1B76300F91463 /* CommandObjectSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSource.h; path = source/Commands/CommandObjectSource.h; sourceTree = ""; }; - 26BC7D2A10F1B76300F91463 /* CommandObjectSourceFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSourceFile.h; path = source/Commands/CommandObjectSourceFile.h; sourceTree = ""; }; 26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSyntax.h; path = source/Commands/CommandObjectSyntax.h; sourceTree = ""; }; 26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectThread.h; path = source/Commands/CommandObjectThread.h; sourceTree = ""; }; 26BC7D2F10F1B76300F91463 /* CommandObjectVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVariable.h; path = source/Commands/CommandObjectVariable.h; sourceTree = ""; }; @@ -712,7 +709,6 @@ 26BC7E1610F1B83100F91463 /* Stoppoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stoppoint.cpp; path = source/Breakpoint/Stoppoint.cpp; sourceTree = ""; }; 26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StoppointLocation.cpp; path = source/Breakpoint/StoppointLocation.cpp; sourceTree = ""; }; 26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointLocation.cpp; path = source/Breakpoint/WatchpointLocation.cpp; sourceTree = ""; }; - 26BC7E2A10F1B84700F91463 /* CommandObjectAlias.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectAlias.cpp; path = source/Commands/CommandObjectAlias.cpp; sourceTree = ""; }; 26BC7E2B10F1B84700F91463 /* CommandObjectAppend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectAppend.cpp; path = source/Commands/CommandObjectAppend.cpp; sourceTree = ""; }; 26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpoint.cpp; path = source/Commands/CommandObjectBreakpoint.cpp; sourceTree = ""; }; 26BC7E2F10F1B84700F91463 /* CommandObjectDelete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectDelete.cpp; path = source/Commands/CommandObjectDelete.cpp; sourceTree = ""; }; @@ -732,7 +728,6 @@ 26BC7E4010F1B84700F91463 /* CommandObjectSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSettings.cpp; path = source/Commands/CommandObjectSettings.cpp; sourceTree = ""; }; 26BC7E4110F1B84700F91463 /* CommandObjectShow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectShow.cpp; path = source/Commands/CommandObjectShow.cpp; sourceTree = ""; }; 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSource.cpp; path = source/Commands/CommandObjectSource.cpp; sourceTree = ""; }; - 26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSourceFile.cpp; path = source/Commands/CommandObjectSourceFile.cpp; sourceTree = ""; }; 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSyntax.cpp; path = source/Commands/CommandObjectSyntax.cpp; sourceTree = ""; }; 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectThread.cpp; path = source/Commands/CommandObjectThread.cpp; sourceTree = ""; }; 26BC7E4810F1B84700F91463 /* CommandObjectVariable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVariable.cpp; path = source/Commands/CommandObjectVariable.cpp; sourceTree = ""; }; @@ -930,6 +925,8 @@ 4C43DF8A11069C3200E55CBF /* ThreadPlanStepOverRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOverRange.cpp; path = source/Target/ThreadPlanStepOverRange.cpp; sourceTree = ""; }; 4C51FF1511A4C485007C962F /* ObjCTrampolineHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCTrampolineHandler.h; sourceTree = ""; }; 4C51FF1611A4C486007C962F /* ObjCTrampolineHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjCTrampolineHandler.cpp; sourceTree = ""; }; + 4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectCommands.cpp; path = source/Commands/CommandObjectCommands.cpp; sourceTree = ""; }; + 4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectCommands.h; path = source/Commands/CommandObjectCommands.h; sourceTree = ""; }; 4C98D3DA118FB96F00E575D0 /* ClangFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangFunction.cpp; path = source/Expression/ClangFunction.cpp; sourceTree = ""; }; 4C98D3DB118FB96F00E575D0 /* RecordingMemoryManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecordingMemoryManager.cpp; path = source/Expression/RecordingMemoryManager.cpp; sourceTree = ""; }; 4C98D3E0118FB98F00E575D0 /* ClangFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangFunction.h; path = include/lldb/Expression/ClangFunction.h; sourceTree = ""; }; @@ -991,8 +988,6 @@ 9A633FE7112DCE3C001A7E43 /* SBFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFrame.cpp; path = source/API/SBFrame.cpp; sourceTree = ""; }; 9A633FE8112DCE3C001A7E43 /* SBFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBFrame.h; path = include/lldb/API/SBFrame.h; sourceTree = ""; }; 9A82010B10FFB49800182560 /* ScriptInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScriptInterpreter.cpp; path = source/Interpreter/ScriptInterpreter.cpp; sourceTree = ""; }; - 9A8B4EA210FD515000C68FF2 /* CommandObjectUnalias.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectUnalias.h; path = source/Commands/CommandObjectUnalias.h; sourceTree = ""; }; - 9A8B4EA310FD516400C68FF2 /* CommandObjectUnalias.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectUnalias.cpp; path = source/Commands/CommandObjectUnalias.cpp; sourceTree = ""; }; 9A9830F21125FC5800A56CB0 /* SBBroadcaster.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBBroadcaster.cpp; path = source/API/SBBroadcaster.cpp; sourceTree = ""; }; 9A9830F31125FC5800A56CB0 /* SBBroadcaster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBBroadcaster.h; path = include/lldb/API/SBBroadcaster.h; sourceTree = ""; }; 9A9830F41125FC5800A56CB0 /* SBCommandContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBCommandContext.cpp; path = source/API/SBCommandContext.cpp; sourceTree = ""; }; @@ -1753,8 +1748,6 @@ 26BC7D0D10F1B71D00F91463 /* Commands */ = { isa = PBXGroup; children = ( - 26BC7D1110F1B76300F91463 /* CommandObjectAlias.h */, - 26BC7E2A10F1B84700F91463 /* CommandObjectAlias.cpp */, 26BC7D1210F1B76300F91463 /* CommandObjectAppend.h */, 26BC7E2B10F1B84700F91463 /* CommandObjectAppend.cpp */, 4CA9637A11B6E99A00780E28 /* CommandObjectApropos.h */, @@ -1767,6 +1760,8 @@ 9A42976211861AA600FE05CD /* CommandObjectBreakpointCommand.cpp */, 4C98D3E5118FB9B100E575D0 /* CommandObjectCall.h */, 4C98D3E4118FB9B100E575D0 /* CommandObjectCall.cpp */, + 4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */, + 4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */, 26BC7D1610F1B76300F91463 /* CommandObjectDelete.h */, 26BC7E2F10F1B84700F91463 /* CommandObjectDelete.cpp */, 26BC7D1710F1B76300F91463 /* CommandObjectDisassemble.h */, @@ -1805,16 +1800,12 @@ 26BC7E4110F1B84700F91463 /* CommandObjectShow.cpp */, 26BC7D2910F1B76300F91463 /* CommandObjectSource.h */, 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */, - 26BC7D2A10F1B76300F91463 /* CommandObjectSourceFile.h */, - 26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */, 26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */, 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */, 269416AE119A024800FF2715 /* CommandObjectTarget.h */, 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */, 26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */, 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */, - 9A8B4EA210FD515000C68FF2 /* CommandObjectUnalias.h */, - 9A8B4EA310FD516400C68FF2 /* CommandObjectUnalias.cpp */, 26BC7D2F10F1B76300F91463 /* CommandObjectVariable.h */, 26BC7E4810F1B84700F91463 /* CommandObjectVariable.cpp */, ); @@ -2198,6 +2189,7 @@ 49A8A3A411D568BF00AD3B68 /* ClangResultSynthesizer.h in Headers */, 49DA743511DE6BB2006AEF7E /* IRToDWARF.h in Headers */, 49307AB211DEA4F20081F992 /* IRForTarget.h in Headers */, + 4C5DBBC911E3FEC60035160F /* CommandObjectCommands.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2380,7 +2372,6 @@ 26D5B07211B07550009A862E /* Stoppoint.cpp in Sources */, 26D5B07311B07550009A862E /* StoppointLocation.cpp in Sources */, 26D5B07411B07550009A862E /* WatchpointLocation.cpp in Sources */, - 26D5B07511B07550009A862E /* CommandObjectAlias.cpp in Sources */, 26D5B07611B07550009A862E /* CommandObjectAppend.cpp in Sources */, 26D5B07711B07550009A862E /* CommandObjectBreakpoint.cpp in Sources */, 26D5B07811B07550009A862E /* CommandObjectDelete.cpp in Sources */, @@ -2400,7 +2391,6 @@ 26D5B08611B07550009A862E /* CommandObjectSettings.cpp in Sources */, 26D5B08711B07550009A862E /* CommandObjectShow.cpp in Sources */, 26D5B08811B07550009A862E /* CommandObjectSource.cpp in Sources */, - 26D5B08911B07550009A862E /* CommandObjectSourceFile.cpp in Sources */, 26D5B08B11B07550009A862E /* CommandObjectSyntax.cpp in Sources */, 26D5B08C11B07550009A862E /* CommandObjectThread.cpp in Sources */, 26D5B08D11B07550009A862E /* CommandObjectVariable.cpp in Sources */, @@ -2544,7 +2534,6 @@ 26D5B11A11B07550009A862E /* SymbolFileDWARFDebugMap.cpp in Sources */, 26D5B11B11B07550009A862E /* SymbolFileSymtab.cpp in Sources */, 26D5B11C11B07550009A862E /* SymbolVendorMacOSX.cpp in Sources */, - 26D5B11D11B07550009A862E /* CommandObjectUnalias.cpp in Sources */, 26D5B11E11B07550009A862E /* ScriptInterpreter.cpp in Sources */, 26D5B11F11B07550009A862E /* BreakpointResolverAddress.cpp in Sources */, 26D5B12011B07550009A862E /* BreakpointResolverFileLine.cpp in Sources */, @@ -2649,6 +2638,7 @@ 49A8A3A011D568A300AD3B68 /* ClangResultSynthesizer.cpp in Sources */, 49DA743011DE6A5A006AEF7E /* IRToDWARF.cpp in Sources */, 49307AAE11DEA4D90081F992 /* IRForTarget.cpp in Sources */, + 4C5DBBC811E3FEC60035160F /* CommandObjectCommands.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Removed: lldb/trunk/source/Commands/CommandObjectAlias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAlias.cpp?rev=107750&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectAlias.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectAlias.cpp (removed) @@ -1,229 +0,0 @@ -//===-- CommandObjectAlias.cpp ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "CommandObjectAlias.h" - - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandObjectMultiword.h" -#include "lldb/Interpreter/Args.h" -#include "lldb/Interpreter/Options.h" -#include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Interpreter/CommandInterpreter.h" - -using namespace lldb; -using namespace lldb_private; - -//------------------------------------------------------------------------- -// CommandObjectAlias -//------------------------------------------------------------------------- - -CommandObjectAlias::CommandObjectAlias () : - CommandObject ("alias", - "Allows users to define their own debugger command abbreviations.", - "alias []") -{ - SetHelpLong( -"'alias' allows the user to create a short-cut or abbreviation for long \n\ -commands, multi-word commands, and commands that take particular options. \n\ -Below are some simple examples of how one might use the 'alias' command: \n\ -\n 'alias sc script' // Creates the abbreviation 'sc' for the 'script' \n\ - // command. \n\ - 'alias bp breakpoint' // Creates the abbreviation 'bp' for the 'breakpoint' \n\ - // command. Since breakpoint commands are two-word \n\ - // commands, the user will still need to enter the \n\ - // second word after 'bp', e.g. 'bp enable' or \n\ - // 'bp delete'. \n\ - 'alias bpi breakpoint list' // Creates the abbreviation 'bpi' for the \n\ - // two-word command 'breakpoint list'. \n\ -\nAn alias can include some options for the command, with the values either \n\ -filled in at the time the alias is created, or specified as positional \n\ -arguments, to be filled in when the alias is invoked. The following example \n\ -shows how to create aliases with options: \n\ -\n\ - 'alias bfl breakpoint set -f %1 -l %2' \n\ -\nThis creates the abbreviation 'bfl' (for break-file-line), with the -f and -l \n\ -options already part of the alias. So if the user wants to set a breakpoint \n\ -by file and line without explicitly having to use the -f and -l options, the \n\ -user can now use 'bfl' instead. The '%1' and '%2' are positional placeholders \n\ -for the actual arguments that will be passed when the alias command is used. \n\ -The number in the placeholder refers to the position/order the actual value \n\ -occupies when the alias is used. So all the occurrences of '%1' in the alias \n\ -will be replaced with the first argument, all the occurrences of '%2' in the \n\ -alias will be replaced with the second argument, and so on. This also allows \n\ -actual arguments to be used multiple times within an alias (see 'process \n\ -launch' example below). So in the 'bfl' case, the actual file value will be \n\ -filled in with the first argument following 'bfl' and the actual line number \n\ -value will be filled in with the second argument. The user would use this \n\ -alias as follows: \n\ -\n (dbg) alias bfl breakpoint set -f %1 -l %2 \n\ - <... some time later ...> \n\ - (dbg) bfl my-file.c 137 \n\ -\nThis would be the same as if the user had entered \n\ -'breakpoint set -f my-file.c -l 137'. \n\ -\nAnother example: \n\ -\n (dbg) alias pltty process launch -s -o %1 -e %1 \n\ - (dbg) pltty /dev/tty0 \n\ - // becomes 'process launch -s -o /dev/tty0 -e /dev/tty0' \n\ -\nIf the user always wanted to pass the same value to a particular option, the \n\ -alias could be defined with that value directly in the alias as a constant, \n\ -rather than using a positional placeholder: \n\ -\n alias bl3 breakpoint set -f %1 -l 3 // Always sets a breakpoint on line \n\ - // 3 of whatever file is indicated. \n"); - -} - -CommandObjectAlias::~CommandObjectAlias () -{ -} - - -bool -CommandObjectAlias::Execute -( - CommandInterpreter &interpreter, - Args& args, - CommandReturnObject &result -) -{ - const int argc = args.GetArgumentCount(); - - if (argc < 2) - { - result.AppendError ("'alias' requires at least two arguments"); - result.SetStatus (eReturnStatusFailed); - return false; - } - - const std::string alias_command = args.GetArgumentAtIndex(0); - const std::string actual_command = args.GetArgumentAtIndex(1); - - args.Shift(); // Shift the alias command word off the argument vector. - args.Shift(); // Shift the old command word off the argument vector. - - // Verify that the command is alias'able, and get the appropriate command object. - - if (interpreter.CommandExists (alias_command.c_str())) - { - result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be redefined.\n", - alias_command.c_str()); - result.SetStatus (eReturnStatusFailed); - } - else - { - CommandObjectSP command_obj_sp(interpreter.GetCommandSPExact (actual_command.c_str(), true)); - CommandObjectSP subcommand_obj_sp; - bool use_subcommand = false; - if (command_obj_sp.get()) - { - CommandObject *cmd_obj = command_obj_sp.get(); - CommandObject *sub_cmd_obj; - OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector); - OptionArgVector *option_arg_vector = option_arg_vector_sp.get(); - - if (cmd_obj->IsMultiwordObject()) - { - if (argc >= 3) - { - const std::string sub_command = args.GetArgumentAtIndex(0); - assert (sub_command.length() != 0); - subcommand_obj_sp = - (((CommandObjectMultiword *) cmd_obj)->GetSubcommandSP (sub_command.c_str())); - if (subcommand_obj_sp.get()) - { - sub_cmd_obj = subcommand_obj_sp.get(); - use_subcommand = true; - args.Shift(); // Shift the sub_command word off the argument vector. - } - else - { - result.AppendErrorWithFormat ("Error occurred while attempting to look up command '%s %s'.\n", - alias_command.c_str(), sub_command.c_str()); - result.SetStatus (eReturnStatusFailed); - return false; - } - } - } - - // Verify & handle any options/arguments passed to the alias command - - if (args.GetArgumentCount () > 0) - { - if ((!use_subcommand && (cmd_obj->WantsRawCommandString())) - || (use_subcommand && (sub_cmd_obj->WantsRawCommandString()))) - { - result.AppendErrorWithFormat ("'%s' cannot be aliased with any options or arguments.\n", - (use_subcommand ? sub_cmd_obj->GetCommandName() - : cmd_obj->GetCommandName())); - result.SetStatus (eReturnStatusFailed); - return false; - } - - // options or arguments have been passed to the alias command, and must be verified & processed here. - if ((!use_subcommand && (cmd_obj->GetOptions() != NULL)) - || (use_subcommand && (sub_cmd_obj->GetOptions() != NULL))) - { - Options *options; - if (use_subcommand) - options = sub_cmd_obj->GetOptions(); - else - options = cmd_obj->GetOptions(); - options->ResetOptionValues (); - args.Unshift ("dummy_arg"); - args.ParseAliasOptions (*options, result, option_arg_vector); - args.Shift (); - if (result.Succeeded()) - options->VerifyPartialOptions (result); - if (!result.Succeeded()) - return false; - } - else - { - for (int i = 0; i < args.GetArgumentCount(); ++i) - option_arg_vector->push_back (OptionArgPair ("", - std::string (args.GetArgumentAtIndex (i)))); - } - } - - // Create the alias. - - if (interpreter.AliasExists (alias_command.c_str()) - || interpreter.UserCommandExists (alias_command.c_str())) - { - OptionArgVectorSP tmp_option_arg_sp (interpreter.GetAliasOptions (alias_command.c_str())); - if (tmp_option_arg_sp.get()) - { - if (option_arg_vector->size() == 0) - interpreter.RemoveAliasOptions (alias_command.c_str()); - } - result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", alias_command.c_str()); - } - - if (use_subcommand) - interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp); - else - interpreter.AddAlias (alias_command.c_str(), command_obj_sp); - if (option_arg_vector->size() > 0) - interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp); - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - else - { - result.AppendErrorWithFormat ("'%s' is not an existing command.\n", actual_command.c_str()); - result.SetStatus (eReturnStatusFailed); - } - } - - return result.Succeeded(); -} - Removed: lldb/trunk/source/Commands/CommandObjectAlias.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAlias.h?rev=107750&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectAlias.h (original) +++ lldb/trunk/source/Commands/CommandObjectAlias.h (removed) @@ -1,42 +0,0 @@ -//===-- CommandObjectAlias.h ------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_CommandObjectAlias_h_ -#define liblldb_CommandObjectAlias_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandObject.h" - -namespace lldb_private { - -//------------------------------------------------------------------------- -// CommandObjectAlias -//------------------------------------------------------------------------- - -class CommandObjectAlias : public CommandObject -{ -public: - - CommandObjectAlias (); - - virtual - ~CommandObjectAlias (); - - virtual bool - Execute (CommandInterpreter &interpreter, - Args& command, - CommandReturnObject &result); -}; - -} // namespace lldb_private - -#endif // liblldb_CommandObjectAlias_h_ Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Tue Jul 6 22:36:20 2010 @@ -18,7 +18,6 @@ #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Interpreter/CommandObjectMultiword.h" using namespace lldb; using namespace lldb_private; Added: lldb/trunk/source/Commands/CommandObjectCommands.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=107751&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (added) +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Tue Jul 6 22:36:20 2010 @@ -0,0 +1,437 @@ +//===-- CommandObjectSource.cpp ---------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "CommandObjectCommands.h" + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Interpreter/Args.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Interpreter/Options.h" + +using namespace lldb; +using namespace lldb_private; + +const char *k_space_characters = "\t\n\v\f\r "; + +//------------------------------------------------------------------------- +// CommandObjectCommandsSource +//------------------------------------------------------------------------- + +class CommandObjectCommandsSource : public CommandObject +{ +public: + CommandObjectCommandsSource() : + CommandObject ("commands source", + "Reads in debugger commands from the file and executes them.", + "command source ") + { + } + + ~CommandObjectCommandsSource () + { + } + + bool + Execute + ( + CommandInterpreter &interpreter, + Args& args, + CommandReturnObject &result + ) + { + const int argc = args.GetArgumentCount(); + if (argc == 1) + { + const char *filename = args.GetArgumentAtIndex(0); + bool success = true; + + result.AppendMessageWithFormat ("Executing commands in '%s'.\n", filename); + + FileSpec cmd_file (filename); + if (cmd_file.Exists()) + { + STLStringArray commands; + success = cmd_file.ReadFileLines (commands); + + STLStringArray::iterator pos = commands.begin(); + + // Trim out any empty lines or lines that start with the comment + // char '#' + while (pos != commands.end()) + { + bool remove_string = false; + size_t non_space = pos->find_first_not_of (k_space_characters); + if (non_space == std::string::npos) + remove_string = true; // Empty line + else if ((*pos)[non_space] == '#') + remove_string = true; // Comment line that starts with '#' + + if (remove_string) + pos = commands.erase(pos); + else + ++pos; + } + + if (commands.size() > 0) + { + const size_t num_commands = commands.size(); + size_t i; + for (i = 0; i []") + { + SetHelpLong( + "'alias' allows the user to create a short-cut or abbreviation for long \n\ + commands, multi-word commands, and commands that take particular options. \n\ + Below are some simple examples of how one might use the 'alias' command: \n\ + \n 'alias sc script' // Creates the abbreviation 'sc' for the 'script' \n\ + // command. \n\ + 'alias bp breakpoint' // Creates the abbreviation 'bp' for the 'breakpoint' \n\ + // command. Since breakpoint commands are two-word \n\ + // commands, the user will still need to enter the \n\ + // second word after 'bp', e.g. 'bp enable' or \n\ + // 'bp delete'. \n\ + 'alias bpi breakpoint list' // Creates the abbreviation 'bpi' for the \n\ + // two-word command 'breakpoint list'. \n\ + \nAn alias can include some options for the command, with the values either \n\ + filled in at the time the alias is created, or specified as positional \n\ + arguments, to be filled in when the alias is invoked. The following example \n\ + shows how to create aliases with options: \n\ + \n\ + 'alias bfl breakpoint set -f %1 -l %2' \n\ + \nThis creates the abbreviation 'bfl' (for break-file-line), with the -f and -l \n\ + options already part of the alias. So if the user wants to set a breakpoint \n\ + by file and line without explicitly having to use the -f and -l options, the \n\ + user can now use 'bfl' instead. The '%1' and '%2' are positional placeholders \n\ + for the actual arguments that will be passed when the alias command is used. \n\ + The number in the placeholder refers to the position/order the actual value \n\ + occupies when the alias is used. So all the occurrences of '%1' in the alias \n\ + will be replaced with the first argument, all the occurrences of '%2' in the \n\ + alias will be replaced with the second argument, and so on. This also allows \n\ + actual arguments to be used multiple times within an alias (see 'process \n\ + launch' example below). So in the 'bfl' case, the actual file value will be \n\ + filled in with the first argument following 'bfl' and the actual line number \n\ + value will be filled in with the second argument. The user would use this \n\ + alias as follows: \n\ + \n (dbg) alias bfl breakpoint set -f %1 -l %2 \n\ + <... some time later ...> \n\ + (dbg) bfl my-file.c 137 \n\ + \nThis would be the same as if the user had entered \n\ + 'breakpoint set -f my-file.c -l 137'. \n\ + \nAnother example: \n\ + \n (dbg) alias pltty process launch -s -o %1 -e %1 \n\ + (dbg) pltty /dev/tty0 \n\ + // becomes 'process launch -s -o /dev/tty0 -e /dev/tty0' \n\ + \nIf the user always wanted to pass the same value to a particular option, the \n\ + alias could be defined with that value directly in the alias as a constant, \n\ + rather than using a positional placeholder: \n\ + \n alias bl3 breakpoint set -f %1 -l 3 // Always sets a breakpoint on line \n\ + // 3 of whatever file is indicated. \n"); + + } + + ~CommandObjectCommandsAlias () + { + } + + + bool + Execute + ( + CommandInterpreter &interpreter, + Args& args, + CommandReturnObject &result + ) + { + const int argc = args.GetArgumentCount(); + + if (argc < 2) + { + result.AppendError ("'alias' requires at least two arguments"); + result.SetStatus (eReturnStatusFailed); + return false; + } + + const std::string alias_command = args.GetArgumentAtIndex(0); + const std::string actual_command = args.GetArgumentAtIndex(1); + + args.Shift(); // Shift the alias command word off the argument vector. + args.Shift(); // Shift the old command word off the argument vector. + + // Verify that the command is alias'able, and get the appropriate command object. + + if (interpreter.CommandExists (alias_command.c_str())) + { + result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be redefined.\n", + alias_command.c_str()); + result.SetStatus (eReturnStatusFailed); + } + else + { + CommandObjectSP command_obj_sp(interpreter.GetCommandSPExact (actual_command.c_str(), true)); + CommandObjectSP subcommand_obj_sp; + bool use_subcommand = false; + if (command_obj_sp.get()) + { + CommandObject *cmd_obj = command_obj_sp.get(); + CommandObject *sub_cmd_obj; + OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector); + OptionArgVector *option_arg_vector = option_arg_vector_sp.get(); + + if (cmd_obj->IsMultiwordObject()) + { + if (argc >= 3) + { + const std::string sub_command = args.GetArgumentAtIndex(0); + assert (sub_command.length() != 0); + subcommand_obj_sp = + (((CommandObjectMultiword *) cmd_obj)->GetSubcommandSP (sub_command.c_str())); + if (subcommand_obj_sp.get()) + { + sub_cmd_obj = subcommand_obj_sp.get(); + use_subcommand = true; + args.Shift(); // Shift the sub_command word off the argument vector. + } + else + { + result.AppendErrorWithFormat ("Error occurred while attempting to look up command '%s %s'.\n", + alias_command.c_str(), sub_command.c_str()); + result.SetStatus (eReturnStatusFailed); + return false; + } + } + } + + // Verify & handle any options/arguments passed to the alias command + + if (args.GetArgumentCount () > 0) + { + if ((!use_subcommand && (cmd_obj->WantsRawCommandString())) + || (use_subcommand && (sub_cmd_obj->WantsRawCommandString()))) + { + result.AppendErrorWithFormat ("'%s' cannot be aliased with any options or arguments.\n", + (use_subcommand ? sub_cmd_obj->GetCommandName() + : cmd_obj->GetCommandName())); + result.SetStatus (eReturnStatusFailed); + return false; + } + + // options or arguments have been passed to the alias command, and must be + // verified & processed here. + if ((!use_subcommand && (cmd_obj->GetOptions() != NULL)) + || (use_subcommand && (sub_cmd_obj->GetOptions() != NULL))) + { + Options *options; + if (use_subcommand) + options = sub_cmd_obj->GetOptions(); + else + options = cmd_obj->GetOptions(); + options->ResetOptionValues (); + args.Unshift ("dummy_arg"); + args.ParseAliasOptions (*options, result, option_arg_vector); + args.Shift (); + if (result.Succeeded()) + options->VerifyPartialOptions (result); + if (!result.Succeeded()) + return false; + } + else + { + for (int i = 0; i < args.GetArgumentCount(); ++i) + option_arg_vector->push_back (OptionArgPair ("", + std::string (args.GetArgumentAtIndex (i)))); + } + } + + // Create the alias. + + if (interpreter.AliasExists (alias_command.c_str()) + || interpreter.UserCommandExists (alias_command.c_str())) + { + OptionArgVectorSP tmp_option_arg_sp (interpreter.GetAliasOptions (alias_command.c_str())); + if (tmp_option_arg_sp.get()) + { + if (option_arg_vector->size() == 0) + interpreter.RemoveAliasOptions (alias_command.c_str()); + } + result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", + alias_command.c_str()); + } + + if (use_subcommand) + interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp); + else + interpreter.AddAlias (alias_command.c_str(), command_obj_sp); + if (option_arg_vector->size() > 0) + interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } + else + { + result.AppendErrorWithFormat ("'%s' is not an existing command.\n", actual_command.c_str()); + result.SetStatus (eReturnStatusFailed); + } + } + + return result.Succeeded(); + } +}; + +#pragma mark CommandObjectCommandsUnalias +//------------------------------------------------------------------------- +// CommandObjectCommandsUnalias +//------------------------------------------------------------------------- + +class CommandObjectCommandsUnalias : public CommandObject +{ +public: + CommandObjectCommandsUnalias () : + CommandObject ("commands unalias", + "Allows the user to remove/delete a user-defined command abbreviation.", + "unalias ") + { + } + + ~CommandObjectCommandsUnalias() + { + } + + + bool + Execute + ( + CommandInterpreter &interpreter, + Args& args, + CommandReturnObject &result + ) + { + CommandObject::CommandMap::iterator pos; + CommandObject *cmd_obj; + + if (args.GetArgumentCount() != 0) + { + const char *command_name = args.GetArgumentAtIndex(0); + cmd_obj = interpreter.GetCommandObject(command_name); + if (cmd_obj) + { + if (interpreter.CommandExists (command_name)) + { + result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be removed.\n", + command_name); + result.SetStatus (eReturnStatusFailed); + } + else + { + + if (interpreter.RemoveAlias (command_name) == false) + { + if (interpreter.AliasExists (command_name)) + result.AppendErrorWithFormat ("Error occurred while attempting to unalias '%s'.\n", + command_name); + else + result.AppendErrorWithFormat ("'%s' is not an existing alias.\n", command_name); + result.SetStatus (eReturnStatusFailed); + } + else + result.SetStatus (eReturnStatusSuccessFinishNoResult); + } + } + else + { + result.AppendErrorWithFormat ("'%s' is not a known command.\nTry 'help' to see a " + "current list of commands.\n", + command_name); + result.SetStatus (eReturnStatusFailed); + } + } + else + { + result.AppendError ("must call 'unalias' with a valid alias"); + result.SetStatus (eReturnStatusFailed); + } + + return result.Succeeded(); + } +}; + +#pragma mark CommandObjectMultiwordCommands + +//------------------------------------------------------------------------- +// CommandObjectMultiwordCommands +//------------------------------------------------------------------------- + +CommandObjectMultiwordCommands::CommandObjectMultiwordCommands (CommandInterpreter &interpreter) : + CommandObjectMultiword ("commands", + "Commands for managing the command interpreters commands", + "commands []") +{ + LoadSubCommand (interpreter, "source", CommandObjectSP (new CommandObjectCommandsSource ())); + LoadSubCommand (interpreter, "alias", CommandObjectSP (new CommandObjectCommandsAlias ())); +} + +CommandObjectMultiwordCommands::~CommandObjectMultiwordCommands () +{ +} + Added: lldb/trunk/source/Commands/CommandObjectCommands.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.h?rev=107751&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.h (added) +++ lldb/trunk/source/Commands/CommandObjectCommands.h Tue Jul 6 22:36:20 2010 @@ -0,0 +1,40 @@ +//===-- CommandObjectCommands.h -----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_CommandObjectCommands_h_ +#define liblldb_CommandObjectCommands_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Interpreter/CommandObject.h" +#include "lldb/Interpreter/CommandObjectMultiword.h" +#include "lldb/Core/STLUtils.h" + +namespace lldb_private { + +//------------------------------------------------------------------------- +// CommandObjectMultiwordCommands +//------------------------------------------------------------------------- + +class CommandObjectMultiwordCommands : public CommandObjectMultiword +{ +public: + + CommandObjectMultiwordCommands (CommandInterpreter &interpreter); + + virtual + ~CommandObjectMultiwordCommands (); + +}; + +} // namespace lldb_private + +#endif // liblldb_CommandObjectCommands_h_ Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Tue Jul 6 22:36:20 2010 @@ -287,3 +287,16 @@ } } +const char * +CommandObjectMultiword::GetRepeatCommand (Args ¤t_command_args, uint32_t index) +{ + if (current_command_args.GetArgumentCount() == 0) + return NULL; + index++; + CommandObject *sub_command_object = GetSubcommandObject (current_command_args.GetArgumentAtIndex(index)); + if (sub_command_object == NULL) + return NULL; + else + return sub_command_object->GetRepeatCommand(current_command_args, index); +} + Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Jul 6 22:36:20 2010 @@ -247,6 +247,12 @@ return result.Succeeded(); } + virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index) + { + // No repeat for "process launch"... + return ""; + } + protected: CommandOptions m_options; Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSource.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSource.cpp Tue Jul 6 22:36:20 2010 @@ -17,110 +17,347 @@ #include "lldb/Core/Debugger.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Core/FileSpec.h" #include "lldb/Target/Process.h" +#include "lldb/Core/SourceManager.h" #include "lldb/Target/TargetList.h" +#include "lldb/Interpreter/CommandCompletions.h" +#include "lldb/Interpreter/Options.h" using namespace lldb; using namespace lldb_private; -const char *k_space_characters = "\t\n\v\f\r "; - //------------------------------------------------------------------------- -// CommandObjectSource +// CommandObjectSourceList //------------------------------------------------------------------------- -CommandObjectSource::CommandObjectSource() : - CommandObject ("source", - "Reads in debugger commands from the file and executes them.", - "source ") +class CommandObjectSourceInfo : public CommandObject { -} -CommandObjectSource::~CommandObjectSource () + class CommandOptions : public Options + { + public: + CommandOptions () : + Options() + { + } + + ~CommandOptions () + { + } + + Error + SetOptionValue (int option_idx, const char *option_arg) + { + Error error; + const char short_option = g_option_table[option_idx].short_option; + switch (short_option) + { + case 'l': + start_line = Args::StringToUInt32 (option_arg, 0); + if (start_line == 0) + error.SetErrorStringWithFormat("Invalid line number: '%s'.\n", option_arg); + break; + + case 'f': + file_name = option_arg; + break; + + default: + error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option); + break; + } + + return error; + } + + void + ResetOptionValues () + { + Options::ResetOptionValues(); + + file_spec.Clear(); + file_name.clear(); + start_line = 0; + } + + const lldb::OptionDefinition* + GetDefinitions () + { + return g_option_table; + } + static lldb::OptionDefinition g_option_table[]; + + // Instance variables to hold the values for command options. + FileSpec file_spec; + std::string file_name; + uint32_t start_line; + + }; + +public: + CommandObjectSourceInfo() : + CommandObject ("source info", + "Display info on the source lines from the current executable's debug info.", + "source info []") + { + } + + ~CommandObjectSourceInfo () + { + } + + + Options * + GetOptions () + { + return &m_options; + } + + + bool + Execute + ( + CommandInterpreter &interpreter, + Args& args, + CommandReturnObject &result + ) + { + result.AppendError ("Not yet implemented"); + result.SetStatus (eReturnStatusFailed); + return false; + } +protected: + CommandOptions m_options; +}; + +lldb::OptionDefinition +CommandObjectSourceInfo::CommandOptions::g_option_table[] = { -} +{ LLDB_OPT_SET_1, false, "line", 'l', required_argument, NULL, 0, "", "The line number at which to start the display source."}, +{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", "The file from which to display source."}, +{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } +}; + +#pragma mark CommandObjectSourceList +//------------------------------------------------------------------------- +// CommandObjectSourceList +//------------------------------------------------------------------------- -bool -CommandObjectSource::Execute -( - CommandInterpreter &interpreter, - Args& args, - CommandReturnObject &result -) +class CommandObjectSourceList : public CommandObject { - const int argc = args.GetArgumentCount(); - if (argc == 1) + + class CommandOptions : public Options { - const char *filename = args.GetArgumentAtIndex(0); - bool success = true; + public: + CommandOptions () : + Options() + { + } - result.AppendMessageWithFormat ("Executing commands in '%s'.\n", filename); + ~CommandOptions () + { + } - FileSpec cmd_file (filename); - if (cmd_file.Exists()) + Error + SetOptionValue (int option_idx, const char *option_arg) { - STLStringArray commands; - success = cmd_file.ReadFileLines (commands); + Error error; + const char short_option = g_option_table[option_idx].short_option; + switch (short_option) + { + case 'l': + start_line = Args::StringToUInt32 (option_arg, 0); + if (start_line == 0) + error.SetErrorStringWithFormat("Invalid line number: '%s'.\n", option_arg); + break; + + case 'n': + num_lines = Args::StringToUInt32 (option_arg, 0); + if (num_lines == 0) + error.SetErrorStringWithFormat("Invalid line count: '%s'.\n", option_arg); + break; + + case 'f': + file_name = option_arg; + break; + + default: + error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option); + break; + } - STLStringArray::iterator pos = commands.begin(); + return error; + } - // Trim out any empty lines or lines that start with the comment - // char '#' - while (pos != commands.end()) - { - bool remove_string = false; - size_t non_space = pos->find_first_not_of (k_space_characters); - if (non_space == std::string::npos) - remove_string = true; // Empty line - else if ((*pos)[non_space] == '#') - remove_string = true; // Comment line that starts with '#' + void + ResetOptionValues () + { + Options::ResetOptionValues(); - if (remove_string) - pos = commands.erase(pos); - else - ++pos; - } + file_spec.Clear(); + file_name.clear(); + start_line = 0; + num_lines = 10; + } - if (commands.size() > 0) - { - const size_t num_commands = commands.size(); - size_t i; - for (i = 0; i] []") + { + } + + ~CommandObjectSourceList () + { + } + + + Options * + GetOptions () + { + return &m_options; + } - if (i < num_commands) + + bool + Execute + ( + CommandInterpreter &interpreter, + Args& args, + CommandReturnObject &result + ) + { + const int argc = args.GetArgumentCount(); + + if (argc != 0) + { + result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n", GetCommandName()); + result.SetStatus (eReturnStatusFailed); + } + + ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext()); + if (m_options.file_name.empty()) + { + // Last valid source manager context, or the current frame if no + // valid last context in source manager. + // One little trick here, if you type the exact same list command twice in a row, it is + // more likely because you typed it once, then typed it again + if (m_options.start_line == 0) + { + if (interpreter.GetDebugger().GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream())) { - result.AppendErrorWithFormat("Aborting source of '%s' after command '%s' failed.\n", filename, commands[i].c_str()); result.SetStatus (eReturnStatusSuccessFinishResult); } - else + } + else + { + if (interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile( + m_options.start_line, // Line to display + 0, // Lines before line to display + m_options.num_lines, // Lines after line to display + "", // Don't mark "line" + &result.GetOutputStream())) { - success = true; - result.SetStatus (eReturnStatusFailed); + result.SetStatus (eReturnStatusSuccessFinishResult); } + } } else { - result.AppendErrorWithFormat ("File '%s' does not exist.\n", filename); - result.SetStatus (eReturnStatusFailed); - success = false; - } + const char *filename = m_options.file_name.c_str(); + Target *target = interpreter.GetDebugger().GetCurrentTarget().get(); + if (target == NULL) + { + result.AppendError ("invalid target, set executable file using 'file' command"); + result.SetStatus (eReturnStatusFailed); + return false; + } - if (success) - { - result.SetStatus (eReturnStatusSuccessFinishNoResult); + + bool check_inlines = false; + SymbolContextList sc_list; + size_t num_matches = target->GetImages().ResolveSymbolContextForFilePath (filename, + 0, + check_inlines, + eSymbolContextModule | eSymbolContextCompUnit, + sc_list); + if (num_matches > 0) + { + SymbolContext sc; + if (sc_list.GetContextAtIndex(0, sc)) + { + if (sc.comp_unit) + { + interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit, + m_options.start_line, // Line to display + 0, // Lines before line to display + m_options.num_lines, // Lines after line to display + "", // Don't mark "line" + &result.GetOutputStream()); + + result.SetStatus (eReturnStatusSuccessFinishResult); + + } + } + } } + + return result.Succeeded(); } - else + + virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index) { - result.AppendErrorWithFormat("'%s' takes exactly one executable filename argument.\n", GetCommandName()); - result.SetStatus (eReturnStatusFailed); + return m_cmd_name.c_str(); } - return result.Succeeded(); +protected: + CommandOptions m_options; + +}; + +lldb::OptionDefinition +CommandObjectSourceList::CommandOptions::g_option_table[] = +{ +{ LLDB_OPT_SET_1, false, "line", 'l', required_argument, NULL, 0, "", "The line number at which to start the display source."}, +{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", "The file from which to display source."}, +{ LLDB_OPT_SET_1, false, "count", 'n', required_argument, NULL, 0, "", "The number of source lines to display."}, +{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } +}; + +#pragma mark CommandObjectMultiwordSource + +//------------------------------------------------------------------------- +// CommandObjectMultiwordSource +//------------------------------------------------------------------------- + +CommandObjectMultiwordSource::CommandObjectMultiwordSource (CommandInterpreter &interpreter) : + CommandObjectMultiword ("source", + "Commands for accessing source file information", + "source []") +{ + LoadSubCommand (interpreter, "info", CommandObjectSP (new CommandObjectSourceInfo ())); + LoadSubCommand (interpreter, "list", CommandObjectSP (new CommandObjectSourceList ())); +} + +CommandObjectMultiwordSource::~CommandObjectMultiwordSource () +{ } + Modified: lldb/trunk/source/Commands/CommandObjectSource.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.h?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSource.h (original) +++ lldb/trunk/source/Commands/CommandObjectSource.h Tue Jul 6 22:36:20 2010 @@ -1,4 +1,4 @@ -//===-- CommandObjectSource.h -----------------------------------*- C++ -*-===// +//===-- CommandObjectSource.h.h -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -15,33 +15,26 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" +#include "lldb/Interpreter/CommandObjectMultiword.h" #include "lldb/Core/STLUtils.h" namespace lldb_private { //------------------------------------------------------------------------- -// CommandObjectSource +// CommandObjectMultiwordSource //------------------------------------------------------------------------- -class CommandObjectSource : public CommandObject +class CommandObjectMultiwordSource : public CommandObjectMultiword { public: - CommandObjectSource (); + CommandObjectMultiwordSource (CommandInterpreter &interpreter); virtual - ~CommandObjectSource (); - - STLStringArray & - GetCommands (); - - virtual bool - Execute (CommandInterpreter &interpreter, - Args& command, - CommandReturnObject &result); + ~CommandObjectMultiwordSource (); }; } // namespace lldb_private -#endif // liblldb_CommandObjectSource_h_ +#endif // liblldb_CommandObjectSource.h_h_ Removed: lldb/trunk/source/Commands/CommandObjectSourceFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.cpp?rev=107750&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSourceFile.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSourceFile.cpp (removed) @@ -1,205 +0,0 @@ -//===-- CommandObjectSourceFile.cpp -----------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "CommandObjectSourceFile.h" - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/Args.h" -#include "lldb/Core/Debugger.h" -#include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Target/Process.h" -#include "lldb/Core/SourceManager.h" -#include "lldb/Target/TargetList.h" -#include "lldb/Interpreter/CommandCompletions.h" - -using namespace lldb; -using namespace lldb_private; - -CommandObjectSourceFile::CommandOptions::CommandOptions () : - Options() -{ -} - -CommandObjectSourceFile::CommandOptions::~CommandOptions () -{ -} - -Error -CommandObjectSourceFile::CommandOptions::SetOptionValue (int option_idx, const char *option_arg) -{ - Error error; - const char short_option = g_option_table[option_idx].short_option; - switch (short_option) - { - case 'l': - start_line = Args::StringToUInt32 (option_arg, 0); - if (start_line == 0) - error.SetErrorStringWithFormat("Invalid line number: '%s'.\n", option_arg); - break; - - case 'n': - num_lines = Args::StringToUInt32 (option_arg, 0); - if (num_lines == 0) - error.SetErrorStringWithFormat("Invalid line count: '%s'.\n", option_arg); - break; - - case 'f': - file_name = option_arg; - break; - - default: - error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option); - break; - } - - return error; -} - -void -CommandObjectSourceFile::CommandOptions::ResetOptionValues () -{ - Options::ResetOptionValues(); - - file_spec.Clear(); - file_name.clear(); - start_line = 0; - num_lines = 10; -} - -const lldb::OptionDefinition* -CommandObjectSourceFile::CommandOptions::GetDefinitions () -{ - return g_option_table; -} - -lldb::OptionDefinition -CommandObjectSourceFile::CommandOptions::g_option_table[] = -{ -{ LLDB_OPT_SET_1, false, "line", 'l', required_argument, NULL, 0, "", "The line number at which to start the display source."}, -{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", "The file from which to display source."}, -{ LLDB_OPT_SET_1, false, "count", 'n', required_argument, NULL, 0, "", "The number of source lines to display."}, -{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } -}; - - - -//------------------------------------------------------------------------- -// CommandObjectSourceFile -//------------------------------------------------------------------------- - -CommandObjectSourceFile::CommandObjectSourceFile() : - CommandObject ("source-file", - "Display source files from the current executable's debug info.", - "source-file [] []") -{ -} - -CommandObjectSourceFile::~CommandObjectSourceFile () -{ -} - - -Options * -CommandObjectSourceFile::GetOptions () -{ - return &m_options; -} - - -bool -CommandObjectSourceFile::Execute -( - CommandInterpreter &interpreter, - Args& args, - CommandReturnObject &result -) -{ - const int argc = args.GetArgumentCount(); - - if (argc != 0) - { - result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n", GetCommandName()); - result.SetStatus (eReturnStatusFailed); - } - - ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext()); - if (m_options.file_name.empty()) - { - // Last valid source manager context, or the current frame if no - // valid last context in source manager. - // One little trick here, if you type the exact same list command twice in a row, it is - // more likely because you typed it once, then typed it again - if (m_options.start_line == 0) - { - if (interpreter.GetDebugger().GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream())) - { - result.SetStatus (eReturnStatusSuccessFinishResult); - } - } - else - { - if (interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile( - m_options.start_line, // Line to display - 0, // Lines before line to display - m_options.num_lines, // Lines after line to display - "", // Don't mark "line" - &result.GetOutputStream())) - { - result.SetStatus (eReturnStatusSuccessFinishResult); - } - - } - } - else - { - const char *filename = m_options.file_name.c_str(); - Target *target = interpreter.GetDebugger().GetCurrentTarget().get(); - if (target == NULL) - { - result.AppendError ("invalid target, set executable file using 'file' command"); - result.SetStatus (eReturnStatusFailed); - return false; - } - - - bool check_inlines = false; - SymbolContextList sc_list; - size_t num_matches = target->GetImages().ResolveSymbolContextForFilePath (filename, - 0, - check_inlines, - eSymbolContextModule | eSymbolContextCompUnit, - sc_list); - if (num_matches > 0) - { - SymbolContext sc; - if (sc_list.GetContextAtIndex(0, sc)) - { - if (sc.comp_unit) - { - interpreter.GetDebugger().GetSourceManager ().DisplaySourceLinesWithLineNumbers (sc.comp_unit, - m_options.start_line, // Line to display - 0, // Lines before line to display - m_options.num_lines, // Lines after line to display - "", // Don't mark "line" - &result.GetOutputStream()); - - result.SetStatus (eReturnStatusSuccessFinishResult); - - } - } - } - } - - return result.Succeeded(); -} - Removed: lldb/trunk/source/Commands/CommandObjectSourceFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.h?rev=107750&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSourceFile.h (original) +++ lldb/trunk/source/Commands/CommandObjectSourceFile.h (removed) @@ -1,86 +0,0 @@ -//===-- CommandObjectSourceFile.h -------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_CommandObjectSourceFile_h_ -#define liblldb_CommandObjectSourceFile_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandObject.h" -#include "lldb/Interpreter/Options.h" -#include "lldb/Core/FileSpec.h" - -namespace lldb_private { - -//------------------------------------------------------------------------- -// CommandObjectSourceFile -//------------------------------------------------------------------------- - -class CommandObjectSourceFile : public CommandObject -{ -public: - class CommandOptions : public Options - { - public: - - CommandOptions (); - - virtual - ~CommandOptions (); - - virtual Error - SetOptionValue (int option_idx, const char *option_arg); - - void - ResetOptionValues (); - - const lldb::OptionDefinition* - GetDefinitions (); - - // Options table: Required for subclasses of Options. - - static lldb::OptionDefinition g_option_table[]; - - // Instance variables to hold the values for command options. - FileSpec file_spec; - std::string file_name; - uint32_t start_line; - uint32_t num_lines; - }; - - CommandObjectSourceFile (); - - virtual - ~CommandObjectSourceFile (); - - virtual bool - Execute (CommandInterpreter &interpreter, - Args& command, - CommandReturnObject &result); - - virtual - Options * - GetOptions (); - - virtual const char *GetRepeatCommand (const char *current_command_line) - { - printf("\nReturning: \"%s\"\n", m_cmd_name.c_str()); - return m_cmd_name.c_str(); - } - - -protected: - CommandOptions m_options; -}; - -} // namespace lldb_private - -#endif // liblldb_CommandObjectSourceFile_h_ Removed: lldb/trunk/source/Commands/CommandObjectUnalias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectUnalias.cpp?rev=107750&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectUnalias.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectUnalias.cpp (removed) @@ -1,91 +0,0 @@ -//===-- CommandObjectUnalias.cpp --------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "CommandObjectUnalias.h" - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Interpreter/CommandReturnObject.h" - -using namespace lldb; -using namespace lldb_private; - -//------------------------------------------------------------------------- -// CommandObjectUnalias -//------------------------------------------------------------------------- - -CommandObjectUnalias::CommandObjectUnalias () : - CommandObject ("unalias", - "Allows the user to remove/delete a user-defined command abbreviation.", - "unalias ") -{ -} - -CommandObjectUnalias::~CommandObjectUnalias() -{ -} - - -bool -CommandObjectUnalias::Execute -( - CommandInterpreter &interpreter, - Args& args, - CommandReturnObject &result -) -{ - CommandObject::CommandMap::iterator pos; - CommandObject *cmd_obj; - - if (args.GetArgumentCount() != 0) - { - const char *command_name = args.GetArgumentAtIndex(0); - cmd_obj = interpreter.GetCommandObject(command_name); - if (cmd_obj) - { - if (interpreter.CommandExists (command_name)) - { - result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be removed.\n", - command_name); - result.SetStatus (eReturnStatusFailed); - } - else - { - - if (interpreter.RemoveAlias (command_name) == false) - { - if (interpreter.AliasExists (command_name)) - result.AppendErrorWithFormat ("Error occurred while attempting to unalias '%s'.\n", command_name); - else - result.AppendErrorWithFormat ("'%s' is not an existing alias.\n", command_name); - result.SetStatus (eReturnStatusFailed); - } - else - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - } - else - { - result.AppendErrorWithFormat ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n", - command_name); - result.SetStatus (eReturnStatusFailed); - } - } - else - { - result.AppendError ("must call 'unalias' with a valid alias"); - result.SetStatus (eReturnStatusFailed); - } - - return result.Succeeded(); -} - Removed: lldb/trunk/source/Commands/CommandObjectUnalias.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectUnalias.h?rev=107750&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectUnalias.h (original) +++ lldb/trunk/source/Commands/CommandObjectUnalias.h (removed) @@ -1,43 +0,0 @@ -//===-- CommandObjectUnalias.h ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_CommandObjectUnalias_h_ -#define liblldb_CommandObjectUnalias_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandObject.h" - -namespace lldb_private { - -//------------------------------------------------------------------------- -// CommandObjectUnalias -//------------------------------------------------------------------------- - -class CommandObjectUnalias : public CommandObject -{ -public: - - CommandObjectUnalias (); - - virtual - ~CommandObjectUnalias (); - - virtual bool - Execute (CommandInterpreter &interpreter, - Args& args, - CommandReturnObject &result); - -}; - -} // namespace lldb_private - -#endif // liblldb_CommandObjectUnalias_h_ Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=107751&r1=107750&r2=107751&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jul 6 22:36:20 2010 @@ -38,7 +38,7 @@ #include "../Commands/CommandObjectSettings.h" #include "../Commands/CommandObjectShow.h" #include "../Commands/CommandObjectSource.h" -#include "../Commands/CommandObjectSourceFile.h" +#include "../Commands/CommandObjectCommands.h" #include "../Commands/CommandObjectSyntax.h" #include "../Commands/CommandObjectTarget.h" #include "../Commands/CommandObjectThread.h" @@ -84,24 +84,24 @@ InitializeVariables (); // Set up some initial aliases. - result.Clear(); HandleCommand ("alias q quit", false, result); - result.Clear(); HandleCommand ("alias run process launch", false, result); - result.Clear(); HandleCommand ("alias r process launch", false, result); - result.Clear(); HandleCommand ("alias c process continue", false, result); - result.Clear(); HandleCommand ("alias continue process continue", false, result); - result.Clear(); HandleCommand ("alias expr expression", false, result); - result.Clear(); HandleCommand ("alias exit quit", false, result); - result.Clear(); HandleCommand ("alias b breakpoint", false, result); - result.Clear(); HandleCommand ("alias bt thread backtrace", false, result); - result.Clear(); HandleCommand ("alias si thread step-inst", false, result); - result.Clear(); HandleCommand ("alias step thread step-in", false, result); - result.Clear(); HandleCommand ("alias s thread step-in", false, result); - result.Clear(); HandleCommand ("alias next thread step-over", false, result); - result.Clear(); HandleCommand ("alias n thread step-over", false, result); - result.Clear(); HandleCommand ("alias finish thread step-out", false, result); - result.Clear(); HandleCommand ("alias x memory read", false, result); - result.Clear(); HandleCommand ("alias l source-file", false, result); - result.Clear(); HandleCommand ("alias list source-file", false, result); + result.Clear(); HandleCommand ("command alias q quit", false, result); + result.Clear(); HandleCommand ("command alias run process launch", false, result); + result.Clear(); HandleCommand ("command alias r process launch", false, result); + result.Clear(); HandleCommand ("command alias c process continue", false, result); + result.Clear(); HandleCommand ("command alias continue process continue", false, result); + result.Clear(); HandleCommand ("command alias expr expression", false, result); + result.Clear(); HandleCommand ("command alias exit quit", false, result); + result.Clear(); HandleCommand ("command alias b breakpoint", false, result); + result.Clear(); HandleCommand ("command alias bt thread backtrace", false, result); + result.Clear(); HandleCommand ("command alias si thread step-inst", false, result); + result.Clear(); HandleCommand ("command alias step thread step-in", false, result); + result.Clear(); HandleCommand ("command alias s thread step-in", false, result); + result.Clear(); HandleCommand ("command alias next thread step-over", false, result); + result.Clear(); HandleCommand ("command alias n thread step-over", false, result); + result.Clear(); HandleCommand ("command alias finish thread step-out", false, result); + result.Clear(); HandleCommand ("command alias x memory read", false, result); + result.Clear(); HandleCommand ("command alias l source list", false, result); + result.Clear(); HandleCommand ("command alias list source list", false, result); } void @@ -206,11 +206,11 @@ // Non-CommandObjectCrossref commands can now be created. - m_command_dict["alias"] = CommandObjectSP (new CommandObjectAlias ()); m_command_dict["append"] = CommandObjectSP (new CommandObjectAppend ()); m_command_dict["apropos"] = CommandObjectSP (new CommandObjectApropos ()); m_command_dict["breakpoint"]= CommandObjectSP (new CommandObjectMultiwordBreakpoint (*this)); m_command_dict["call"] = CommandObjectSP (new CommandObjectCall ()); + m_command_dict["commands"] = CommandObjectSP (new CommandObjectMultiwordCommands (*this)); m_command_dict["disassemble"] = CommandObjectSP (new CommandObjectDisassemble ()); m_command_dict["expression"]= CommandObjectSP (new CommandObjectExpression ()); m_command_dict["file"] = CommandObjectSP (new CommandObjectFile ()); @@ -226,11 +226,9 @@ m_command_dict["set"] = CommandObjectSP (new CommandObjectSet ()); m_command_dict["settings"] = CommandObjectSP (new CommandObjectSettings ()); m_command_dict["show"] = CommandObjectSP (new CommandObjectShow ()); - m_command_dict["source"] = CommandObjectSP (new CommandObjectSource ()); - m_command_dict["source-file"] = CommandObjectSP (new CommandObjectSourceFile ()); + m_command_dict["source"] = CommandObjectSP (new CommandObjectMultiwordSource (*this)); m_command_dict["target"] = CommandObjectSP (new CommandObjectMultiwordTarget (*this)); m_command_dict["thread"] = CommandObjectSP (new CommandObjectMultiwordThread (*this)); - m_command_dict["unalias"] = CommandObjectSP (new CommandObjectUnalias ()); m_command_dict["variable"] = CommandObjectSP (new CommandObjectVariable (*this)); std::auto_ptr @@ -630,7 +628,7 @@ command_line = m_repeat_command.c_str(); if (m_repeat_command.empty()) { - result.AppendError(""); + result.AppendErrorWithFormat("No auto repeat.\n"); result.SetStatus (eReturnStatusFailed); return false; } @@ -661,11 +659,11 @@ if (add_to_history) { - const char *repeat_command = command_obj->GetRepeatCommand(command_line); - if (repeat_command) + const char *repeat_command = command_obj->GetRepeatCommand(command_args, 0); + if (repeat_command != NULL) m_repeat_command.assign(repeat_command); else - m_repeat_command.clear(); + m_repeat_command.assign(command_line); m_command_history.push_back (command_line); } From jingham at apple.com Tue Jul 6 22:39:43 2010 From: jingham at apple.com (Jim Ingham) Date: Wed, 07 Jul 2010 03:39:43 -0000 Subject: [Lldb-commits] [lldb] r107753 - /lldb/trunk/source/Interpreter/CommandInterpreter.cpp Message-ID: <20100707033943.7BB9D2A6C12C@llvm.org> Author: jingham Date: Tue Jul 6 22:39:43 2010 New Revision: 107753 URL: http://llvm.org/viewvc/llvm-project?rev=107753&view=rev Log: Remove includes for removed files... Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=107753&r1=107752&r2=107753&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jul 6 22:39:43 2010 @@ -12,7 +12,6 @@ #include #include -#include "../Commands/CommandObjectAlias.h" #include "../Commands/CommandObjectAppend.h" #include "../Commands/CommandObjectApropos.h" #include "../Commands/CommandObjectArgs.h" @@ -42,7 +41,6 @@ #include "../Commands/CommandObjectSyntax.h" #include "../Commands/CommandObjectTarget.h" #include "../Commands/CommandObjectThread.h" -#include "../Commands/CommandObjectUnalias.h" #include "../Commands/CommandObjectVariable.h" #include "lldb/Interpreter/Args.h" From benny.kra at googlemail.com Wed Jul 7 04:19:50 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 07 Jul 2010 09:19:50 -0000 Subject: [Lldb-commits] [lldb] r107763 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp Message-ID: <20100707091951.041492A6C12C@llvm.org> Author: d0k Date: Wed Jul 7 04:19:50 2010 New Revision: 107763 URL: http://llvm.org/viewvc/llvm-project?rev=107763&view=rev Log: Fix build for newer versions of GCC that don't include cstring implicitly. Based on a patch by Pawel Wodnicki! Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp?rev=107763&r1=107762&r2=107763&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp Wed Jul 7 04:19:50 2010 @@ -8,7 +8,8 @@ //===----------------------------------------------------------------------===// #include "DWARFDefines.h" -#include +#include +#include #include #include "lldb/Core/ConstString.h" From benny.kra at googlemail.com Wed Jul 7 04:33:41 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 07 Jul 2010 09:33:41 -0000 Subject: [Lldb-commits] [lldb] r107765 - /lldb/trunk/source/lldb.cpp Message-ID: <20100707093341.7FE302A6C12C@llvm.org> Author: d0k Date: Wed Jul 7 04:33:41 2010 New Revision: 107765 URL: http://llvm.org/viewvc/llvm-project?rev=107765&view=rev Log: Declare LLDBVersionNumber extern "C" to make sure clang++ mangles it properly. Patch from Jean-Daniel Dupas! Modified: lldb/trunk/source/lldb.cpp Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=107765&r1=107764&r2=107765&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Wed Jul 7 04:33:41 2010 @@ -97,10 +97,10 @@ #endif } +extern "C" const double LLDBVersionNumber; const char * lldb_private::GetVersion () { - extern const double LLDBVersionNumber; static char g_version_string[32]; if (g_version_string[0] == '\0') ::snprintf (g_version_string, sizeof(g_version_string), "LLDB-%g", LLDBVersionNumber); From gclayton at apple.com Wed Jul 7 12:06:21 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 07 Jul 2010 17:06:21 -0000 Subject: [Lldb-commits] [lldb] r107793 - in /lldb/trunk/source/Utility: ARM_DWARF_Registers.h ARM_GCC_Registers.h Message-ID: <20100707170621.1DB472A6C12E@llvm.org> Author: gclayton Date: Wed Jul 7 12:06:20 2010 New Revision: 107793 URL: http://llvm.org/viewvc/llvm-project?rev=107793&view=rev Log: Fixed "#endif"s followed by non comments, patch from Jean-Daniel Dupas. Modified: lldb/trunk/source/Utility/ARM_DWARF_Registers.h lldb/trunk/source/Utility/ARM_GCC_Registers.h Modified: lldb/trunk/source/Utility/ARM_DWARF_Registers.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ARM_DWARF_Registers.h?rev=107793&r1=107792&r2=107793&view=diff ============================================================================== --- lldb/trunk/source/Utility/ARM_DWARF_Registers.h (original) +++ lldb/trunk/source/Utility/ARM_DWARF_Registers.h Wed Jul 7 12:06:20 2010 @@ -186,5 +186,5 @@ dwarf_d31 }; -#endif utility_ARM_DWARF_Registers_h_ +#endif // utility_ARM_DWARF_Registers_h_ Modified: lldb/trunk/source/Utility/ARM_GCC_Registers.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ARM_GCC_Registers.h?rev=107793&r1=107792&r2=107793&view=diff ============================================================================== --- lldb/trunk/source/Utility/ARM_GCC_Registers.h (original) +++ lldb/trunk/source/Utility/ARM_GCC_Registers.h Wed Jul 7 12:06:20 2010 @@ -31,5 +31,5 @@ gcc_cpsr }; -#endif utility_ARM_GCC_Registers_h_ +#endif // utility_ARM_GCC_Registers_h_ From gclayton at apple.com Wed Jul 7 12:07:17 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 07 Jul 2010 17:07:17 -0000 Subject: [Lldb-commits] [lldb] r107794 - in /lldb/trunk: include/lldb/Symbol/ source/Commands/ source/Host/macosx/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/Utility/ Message-ID: <20100707170717.6B6642A6C12E@llvm.org> Author: gclayton Date: Wed Jul 7 12:07:17 2010 New Revision: 107794 URL: http://llvm.org/viewvc/llvm-project?rev=107794&view=rev Log: typedef fixups, patch from Jean-Daniel Dupas. Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Host/macosx/Host.mm lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original) +++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Wed Jul 7 12:07:17 2010 @@ -46,7 +46,7 @@ { public: - typedef enum Type + enum Type { unspecified, // not specified, we may be able to assume this is the same register. // gcc doesn't specify all initial values so we really don't know... Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Wed Jul 7 12:07:17 2010 @@ -332,7 +332,7 @@ }; -typedef enum StepScope +enum StepScope { eStepScopeSource, eStepScopeInstruction Modified: lldb/trunk/source/Host/macosx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/Host.mm Wed Jul 7 12:07:17 2010 @@ -213,7 +213,7 @@ ::pthread_key_create (&g_thread_create_key, MacOSXDarwinThread::PThreadDestructor); } -typedef struct HostThreadCreateInfo +struct HostThreadCreateInfo { std::string thread_name; thread_func_t thread_fptr; @@ -503,7 +503,7 @@ return false; } -typedef struct MonitorInfo +struct MonitorInfo { int handle; pthread_t thread; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp Wed Jul 7 12:07:17 2010 @@ -166,7 +166,7 @@ std::pair fp_pc_pair; - typedef struct Frame_i386 + struct Frame_i386 { uint32_t fp; uint32_t pc; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp Wed Jul 7 12:07:17 2010 @@ -179,7 +179,7 @@ std::pair fp_pc_pair; - typedef struct Frame_x86_64 + struct Frame_x86_64 { uint64_t fp; uint64_t pc; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_arm.h Wed Jul 7 12:07:17 2010 @@ -164,7 +164,7 @@ protected: - typedef enum + enum { GPRRegSet = 1, FPURegSet = 2, Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.h Wed Jul 7 12:07:17 2010 @@ -132,7 +132,7 @@ protected: - typedef enum + enum { GPRRegSet = 4, FPURegSet = 5, Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp Wed Jul 7 12:07:17 2010 @@ -80,7 +80,7 @@ std::pair fp_pc_pair; - typedef struct Frame_i386 + struct Frame_i386 { uint32_t fp; uint32_t pc; @@ -168,7 +168,7 @@ std::pair fp_pc_pair; - typedef struct Frame_x86_64 + struct Frame_x86_64 { uint64_t fp; uint64_t pc; Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h?rev=107794&r1=107793&r2=107794&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h Wed Jul 7 12:07:17 2010 @@ -53,7 +53,7 @@ protected: friend class RegisterContextMacOSXFrameBackchain; - typedef struct Cursor + struct Cursor { lldb::addr_t pc; // Program counter lldb::addr_t fp; // Frame pointer for us with backchain From gclayton at apple.com Wed Jul 7 13:40:03 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 07 Jul 2010 18:40:03 -0000 Subject: [Lldb-commits] [lldb] r107801 - /lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Message-ID: <20100707184003.89CF92A6C12C@llvm.org> Author: gclayton Date: Wed Jul 7 13:40:03 2010 New Revision: 107801 URL: http://llvm.org/viewvc/llvm-project?rev=107801&view=rev Log: Added some comments to clarify where "init_lldb" comes from. Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=107801&r1=107800&r2=107801&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original) +++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Wed Jul 7 13:40:03 2010 @@ -37,6 +37,8 @@ #include "lldb/Core/Debugger.h" #include "lldb/Target/Process.h" +// This function is in the C++ output file generated by SWIG after it is +// run on all of the headers in "lldb/API/SB*.h" extern "C" void init_lldb (void); using namespace lldb; @@ -183,6 +185,8 @@ m_compiled_module = static_cast(compiled_module); + // This function is in the C++ output file generated by SWIG after it is + // run on all of the headers in "lldb/API/SB*.h" init_lldb (); // Update the path python uses to search for modules to include the current directory. From johnny.chen at apple.com Wed Jul 7 16:10:56 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 07 Jul 2010 21:10:56 -0000 Subject: [Lldb-commits] [lldb] r107812 - /lldb/trunk/test/load_unload/TestLoadUnload.py Message-ID: <20100707211056.198822A6C12C@llvm.org> Author: johnny Date: Wed Jul 7 16:10:55 2010 New Revision: 107812 URL: http://llvm.org/viewvc/llvm-project?rev=107812&view=rev Log: Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib. Added: lldb/trunk/test/load_unload/TestLoadUnload.py Added: lldb/trunk/test/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/load_unload/TestLoadUnload.py?rev=107812&view=auto ============================================================================== --- lldb/trunk/test/load_unload/TestLoadUnload.py (added) +++ lldb/trunk/test/load_unload/TestLoadUnload.py Wed Jul 7 16:10:55 2010 @@ -0,0 +1,72 @@ +""" +Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib. +""" + +import os, time +import unittest +import lldb +import lldbtest + +class TestClassTypes(lldbtest.TestBase): + + mydir = "load_unload" + + def test_dead_strip(self): + """Test breakpoint by name works correctly with dlopen'ing.""" + res = self.res + exe = os.path.join(os.getcwd(), "a.out") + self.ci.HandleCommand("file " + exe, res) + self.assertTrue(res.Succeeded()) + + # Break by function name a_function (not yet loaded). + self.ci.HandleCommand("breakpoint set -n a_function", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 1: name = 'a_function', locations = 0 " + "(pending)" + )) + + self.ci.HandleCommand("run", res) + time.sleep(0.1) + self.assertTrue(res.Succeeded()) + + # The stop reason of the thread should be breakpoint and at a_function. + self.ci.HandleCommand("thread list", res) + output = res.GetOutput() + self.assertTrue(res.Succeeded()) + self.assertTrue(output.find('state is Stopped') > 0 and + output.find('a_function') > 0 and + output.find('a.c:14') > 0 and + output.find('stop reason = breakpoint') > 0) + + # The breakpoint should have a hit count of 1. + self.ci.HandleCommand("breakpoint list", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0) + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + +# # We should stop agaian at a_function. +# # The stop reason of the thread should be breakpoint and at a_function. +# self.ci.HandleCommand("thread list", res) +# output = res.GetOutput() +# self.assertTrue(res.Succeeded()) +# self.assertTrue(output.find('state is Stopped') > 0 and +# output.find('a_function') > 0 and +# output.find('a.c:14') > 0 and +# output.find('stop reason = breakpoint') > 0) + +# # The breakpoint should have a hit count of 2. +# self.ci.HandleCommand("breakpoint list", res) +# self.assertTrue(res.Succeeded()) +# self.assertTrue(res.GetOutput().find(' resolved, hit count = 2') > 0) + +# self.ci.HandleCommand("continue", res) +# self.assertTrue(res.Succeeded()) + + +if __name__ == '__main__': + lldb.SBDebugger.Initialize() + unittest.main() + lldb.SBDebugger.Terminate() From gclayton at apple.com Wed Jul 7 16:52:01 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 07 Jul 2010 21:52:01 -0000 Subject: [Lldb-commits] [lldb] r107817 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/ObjectFile/ELF/ObjectFileELF64.cpp source/Plugins/ObjectFile/ELF/ObjectFileELF64.h source/Plugins/ObjectFile/ELF/elf.h source/lldb.cpp Message-ID: <20100707215201.635492A6C12C@llvm.org> Author: gclayton Date: Wed Jul 7 16:52:01 2010 New Revision: 107817 URL: http://llvm.org/viewvc/llvm-project?rev=107817&view=rev Log: 64 bit ELF support from Stephen Wilson. Added: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/elf.h lldb/trunk/source/lldb.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107817&r1=107816&r2=107817&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jul 7 16:52:01 2010 @@ -58,6 +58,8 @@ 26680336116005EF008E1FE4 /* SBBreakpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF16CC7114086A1007A7B3F /* SBBreakpointLocation.cpp */; }; 26680337116005F1008E1FE4 /* SBBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF16A9C11402D5B007A7B3F /* SBBreakpoint.cpp */; }; 2668035C11601108008E1FE4 /* LLDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26680207115FD0ED008E1FE4 /* LLDB.framework */; }; + 26A9641011E52C8800EE609E /* ObjectFileELF64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A9640E11E52C8800EE609E /* ObjectFileELF64.cpp */; }; + 26A9641111E52C8800EE609E /* ObjectFileELF64.h in Headers */ = {isa = PBXBuildFile; fileRef = 26A9640F11E52C8800EE609E /* ObjectFileELF64.h */; }; 26B42B1F1187A92B0079C8C8 /* lldb-include.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42B1E1187A92B0079C8C8 /* lldb-include.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26B42C4D1187ABA50079C8C8 /* LLDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B42C4C1187ABA50079C8C8 /* LLDB.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26D5B06511B07550009A862E /* StoppointCallbackContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E0910F1B83100F91463 /* StoppointCallbackContext.cpp */; }; @@ -545,6 +547,8 @@ 26A3B4AC1181454800381BC2 /* ObjectContainerBSDArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectContainerBSDArchive.cpp; sourceTree = ""; }; 26A3B4AD1181454800381BC2 /* ObjectContainerBSDArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectContainerBSDArchive.h; sourceTree = ""; }; 26A4EEB511682AAC007A372A /* LLDBWrapPython.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLDBWrapPython.cpp; path = source/LLDBWrapPython.cpp; sourceTree = ""; }; + 26A9640E11E52C8800EE609E /* ObjectFileELF64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFileELF64.cpp; sourceTree = ""; }; + 26A9640F11E52C8800EE609E /* ObjectFileELF64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectFileELF64.h; sourceTree = ""; }; 26B167A41123BF5500DC7B4F /* ThreadSafeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafeValue.h; path = include/lldb/Core/ThreadSafeValue.h; sourceTree = ""; }; 26B42B1E1187A92B0079C8C8 /* lldb-include.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "lldb-include.h"; path = "include/lldb/lldb-include.h"; sourceTree = ""; }; 26B42C4C1187ABA50079C8C8 /* LLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLDB.h; path = include/lldb/API/LLDB.h; sourceTree = ""; }; @@ -1197,8 +1201,10 @@ isa = PBXGroup; children = ( 260C898410F57C5600BB2B04 /* elf.h */, - 260C898510F57C5600BB2B04 /* ObjectFileELF.cpp */, 260C898610F57C5600BB2B04 /* ObjectFileELF.h */, + 260C898510F57C5600BB2B04 /* ObjectFileELF.cpp */, + 26A9640F11E52C8800EE609E /* ObjectFileELF64.h */, + 26A9640E11E52C8800EE609E /* ObjectFileELF64.cpp */, ); path = ELF; sourceTree = ""; @@ -2190,6 +2196,7 @@ 49DA743511DE6BB2006AEF7E /* IRToDWARF.h in Headers */, 49307AB211DEA4F20081F992 /* IRForTarget.h in Headers */, 4C5DBBC911E3FEC60035160F /* CommandObjectCommands.h in Headers */, + 26A9641111E52C8800EE609E /* ObjectFileELF64.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2639,6 +2646,7 @@ 49DA743011DE6A5A006AEF7E /* IRToDWARF.cpp in Sources */, 49307AAE11DEA4D90081F992 /* IRForTarget.cpp in Sources */, 4C5DBBC811E3FEC60035160F /* CommandObjectCommands.cpp in Sources */, + 26A9641011E52C8800EE609E /* ObjectFileELF64.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=107817&r1=107816&r2=107817&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Jul 7 16:52:01 2010 @@ -70,16 +70,22 @@ } bool -ObjectFileELF::MagicBytesMatch (DataBufferSP& dataSP) +ObjectFileELF::MagicBytesMatch (DataBufferSP& data_sp) { - DataExtractor data(dataSP, eByteOrderHost, 4); - const uint8_t* magic = data.PeekData(0, 4); - if (magic != NULL) - { - return magic[EI_MAG0] == 0x7f - && magic[EI_MAG1] == 'E' - && magic[EI_MAG2] == 'L' - && magic[EI_MAG3] == 'F'; + if (data_sp && data_sp->GetByteSize() > EI_PAD) + { + const uint8_t* magic = data_sp->GetBytes(); + if (magic != NULL) + { + bool have_magic = (magic[EI_MAG0] == 0x7f && + magic[EI_MAG1] == 'E' && + magic[EI_MAG2] == 'L' && + magic[EI_MAG3] == 'F'); + + bool have_32bit = magic[EI_CLASS] == ELFCLASS32; + + return have_magic && have_32bit; + } } return false; } @@ -376,7 +382,7 @@ break; } - switch (ELF32_ST_BIND (symbol.st_info)) + switch (ELF_ST_BIND (symbol.st_info)) { default: case STT_NOTYPE: @@ -442,7 +448,7 @@ symbol_name, // symbol name false, // Is the symbol name mangled? symbol_type, // type of this symbol - ELF32_ST_BIND (symbol.st_info) == STB_GLOBAL, // Is this globally visible? + ELF_ST_BIND (symbol.st_info) == STB_GLOBAL, // Is this globally visible? false, // Is this symbol debug info? false, // Is this symbol a trampoline? false, // Is this symbol artificial? Added: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.cpp?rev=107817&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.cpp (added) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.cpp Wed Jul 7 16:52:01 2010 @@ -0,0 +1,1017 @@ +//===-- ObjectFileELF64.cpp ----------------------------------- -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "ObjectFileELF64.h" + +#include + +#include + +#include "lldb/Core/DataBuffer.h" +#include "lldb/Core/Error.h" +#include "lldb/Core/FileSpecList.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Section.h" +#include "lldb/Core/Stream.h" + +#define CASE_AND_STREAM(s, def, width) \ + case def: s->Printf("%-*s", width, #def); break; + +using namespace lldb; +using namespace lldb_private; + +void +ObjectFileELF64::Initialize() +{ + PluginManager::RegisterPlugin(GetPluginNameStatic(), + GetPluginDescriptionStatic(), + CreateInstance); +} + +void +ObjectFileELF64::Terminate() +{ + PluginManager::UnregisterPlugin(CreateInstance); +} + +const char * +ObjectFileELF64::GetPluginNameStatic() +{ + return "object-file.elf64"; +} + +const char * +ObjectFileELF64::GetPluginDescriptionStatic() +{ + return "ELF object file reader (64-bit)."; +} + +ObjectFile * +ObjectFileELF64::CreateInstance(Module *module, + DataBufferSP &dataSP, + const FileSpec *file, addr_t offset, + addr_t length) +{ + if (ObjectFileELF64::MagicBytesMatch(dataSP)) + { + std::auto_ptr objfile_ap( + new ObjectFileELF64(module, dataSP, file, offset, length)); + if (objfile_ap->ParseHeader()) + return objfile_ap.release(); + } + return NULL; +} + +bool +ObjectFileELF64::MagicBytesMatch(DataBufferSP& data_sp) +{ + if (data_sp && data_sp->GetByteSize() > EI_PAD) + { + const uint8_t* magic = data_sp->GetBytes(); + if (magic != NULL) + { + bool have_magic = (magic[EI_MAG0] == 0x7f && + magic[EI_MAG1] == 'E' && + magic[EI_MAG2] == 'L' && + magic[EI_MAG3] == 'F'); + + bool have_64bit = magic[EI_CLASS] == ELFCLASS64; + + return have_magic && have_64bit; + } + } + return false; +} + +ObjectFileELF64::ObjectFileELF64(Module* module, DataBufferSP& dataSP, + const FileSpec* file, addr_t offset, + addr_t length) + : ObjectFile(module, file, offset, length, dataSP), + m_header(), + m_program_headers(), + m_section_headers(), + m_sections_ap(), + m_symtab_ap(), + m_filespec_ap(), + m_shstr_data() +{ + if (file) + m_file = *file; + ::memset(&m_header, 0, sizeof(m_header)); +} + + +ObjectFileELF64::~ObjectFileELF64() +{ +} + +ByteOrder +ObjectFileELF64::GetByteOrder() const +{ + if (m_header.e_ident[EI_DATA] == ELFDATA2MSB) + return eByteOrderBig; + if (m_header.e_ident[EI_DATA] == ELFDATA2LSB) + return eByteOrderLittle; + return eByteOrderInvalid; +} + +size_t +ObjectFileELF64::GetAddressByteSize() const +{ + return m_data.GetAddressByteSize(); +} + +unsigned +ObjectFileELF64::SectionIndex(const SectionHeaderCollIter &I) +{ + return std::distance(m_section_headers.begin(), I) + 1; +} + +unsigned +ObjectFileELF64::SectionIndex(const SectionHeaderCollConstIter &I) const +{ + return std::distance(m_section_headers.begin(), I) + 1; +} + +bool +ObjectFileELF64::ParseHeader() +{ + m_data.SetAddressByteSize(8); + uint32_t offset = GetOffset(); + if (m_data.GetU8(&offset, m_header.e_ident, EI_NIDENT) == NULL) + return false; + + m_data.SetByteOrder(GetByteOrder()); + + // Read e_type and e_machine. + if (m_data.GetU16(&offset, &m_header.e_type, 2) == NULL) + return false; + + // Read e_version. + if (m_data.GetU32(&offset, &m_header.e_version, 1) == NULL) + return false; + + // Read e_entry, e_phoff and e_shoff. + if (m_data.GetU64(&offset, &m_header.e_entry, 3) == NULL) + return false; + + // Read e_flags. + if (m_data.GetU32(&offset, &m_header.e_flags, 1) == NULL) + return false; + + // Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and e_shstrndx. + if (m_data.GetU16(&offset, &m_header.e_ehsize, 6) == NULL) + return false; + + return true; +} + +bool +ObjectFileELF64::GetUUID(UUID* uuid) +{ + // FIXME: Return MD5 sum here. See comment in ObjectFile.h. + return false; +} + +uint32_t +ObjectFileELF64::GetDependentModules(FileSpecList &files) +{ + size_t num_modules = ParseDependentModules(); + uint32_t num_specs = 0; + + for (unsigned i = 0; i < num_modules; ++i) + { + if (files.AppendIfUnique(m_filespec_ap->GetFileSpecAtIndex(i))) + num_specs++; + } + + return num_specs; +} + +//---------------------------------------------------------------------- +// ParseDependentModules +//---------------------------------------------------------------------- +size_t +ObjectFileELF64::ParseDependentModules() +{ + if (m_filespec_ap.get()) + return m_filespec_ap->GetSize(); + + m_filespec_ap.reset(new FileSpecList()); + + if (!(ParseSectionHeaders() && GetSectionHeaderStringTable())) + return 0; + + // Locate the dynamic table. + user_id_t dynsym_id = 0; + user_id_t dynstr_id = 0; + for (SectionHeaderCollIter I = m_section_headers.begin(); + I != m_section_headers.end(); ++I) + { + if (I->sh_type == SHT_DYNAMIC) + { + dynsym_id = SectionIndex(I); + dynstr_id = I->sh_link + 1; // Section ID's are 1 based. + break; + } + } + + if (!(dynsym_id && dynstr_id)) + return 0; + + SectionList *section_list = GetSectionList(); + if (!section_list) + return 0; + + // Resolve and load the dynamic table entries and corresponding string + // table. + Section *dynsym = section_list->FindSectionByID(dynsym_id).get(); + Section *dynstr = section_list->FindSectionByID(dynstr_id).get(); + if (!(dynsym && dynstr)) + return 0; + + DataExtractor dynsym_data; + DataExtractor dynstr_data; + if (dynsym->ReadSectionDataFromObjectFile(this, dynsym_data) && + dynstr->ReadSectionDataFromObjectFile(this, dynstr_data)) + { + Elf64_Dyn symbol; + const unsigned num_syms = dynsym_data.GetByteSize() / sizeof(Elf64_Dyn); + unsigned offset = 0; + + // The only type of entries we are concerned with are tagged DT_NEEDED, + // yielding the name of a required library. + for (unsigned i = 0; i < num_syms; ++i) + { + if (!dynsym_data.ValidOffsetForDataOfSize(offset, sizeof(Elf64_Dyn))) + break; + + symbol.d_tag = dynsym_data.GetU64(&offset); + symbol.d_un.d_val = dynsym_data.GetU64(&offset); + + if (symbol.d_tag != DT_NEEDED) + continue; + + const char *lib_name = dynstr_data.PeekCStr(symbol.d_un.d_val); + m_filespec_ap->Append(FileSpec(lib_name)); + } + } + + return m_filespec_ap->GetSize(); +} + +//---------------------------------------------------------------------- +// ParseProgramHeaders +//---------------------------------------------------------------------- +size_t +ObjectFileELF64::ParseProgramHeaders() +{ + // We have already parsed the program headers + if (!m_program_headers.empty()) + return m_program_headers.size(); + + // If there are no program headers to read we are done. + if (m_header.e_phnum == 0) + return 0; + + m_program_headers.resize(m_header.e_phnum); + if (m_program_headers.size() != m_header.e_phnum) + return 0; + + const size_t ph_size = m_header.e_phnum * m_header.e_phentsize; + const Elf64_Off ph_offset = m_offset + m_header.e_phoff; + DataBufferSP buffer_sp(m_file.ReadFileContents(ph_offset, ph_size)); + + if (buffer_sp.get() == NULL || buffer_sp->GetByteSize() != ph_size) + return 0; + + DataExtractor data(buffer_sp, m_data.GetByteOrder(), + m_data.GetAddressByteSize()); + + uint32_t idx; + uint32_t offset; + for (idx = 0, offset = 0; idx < m_header.e_phnum; ++idx) + { + if (data.GetU32(&offset, &m_program_headers[idx], 8) == NULL) + return 0; + } + + if (idx < m_program_headers.size()) + m_program_headers.resize(idx); + + return m_program_headers.size(); +} + +//---------------------------------------------------------------------- +// ParseSectionHeaders +//---------------------------------------------------------------------- +size_t +ObjectFileELF64::ParseSectionHeaders() +{ + // We have already parsed the section headers + if (!m_section_headers.empty()) + return m_section_headers.size(); + + // If there are no section headers we are done. + if (m_header.e_shnum == 0) + return 0; + + m_section_headers.resize(m_header.e_shnum); + if (m_section_headers.size() != m_header.e_shnum) + return 0; + + const size_t sh_size = m_header.e_shnum * m_header.e_shentsize; + const Elf64_Off sh_offset = m_offset + m_header.e_shoff; + DataBufferSP buffer_sp(m_file.ReadFileContents(sh_offset, sh_size)); + + if (buffer_sp.get() == NULL || buffer_sp->GetByteSize() != sh_size) + return 0; + + DataExtractor data(buffer_sp, + m_data.GetByteOrder(), + m_data.GetAddressByteSize()); + + uint32_t idx; + uint32_t offset; + for (idx = 0, offset = 0; idx < m_header.e_shnum; ++idx) + { + // Read sh_name and sh_type. + if (data.GetU32(&offset, &m_section_headers[idx].sh_name, 2) == NULL) + break; + + // Read sh_flags, sh_addr, sh_offset and sh_size. + if (data.GetU64(&offset, &m_section_headers[idx].sh_flags, 4) == NULL) + break; + + // Read sh_link and sh_info. + if (data.GetU32(&offset, &m_section_headers[idx].sh_link, 2) == NULL) + break; + + // Read sh_addralign and sh_entsize. + if (data.GetU64(&offset, &m_section_headers[idx].sh_addralign, 2) == NULL) + break; + } + if (idx < m_section_headers.size()) + m_section_headers.resize(idx); + + return m_section_headers.size(); +} + +size_t +ObjectFileELF64::GetSectionHeaderStringTable() +{ + if (m_shstr_data.GetByteSize() == 0) + { + if (m_header.e_shstrndx && m_header.e_shstrndx < m_section_headers.size()) + { + const Elf64_Shdr &sheader = m_section_headers[m_header.e_shstrndx]; + const size_t byte_size = sheader.sh_size; + const Elf64_Off offset = m_offset + sheader.sh_offset; + DataBufferSP buffer_sp(m_file.ReadFileContents(offset, byte_size)); + + if (buffer_sp.get() == NULL || buffer_sp->GetByteSize() != byte_size) + return 0; + + m_shstr_data.SetData(buffer_sp); + } + } + return m_shstr_data.GetByteSize(); +} + +uint32_t +ObjectFileELF64::GetSectionIndexByName(const char *name) +{ + if (!(ParseSectionHeaders() && GetSectionHeaderStringTable())) + return UINT32_MAX; + + // Search the collection of section headers for one with a matching name. + for (SectionHeaderCollIter I = m_section_headers.begin(); + I != m_section_headers.end(); ++I) + { + const char *sectionName = m_shstr_data.PeekCStr(I->sh_name); + + if (!sectionName) + return UINT32_MAX; + + if (strcmp(name, sectionName) != 0) + continue; + + return SectionIndex(I); + } + + return UINT32_MAX; +} + +SectionList * +ObjectFileELF64::GetSectionList() +{ + if (m_sections_ap.get()) + return m_sections_ap.get(); + + if (ParseSectionHeaders() && GetSectionHeaderStringTable()) + { + m_sections_ap.reset(new SectionList()); + + for (SectionHeaderCollIter I = m_section_headers.begin(); + I != m_section_headers.end(); ++I) + { + const Elf64_Shdr &header = *I; + + ConstString name(m_shstr_data.PeekCStr(header.sh_name)); + uint64_t size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size; + + SectionSP section(new Section( + 0, // Parent section. + GetModule(), // Module to which this section belongs. + SectionIndex(I), // Section ID. + name, // Section name. + eSectionTypeOther, // FIXME: Fill in as appropriate. + header.sh_addr, // VM address. + header.sh_size, // VM size in bytes of this section. + header.sh_offset, // Offset of this section in the file. + size, // Size of the section as found in the file. + header.sh_flags)); // Flags for this section. + + m_sections_ap->AddSection(section); + } + } + + return m_sections_ap.get(); +} + +static void +ParseSymbols(Symtab *symtab, SectionList *section_list, + const Elf64_Shdr &symtab_shdr, + const DataExtractor &symtab_data, + const DataExtractor &strtab_data) +{ + assert (sizeof(Elf64_Sym) == symtab_shdr.sh_entsize); + const unsigned numSymbols = symtab_data.GetByteSize() / sizeof(Elf64_Sym); + unsigned offset = 0; + Elf64_Sym symbol; + + static ConstString text_section_name(".text"); + static ConstString init_section_name(".init"); + static ConstString fini_section_name(".fini"); + static ConstString ctors_section_name(".ctors"); + static ConstString dtors_section_name(".dtors"); + + static ConstString data_section_name(".data"); + static ConstString rodata_section_name(".rodata"); + static ConstString rodata1_section_name(".rodata1"); + static ConstString data2_section_name(".data1"); + static ConstString bss_section_name(".bss"); + + for (unsigned i = 0; i < numSymbols; ++i) + { + if (!symtab_data.ValidOffsetForDataOfSize(offset, sizeof(Elf64_Sym))) + break; + + symbol.st_name = symtab_data.GetU32(&offset); + symbol.st_info = symtab_data.GetU8(&offset); + symbol.st_other = symtab_data.GetU8(&offset); + symbol.st_shndx = symtab_data.GetU16(&offset); + symbol.st_value = symtab_data.GetU64(&offset); + symbol.st_size = symtab_data.GetU64(&offset); + + Section *symbol_section = NULL; + SymbolType symbol_type = eSymbolTypeInvalid; + Elf64_Half symbol_idx = symbol.st_shndx; + + switch (symbol_idx) + { + case SHN_ABS: + symbol_type = eSymbolTypeAbsolute; + break; + case SHN_UNDEF: + symbol_type = eSymbolTypeUndefined; + break; + default: + symbol_section = section_list->GetSectionAtIndex(symbol_idx).get(); + break; + } + + switch (ELF_ST_TYPE(symbol.st_info)) + { + default: + case STT_NOTYPE: + // The symbol's type is not specified. + break; + + case STT_OBJECT: + // The symbol is associated with a data object, such as a variable, + // an array, etc. + symbol_type = eSymbolTypeData; + break; + + case STT_FUNC: + // The symbol is associated with a function or other executable code. + symbol_type = eSymbolTypeCode; + break; + + case STT_SECTION: + // The symbol is associated with a section. Symbol table entries of + // this type exist primarily for relocation and normally have + // STB_LOCAL binding. + break; + + case STT_FILE: + // Conventionally, the symbol's name gives the name of the source + // file associated with the object file. A file symbol has STB_LOCAL + // binding, its section index is SHN_ABS, and it precedes the other + // STB_LOCAL symbols for the file, if it is present. + symbol_type = eSymbolTypeObjectFile; + break; + } + + if (symbol_type == eSymbolTypeInvalid) + { + if (symbol_section) + { + const ConstString §_name = symbol_section->GetName(); + if (sect_name == text_section_name || + sect_name == init_section_name || + sect_name == fini_section_name || + sect_name == ctors_section_name || + sect_name == dtors_section_name) + { + symbol_type = eSymbolTypeCode; + } + else if (sect_name == data_section_name || + sect_name == data2_section_name || + sect_name == rodata_section_name || + sect_name == rodata1_section_name || + sect_name == bss_section_name) + { + symbol_type = eSymbolTypeData; + } + } + } + + uint64_t symbol_value = symbol.st_value; + if (symbol_section != NULL) + symbol_value -= symbol_section->GetFileAddress(); + const char *symbol_name = strtab_data.PeekCStr(symbol.st_name); + bool is_global = ELF_ST_BIND(symbol.st_info) == STB_GLOBAL; + uint32_t flags = symbol.st_other << 8 | symbol.st_info; + + Symbol dc_symbol( + i, // ID is the original symbol table index. + symbol_name, // symbol name. + false, // Is the symbol name mangled? + symbol_type, // type of this symbol + is_global, // Is this globally visible? + false, // Is this symbol debug info? + false, // Is this symbol a trampoline? + false, // Is this symbol artificial? + symbol_section, // Section in which this symbol is defined or null. + symbol_value, // Offset in section or symbol value. + symbol.st_size, // size in bytes of this symbol. + flags); // Symbol flags. + symtab->AddSymbol(dc_symbol); + } +} + +void +ObjectFileELF64::ParseSymbolTable(Symtab *symbol_table, + const Elf64_Shdr &symtab_hdr, + user_id_t symtab_id) +{ + assert(symtab_hdr.sh_type == SHT_SYMTAB || + symtab_hdr.sh_type == SHT_DYNSYM); + + // Parse in the section list if needed. + SectionList *section_list = GetSectionList(); + if (!section_list) + return; + + // Section ID's are ones based. + user_id_t strtab_id = symtab_hdr.sh_link + 1; + + Section *symtab = section_list->FindSectionByID(symtab_id).get(); + Section *strtab = section_list->FindSectionByID(strtab_id).get(); + if (symtab && strtab) + { + DataExtractor symtab_data; + DataExtractor strtab_data; + if (symtab->ReadSectionDataFromObjectFile(this, symtab_data) && + strtab->ReadSectionDataFromObjectFile(this, strtab_data)) + { + ParseSymbols(symbol_table, section_list, symtab_hdr, + symtab_data, strtab_data); + } + } +} + +Symtab * +ObjectFileELF64::GetSymtab() +{ + if (m_symtab_ap.get()) + return m_symtab_ap.get(); + + Symtab *symbol_table = new Symtab(this); + m_symtab_ap.reset(symbol_table); + + if (!(ParseSectionHeaders() && GetSectionHeaderStringTable())) + return symbol_table; + + // Locate and parse all linker symbol tables. + for (SectionHeaderCollIter I = m_section_headers.begin(); + I != m_section_headers.end(); ++I) + { + if (I->sh_type == SHT_SYMTAB || I->sh_type == SHT_DYNSYM) + { + const Elf64_Shdr &symtab_section = *I; + user_id_t section_id = SectionIndex(I); + ParseSymbolTable(symbol_table, symtab_section, section_id); + } + } + + return symbol_table; +} + +//===----------------------------------------------------------------------===// +// Dump +// +// Dump the specifics of the runtime file container (such as any headers +// segments, sections, etc). +// ---------------------------------------------------------------------- +void +ObjectFileELF64::Dump(Stream *s) +{ + DumpELFHeader(s, m_header); + s->EOL(); + DumpELFProgramHeaders(s); + s->EOL(); + DumpELFSectionHeaders(s); + s->EOL(); + SectionList *section_list = GetSectionList(); + if (section_list) + section_list->Dump(s, NULL, true); + Symtab *symtab = GetSymtab(); + if (symtab) + symtab->Dump(s, NULL); + s->EOL(); + DumpDependentModules(s); + s->EOL(); +} + +//---------------------------------------------------------------------- +// DumpELFHeader +// +// Dump the ELF header to the specified output stream +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFHeader(Stream *s, const Elf64_Ehdr& header) +{ + + s->PutCString("ELF Header\n"); + s->Printf("e_ident[EI_MAG0 ] = 0x%2.2x\n", header.e_ident[EI_MAG0]); + s->Printf("e_ident[EI_MAG1 ] = 0x%2.2x '%c'\n", + header.e_ident[EI_MAG1], header.e_ident[EI_MAG1]); + s->Printf("e_ident[EI_MAG2 ] = 0x%2.2x '%c'\n", + header.e_ident[EI_MAG2], header.e_ident[EI_MAG2]); + s->Printf("e_ident[EI_MAG3 ] = 0x%2.2x '%c'\n", + header.e_ident[EI_MAG3], header.e_ident[EI_MAG3]); + + s->Printf("e_ident[EI_CLASS ] = 0x%2.2x\n", header.e_ident[EI_CLASS]); + s->Printf("e_ident[EI_DATA ] = 0x%2.2x ", header.e_ident[EI_DATA]); + DumpELFHeader_e_ident_EI_DATA(s, header.e_ident[EI_DATA]); + s->Printf ("\ne_ident[EI_VERSION] = 0x%2.2x\n", header.e_ident[EI_VERSION]); + s->Printf ("e_ident[EI_PAD ] = 0x%2.2x\n", header.e_ident[EI_PAD]); + + s->Printf("e_type = 0x%4.4x ", header.e_type); + DumpELFHeader_e_type(s, header.e_type); + s->Printf("\ne_machine = 0x%4.4x\n", header.e_machine); + s->Printf("e_version = 0x%8.8x\n", header.e_version); + s->Printf("e_entry = 0x%8.8x\n", header.e_entry); + s->Printf("e_phoff = 0x%8.8x\n", header.e_phoff); + s->Printf("e_shoff = 0x%8.8x\n", header.e_shoff); + s->Printf("e_flags = 0x%8.8x\n", header.e_flags); + s->Printf("e_ehsize = 0x%4.4x\n", header.e_ehsize); + s->Printf("e_phentsize = 0x%4.4x\n", header.e_phentsize); + s->Printf("e_phnum = 0x%4.4x\n", header.e_phnum); + s->Printf("e_shentsize = 0x%4.4x\n", header.e_shentsize); + s->Printf("e_shnum = 0x%4.4x\n", header.e_shnum); + s->Printf("e_shstrndx = 0x%4.4x\n", header.e_shstrndx); +} + +//---------------------------------------------------------------------- +// DumpELFHeader_e_type +// +// Dump an token value for the ELF header member e_type +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFHeader_e_type(Stream *s, Elf64_Half e_type) +{ + switch (e_type) + { + case ET_NONE: *s << "ET_NONE"; break; + case ET_REL: *s << "ET_REL"; break; + case ET_EXEC: *s << "ET_EXEC"; break; + case ET_DYN: *s << "ET_DYN"; break; + case ET_CORE: *s << "ET_CORE"; break; + default: + break; + } +} + +//---------------------------------------------------------------------- +// DumpELFHeader_e_ident_EI_DATA +// +// Dump an token value for the ELF header member e_ident[EI_DATA] +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFHeader_e_ident_EI_DATA(Stream *s, unsigned char ei_data) +{ + switch (ei_data) + { + case ELFDATANONE: *s << "ELFDATANONE"; break; + case ELFDATA2LSB: *s << "ELFDATA2LSB - Little Endian"; break; + case ELFDATA2MSB: *s << "ELFDATA2MSB - Big Endian"; break; + default: + break; + } +} + + +//---------------------------------------------------------------------- +// DumpELFProgramHeader +// +// Dump a single ELF program header to the specified output stream +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFProgramHeader(Stream *s, const Elf64_Phdr &ph) +{ + DumpELFProgramHeader_p_type(s, ph.p_type); + s->Printf(" %8.8x %8.8x %8.8x %8.8x %8.8x %8.8x (", + ph.p_offset, ph.p_vaddr, ph.p_paddr, ph.p_filesz, ph.p_memsz, + ph.p_flags); + DumpELFProgramHeader_p_flags(s, ph.p_flags); + s->Printf(") %8.8x", ph.p_align); +} + +//---------------------------------------------------------------------- +// DumpELFProgramHeader_p_type +// +// Dump an token value for the ELF program header member p_type which +// describes the type of the program header +// ---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFProgramHeader_p_type(Stream *s, Elf64_Word p_type) +{ + const int kStrWidth = 10; + switch (p_type) + { + CASE_AND_STREAM(s, PT_NULL , kStrWidth); + CASE_AND_STREAM(s, PT_LOAD , kStrWidth); + CASE_AND_STREAM(s, PT_DYNAMIC , kStrWidth); + CASE_AND_STREAM(s, PT_INTERP , kStrWidth); + CASE_AND_STREAM(s, PT_NOTE , kStrWidth); + CASE_AND_STREAM(s, PT_SHLIB , kStrWidth); + CASE_AND_STREAM(s, PT_PHDR , kStrWidth); + default: + s->Printf("0x%8.8x%*s", p_type, kStrWidth - 10, ""); + break; + } +} + + +//---------------------------------------------------------------------- +// DumpELFProgramHeader_p_flags +// +// Dump an token value for the ELF program header member p_flags +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFProgramHeader_p_flags(Stream *s, Elf64_Word p_flags) +{ + *s << ((p_flags & PF_X) ? "PF_X" : " ") + << (((p_flags & PF_X) && (p_flags & PF_W)) ? '+' : ' ') + << ((p_flags & PF_W) ? "PF_W" : " ") + << (((p_flags & PF_W) && (p_flags & PF_R)) ? '+' : ' ') + << ((p_flags & PF_R) ? "PF_R" : " "); +} + +//---------------------------------------------------------------------- +// DumpELFProgramHeaders +// +// Dump all of the ELF program header to the specified output stream +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFProgramHeaders(Stream *s) +{ + if (ParseProgramHeaders()) + { + s->PutCString("Program Headers\n"); + s->PutCString("IDX p_type p_offset p_vaddr p_paddr " + "p_filesz p_memsz p_flags p_align\n"); + s->PutCString("==== ---------- -------- -------- -------- " + "-------- -------- ------------------------- --------\n"); + + uint32_t idx = 0; + for (ProgramHeaderCollConstIter I = m_program_headers.begin(); + I != m_program_headers.end(); ++I, ++idx) + { + s->Printf("[%2u] ", idx); + ObjectFileELF64::DumpELFProgramHeader(s, *I); + s->EOL(); + } + } +} + +//---------------------------------------------------------------------- +// DumpELFSectionHeader +// +// Dump a single ELF section header to the specified output stream +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFSectionHeader(Stream *s, const Elf64_Shdr &sh) +{ + s->Printf("%8.8x ", sh.sh_name); + DumpELFSectionHeader_sh_type(s, sh.sh_type); + s->Printf(" %8.8x (", sh.sh_flags); + DumpELFSectionHeader_sh_flags(s, sh.sh_flags); + s->Printf(") %8.8x %8.8x %8.8x %8.8x %8.8x %8.8x %8.8x", + sh.sh_addr, sh.sh_offset, sh.sh_size, sh.sh_link, sh.sh_info, + sh.sh_addralign, sh.sh_entsize); +} + +//---------------------------------------------------------------------- +// DumpELFSectionHeader_sh_type +// +// Dump an token value for the ELF section header member sh_type which +// describes the type of the section +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFSectionHeader_sh_type(Stream *s, Elf64_Word sh_type) +{ + const int kStrWidth = 12; + switch (sh_type) + { + CASE_AND_STREAM(s, SHT_NULL , kStrWidth); + CASE_AND_STREAM(s, SHT_PROGBITS , kStrWidth); + CASE_AND_STREAM(s, SHT_SYMTAB , kStrWidth); + CASE_AND_STREAM(s, SHT_STRTAB , kStrWidth); + CASE_AND_STREAM(s, SHT_RELA , kStrWidth); + CASE_AND_STREAM(s, SHT_HASH , kStrWidth); + CASE_AND_STREAM(s, SHT_DYNAMIC , kStrWidth); + CASE_AND_STREAM(s, SHT_NOTE , kStrWidth); + CASE_AND_STREAM(s, SHT_NOBITS , kStrWidth); + CASE_AND_STREAM(s, SHT_REL , kStrWidth); + CASE_AND_STREAM(s, SHT_SHLIB , kStrWidth); + CASE_AND_STREAM(s, SHT_DYNSYM , kStrWidth); + CASE_AND_STREAM(s, SHT_LOPROC , kStrWidth); + CASE_AND_STREAM(s, SHT_HIPROC , kStrWidth); + CASE_AND_STREAM(s, SHT_LOUSER , kStrWidth); + CASE_AND_STREAM(s, SHT_HIUSER , kStrWidth); + default: + s->Printf("0x%8.8x%*s", sh_type, kStrWidth - 10, ""); + break; + } +} + +//---------------------------------------------------------------------- +// DumpELFSectionHeader_sh_flags +// +// Dump an token value for the ELF section header member sh_flags +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFSectionHeader_sh_flags(Stream *s, Elf64_Word sh_flags) +{ + *s << ((sh_flags & SHF_WRITE) ? "WRITE" : " ") + << (((sh_flags & SHF_WRITE) && (sh_flags & SHF_ALLOC)) ? '+' : ' ') + << ((sh_flags & SHF_ALLOC) ? "ALLOC" : " ") + << (((sh_flags & SHF_ALLOC) && (sh_flags & SHF_EXECINSTR)) ? '+' : ' ') + << ((sh_flags & SHF_EXECINSTR) ? "EXECINSTR" : " "); +} + +//---------------------------------------------------------------------- +// DumpELFSectionHeaders +// +// Dump all of the ELF section header to the specified output stream +//---------------------------------------------------------------------- +void +ObjectFileELF64::DumpELFSectionHeaders(Stream *s) +{ + if (!(ParseSectionHeaders() && GetSectionHeaderStringTable())) + return; + + s->PutCString("Section Headers\n"); + s->PutCString("IDX name type flags " + "addr offset size link info addralgn " + "entsize Name\n"); + s->PutCString("==== -------- ------------ -------------------------------- " + "-------- -------- -------- -------- -------- -------- " + "-------- ====================\n"); + + uint32_t idx = 0; + for (SectionHeaderCollConstIter I = m_section_headers.begin(); + I != m_section_headers.end(); ++I, ++idx) + { + s->Printf("[%2u] ", idx); + ObjectFileELF64::DumpELFSectionHeader(s, *I); + const char* section_name = m_shstr_data.PeekCStr(I->sh_name); + if (section_name) + *s << ' ' << section_name << "\n"; + } +} + +void +ObjectFileELF64::DumpDependentModules(lldb_private::Stream *s) +{ + size_t num_modules = ParseDependentModules(); + + if (num_modules > 0) + { + s->PutCString("Dependent Modules:\n"); + for (unsigned i = 0; i < num_modules; ++i) + { + const FileSpec &spec = m_filespec_ap->GetFileSpecAtIndex(i); + s->Printf(" %s\n", spec.GetFilename().GetCString()); + } + } +} + +bool +ObjectFileELF64::GetTargetTriple(ConstString &target_triple) +{ + static ConstString g_target_triple; + + if (g_target_triple) + { + target_triple = g_target_triple; + return true; + } + + std::string triple; + switch (m_header.e_machine) + { + default: + assert(false && "Unexpected machine type."); + break; + case EM_SPARC: triple.assign("sparc-"); break; + case EM_386: triple.assign("i386-"); break; + case EM_68K: triple.assign("68k-"); break; + case EM_88K: triple.assign("88k-"); break; + case EM_860: triple.assign("i860-"); break; + case EM_MIPS: triple.assign("mips-"); break; + case EM_PPC: triple.assign("powerpc-"); break; + case EM_PPC64: triple.assign("powerpc64-"); break; + case EM_ARM: triple.assign("arm-"); break; + case EM_X86_64: triple.assign("x86_64-"); break; + } + // TODO: determine if there is a vendor in the ELF? Default to "linux" for now + triple += "linux-"; + // TODO: determine if there is an OS in the ELF? Default to "gnu" for now + triple += "gnu"; + g_target_triple.SetCString(triple.c_str()); + target_triple = g_target_triple; + + return true; +} + +//------------------------------------------------------------------ +// PluginInterface protocol +//------------------------------------------------------------------ +const char * +ObjectFileELF64::GetPluginName() +{ + return "ObjectFileELF64"; +} + +const char * +ObjectFileELF64::GetShortPluginName() +{ + return GetPluginNameStatic(); +} + +uint32_t +ObjectFileELF64::GetPluginVersion() +{ + return 1; +} + +void +ObjectFileELF64::GetPluginCommandHelp (const char *command, Stream *strm) +{ +} + +Error +ObjectFileELF64::ExecutePluginCommand (Args &command, Stream *strm) +{ + Error error; + error.SetErrorString("No plug-in commands are currently supported."); + return error; +} + +Log * +ObjectFileELF64::EnablePluginLogging (Stream *strm, Args &command) +{ + return NULL; +} Added: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.h?rev=107817&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.h (added) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF64.h Wed Jul 7 16:52:01 2010 @@ -0,0 +1,209 @@ +//===-- ObjectFileELF64.h ------------------------------------- -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ObjectFileELF64_h_ +#define liblldb_ObjectFileELF64_h_ + +#include +#include + +#include "lldb/lldb-private.h" +#include "lldb/Core/FileSpec.h" +#include "lldb/Symbol/ObjectFile.h" + +#include "elf.h" + +//---------------------------------------------------------------------- +// This class needs to be hidden as eventually belongs in a plugin that +// will export the ObjectFile protocol +//---------------------------------------------------------------------- +class ObjectFileELF64 : + public lldb_private::ObjectFile +{ +public: + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + static void + Initialize(); + + static void + Terminate(); + + static const char * + GetPluginNameStatic(); + + static const char * + GetPluginDescriptionStatic(); + + static lldb_private::ObjectFile * + CreateInstance(lldb_private::Module* module, + lldb::DataBufferSP& dataSP, + const lldb_private::FileSpec* file, + lldb::addr_t offset, + lldb::addr_t length); + + static bool + MagicBytesMatch(lldb::DataBufferSP& dataSP); + + //------------------------------------------------------------------ + // Member Functions + //------------------------------------------------------------------ + ObjectFileELF64(lldb_private::Module* module, + lldb::DataBufferSP& dataSP, + const lldb_private::FileSpec* file, + lldb::addr_t offset, + lldb::addr_t length); + + virtual + ~ObjectFileELF64(); + + virtual bool + ParseHeader(); + + virtual lldb::ByteOrder + GetByteOrder() const; + + virtual size_t + GetAddressByteSize() const; + + virtual lldb_private::Symtab * + GetSymtab(); + + virtual lldb_private::SectionList * + GetSectionList(); + + virtual void + Dump(lldb_private::Stream *s); + + virtual bool + GetTargetTriple(lldb_private::ConstString &target_triple); + + virtual bool + GetUUID(lldb_private::UUID* uuid); + + virtual uint32_t + GetDependentModules(lldb_private::FileSpecList& files); + + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ + virtual const char * + GetPluginName(); + + virtual const char * + GetShortPluginName(); + + virtual uint32_t + GetPluginVersion(); + + virtual void + GetPluginCommandHelp(const char *command, lldb_private::Stream *strm); + + virtual lldb_private::Error + ExecutePluginCommand(lldb_private::Args &command, + lldb_private::Stream *strm); + + virtual lldb_private::Log * + EnablePluginLogging(lldb_private::Stream *strm, + lldb_private::Args &command); + +protected: + typedef std::vector ProgramHeaderColl; + typedef ProgramHeaderColl::iterator ProgramHeaderCollIter; + typedef ProgramHeaderColl::const_iterator ProgramHeaderCollConstIter; + + typedef std::vector SectionHeaderColl; + typedef SectionHeaderColl::iterator SectionHeaderCollIter; + typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter; + + Elf64_Ehdr m_header; + ProgramHeaderColl m_program_headers; + SectionHeaderColl m_section_headers; + mutable std::auto_ptr m_sections_ap; + mutable std::auto_ptr m_symtab_ap; + mutable std::auto_ptr m_filespec_ap; + lldb_private::DataExtractor m_shstr_data; + + size_t + ParseSections(); + + size_t + ParseSymtab(bool minimize); + +private: + // Returns the 1 based index of a section header. + unsigned + SectionIndex(const SectionHeaderCollIter &I); + + unsigned + SectionIndex(const SectionHeaderCollConstIter &I) const; + + // ELF header dump routines + static void + DumpELFHeader(lldb_private::Stream *s, const Elf64_Ehdr& header); + + static void + DumpELFHeader_e_ident_EI_DATA(lldb_private::Stream *s, + unsigned char ei_data); + + static void + DumpELFHeader_e_type(lldb_private::Stream *s, Elf64_Half e_type); + + // ELF program header dump routines + void + DumpELFProgramHeaders(lldb_private::Stream *s); + + static void + DumpELFProgramHeader(lldb_private::Stream *s, const Elf64_Phdr &ph); + + static void + DumpELFProgramHeader_p_type(lldb_private::Stream *s, Elf64_Word p_type); + + static void + DumpELFProgramHeader_p_flags(lldb_private::Stream *s, Elf64_Word p_flags); + + // ELF section header dump routines + void + DumpELFSectionHeaders(lldb_private::Stream *s); + + static void + DumpELFSectionHeader(lldb_private::Stream *s, const Elf64_Shdr& sh); + + static void + DumpELFSectionHeader_sh_type(lldb_private::Stream *s, Elf64_Word sh_type); + + static void + DumpELFSectionHeader_sh_flags(lldb_private::Stream *s, Elf64_Word sh_flags); + + void + DumpDependentModules(lldb_private::Stream *s); + + size_t + ParseProgramHeaders(); + + size_t + ParseSectionHeaders(); + + size_t + ParseDependentModules(); + + void + ParseSymbolTable(lldb_private::Symtab *symbol_table, + const Elf64_Shdr &symtab_section, + lldb::user_id_t symtab_id); + + size_t + GetSectionHeaderStringTable(); + + uint32_t + GetSectionIndexByName(const char *name); +}; + +#endif // #ifndef liblldb_ObjectFileELF64_h_ Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/elf.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/elf.h?rev=107817&r1=107816&r2=107817&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/elf.h (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/elf.h Wed Jul 7 16:52:01 2010 @@ -10,17 +10,30 @@ #ifndef __elf_h__ #define __elf_h__ +//---------------------------------------------------------------------- +// Typedefs for ELF32. +//---------------------------------------------------------------------- typedef uint16_t Elf32_Half; typedef uint32_t Elf32_Word; typedef int32_t Elf32_Sword; typedef uint32_t Elf32_Addr; typedef uint32_t Elf32_Off; +//---------------------------------------------------------------------- +// Typedefs for ELF64. +//---------------------------------------------------------------------- +typedef uint16_t Elf64_Half; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; +typedef uint64_t Elf64_Addr; +typedef uint64_t Elf64_Off; #define EI_NIDENT 16 //---------------------------------------------------------------------- -// ELF Header +// ELF Headers //---------------------------------------------------------------------- typedef struct Elf32_Ehdr_Tag { @@ -40,6 +53,24 @@ Elf32_Half e_shstrndx; } Elf32_Ehdr; +typedef struct Elf64_Ehdr_Tag +{ + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + //---------------------------------------------------------------------- // e_type // @@ -69,6 +100,7 @@ #define EM_PPC 20 // PowerPC #define EM_PPC64 21 // PowerPC64 #define EM_ARM 40 // ARM +#define EM_X86_64 62 // AMD x86-64 //---------------------------------------------------------------------- @@ -83,6 +115,11 @@ #define EI_VERSION 6 // File version #define EI_PAD 7 // Start of padding bytes +//---------------------------------------------------------------------- +// EI_CLASS definitions +//---------------------------------------------------------------------- +#define ELFCLASS32 1 // 32-bit object file +#define ELFCLASS64 2 // 64-bit object file //---------------------------------------------------------------------- // EI_DATA definitions @@ -92,7 +129,7 @@ #define ELFDATA2MSB 2 // Big Endian //---------------------------------------------------------------------- -// Section Header +// Section Headers //---------------------------------------------------------------------- typedef struct Elf32_Shdr_Tag { @@ -108,6 +145,20 @@ Elf32_Word sh_entsize; } Elf32_Shdr; +typedef struct Elf64_Shdr_Tag +{ + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + //---------------------------------------------------------------------- // Section Types (sh_type) //---------------------------------------------------------------------- @@ -149,7 +200,7 @@ //---------------------------------------------------------------------- -// Symbol Table Entry Header +// Symbol Table Entry Headers //---------------------------------------------------------------------- typedef struct Elf32_Sym_Tag { @@ -161,10 +212,23 @@ Elf32_Half st_shndx; } Elf32_Sym; +typedef struct Elf64_Sym_Tag +{ + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Half st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +} Elf64_Sym; -#define ELF32_ST_BIND(i) ((i)>>4) -#define ELF32_ST_TYPE(i) ((i)&0xf) -#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) +//---------------------------------------------------------------------- +// Accessors to the binding and type bits in the st_info field of a +// symbol table entry. Valid for both 32 and 64 bit variations. +//---------------------------------------------------------------------- +#define ELF_ST_BIND(i) ((i)>>4) +#define ELF_ST_TYPE(i) ((i)&0xf) +#define ELF_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) // ST_BIND #define STB_LOCAL 0 @@ -199,10 +263,70 @@ Elf32_Sword r_addend; } Elf32_Rela; +typedef struct Elf64_Rel_Tag +{ + Elf64_Addr r_offset; + Elf64_Word r_info; +} Elf64_Rel; + +typedef struct Elf64_Rela_Tag +{ + Elf64_Addr r_offset; + Elf64_Word r_info; + Elf64_Sword r_addend; +} Elf64_Rela; + #define ELF32_R_SYM(i) ((i)>>8) #define ELF32_R_TYPE(i) ((unsignedchar)(i)) #define ELF32_R_INFO(s,t) (((s)<<8)+(unsignedchar)(t)) +//---------------------------------------------------------------------- +// Dynamic Table Entry Headers +//---------------------------------------------------------------------- +typedef struct Elf64_Dyn_Tag +{ + Elf64_Sxword d_tag; + union + { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +#define DT_NULL 0 // Marks end of dynamic array. +#define DT_NEEDED 1 // String table offset of needed library. +#define DT_PLTRELSZ 2 // Size of relocation entries in PLT. +#define DT_PLTGOT 3 // Address associated with linkage table. +#define DT_HASH 4 // Address of symbolic hash table. +#define DT_STRTAB 5 // Address of dynamic string table. +#define DT_SYMTAB 6 // Address of dynamic symbol table. +#define DT_RELA 7 // Address of relocation table (Rela entries). +#define DT_RELASZ 8 // Size of Rela relocation table. +#define DT_RELAENT 9 // Size of a Rela relocation entry. +#define DT_STRSZ 10 // Total size of the string table. +#define DT_SYMENT 11 // Size of a symbol table entry. +#define DT_INIT 12 // Address of initialization function. +#define DT_FINI 13 // Address of termination function. +#define DT_SONAME 14 // String table offset of a shared objects name. +#define DT_RPATH 15 // String table offset of library search path. +#define DT_SYMBOLIC 16 // Changes symbol resolution algorithm. +#define DT_REL 17 // Address of relocation table (Rel entries). +#define DT_RELSZ 18 // Size of Rel relocation table. +#define DT_RELENT 19 // Size of a Rel relocation entry. +#define DT_PLTREL 20 // Type of relocation entry used for linking. +#define DT_DEBUG 21 // Reserved for debugger. +#define DT_TEXTREL 22 // Relocations exist for non-writable segements. +#define DT_JMPREL 23 // Address of relocations associated with PLT. +#define DT_BIND_NOW 24 // Process all relocations before execution. +#define DT_INIT_ARRAY 25 // Pointer to array of initialization functions. +#define DT_FINI_ARRAY 26 // Pointer to array of termination functions. +#define DT_INIT_ARRAYSZ 27 // Size of DT_INIT_ARRAY. +#define DT_FINI_ARRAYSZ 28 // Size of DT_FINI_ARRAY. +#define DT_LOOS 0x60000000 // Start of environment specific tags. +#define DT_HIOS 0x6FFFFFFF // End of environment specific tags. +#define DT_LOPROC 0x70000000 // Start of processor specific tags. +#define DT_HIPROC 0x7FFFFFFF // End of processor specific tags. + //---------------------------------------------------------------------- // Program Headers @@ -219,6 +343,18 @@ Elf32_Word p_align; } Elf32_Phdr; +typedef struct Elf64_Phdr_Tag +{ + Elf64_Word p_type; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Word p_filesz; + Elf64_Word p_memsz; + Elf64_Word p_flags; + Elf64_Word p_align; +} Elf64_Phdr; + //---------------------------------------------------------------------- // Program Header Type (p_type) //---------------------------------------------------------------------- Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=107817&r1=107816&r2=107817&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Wed Jul 7 16:52:01 2010 @@ -19,6 +19,7 @@ #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h" #include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h" #include "Plugins/ObjectFile/ELF/ObjectFileELF.h" +#include "Plugins/ObjectFile/ELF/ObjectFileELF64.h" #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h" #include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h" @@ -55,6 +56,7 @@ DisassemblerLLVM::Initialize(); ObjectContainerBSDArchive::Initialize(); ObjectFileELF::Initialize(); + ObjectFileELF64::Initialize(); SymbolVendorMacOSX::Initialize(); SymbolFileDWARF::Initialize(); SymbolFileDWARFDebugMap::Initialize(); @@ -84,6 +86,7 @@ DisassemblerLLVM::Terminate(); ObjectContainerBSDArchive::Terminate(); ObjectFileELF::Terminate(); + ObjectFileELF64::Terminate(); SymbolVendorMacOSX::Terminate(); SymbolFileDWARF::Terminate(); SymbolFileDWARFDebugMap::Terminate(); From johnny.chen at apple.com Wed Jul 7 17:49:43 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 07 Jul 2010 22:49:43 -0000 Subject: [Lldb-commits] [lldb] r107829 - /lldb/trunk/test/order/main.c Message-ID: <20100707224943.9F7C62A6C12D@llvm.org> Author: johnny Date: Wed Jul 7 17:49:43 2010 New Revision: 107829 URL: http://llvm.org/viewvc/llvm-project?rev=107829&view=rev Log: Fixed typos in the comments. Modified: lldb/trunk/test/order/main.c Modified: lldb/trunk/test/order/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/order/main.c?rev=107829&r1=107828&r2=107829&view=diff ============================================================================== --- lldb/trunk/test/order/main.c (original) +++ lldb/trunk/test/order/main.c Wed Jul 7 17:49:43 2010 @@ -14,7 +14,7 @@ int f3 (char *s); -// We want f1 to start on line 10 +// We want f1 to start on line 20 int f1 (char *s) { return printf("f1: %s\n", s); @@ -24,7 +24,7 @@ -// We want f2 to start on line 20 +// We want f2 to start on line 30 int f2 (char *s) { return printf("f2: %s\n", s); @@ -34,7 +34,7 @@ -// We want f3 to start on line 30 +// We want f3 to start on line 40 int f3 (char *s) { return printf("f3: %s\n", s); @@ -44,7 +44,7 @@ -// We want main to start on line 40 +// We want main to start on line 50 int main (int argc, const char * argv[]) { f1("carp"); From johnny.chen at apple.com Wed Jul 7 19:17:29 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 08 Jul 2010 00:17:29 -0000 Subject: [Lldb-commits] [lldb] r107844 - /lldb/trunk/test/order/TestOrder.py Message-ID: <20100708001729.4CC862A6C12C@llvm.org> Author: johnny Date: Wed Jul 7 19:17:29 2010 New Revision: 107844 URL: http://llvm.org/viewvc/llvm-project?rev=107844&view=rev Log: Test that debug symbols have the correct order as specified by the order file. Added: lldb/trunk/test/order/TestOrder.py Added: lldb/trunk/test/order/TestOrder.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/order/TestOrder.py?rev=107844&view=auto ============================================================================== --- lldb/trunk/test/order/TestOrder.py (added) +++ lldb/trunk/test/order/TestOrder.py Wed Jul 7 19:17:29 2010 @@ -0,0 +1,39 @@ +""" +Test that debug symbols have the correct order as specified by the order file. +""" + +import os, time +import re +import unittest +import lldb +import lldbtest + +class TestClassTypes(lldbtest.TestBase): + + mydir = "order" + + def test_order(self): + """Test debug symbols follow the correct order by the order file.""" + res = self.res + exe = os.path.join(os.getcwd(), "a.out") + self.ci.HandleCommand("file " + exe, res) + self.assertTrue(res.Succeeded()) + + # Test that the debug symbols have Function f3 before Function f1. + self.ci.HandleCommand("image dump symtab a.out", res) + self.assertTrue(res.Succeeded()) + output = res.GetOutput() + mo_f3 = re.search("Function +.+f3", output) + mo_f1 = re.search("Function +.+f1", output) + + # Match objects for f3 and f1 must exist and f3 must come before f1. + self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start()) + + self.ci.HandleCommand("run", res) + self.assertTrue(res.Succeeded()) + + +if __name__ == '__main__': + lldb.SBDebugger.Initialize() + unittest.main() + lldb.SBDebugger.Terminate() From scallanan at apple.com Wed Jul 7 21:13:18 2010 From: scallanan at apple.com (Sean Callanan) Date: Thu, 08 Jul 2010 02:13:18 -0000 Subject: [Lldb-commits] [lldb] r107853 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj llvm.zip scripts/build-llvm.pl Message-ID: <20100708021318.6C5222A6C12C@llvm.org> Author: spyffe Date: Wed Jul 7 21:13:18 2010 New Revision: 107853 URL: http://llvm.org/viewvc/llvm-project?rev=107853&view=rev Log: Updated to build against the latest LLVM release. Also fixed our build to define NDEBUG; code that uses LLVM headers without NDEBUG is binary-incompatible with libraries built with NDEBUG. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/llvm.zip lldb/trunk/scripts/build-llvm.pl Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107853&r1=107852&r2=107853&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jul 7 21:13:18 2010 @@ -2753,8 +2753,9 @@ "$(LLVM_BUILD_DIR)", ); LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; - LLVM_CONFIGURATION = Debug; + LLVM_CONFIGURATION = Release; OTHER_CFLAGS = ( + "-DNDEBUG", "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", "-Wparentheses", @@ -2808,6 +2809,7 @@ LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_CONFIGURATION = Release; OTHER_CFLAGS = ( + "-DNDEBUG", "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", "-Wparentheses", @@ -2917,6 +2919,7 @@ LLVM_BUILD_DIR = "$(DERIVED_FILE_DIR)/llvm.build"; LLVM_CONFIGURATION = Release; OTHER_CFLAGS = ( + "-DNDEBUG", "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", "-Wparentheses", Modified: lldb/trunk/llvm.zip URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=107853&r1=107852&r2=107853&view=diff ============================================================================== Binary files - no diff available. Modified: lldb/trunk/scripts/build-llvm.pl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=107853&r1=107852&r2=107853&view=diff ============================================================================== --- lldb/trunk/scripts/build-llvm.pl (original) +++ lldb/trunk/scripts/build-llvm.pl Wed Jul 7 21:13:18 2010 @@ -25,7 +25,7 @@ our $llvm_configuration = $ENV{LLVM_CONFIGURATION}; -our $llvm_revision = "'{2010-07-02T08:00}'"; +our $llvm_revision = "'{2010-07-07T08:00}'"; our $llvm_source_dir = "$ENV{SRCROOT}"; our $cc = "$ENV{DEVELOPER_BIN_DIR}/gcc-4.2"; our $cxx = "$ENV{DEVELOPER_BIN_DIR}/g++-4.2"; @@ -225,7 +225,7 @@ # Build llvm and clang print "Configuring clang ($arch) in '$llvm_dstroot_arch'...\n"; my $lldb_configuration_options = ''; - $llvm_configuration eq 'Release' and $lldb_configuration_options .= '--enable-optimized'; + $llvm_configuration eq 'Release' and $lldb_configuration_options .= '--enable-optimized --disable-assertions'; do_command ("cd '$llvm_dstroot_arch' && '$llvm_source_dir/llvm/configure' $lldb_configuration_options --enable-targets=x86,x86_64,arm --build=$arch-apple-darwin10 CC=\"$cc -arch $arch\" CXX=\"$cxx -arch $arch\"", "configuring llvm build", 1); } From gclayton at apple.com Thu Jul 8 10:59:20 2010 From: gclayton at apple.com (Greg Clayton) Date: Thu, 8 Jul 2010 08:59:20 -0700 Subject: [Lldb-commits] [lldb] r107853 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj llvm.zip scripts/build-llvm.pl In-Reply-To: <20100708021318.6C5222A6C12C@llvm.org> References: <20100708021318.6C5222A6C12C@llvm.org> Message-ID: Enabling "NDEBUG" disables all asserts in all of our code. Can you revert the "NDEBUG" changes? If LLVM headers are affected by NDEBUG we need to talk about a better solution. Greg Clayton On Jul 7, 2010, at 7:13 PM, Sean Callanan wrote: > Author: spyffe > Date: Wed Jul 7 21:13:18 2010 > New Revision: 107853 > > URL: http://llvm.org/viewvc/llvm-project?rev=107853&view=rev > Log: > Updated to build against the latest LLVM release. > Also fixed our build to define NDEBUG; code that > uses LLVM headers without NDEBUG is > binary-incompatible with libraries built with > NDEBUG. > > Modified: > lldb/trunk/lldb.xcodeproj/project.pbxproj > lldb/trunk/llvm.zip > lldb/trunk/scripts/build-llvm.pl > > Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107853&r1=107852&r2=107853&view=diff > ============================================================================== > --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) > +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jul 7 21:13:18 2010 > @@ -2753,8 +2753,9 @@ > "$(LLVM_BUILD_DIR)", > ); > LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; > - LLVM_CONFIGURATION = Debug; > + LLVM_CONFIGURATION = Release; > OTHER_CFLAGS = ( > + "-DNDEBUG", > "-DFOR_DYLD=0", > "-DSUPPORT_REMOTE_UNWINDING", > "-Wparentheses", > @@ -2808,6 +2809,7 @@ > LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; > LLVM_CONFIGURATION = Release; > OTHER_CFLAGS = ( > + "-DNDEBUG", > "-DFOR_DYLD=0", > "-DSUPPORT_REMOTE_UNWINDING", > "-Wparentheses", > @@ -2917,6 +2919,7 @@ > LLVM_BUILD_DIR = "$(DERIVED_FILE_DIR)/llvm.build"; > LLVM_CONFIGURATION = Release; > OTHER_CFLAGS = ( > + "-DNDEBUG", > "-DFOR_DYLD=0", > "-DSUPPORT_REMOTE_UNWINDING", > "-Wparentheses", > > Modified: lldb/trunk/llvm.zip > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=107853&r1=107852&r2=107853&view=diff > ============================================================================== > Binary files - no diff available. > > Modified: lldb/trunk/scripts/build-llvm.pl > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=107853&r1=107852&r2=107853&view=diff > ============================================================================== > --- lldb/trunk/scripts/build-llvm.pl (original) > +++ lldb/trunk/scripts/build-llvm.pl Wed Jul 7 21:13:18 2010 > @@ -25,7 +25,7 @@ > > our $llvm_configuration = $ENV{LLVM_CONFIGURATION}; > > -our $llvm_revision = "'{2010-07-02T08:00}'"; > +our $llvm_revision = "'{2010-07-07T08:00}'"; > our $llvm_source_dir = "$ENV{SRCROOT}"; > our $cc = "$ENV{DEVELOPER_BIN_DIR}/gcc-4.2"; > our $cxx = "$ENV{DEVELOPER_BIN_DIR}/g++-4.2"; > @@ -225,7 +225,7 @@ > # Build llvm and clang > print "Configuring clang ($arch) in '$llvm_dstroot_arch'...\n"; > my $lldb_configuration_options = ''; > - $llvm_configuration eq 'Release' and $lldb_configuration_options .= '--enable-optimized'; > + $llvm_configuration eq 'Release' and $lldb_configuration_options .= '--enable-optimized --disable-assertions'; > do_command ("cd '$llvm_dstroot_arch' && '$llvm_source_dir/llvm/configure' $lldb_configuration_options --enable-targets=x86,x86_64,arm --build=$arch-apple-darwin10 CC=\"$cc -arch $arch\" CXX=\"$cxx -arch $arch\"", > "configuring llvm build", 1); > } > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From gclayton at apple.com Thu Jul 8 11:09:07 2010 From: gclayton at apple.com (Greg Clayton) Date: Thu, 8 Jul 2010 09:09:07 -0700 Subject: [Lldb-commits] [lldb] r107853 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj llvm.zip scripts/build-llvm.pl In-Reply-To: References: <20100708021318.6C5222A6C12C@llvm.org> Message-ID: <8774EBA9-CDCD-441A-8F8F-2A126C669835@apple.com> Actually hold off on reverting the changes until we get LLVM fixed. I am filing a bug right now. On Jul 8, 2010, at 8:59 AM, Greg Clayton wrote: > Enabling "NDEBUG" disables all asserts in all of our code. Can you revert the "NDEBUG" changes? > > If LLVM headers are affected by NDEBUG we need to talk about a better solution. > > Greg Clayton > > > On Jul 7, 2010, at 7:13 PM, Sean Callanan wrote: > >> Author: spyffe >> Date: Wed Jul 7 21:13:18 2010 >> New Revision: 107853 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=107853&view=rev >> Log: >> Updated to build against the latest LLVM release. >> Also fixed our build to define NDEBUG; code that >> uses LLVM headers without NDEBUG is >> binary-incompatible with libraries built with >> NDEBUG. >> >> Modified: >> lldb/trunk/lldb.xcodeproj/project.pbxproj >> lldb/trunk/llvm.zip >> lldb/trunk/scripts/build-llvm.pl >> >> Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj >> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107853&r1=107852&r2=107853&view=diff >> ============================================================================== >> --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) >> +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jul 7 21:13:18 2010 >> @@ -2753,8 +2753,9 @@ >> "$(LLVM_BUILD_DIR)", >> ); >> LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; >> - LLVM_CONFIGURATION = Debug; >> + LLVM_CONFIGURATION = Release; >> OTHER_CFLAGS = ( >> + "-DNDEBUG", >> "-DFOR_DYLD=0", >> "-DSUPPORT_REMOTE_UNWINDING", >> "-Wparentheses", >> @@ -2808,6 +2809,7 @@ >> LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; >> LLVM_CONFIGURATION = Release; >> OTHER_CFLAGS = ( >> + "-DNDEBUG", >> "-DFOR_DYLD=0", >> "-DSUPPORT_REMOTE_UNWINDING", >> "-Wparentheses", >> @@ -2917,6 +2919,7 @@ >> LLVM_BUILD_DIR = "$(DERIVED_FILE_DIR)/llvm.build"; >> LLVM_CONFIGURATION = Release; >> OTHER_CFLAGS = ( >> + "-DNDEBUG", >> "-DFOR_DYLD=0", >> "-DSUPPORT_REMOTE_UNWINDING", >> "-Wparentheses", >> >> Modified: lldb/trunk/llvm.zip >> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/llvm.zip?rev=107853&r1=107852&r2=107853&view=diff >> ============================================================================== >> Binary files - no diff available. >> >> Modified: lldb/trunk/scripts/build-llvm.pl >> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=107853&r1=107852&r2=107853&view=diff >> ============================================================================== >> --- lldb/trunk/scripts/build-llvm.pl (original) >> +++ lldb/trunk/scripts/build-llvm.pl Wed Jul 7 21:13:18 2010 >> @@ -25,7 +25,7 @@ >> >> our $llvm_configuration = $ENV{LLVM_CONFIGURATION}; >> >> -our $llvm_revision = "'{2010-07-02T08:00}'"; >> +our $llvm_revision = "'{2010-07-07T08:00}'"; >> our $llvm_source_dir = "$ENV{SRCROOT}"; >> our $cc = "$ENV{DEVELOPER_BIN_DIR}/gcc-4.2"; >> our $cxx = "$ENV{DEVELOPER_BIN_DIR}/g++-4.2"; >> @@ -225,7 +225,7 @@ >> # Build llvm and clang >> print "Configuring clang ($arch) in '$llvm_dstroot_arch'...\n"; >> my $lldb_configuration_options = ''; >> - $llvm_configuration eq 'Release' and $lldb_configuration_options .= '--enable-optimized'; >> + $llvm_configuration eq 'Release' and $lldb_configuration_options .= '--enable-optimized --disable-assertions'; >> do_command ("cd '$llvm_dstroot_arch' && '$llvm_source_dir/llvm/configure' $lldb_configuration_options --enable-targets=x86,x86_64,arm --build=$arch-apple-darwin10 CC=\"$cc -arch $arch\" CXX=\"$cxx -arch $arch\"", >> "configuring llvm build", 1); >> } >> >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From scallanan at apple.com Thu Jul 8 13:16:16 2010 From: scallanan at apple.com (Sean Callanan) Date: Thu, 08 Jul 2010 18:16:16 -0000 Subject: [Lldb-commits] [lldb] r107894 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Symbol/ClangASTContext.cpp Message-ID: <20100708181616.D55682A6C12C@llvm.org> Author: spyffe Date: Thu Jul 8 13:16:16 2010 New Revision: 107894 URL: http://llvm.org/viewvc/llvm-project?rev=107894&view=rev Log: Moved NDEBUG from a global setting to a specific hack. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=107894&r1=107893&r2=107894&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jul 8 13:16:16 2010 @@ -2755,7 +2755,6 @@ LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_CONFIGURATION = Release; OTHER_CFLAGS = ( - "-DNDEBUG", "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", "-Wparentheses", @@ -2809,7 +2808,6 @@ LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_CONFIGURATION = Release; OTHER_CFLAGS = ( - "-DNDEBUG", "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", "-Wparentheses", @@ -2919,7 +2917,6 @@ LLVM_BUILD_DIR = "$(DERIVED_FILE_DIR)/llvm.build"; LLVM_CONFIGURATION = Release; OTHER_CFLAGS = ( - "-DNDEBUG", "-DFOR_DYLD=0", "-DSUPPORT_REMOTE_UNWINDING", "-Wparentheses", Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=107894&r1=107893&r2=107894&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Jul 8 13:16:16 2010 @@ -14,6 +14,7 @@ #include // Other libraries and framework includes +#define NDEBUG #include "clang/AST/ASTContext.h" #include "clang/AST/ASTImporter.h" #include "clang/AST/CXXInheritance.h" @@ -26,6 +27,7 @@ #include "clang/Basic/TargetOptions.h" #include "clang/Frontend/FrontendOptions.h" #include "clang/Frontend/LangStandard.h" +#undef NDEBUG #include "lldb/Core/dwarf.h" From johnny.chen at apple.com Thu Jul 8 16:38:07 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 08 Jul 2010 21:38:07 -0000 Subject: [Lldb-commits] [lldb] r107914 - /lldb/trunk/test/set_values/TestSetValues.py Message-ID: <20100708213807.785562A6C12C@llvm.org> Author: johnny Date: Thu Jul 8 16:38:07 2010 New Revision: 107914 URL: http://llvm.org/viewvc/llvm-project?rev=107914&view=rev Log: Add a test case (incomplete) to check that settings and readings of program variabes work. Added: lldb/trunk/test/set_values/TestSetValues.py Added: lldb/trunk/test/set_values/TestSetValues.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/set_values/TestSetValues.py?rev=107914&view=auto ============================================================================== --- lldb/trunk/test/set_values/TestSetValues.py (added) +++ lldb/trunk/test/set_values/TestSetValues.py Thu Jul 8 16:38:07 2010 @@ -0,0 +1,117 @@ +"""Test settings and readings of program variables.""" + +import os, time +import unittest +import lldb +import lldbtest + +class TestClassTypes(lldbtest.TestBase): + + mydir = "set_values" + + def test_class_types(self): + """Test settings and readings of program variables.""" + res = self.res + exe = os.path.join(os.getcwd(), "a.out") + self.ci.HandleCommand("file " + exe, res) + self.assertTrue(res.Succeeded()) + + # Set breakpoints on several places to set program variables. + self.ci.HandleCommand("breakpoint set -f main.c -l 15", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 1: file ='main.c', line = 15, locations = 1")) + self.ci.HandleCommand("breakpoint set -f main.c -l 36", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 2: file ='main.c', line = 36, locations = 1")) + self.ci.HandleCommand("breakpoint set -f main.c -l 57", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 3: file ='main.c', line = 57, locations = 1")) + self.ci.HandleCommand("breakpoint set -f main.c -l 78", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 4: file ='main.c', line = 78, locations = 1")) + self.ci.HandleCommand("breakpoint set -f main.c -l 85", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "Breakpoint created: 5: file ='main.c', line = 85, locations = 1")) + + self.ci.HandleCommand("run", res) + time.sleep(0.1) + self.assertTrue(res.Succeeded()) + + # The stop reason of the thread should be breakpoint. + self.ci.HandleCommand("thread list", res) + print "thread list ->", res.GetOutput() + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().find('state is Stopped') > 0 and + res.GetOutput().find('stop reason = breakpoint') > 0) + + # The breakpoint should have a hit count of 1. + self.ci.HandleCommand("breakpoint list", res) + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0) + + # main.c:15 + # Check that 'variable list' displays the correct data type and value. + self.ci.HandleCommand("variable list", res); + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith("i = (char) 'a'")) + # TODO: + # Now set variable 'i' and check that it is correctly displayed. + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + + # main.c:36 + # Check that 'variable list' displays the correct data type and value. + self.ci.HandleCommand("variable list", res); + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith( + "i = (short unsigned int) 0x0021")) + # TODO: + # Now set variable 'i' and check that it is correctly displayed. + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + + # main.c:57 + # Check that 'variable list' displays the correct data type and value. + self.ci.HandleCommand("variable list", res); + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith("i = (long int) 33")) + # TODO: + # Now set variable 'i' and check that it is correctly displayed. + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + + # main.c:78 + # Check that 'variable list' displays the correct data type and value. + self.ci.HandleCommand("variable list", res); + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith("i = (double) 3.14159")) + # TODO: + # Now set variable 'i' and check that it is correctly displayed. + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + + # main.c:85 + # Check that 'variable list' displays the correct data type and value. + self.ci.HandleCommand("variable list", res); + self.assertTrue(res.Succeeded()) + self.assertTrue(res.GetOutput().startswith("i = (long double) ")) + # TODO: + # Now set variable 'i' and check that it is correctly displayed. + + self.ci.HandleCommand("continue", res) + self.assertTrue(res.Succeeded()) + + +if __name__ == '__main__': + lldb.SBDebugger.Initialize() + unittest.main() + lldb.SBDebugger.Terminate() From gclayton at apple.com Fri Jul 9 15:39:51 2010 From: gclayton at apple.com (Greg Clayton) Date: Fri, 09 Jul 2010 20:39:51 -0000 Subject: [Lldb-commits] [lldb] r108009 - in /lldb/trunk: ./ include/ include/lldb/ include/lldb/API/ include/lldb/Breakpoint/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Host/ include/lldb/Interpreter/ include/lldb/Target/ lib/ lldb.xcodeproj/ scripts/ source/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Generated/ source/Host/ source/Host/linux/ source/Host/macosx/ source/Host/posix/ source/Interpreter/ source/Plugins/ source/Plugins/ABI/MacOSX-i386/ source/Plugins/ABI/Sys... Message-ID: <20100709203952.5B7B62A6C12C@llvm.org> Author: gclayton Date: Fri Jul 9 15:39:50 2010 New Revision: 108009 URL: http://llvm.org/viewvc/llvm-project?rev=108009&view=rev Log: 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. Added: lldb/trunk/Makefile lldb/trunk/include/Makefile lldb/trunk/include/lldb/Makefile lldb/trunk/lib/ lldb/trunk/lib/Makefile lldb/trunk/scripts/generate-vers.pl (with props) lldb/trunk/source/API/Makefile lldb/trunk/source/Breakpoint/Makefile lldb/trunk/source/Commands/Makefile lldb/trunk/source/Core/Makefile lldb/trunk/source/Expression/Makefile lldb/trunk/source/Generated/ lldb/trunk/source/Generated/Makefile lldb/trunk/source/Host/Makefile lldb/trunk/source/Host/linux/Makefile lldb/trunk/source/Host/macosx/Makefile lldb/trunk/source/Host/posix/Makefile lldb/trunk/source/Interpreter/Makefile lldb/trunk/source/Makefile lldb/trunk/source/Plugins/ABI/MacOSX-i386/Makefile lldb/trunk/source/Plugins/ABI/SysV-x86_64/Makefile lldb/trunk/source/Plugins/Disassembler/llvm/Makefile lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile lldb/trunk/source/Plugins/Makefile lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/Makefile lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile lldb/trunk/source/Plugins/ObjectFile/ELF/Makefile lldb/trunk/source/Plugins/ObjectFile/Mach-O/Makefile lldb/trunk/source/Plugins/Process/MacOSX-User/Makefile lldb/trunk/source/Plugins/Process/Utility/Makefile lldb/trunk/source/Plugins/Process/gdb-remote/Makefile lldb/trunk/source/Plugins/SymbolFile/DWARF/Makefile lldb/trunk/source/Plugins/SymbolFile/Symtab/Makefile lldb/trunk/source/Plugins/SymbolVendor/MacOSX/Makefile lldb/trunk/source/Symbol/Makefile lldb/trunk/source/Target/Makefile lldb/trunk/source/Utility/Makefile lldb/trunk/tools/Makefile lldb/trunk/tools/driver/Makefile Removed: lldb/trunk/source/Plugins/Process/gdb-remote/GDBServer.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.h Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h lldb/trunk/include/lldb/API/SBBreakpointLocation.h lldb/trunk/include/lldb/Breakpoint/Breakpoint.h lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h lldb/trunk/include/lldb/Core/FileSpec.h lldb/trunk/include/lldb/Expression/ClangExpression.h lldb/trunk/include/lldb/Expression/ClangFunction.h lldb/trunk/include/lldb/Host/Predicate.h lldb/trunk/include/lldb/Interpreter/CommandCompletions.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h lldb/trunk/include/lldb/Target/ThreadSpec.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointIDList.cpp lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp lldb/trunk/source/Breakpoint/BreakpointOptions.cpp lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp lldb/trunk/source/Breakpoint/BreakpointSite.cpp lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp lldb/trunk/source/Breakpoint/StoppointLocation.cpp lldb/trunk/source/Breakpoint/WatchpointLocation.cpp lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Commands/CommandObjectAppend.cpp lldb/trunk/source/Commands/CommandObjectApropos.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.h lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp lldb/trunk/source/Commands/CommandObjectCommands.cpp lldb/trunk/source/Commands/CommandObjectCrossref.cpp lldb/trunk/source/Commands/CommandObjectHelp.cpp lldb/trunk/source/Commands/CommandObjectImage.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectSyntax.cpp lldb/trunk/source/Commands/CommandObjectSyntax.h lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Core/Address.cpp lldb/trunk/source/Core/AddressRange.cpp lldb/trunk/source/Core/AddressResolverFileLine.cpp lldb/trunk/source/Core/ArchSpec.cpp lldb/trunk/source/Core/ConstString.cpp lldb/trunk/source/Core/DataBufferMemoryMap.cpp lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/Core/Error.cpp lldb/trunk/source/Core/FileSpec.cpp lldb/trunk/source/Core/Language.cpp lldb/trunk/source/Core/SearchFilter.cpp lldb/trunk/source/Core/Stream.cpp lldb/trunk/source/Core/StreamFile.cpp lldb/trunk/source/Core/StringList.cpp lldb/trunk/source/Core/Value.cpp lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Core/ValueObjectChild.cpp lldb/trunk/source/Expression/ClangExpression.cpp lldb/trunk/source/Expression/ClangFunction.cpp lldb/trunk/source/Expression/ClangStmtVisitor.cpp lldb/trunk/source/Expression/DWARFExpression.cpp lldb/trunk/source/Host/macosx/Host.mm lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Interpreter/Args.cpp lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.h lldb/trunk/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.h lldb/trunk/source/Plugins/Process/Utility/libunwind/include/libunwind.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/Type.cpp lldb/trunk/source/Target/ObjCObjectPrinter.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/ThreadPlanStepRange.cpp lldb/trunk/source/Target/ThreadPlanStepUntil.cpp lldb/trunk/source/Utility/StringExtractor.cpp lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp lldb/trunk/source/Utility/StringExtractorGDBRemote.h lldb/trunk/source/lldb.cpp lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj lldb/trunk/tools/debugserver/source/RNBRemote.cpp lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/IOChannel.cpp lldb/trunk/tools/driver/IOChannel.h Added: lldb/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/Makefile (added) +++ lldb/trunk/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/include/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/include/Makefile (added) +++ lldb/trunk/include/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpoint.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpoint.h Fri Jul 9 15:39:50 2010 @@ -69,9 +69,9 @@ IsEnabled (); void - SetIgnoreCount (int32_t count); + SetIgnoreCount (uint32_t count); - int32_t + uint32_t GetIgnoreCount () const; void Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Fri Jul 9 15:39:50 2010 @@ -35,11 +35,11 @@ bool IsEnabled (); - int32_t + uint32_t GetIgnoreCount (); void - SetIgnoreCount (int32_t n); + SetIgnoreCount (uint32_t n); void SetThreadID (lldb::tid_t sb_thread_id); Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original) +++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Fri Jul 9 15:39:50 2010 @@ -321,14 +321,14 @@ /// The number of breakpoint hits to ignore. //------------------------------------------------------------------ void - SetIgnoreCount (int32_t count); + SetIgnoreCount (uint32_t count); //------------------------------------------------------------------ /// Return the current Ignore Count. /// @return /// The number of breakpoint hits to be ignored. //------------------------------------------------------------------ - int32_t + uint32_t GetIgnoreCount () const; //------------------------------------------------------------------ Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointIDList.h Fri Jul 9 15:39:50 2010 @@ -37,14 +37,14 @@ virtual ~BreakpointIDList (); - int - Size(); + size_t + GetSize(); BreakpointID & - GetBreakpointIDAtIndex (int index); + GetBreakpointIDAtIndex (uint32_t index); bool - RemoveBreakpointIDAtIndex (int index); + RemoveBreakpointIDAtIndex (uint32_t index); void Clear(); @@ -56,16 +56,16 @@ AddBreakpointID (const char *bp_id); bool - FindBreakpointID (BreakpointID &bp_id, int *position); + FindBreakpointID (BreakpointID &bp_id, uint32_t *position); bool - FindBreakpointID (const char *bp_id, int *position); + FindBreakpointID (const char *bp_id, uint32_t *position); void - InsertStringArray (const char **string_array, int array_size, CommandReturnObject &result); + InsertStringArray (const char **string_array, uint32_t array_size, CommandReturnObject &result); static bool - StringContainsIDRangeExpression (const char *in_string, int *range_start_len, int *range_end_pos); + StringContainsIDRangeExpression (const char *in_string, uint32_t *range_start_len, uint32_t *range_end_pos); static void FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, Args &new_args); Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Fri Jul 9 15:39:50 2010 @@ -119,7 +119,7 @@ /// @return /// The number of breakpoint hits to be ignored. //------------------------------------------------------------------ - int32_t + uint32_t GetIgnoreCount (); //------------------------------------------------------------------ @@ -129,7 +129,7 @@ /// The number of breakpoint hits to ignore. //------------------------------------------------------------------ void - SetIgnoreCount (int32_t n); + SetIgnoreCount (uint32_t n); //------------------------------------------------------------------ /// Set the callback action invoked when the breakpoint is hit. Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h Fri Jul 9 15:39:50 2010 @@ -53,7 +53,7 @@ /// \b true if the breakpoint was in the list. //------------------------------------------------------------------ bool - Remove (lldb::user_id_t break_id, lldb::user_id_t break_loc_id); + Remove (lldb::break_id_t break_id, lldb::break_id_t break_loc_id); //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with id \a @@ -70,7 +70,7 @@ /// pointer if the breakpoint doesn't exist. //------------------------------------------------------------------ lldb::BreakpointLocationSP - FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id); + FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id); //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with id \a @@ -87,7 +87,7 @@ /// pointer if the breakpoint doesn't exist. //------------------------------------------------------------------ const lldb::BreakpointLocationSP - FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const; + FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const; //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with index @@ -187,10 +187,10 @@ typedef std::vector collection; collection::iterator - GetIDPairIterator(lldb::user_id_t break_id, lldb::user_id_t break_loc_id); + GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id); collection::const_iterator - GetIDPairConstIterator(lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const; + GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const; collection m_break_loc_collection; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h Fri Jul 9 15:39:50 2010 @@ -72,7 +72,7 @@ /// pointer if the breakpoint doesn't exist. //------------------------------------------------------------------ lldb::BreakpointLocationSP - FindByID (lldb::user_id_t breakID); + FindByID (lldb::break_id_t breakID); //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with id @@ -86,7 +86,7 @@ /// pointer if the breakpoint doesn't exist. //------------------------------------------------------------------ const lldb::BreakpointLocationSP - FindByID (lldb::user_id_t breakID) const; + FindByID (lldb::break_id_t breakID) const; //------------------------------------------------------------------ /// Returns the breakpoint location id to the breakpoint location @@ -98,7 +98,7 @@ /// @result /// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID. //------------------------------------------------------------------ - lldb::user_id_t + lldb::break_id_t FindIDByAddress (Address &addr); //------------------------------------------------------------------ @@ -183,7 +183,7 @@ /// \b true if the breakpoint \a breakID was in the list. //------------------------------------------------------------------ bool - Remove (lldb::user_id_t breakID); + Remove (lldb::break_id_t breakID); //------------------------------------------------------------------ /// Enquires of the breakpoint location in this list with ID \a @@ -200,7 +200,7 @@ //------------------------------------------------------------------ bool ShouldStop (StoppointCallbackContext *context, - lldb::user_id_t breakID); + lldb::break_id_t breakID); //------------------------------------------------------------------ /// Returns the number of elements in this breakpoint location list. @@ -252,7 +252,7 @@ /// @result /// Returns breakpoint location id. //------------------------------------------------------------------ - virtual lldb::user_id_t + virtual lldb::break_id_t Add (lldb::BreakpointLocationSP& bp_loc_sp); typedef std::vector collection; @@ -269,10 +269,10 @@ GetNextID(); collection::iterator - GetIDIterator(lldb::user_id_t breakID); + GetIDIterator(lldb::break_id_t breakID); collection::const_iterator - GetIDConstIterator(lldb::user_id_t breakID) const; + GetIDConstIterator(lldb::break_id_t breakID) const; collection m_locations; addr_map m_address_to_location; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Fri Jul 9 15:39:50 2010 @@ -108,14 +108,14 @@ SetEnabled (bool enabled); void - SetIgnoreCount (int32_t n); + SetIgnoreCount (uint32_t n); //------------------------------------------------------------------ /// Return the current Ignore Count. /// @return /// The number of breakpoint hits to be ignored. //------------------------------------------------------------------ - int32_t + uint32_t GetIgnoreCount () const; //------------------------------------------------------------------ @@ -216,7 +216,7 @@ lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback bool m_callback_is_synchronous; bool m_enabled; - int32_t m_ignore_count; // Number of times to ignore this breakpoint + uint32_t m_ignore_count; // Number of times to ignore this breakpoint std::auto_ptr m_thread_spec_ap; // Thread for which this breakpoint will take }; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Fri Jul 9 15:39:50 2010 @@ -243,8 +243,8 @@ /// \a break_loc_id is the Breakpoint Location to remove. //------------------------------------------------------------------ uint32_t - RemoveOwner (lldb::user_id_t break_id, - lldb::user_id_t break_loc_id); + RemoveOwner (lldb::break_id_t break_id, + lldb::break_id_t break_loc_id); BreakpointSite::Type m_type;///< The type of this breakpoint site. uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site uses trap opcodes. Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h Fri Jul 9 15:39:50 2010 @@ -50,7 +50,7 @@ /// @return /// The ID of the BreakpointSite in the list. //------------------------------------------------------------------ - lldb::user_id_t + lldb::break_id_t Add (const lldb::BreakpointSiteSP& bp_site_sp); //------------------------------------------------------------------ @@ -86,7 +86,7 @@ /// breakpoint doesn't exist. //------------------------------------------------------------------ lldb::BreakpointSiteSP - FindByID (lldb::user_id_t breakID); + FindByID (lldb::break_id_t breakID); //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint site with id \a breakID - const version. @@ -99,7 +99,7 @@ /// breakpoint doesn't exist. //------------------------------------------------------------------ const lldb::BreakpointSiteSP - FindByID (lldb::user_id_t breakID) const; + FindByID (lldb::break_id_t breakID) const; //------------------------------------------------------------------ /// Returns the breakpoint site id to the breakpoint site at address \a addr. @@ -110,7 +110,7 @@ /// @result /// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID. //------------------------------------------------------------------ - lldb::user_id_t + lldb::break_id_t FindIDByAddress (lldb::addr_t addr); //------------------------------------------------------------------ @@ -149,7 +149,7 @@ /// \b true if the breakpoint site \a breakID was in the list. //------------------------------------------------------------------ bool - Remove (lldb::user_id_t breakID); + Remove (lldb::break_id_t breakID); //------------------------------------------------------------------ /// Removes the breakpoint site at address \a addr from this list. @@ -164,7 +164,7 @@ RemoveByAddress (lldb::addr_t addr); void - SetEnabledForAll(const bool enable, const lldb::user_id_t except_id = LLDB_INVALID_BREAK_ID); + SetEnabledForAll(const bool enable, const lldb::break_id_t except_id = LLDB_INVALID_BREAK_ID); typedef void (*BreakpointSiteSPMapFunc) (lldb::BreakpointSiteSP &bp, void *baton); @@ -182,7 +182,7 @@ /// \b true if we should stop, \b false otherwise. //------------------------------------------------------------------ bool - ShouldStop (StoppointCallbackContext *context, lldb::user_id_t breakID); + ShouldStop (StoppointCallbackContext *context, lldb::break_id_t breakID); //------------------------------------------------------------------ /// Returns the number of elements in the list. @@ -197,10 +197,10 @@ typedef std::map collection; collection::iterator - GetIDIterator(lldb::user_id_t breakID); + GetIDIterator(lldb::break_id_t breakID); collection::const_iterator - GetIDConstIterator(lldb::user_id_t breakID) const; + GetIDConstIterator(lldb::break_id_t breakID) const; // This function exposes the m_bp_site_list. I use the in Process because there // are places there where you want to iterate over the list, and it is less efficient Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h Fri Jul 9 15:39:50 2010 @@ -82,9 +82,9 @@ //------------------------------------------------------------------ // Classes that inherit from StoppointLocation can see and modify these //------------------------------------------------------------------ - lldb::break_id_t m_loc_id; // Break ID - lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't - // store a full Address since that's not needed for the breakpoint sites. + lldb::break_id_t m_loc_id; // Break ID + lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't + // store a full Address since that's not needed for the breakpoint sites. bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources) uint32_t m_hw_index; // The hardware resource index for this breakpoint/watchpoint uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for Modified: lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h Fri Jul 9 15:39:50 2010 @@ -41,8 +41,8 @@ bool WatchpointRead () const; bool WatchpointWrite () const; - int32_t GetIgnoreCount () const; - void SetIgnoreCount (int32_t n); + uint32_t GetIgnoreCount () const; + void SetIgnoreCount (uint32_t n); void SetWatchpointType (uint32_t type); bool BreakpointWasHit (StoppointCallbackContext *context); bool SetCallback (WatchpointHitCallback callback, void *callback_baton); @@ -54,7 +54,7 @@ m_watch_write:1, // 1 if we stop when the watched data is written to m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access - int32_t m_ignore_count; // Number of times to ignore this breakpoint + uint32_t m_ignore_count; // Number of times to ignore this breakpoint WatchpointHitCallback m_callback; void * m_callback_baton; // Callback user data to pass to callback Modified: lldb/trunk/include/lldb/Core/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpec.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/FileSpec.h (original) +++ lldb/trunk/include/lldb/Core/FileSpec.h Fri Jul 9 15:39:50 2010 @@ -451,7 +451,7 @@ /// resolved path doesn't fit in dst_len, dst_len-1 characters will /// be written to \a dst_path, but the actual required length will still be returned. //------------------------------------------------------------------ - static int + static size_t Resolve (const char *src_path, char *dst_path, size_t dst_len); //------------------------------------------------------------------ @@ -475,7 +475,7 @@ /// resolved path doesn't fit in dst_len, dst_len-1 characters will /// be written to \a dst_path, but the actual required length will still be returned. //------------------------------------------------------------------ - static int + static size_t ResolveUsername (const char *src_path, char *dst_path, size_t dst_len); Modified: lldb/trunk/include/lldb/Expression/ClangExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpression.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpression.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpression.h Fri Jul 9 15:39:50 2010 @@ -15,6 +15,7 @@ #include #include #include +#include // Other libraries and framework includes // Project includes Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangFunction.h (original) +++ lldb/trunk/include/lldb/Expression/ClangFunction.h Fri Jul 9 15:39:50 2010 @@ -224,10 +224,10 @@ std::string m_wrapper_function_name; std::string m_wrapper_struct_name; + lldb::addr_t m_wrapper_function_addr; + std::list m_wrapper_args_addrs; const clang::ASTRecordLayout *m_struct_layout; ValueList m_arg_values; - lldb::addr_t m_wrapper_fun_addr; - std::list m_wrapper_args_addrs; size_t m_value_struct_size; size_t m_return_offset; Modified: lldb/trunk/include/lldb/Host/Predicate.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Predicate.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/Predicate.h (original) +++ lldb/trunk/include/lldb/Host/Predicate.h Fri Jul 9 15:39:50 2010 @@ -53,9 +53,9 @@ /// constructors. //------------------------------------------------------------------ Predicate () : + m_value(), m_mutex(), - m_condition(), - m_value() + m_condition() { } @@ -69,9 +69,9 @@ /// The initial value for our T object. //------------------------------------------------------------------ Predicate (T initial_value) : + m_value(initial_value), m_mutex(), - m_condition(), - m_value(initial_value) + m_condition() { } Modified: lldb/trunk/include/lldb/Interpreter/CommandCompletions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandCompletions.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandCompletions.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandCompletions.h Fri Jul 9 15:39:50 2010 @@ -52,7 +52,7 @@ struct CommonCompletionElement { - CommonCompletionTypes type; + uint32_t type; CompletionCallback callback; }; Added: lldb/trunk/include/lldb/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/include/lldb/Makefile (added) +++ lldb/trunk/include/lldb/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Fri Jul 9 15:39:50 2010 @@ -466,7 +466,7 @@ /// Returns an error object. //------------------------------------------------------------------ virtual Error - WillAttach (lldb::pid_t pid) + WillAttachToProcessWithID (lldb::pid_t pid) { return Error(); } @@ -481,7 +481,7 @@ /// Returns an error object. //------------------------------------------------------------------ virtual Error - WillAttach (const char *process_name, bool wait_for_launch) + WillAttachToProcessWithName (const char *process_name, bool wait_for_launch) { return Error(); } @@ -497,7 +497,7 @@ /// LLDB_INVALID_PROCESS_ID if attaching fails. //------------------------------------------------------------------ virtual Error - DoAttach (lldb::pid_t pid) = 0; + DoAttachToProcessWithID (lldb::pid_t pid) = 0; //------------------------------------------------------------------ /// Attach to an existing process using a partial process name. @@ -515,7 +515,7 @@ /// LLDB_INVALID_PROCESS_ID if attaching fails. //------------------------------------------------------------------ virtual Error - DoAttach (const char *process_name, bool wait_for_launch) + DoAttachToProcessWithName (const char *process_name, bool wait_for_launch) { Error error; error.SetErrorString("attach by name is not supported"); Modified: lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h Fri Jul 9 15:39:50 2010 @@ -38,7 +38,7 @@ { eNone = 0, eAvoidInlines = (1 << 0), - eAvoidNoDebug = (1 << 1), + eAvoidNoDebug = (1 << 1) }; //------------------------------------------------------------------ Modified: lldb/trunk/include/lldb/Target/ThreadSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadSpec.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadSpec.h (original) +++ lldb/trunk/include/lldb/Target/ThreadSpec.h Fri Jul 9 15:39:50 2010 @@ -93,7 +93,7 @@ bool IndexMatches (uint32_t index) const { - if (m_index == -1 || index == -1) + if (m_index == UINT32_MAX || index == UINT32_MAX) return true; else return index == m_index; Added: lldb/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/lib/Makefile (added) +++ lldb/trunk/lib/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jul 9 15:39:50 2010 @@ -2773,7 +2773,7 @@ ); PREBINDING = NO; PRODUCT_NAME = LLDB; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/source $(SRCROOT)/source/Plugins/Process/Utility $(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include"; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -2826,7 +2826,7 @@ ); PREBINDING = NO; PRODUCT_NAME = LLDB; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/source $(SRCROOT)/source/Plugins/Process/Utility $(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include"; VERSIONING_SYSTEM = "apple-generic"; ZERO_LINK = NO; }; @@ -2935,7 +2935,7 @@ ); PREBINDING = NO; PRODUCT_NAME = LLDB; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/source $(SRCROOT)/source/Plugins/Process/Utility $(SRCROOT)/include $(SRCROOT)/source/Host/macosx/cfcpp $(SRCROOT)/llvm/include $(SRCROOT)/llvm/tools/clang/include $(LLVM_BUILD_DIR)/llvm/include $(LLVM_BUILD_DIR)/llvm/tools/clang/include"; VERSIONING_SYSTEM = "apple-generic"; ZERO_LINK = NO; }; Added: lldb/trunk/scripts/generate-vers.pl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/generate-vers.pl?rev=108009&view=auto ============================================================================== --- lldb/trunk/scripts/generate-vers.pl (added) +++ lldb/trunk/scripts/generate-vers.pl Fri Jul 9 15:39:50 2010 @@ -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; Propchange: lldb/trunk/scripts/generate-vers.pl ------------------------------------------------------------------------------ svn:executable = * Added: lldb/trunk/source/API/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/API/Makefile (added) +++ lldb/trunk/source/API/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/API/SBBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpoint.cpp (original) +++ lldb/trunk/source/API/SBBreakpoint.cpp Fri Jul 9 15:39:50 2010 @@ -235,13 +235,13 @@ } void -SBBreakpoint::SetIgnoreCount (int32_t count) +SBBreakpoint::SetIgnoreCount (uint32_t count) { if (m_opaque_sp) m_opaque_sp->SetIgnoreCount (count); } -int32_t +uint32_t SBBreakpoint::GetIgnoreCount () const { if (m_opaque_sp) Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Fri Jul 9 15:39:50 2010 @@ -76,7 +76,7 @@ return false; } -int32_t +uint32_t SBBreakpointLocation::GetIgnoreCount () { if (m_opaque_sp) @@ -86,7 +86,7 @@ } void -SBBreakpointLocation::SetIgnoreCount (int32_t n) +SBBreakpointLocation::SetIgnoreCount (uint32_t n) { if (m_opaque_sp) m_opaque_sp->SetIgnoreCount (n); Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Fri Jul 9 15:39:50 2010 @@ -187,7 +187,7 @@ const uint32_t num_variables = variable_list.GetSize(); bool found = false; - for (int i = 0; i < num_variables && !found; ++i) + for (uint32_t i = 0; i < num_variables && !found; ++i) { var_sp = variable_list.GetVariableAtIndex(i); if (var_sp @@ -231,7 +231,7 @@ const uint32_t num_variables = variable_list.GetSize(); bool found = false; - for (int i = 0; i < num_variables && !found; ++i) + for (uint32_t i = 0; i < num_variables && !found; ++i) { var_sp = variable_list.GetVariableAtIndex(i); if (var_sp @@ -331,6 +331,9 @@ case eValueTypeVariableLocal: add_variable = locals; break; + + default: + break; } if (add_variable) { Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Fri Jul 9 15:39:50 2010 @@ -289,7 +289,7 @@ { const BreakpointList &bp_list = m_opaque_sp->GetBreakpointList(); size_t num_bps = bp_list.GetSize(); - for (int i = 0; i < num_bps; ++i) + for (size_t i = 0; i < num_bps; ++i) { SBBreakpoint sb_breakpoint (bp_list.GetBreakpointByIndex (i)); sb_breakpoint.GetDescription (out_file, "full"); Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Jul 9 15:39:50 2010 @@ -147,7 +147,10 @@ stop_desc = exc_desc; stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size } - break; + break; + + default: + break; } if (stop_desc && stop_desc[0]) @@ -225,7 +228,7 @@ { uint32_t num_stack_frames = m_opaque_sp->GetStackFrameCount (); StackFrameSP frame_sp; - int frame_idx = 0; + uint32_t frame_idx = 0; for (frame_idx = first_frame; frame_idx < first_frame + num_frames; ++frame_idx) { Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Fri Jul 9 15:39:50 2010 @@ -153,12 +153,12 @@ } void -Breakpoint::SetIgnoreCount (int32_t n) +Breakpoint::SetIgnoreCount (uint32_t n) { m_options.SetIgnoreCount(n); } -int32_t +uint32_t Breakpoint::GetIgnoreCount () const { return m_options.GetIgnoreCount(); @@ -255,7 +255,7 @@ // them after the locations pass. Have to do it this way because // resolving breakpoints will add new locations potentially. - for (int i = 0; i < module_list.GetSize(); i++) + for (size_t i = 0; i < module_list.GetSize(); i++) { bool seen = false; ModuleSP module_sp (module_list.GetModuleAtIndex (i)); @@ -263,9 +263,9 @@ if (!m_filter_sp->ModulePasses (module_sp)) continue; - for (int i = 0; i < m_locations.GetSize(); i++) + for (size_t j = 0; j < m_locations.GetSize(); j++) { - BreakpointLocationSP break_loc = m_locations.GetByIndex(i); + BreakpointLocationSP break_loc = m_locations.GetByIndex(j); const Section *section = break_loc->GetAddress().GetSection(); if (section == NULL || section->GetModule() == module) { @@ -300,15 +300,15 @@ // the same? Or do we need to do an equality on modules that is an // "equivalence"??? - for (int i = 0; i < module_list.GetSize(); i++) + for (size_t i = 0; i < module_list.GetSize(); i++) { ModuleSP module_sp (module_list.GetModuleAtIndex (i)); if (!m_filter_sp->ModulePasses (module_sp)) continue; - for (int i = 0; i < m_locations.GetSize(); i++) + for (size_t j = 0; j < m_locations.GetSize(); j++) { - BreakpointLocationSP break_loc = m_locations.GetByIndex(i); + BreakpointLocationSP break_loc = m_locations.GetByIndex(j); const Section *section = break_loc->GetAddress().GetSection(); if (section) { @@ -353,8 +353,8 @@ GetResolverDescription (s); GetFilterDescription (s); - const uint32_t num_locations = GetNumLocations (); - const uint32_t num_resolved_locations = GetNumResolvedLocations (); + const size_t num_locations = GetNumLocations (); + const size_t num_resolved_locations = GetNumResolvedLocations (); switch (level) { @@ -362,9 +362,9 @@ case lldb::eDescriptionLevelFull: if (num_locations > 0) { - s->Printf(", locations = %u", num_locations); + s->Printf(", locations = %zu", num_locations); if (num_resolved_locations > 0) - s->Printf(", resolved = %u", num_resolved_locations); + s->Printf(", resolved = %zu", num_resolved_locations); } else { @@ -387,12 +387,15 @@ s->Indent(); GetOptions()->GetDescription(s, level); break; + + default: + break; } if (show_locations) { s->IndentMore(); - for (int i = 0; i < GetNumLocations(); ++i) + for (size_t i = 0; i < num_locations; ++i) { BreakpointLocation *loc = GetLocationAtIndex(i).get(); loc->GetDescription(s, level); Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Fri Jul 9 15:39:50 2010 @@ -31,14 +31,14 @@ { } -int -BreakpointIDList::Size() +size_t +BreakpointIDList::GetSize() { return m_breakpoint_ids.size(); } BreakpointID & -BreakpointIDList::GetBreakpointIDAtIndex (int index) +BreakpointIDList::GetBreakpointIDAtIndex (uint32_t index) { if (index < m_breakpoint_ids.size()) return m_breakpoint_ids[index]; @@ -47,23 +47,13 @@ } bool -BreakpointIDList::RemoveBreakpointIDAtIndex (int index) +BreakpointIDList::RemoveBreakpointIDAtIndex (uint32_t index) { - bool success = false; - if (index < m_breakpoint_ids.size()) - { - BreakpointIDArray::iterator pos; - int i; + if (index >= m_breakpoint_ids.size()) + return false; - for (pos = m_breakpoint_ids.begin(), i = 0; i != index && pos != m_breakpoint_ids.end(); ++pos, ++i); - assert (i == index); - if (pos != m_breakpoint_ids.end()) - { - m_breakpoint_ids.erase (pos); - success = true; - } - } - return success; + m_breakpoint_ids.erase (m_breakpoint_ids.begin() + index); + return true; } void @@ -99,12 +89,12 @@ } bool -BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, int *position) +BreakpointIDList::FindBreakpointID (BreakpointID &bp_id, uint32_t *position) { bool success = false; BreakpointIDArray::iterator tmp_pos; - for (int i = 0; i < m_breakpoint_ids.size(); ++i) + for (size_t i = 0; i < m_breakpoint_ids.size(); ++i) { BreakpointID tmp_id = m_breakpoint_ids[i]; if (tmp_id.GetBreakpointID() == bp_id.GetBreakpointID() @@ -120,7 +110,7 @@ } bool -BreakpointIDList::FindBreakpointID (const char *bp_id_str, int *position) +BreakpointIDList::FindBreakpointID (const char *bp_id_str, uint32_t *position) { BreakpointID temp_bp_id; break_id_t bp_id; @@ -136,12 +126,12 @@ } void -BreakpointIDList::InsertStringArray (const char **string_array, int array_size, CommandReturnObject &result) +BreakpointIDList::InsertStringArray (const char **string_array, uint32_t array_size, CommandReturnObject &result) { if (string_array == NULL) return; - for (int i = 0; i < array_size; ++i) + for (uint32_t i = 0; i < array_size; ++i) { break_id_t bp_id; break_id_t loc_id; @@ -176,24 +166,23 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, Args &new_args) { - char *range_start; + std::string range_start; const char *range_end; const char *current_arg; - int num_old_args = old_args.GetArgumentCount(); + const size_t num_old_args = old_args.GetArgumentCount(); - for (int i = 0; i < num_old_args; ++i) + for (size_t i = 0; i < num_old_args; ++i) { bool is_range = false; current_arg = old_args.GetArgumentAtIndex (i); - int range_start_len = 0; - int range_end_pos = 0; + uint32_t range_start_len = 0; + uint32_t range_end_pos = 0; if (BreakpointIDList::StringContainsIDRangeExpression (current_arg, &range_start_len, &range_end_pos)) { is_range = true; range_start = (char *) malloc (range_start_len + 1); - strncpy (range_start, current_arg, range_start_len); - range_start[range_start_len] = '\0'; + range_start.assign (current_arg, range_start_len); range_end = current_arg + range_end_pos; } else if ((i + 2 < num_old_args) @@ -201,7 +190,7 @@ && BreakpointID::IsValidIDExpression (current_arg) && BreakpointID::IsValidIDExpression (old_args.GetArgumentAtIndex (i+2))) { - range_start = (char *) current_arg; + range_start.assign (current_arg); range_end = old_args.GetArgumentAtIndex (i+2); is_range = true; i = i+2; @@ -214,14 +203,14 @@ break_id_t start_loc_id; break_id_t end_loc_id; - BreakpointID::ParseCanonicalReference (range_start, &start_bp_id, &start_loc_id); + BreakpointID::ParseCanonicalReference (range_start.c_str(), &start_bp_id, &start_loc_id); BreakpointID::ParseCanonicalReference (range_end, &end_bp_id, &end_loc_id); if ((start_bp_id == LLDB_INVALID_BREAK_ID) || (! target->GetBreakpointByID (start_bp_id))) { new_args.Clear(); - result.AppendErrorWithFormat ("'%s' is not a valid breakpoint ID.\n", range_start); + result.AppendErrorWithFormat ("'%s' is not a valid breakpoint ID.\n", range_start.c_str()); result.SetStatus (eReturnStatusFailed); return; } @@ -239,8 +228,8 @@ // target and find all the breakpoints that fit into this range, and add them to new_args. const BreakpointList& breakpoints = target->GetBreakpointList(); - size_t num_breakpoints = breakpoints.GetSize(); - for (int j = 0; j < num_breakpoints; ++j) + const size_t num_breakpoints = breakpoints.GetSize(); + for (size_t j = 0; j < num_breakpoints; ++j) { Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (j).get(); break_id_t cur_bp_id = breakpoint->GetID(); @@ -248,11 +237,11 @@ if ((cur_bp_id < start_bp_id) || (cur_bp_id > end_bp_id)) continue; - size_t num_locations = breakpoint->GetNumLocations(); + const size_t num_locations = breakpoint->GetNumLocations(); if ((cur_bp_id == start_bp_id) && (start_loc_id != LLDB_INVALID_BREAK_ID)) { - for (int k = 0; k < num_locations; ++k) + for (size_t k = 0; k < num_locations; ++k) { BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get(); if (bp_loc->GetID() >= start_loc_id) @@ -265,7 +254,7 @@ } else if ((cur_bp_id == end_bp_id) && (end_loc_id != LLDB_INVALID_BREAK_ID)) { - for (int k = 0; k < num_locations; ++k) + for (size_t k = 0; k < num_locations; ++k) { BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get(); if (bp_loc->GetID() <= end_loc_id) @@ -294,19 +283,14 @@ return; } -//bool -//BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, const char **range_start, -// const **range_end) bool -BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, int *range_start_len, int *range_end_pos) +BreakpointIDList::StringContainsIDRangeExpression (const char *in_string, uint32_t *range_start_len, uint32_t *range_end_pos) { bool is_range_expression = false; std::string arg_str = in_string; std::string::size_type idx; std::string::size_type start_pos = 0; - //*range_start = NULL; - //*range_end = NULL; *range_start_len = 0; *range_end_pos = 0; Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Jul 9 15:39:50 2010 @@ -137,14 +137,14 @@ GetLocationOptions()->ClearCallback(); } -int32_t +uint32_t BreakpointLocation::GetIgnoreCount () { return GetOptionsNoCreate()->GetIgnoreCount(); } void -BreakpointLocation::SetIgnoreCount (int32_t n) +BreakpointLocation::SetIgnoreCount (uint32_t n) { GetLocationOptions()->SetIgnoreCount(n); } Modified: lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp Fri Jul 9 15:39:50 2010 @@ -46,7 +46,7 @@ } bool -BreakpointLocationCollection::Remove (lldb::user_id_t bp_id, lldb::user_id_t bp_loc_id) +BreakpointLocationCollection::Remove (lldb::break_id_t bp_id, lldb::break_id_t bp_loc_id) { collection::iterator pos = GetIDPairIterator(bp_id, bp_loc_id); // Predicate if (pos != m_break_loc_collection.end()) @@ -61,7 +61,7 @@ class BreakpointIDPairMatches { public: - BreakpointIDPairMatches (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) : + BreakpointIDPairMatches (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) : m_break_id(break_id), m_break_loc_id (break_loc_id) { @@ -74,26 +74,26 @@ } private: - const lldb::user_id_t m_break_id; - const lldb::user_id_t m_break_loc_id; + const lldb::break_id_t m_break_id; + const lldb::break_id_t m_break_loc_id; }; BreakpointLocationCollection::collection::iterator -BreakpointLocationCollection::GetIDPairIterator (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) +BreakpointLocationCollection::GetIDPairIterator (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) { return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate } BreakpointLocationCollection::collection::const_iterator -BreakpointLocationCollection::GetIDPairConstIterator (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const +BreakpointLocationCollection::GetIDPairConstIterator (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const { return std::find_if(m_break_loc_collection.begin(), m_break_loc_collection.end(), // Search full range BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate } BreakpointLocationSP -BreakpointLocationCollection::FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) +BreakpointLocationCollection::FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) { BreakpointLocationSP stop_sp; collection::iterator pos = GetIDPairIterator(break_id, break_loc_id); @@ -104,7 +104,7 @@ } const BreakpointLocationSP -BreakpointLocationCollection::FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const +BreakpointLocationCollection::FindByIDPair (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const { BreakpointLocationSP stop_sp; collection::const_iterator pos = GetIDPairConstIterator(break_id, break_loc_id); @@ -118,7 +118,7 @@ BreakpointLocationCollection::GetByIndex (uint32_t i) { BreakpointLocationSP stop_sp; - if (i >= 0 && i < m_break_loc_collection.size()) + if (i < m_break_loc_collection.size()) stop_sp = m_break_loc_collection[i]; return stop_sp; @@ -128,7 +128,7 @@ BreakpointLocationCollection::GetByIndex (uint32_t i) const { BreakpointLocationSP stop_sp; - if (i >= 0 && i < m_break_loc_collection.size()) + if (i < m_break_loc_collection.size()) stop_sp = m_break_loc_collection[i]; return stop_sp; @@ -139,7 +139,8 @@ { bool shouldStop = false; - for (int i = 0; i < GetSize(); i++) { + const size_t count = GetSize(); + for (size_t i = 0; i < count; i++) { bool one_result = GetByIndex(i)->ShouldStop(context); if (one_result) shouldStop = true; Modified: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp Fri Jul 9 15:39:50 2010 @@ -32,7 +32,7 @@ { } -lldb::user_id_t +lldb::break_id_t BreakpointLocationList::Add (BreakpointLocationSP &bp_loc_sp) { if (bp_loc_sp) @@ -46,7 +46,7 @@ } bool -BreakpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::user_id_t break_id) +BreakpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::break_id_t break_id) { BreakpointLocationSP bp = FindByID (break_id); if (bp) @@ -61,7 +61,7 @@ return true; } -lldb::user_id_t +lldb::break_id_t BreakpointLocationList::FindIDByAddress (Address &addr) { BreakpointLocationSP bp_loc_sp = FindByAddress (addr); @@ -73,7 +73,7 @@ } bool -BreakpointLocationList::Remove (lldb::user_id_t break_id) +BreakpointLocationList::Remove (lldb::break_id_t break_id) { Mutex::Locker locker (m_mutex); collection::iterator pos = GetIDIterator(break_id); // Predicate @@ -90,7 +90,7 @@ class BreakpointLocationIDMatches { public: - BreakpointLocationIDMatches (lldb::user_id_t break_id) : + BreakpointLocationIDMatches (lldb::break_id_t break_id) : m_break_id(break_id) { } @@ -101,7 +101,7 @@ } private: - const lldb::user_id_t m_break_id; + const lldb::break_id_t m_break_id; }; class BreakpointLocationAddressMatches @@ -122,7 +122,7 @@ }; BreakpointLocationList::collection::iterator -BreakpointLocationList::GetIDIterator (lldb::user_id_t break_id) +BreakpointLocationList::GetIDIterator (lldb::break_id_t break_id) { Mutex::Locker locker (m_mutex); return std::find_if (m_locations.begin(), @@ -131,7 +131,7 @@ } BreakpointLocationList::collection::const_iterator -BreakpointLocationList::GetIDConstIterator (lldb::user_id_t break_id) const +BreakpointLocationList::GetIDConstIterator (lldb::break_id_t break_id) const { Mutex::Locker locker (m_mutex); return std::find_if (m_locations.begin(), @@ -140,7 +140,7 @@ } BreakpointLocationSP -BreakpointLocationList::FindByID (lldb::user_id_t break_id) +BreakpointLocationList::FindByID (lldb::break_id_t break_id) { Mutex::Locker locker (m_mutex); BreakpointLocationSP stop_sp; @@ -152,7 +152,7 @@ } const BreakpointLocationSP -BreakpointLocationList::FindByID (lldb::user_id_t break_id) const +BreakpointLocationList::FindByID (lldb::break_id_t break_id) const { Mutex::Locker locker (m_mutex); BreakpointLocationSP stop_sp; @@ -192,13 +192,6 @@ return bp_loc_list.GetSize() - orig_size; } - -static int -FindLocationByAddress (Address *addr_ptr, const BreakpointLocationSP *bp_loc_sp_ptr) -{ - return Address::CompareModulePointerAndOffset(*addr_ptr, (*bp_loc_sp_ptr)->GetAddress()); -} - const BreakpointLocationSP BreakpointLocationList::FindByAddress (Address &addr) const { @@ -234,7 +227,7 @@ { Mutex::Locker locker (m_mutex); BreakpointLocationSP stop_sp; - if (i >= 0 && i < m_locations.size()) + if (i < m_locations.size()) stop_sp = m_locations[i]; return stop_sp; @@ -245,7 +238,7 @@ { Mutex::Locker locker (m_mutex); BreakpointLocationSP stop_sp; - if (i >= 0 && i < m_locations.size()) + if (i < m_locations.size()) stop_sp = m_locations[i]; return stop_sp; Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Fri Jul 9 15:39:50 2010 @@ -32,8 +32,8 @@ //---------------------------------------------------------------------- BreakpointOptions::BreakpointOptions() : m_callback (BreakpointOptions::NullCallback), - m_callback_is_synchronous (false), m_callback_baton_sp (), + m_callback_is_synchronous (false), m_enabled (true), m_ignore_count (0), m_thread_spec_ap (NULL) @@ -160,14 +160,14 @@ m_enabled = enabled; } -int32_t +uint32_t BreakpointOptions::GetIgnoreCount () const { return m_ignore_count; } void -BreakpointOptions::SetIgnoreCount (int32_t n) +BreakpointOptions::SetIgnoreCount (uint32_t n) { m_ignore_count = n; } Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Fri Jul 9 15:39:50 2010 @@ -59,7 +59,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS); sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list); - for (int i = 0; i < sc_list_size; i++) + for (uint32_t i = 0; i < sc_list_size; i++) { SymbolContext sc; if (sc_list.GetContextAtIndex(i, sc)) Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Fri Jul 9 15:39:50 2010 @@ -40,7 +40,8 @@ BreakpointSite::~BreakpointSite() { BreakpointLocationSP bp_loc_sp; - for (int i = 0; i < m_owners.GetSize(); i++) + const size_t owner_count = m_owners.GetSize(); + for (size_t i = 0; i < owner_count; i++) { m_owners.GetByIndex(i)->ClearBreakpointSite(); } @@ -66,7 +67,8 @@ bool BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id) { - for (int i = 0; i < m_owners.GetSize(); i++) + const size_t owner_count = m_owners.GetSize(); + for (size_t i = 0; i < owner_count; i++) { if (m_owners.GetByIndex(i)->GetBreakpoint().GetID() == bp_id) return true; @@ -158,7 +160,7 @@ } uint32_t -BreakpointSite::RemoveOwner (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) +BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id) { m_owners.Remove(break_id, break_loc_id); return m_owners.GetSize(); Modified: lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp Fri Jul 9 15:39:50 2010 @@ -31,7 +31,7 @@ // Add breakpoint site to the list. However, if the element already exists in the // list, then we don't add it, and return LLDB_INVALID_BREAK_ID. -lldb::user_id_t +lldb::break_id_t BreakpointSiteList::Add(const BreakpointSiteSP &bp) { lldb::addr_t bp_site_load_addr = bp->GetLoadAddress(); @@ -49,7 +49,7 @@ } bool -BreakpointSiteList::ShouldStop (StoppointCallbackContext *context, lldb::user_id_t break_id) +BreakpointSiteList::ShouldStop (StoppointCallbackContext *context, lldb::break_id_t break_id) { BreakpointSiteSP bp = FindByID (break_id); if (bp) @@ -63,7 +63,7 @@ // doesn't exist. return true; } -lldb::user_id_t +lldb::break_id_t BreakpointSiteList::FindIDByAddress (lldb::addr_t addr) { BreakpointSiteSP bp = FindByAddress (addr); @@ -77,7 +77,7 @@ } bool -BreakpointSiteList::Remove (lldb::user_id_t break_id) +BreakpointSiteList::Remove (lldb::break_id_t break_id) { collection::iterator pos = GetIDIterator(break_id); // Predicate if (pos != m_bp_site_list.end()) @@ -103,7 +103,7 @@ class BreakpointSiteIDMatches { public: - BreakpointSiteIDMatches (lldb::user_id_t break_id) : + BreakpointSiteIDMatches (lldb::break_id_t break_id) : m_break_id(break_id) { } @@ -114,25 +114,25 @@ } private: - const lldb::user_id_t m_break_id; + const lldb::break_id_t m_break_id; }; BreakpointSiteList::collection::iterator -BreakpointSiteList::GetIDIterator (lldb::user_id_t break_id) +BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id) { return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range BreakpointSiteIDMatches(break_id)); // Predicate } BreakpointSiteList::collection::const_iterator -BreakpointSiteList::GetIDConstIterator (lldb::user_id_t break_id) const +BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const { return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(), // Search full range BreakpointSiteIDMatches(break_id)); // Predicate } BreakpointSiteSP -BreakpointSiteList::FindByID (lldb::user_id_t break_id) +BreakpointSiteList::FindByID (lldb::break_id_t break_id) { BreakpointSiteSP stop_sp; collection::iterator pos = GetIDIterator(break_id); @@ -143,7 +143,7 @@ } const BreakpointSiteSP -BreakpointSiteList::FindByID (lldb::user_id_t break_id) const +BreakpointSiteList::FindByID (lldb::break_id_t break_id) const { BreakpointSiteSP stop_sp; collection::const_iterator pos = GetIDConstIterator(break_id); @@ -210,7 +210,7 @@ } void -BreakpointSiteList::SetEnabledForAll (const bool enabled, const lldb::user_id_t except_id) +BreakpointSiteList::SetEnabledForAll (const bool enabled, const lldb::break_id_t except_id) { collection::iterator end = m_bp_site_list.end(); collection::iterator pos; Added: lldb/trunk/source/Breakpoint/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Breakpoint/Makefile (added) +++ lldb/trunk/source/Breakpoint/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Breakpoint/StoppointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/StoppointLocation.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/StoppointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/StoppointLocation.cpp Fri Jul 9 15:39:50 2010 @@ -22,21 +22,21 @@ //---------------------------------------------------------------------- StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, bool hardware) : m_loc_id(bid), - m_byte_size(0), m_addr(addr), - m_hit_count(0), m_hw_preferred(hardware), - m_hw_index(LLDB_INVALID_INDEX32) + m_hw_index(LLDB_INVALID_INDEX32), + m_byte_size(0), + m_hit_count(0) { } StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, size_t size, bool hardware) : m_loc_id(bid), - m_byte_size(size), m_addr(addr), - m_hit_count(0), m_hw_preferred(hardware), - m_hw_index(LLDB_INVALID_INDEX32) + m_hw_index(LLDB_INVALID_INDEX32), + m_byte_size(size), + m_hit_count(0) { } Modified: lldb/trunk/source/Breakpoint/WatchpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocation.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/WatchpointLocation.cpp Fri Jul 9 15:39:50 2010 @@ -123,14 +123,14 @@ { return m_watch_write != 0; } -int32_t +uint32_t WatchpointLocation::GetIgnoreCount () const { return m_ignore_count; } void -WatchpointLocation::SetIgnoreCount (int32_t n) +WatchpointLocation::SetIgnoreCount (uint32_t n) { m_ignore_count = n; } Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Fri Jul 9 15:39:50 2010 @@ -161,7 +161,7 @@ // but for completeness sake we'll resolve the user name and only put a slash // on the end if it exists. char resolved_username[PATH_MAX]; - int resolved_username_len = FileSpec::ResolveUsername (partial_name_copy, resolved_username, + size_t resolved_username_len = FileSpec::ResolveUsername (partial_name_copy, resolved_username, sizeof (resolved_username)); // Not sure how this would happen, a username longer than PATH_MAX? Still... @@ -238,7 +238,7 @@ if (*partial_name_copy == '~') { - int resolved_username_len = FileSpec::ResolveUsername(containing_part, containing_part, sizeof (containing_part)); + size_t resolved_username_len = FileSpec::ResolveUsername(containing_part, containing_part, sizeof (containing_part)); // User name doesn't exist, we're not getting any further... if (resolved_username_len == 0 || resolved_username_len >= sizeof (containing_part)) return matches.GetSize(); @@ -591,7 +591,7 @@ SymbolContext sc; // Now add the functions & symbols to the list - only add if unique: - for (int i = 0; i < func_list.GetSize(); i++) + for (uint32_t i = 0; i < func_list.GetSize(); i++) { if (func_list.GetContextAtIndex(i, sc)) { @@ -602,7 +602,7 @@ } } - 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)) { Modified: lldb/trunk/source/Commands/CommandObjectAppend.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAppend.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectAppend.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectAppend.cpp Fri Jul 9 15:39:50 2010 @@ -73,7 +73,7 @@ { if (var->GetType() == StateVariable::eTypeString) { - for (int i = 0; i < command.GetArgumentCount(); ++i) + for (size_t i = 0; i < command.GetArgumentCount(); ++i) var->AppendStringValue (command.GetArgumentAtIndex(i)); result.SetStatus (eReturnStatusSuccessFinishNoResult); } Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Fri Jul 9 15:39:50 2010 @@ -69,14 +69,14 @@ result.AppendMessageWithFormat ("The following commands may relate to '%s':\n", search_word); size_t max_len = 0; - for (int i = 0; i < commands_found.GetSize(); ++i) + for (size_t i = 0; i < commands_found.GetSize(); ++i) { - int len = strlen (commands_found.GetStringAtIndex (i)); + size_t len = strlen (commands_found.GetStringAtIndex (i)); if (len > max_len) max_len = len; } - for (int i = 0; i < commands_found.GetSize(); ++i) + for (size_t i = 0; i < commands_found.GetSize(); ++i) interpreter.OutputFormattedHelpText (result.GetOutputStream(), commands_found.GetStringAtIndex(i), "--", commands_help. Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Jul 9 15:39:50 2010 @@ -56,11 +56,11 @@ m_func_regexp (), m_modules (), m_load_addr(), + m_ignore_count (0), m_thread_id(LLDB_INVALID_THREAD_ID), - m_thread_index (-1), + m_thread_index (UINT32_MAX), m_thread_name(), - m_queue_name(), - m_ignore_count (-1) + m_queue_name() { } @@ -190,8 +190,8 @@ } case 'k': { - m_ignore_count = Args::StringToSInt32(optarg, -1, 0); - if (m_ignore_count == -1) + m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0); + if (m_ignore_count == UINT32_MAX) error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); } break; @@ -210,8 +210,8 @@ break; case 'x': { - m_thread_index = Args::StringToUInt64(optarg, -1, 0); - if (m_thread_id == -1) + m_thread_index = Args::StringToUInt32(optarg, UINT32_MAX, 0); + if (m_thread_id == UINT32_MAX) error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg); } @@ -237,9 +237,9 @@ m_func_regexp.clear(); m_load_addr = LLDB_INVALID_ADDRESS; m_modules.clear(); - m_ignore_count = -1; + m_ignore_count = 0; m_thread_id = LLDB_INVALID_THREAD_ID; - m_thread_index = -1; + m_thread_index = UINT32_MAX; m_thread_name.clear(); m_queue_name.clear(); } @@ -469,7 +469,7 @@ if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) bp->SetThreadID (m_options.m_thread_id); - if (m_options.m_thread_index != -1) + if (m_options.m_thread_index != UINT32_MAX) bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); if (!m_options.m_thread_name.empty()) @@ -478,7 +478,7 @@ if (!m_options.m_queue_name.empty()) bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); - if (m_options.m_ignore_count != -1) + if (m_options.m_ignore_count != 0) bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count); } @@ -558,7 +558,7 @@ // NOW, convert the list of breakpoint id strings in TEMP_ARGS into an actual BreakpointIDList: - valid_ids->InsertStringArray ((const char **) temp_args.GetArgumentVector(), temp_args.GetArgumentCount(), result); + valid_ids->InsertStringArray (temp_args.GetConstArgumentVector(), temp_args.GetArgumentCount(), result); // At this point, all of the breakpoint ids that the user passed in have been converted to breakpoint IDs // and put into valid_ids. @@ -568,7 +568,8 @@ // Now that we've converted everything from args into a list of breakpoint ids, go through our tentative list // of breakpoint id's and verify that they correspond to valid/currently set breakpoints. - for (int i = 0; i < valid_ids->Size(); ++i) + const size_t count = valid_ids->GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_ids->GetBreakpointIDAtIndex (i); Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get(); @@ -578,9 +579,10 @@ if (cur_bp_id.GetLocationID() > num_locations) { StreamString id_str; - BreakpointID::GetCanonicalReference (&id_str, cur_bp_id.GetBreakpointID(), - cur_bp_id.GetLocationID()); - i = valid_ids->Size() + 1; + BreakpointID::GetCanonicalReference (&id_str, + cur_bp_id.GetBreakpointID(), + cur_bp_id.GetLocationID()); + i = valid_ids->GetSize() + 1; result.AppendErrorWithFormat ("'%s' is not a currently valid breakpoint/location id.\n", id_str.GetData()); result.SetStatus (eReturnStatusFailed); @@ -588,7 +590,7 @@ } else { - i = valid_ids->Size() + 1; + i = valid_ids->GetSize() + 1; result.AppendErrorWithFormat ("'%d' is not a currently valid breakpoint id.\n", cur_bp_id.GetBreakpointID()); result.SetStatus (eReturnStatusFailed); } @@ -731,7 +733,7 @@ { // No breakpoint selected; show info about all currently set breakpoints. result.AppendMessage ("Current breakpoints:"); - for (int i = 0; i < num_breakpoints; ++i) + for (size_t i = 0; i < num_breakpoints; ++i) { Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (i).get(); AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level); @@ -746,7 +748,7 @@ if (result.Succeeded()) { - for (int i = 0; i < valid_bp_ids.Size(); ++i) + for (size_t i = 0; i < valid_bp_ids.GetSize(); ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get(); @@ -834,7 +836,8 @@ { int enable_count = 0; int loc_count = 0; - for (int i = 0; i < valid_bp_ids.Size(); ++i) + const size_t count = valid_bp_ids.GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); @@ -933,7 +936,8 @@ { int disable_count = 0; int loc_count = 0; - for (int i = 0; i < valid_bp_ids.Size(); ++i) + const size_t count = valid_bp_ids.GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); @@ -1035,7 +1039,8 @@ { int delete_count = 0; int disable_count = 0; - for (int i = 0; i < valid_bp_ids.Size(); ++i) + const size_t count = valid_bp_ids.GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); @@ -1074,12 +1079,15 @@ CommandObjectBreakpointModify::CommandOptions::CommandOptions() : Options (), + m_ignore_count (0), m_thread_id(LLDB_INVALID_THREAD_ID), - m_thread_index (-1), + m_thread_index (UINT32_MAX), m_thread_name(), m_queue_name(), - m_ignore_count (-1), - m_enable_passed (false) + m_enable_passed (false), + m_enable_value (false), + m_name_passed (false), + m_queue_passed (false) { } @@ -1139,8 +1147,8 @@ break; case 'k': { - m_ignore_count = Args::StringToSInt32(optarg, -1, 0); - if (m_ignore_count == -1) + m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0); + if (m_ignore_count == UINT32_MAX) error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); } break; @@ -1167,8 +1175,8 @@ break; case 'x': { - m_thread_index = Args::StringToUInt64(optarg, -1, 0); - if (m_thread_id == -1) + m_thread_index = Args::StringToUInt32 (optarg, UINT32_MAX, 0); + if (m_thread_id == UINT32_MAX) error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg); } @@ -1186,9 +1194,9 @@ { Options::ResetOptionValues(); - m_ignore_count = -1; + m_ignore_count = 0; m_thread_id = LLDB_INVALID_THREAD_ID; - m_thread_index = -1; + m_thread_index = UINT32_MAX; m_thread_name.clear(); m_queue_name.clear(); m_enable_passed = false; @@ -1249,7 +1257,8 @@ if (result.Succeeded()) { - for (int i = 0; i < valid_bp_ids.Size(); ++i) + const size_t count = valid_bp_ids.GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); @@ -1264,7 +1273,7 @@ if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) location->SetThreadID (m_options.m_thread_id); - if (m_options.m_thread_index != -1) + if (m_options.m_thread_index != UINT32_MAX) location->GetLocationOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); if (m_options.m_name_passed) @@ -1273,7 +1282,7 @@ if (m_options.m_queue_passed) location->GetLocationOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); - if (m_options.m_ignore_count != -1) + if (m_options.m_ignore_count != 0) location->GetLocationOptions()->SetIgnoreCount(m_options.m_ignore_count); if (m_options.m_enable_passed) @@ -1285,7 +1294,7 @@ if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) bp->SetThreadID (m_options.m_thread_id); - if (m_options.m_thread_index != -1) + if (m_options.m_thread_index != UINT32_MAX) bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); if (m_options.m_name_passed) @@ -1294,7 +1303,7 @@ if (m_options.m_queue_passed) bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); - if (m_options.m_ignore_count != -1) + if (m_options.m_ignore_count != 0) bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count); if (m_options.m_enable_passed) Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Fri Jul 9 15:39:50 2010 @@ -104,9 +104,9 @@ std::string m_func_name; uint32_t m_func_name_type_mask; std::string m_func_regexp; - lldb::addr_t m_load_addr; STLStringArray m_modules; - int32_t m_ignore_count; + lldb::addr_t m_load_addr; + uint32_t m_ignore_count; lldb::tid_t m_thread_id; uint32_t m_thread_index; std::string m_thread_name; @@ -164,7 +164,7 @@ // Instance variables to hold the values for command options. - int32_t m_ignore_count; + uint32_t m_ignore_count; lldb::tid_t m_thread_id; uint32_t m_thread_index; std::string m_thread_name; Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Fri Jul 9 15:39:50 2010 @@ -244,7 +244,8 @@ if (result.Succeeded()) { - for (int i = 0; i < valid_bp_ids.Size(); ++i) + const size_t count = valid_bp_ids.GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) @@ -441,7 +442,8 @@ if (result.Succeeded()) { - for (int i = 0; i < valid_bp_ids.Size(); ++i) + const size_t count = valid_bp_ids.GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) @@ -526,7 +528,8 @@ if (result.Succeeded()) { - for (int i = 0; i < valid_bp_ids.Size(); ++i) + const size_t count = valid_bp_ids.GetSize(); + for (size_t i = 0; i < count; ++i) { BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Jul 9 15:39:50 2010 @@ -205,14 +205,14 @@ CommandReturnObject &result ) { - const int argc = args.GetArgumentCount(); + const size_t argc = args.GetArgumentCount(); if (argc < 2) - { + { result.AppendError ("'alias' requires at least two arguments"); result.SetStatus (eReturnStatusFailed); return false; - } + } const std::string alias_command = args.GetArgumentAtIndex(0); const std::string actual_command = args.GetArgumentAtIndex(1); @@ -236,7 +236,7 @@ if (command_obj_sp.get()) { CommandObject *cmd_obj = command_obj_sp.get(); - CommandObject *sub_cmd_obj; + CommandObject *sub_cmd_obj = NULL; OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector); OptionArgVector *option_arg_vector = option_arg_vector_sp.get(); @@ -299,7 +299,7 @@ } else { - for (int i = 0; i < args.GetArgumentCount(); ++i) + for (size_t i = 0; i < argc; ++i) option_arg_vector->push_back (OptionArgPair ("", std::string (args.GetArgumentAtIndex (i)))); } Modified: lldb/trunk/source/Commands/CommandObjectCrossref.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCrossref.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCrossref.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCrossref.cpp Fri Jul 9 15:39:50 2010 @@ -74,7 +74,8 @@ { result.AppendMessage ("This command can be called on the following types of objects:"); - for (int i = 0; i < m_crossref_object_types.GetArgumentCount(); ++i) + const size_t count = m_crossref_object_types.GetArgumentCount(); + for (size_t i = 0; i < count; ++i) { const char *obj_name = m_crossref_object_types.GetArgumentAtIndex(i); result.AppendMessageWithFormat (" %s (e.g. '%s %s')\n", obj_name, Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Fri Jul 9 15:39:50 2010 @@ -27,8 +27,8 @@ CommandObjectHelp::CommandObjectHelp () : CommandObject ("help", - "Shows a list of all debugger commands, or give details about specific commands.", - "help []") + "Shows a list of all debugger commands, or give details about specific commands.", + "help []") { } @@ -123,7 +123,8 @@ { Stream &output_strm = result.GetOutputStream(); output_strm.Printf("Help requested with ambiguous command name, possible completions:\n"); - for (int i = 0; i < matches.GetSize(); i++) + const uint32_t match_count = matches.GetSize(); + for (uint32_t i = 0; i < match_count; i++) { output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i)); } Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectImage.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectImage.cpp Fri Jul 9 15:39:50 2010 @@ -469,7 +469,7 @@ OptionElementVector &opt_element_vector, int match_start_point, int max_return_elements, - bool word_complete, + bool &word_complete, StringList &matches) { // Arguments are the standard source file completer. Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Jul 9 15:39:50 2010 @@ -462,11 +462,20 @@ return false; } - size_t item_byte_size = m_options.m_byte_size ? m_options.m_byte_size : 1; StreamString buffer (Stream::eBinary, process->GetAddressByteSize(), process->GetByteOrder()); + size_t item_byte_size = m_options.m_byte_size; + + if (m_options.m_byte_size == 0) + { + if (m_options.m_format == eFormatPointer) + item_byte_size = buffer.GetAddressByteSize(); + else + item_byte_size = 1; + } + lldb::addr_t addr = Args::StringToUInt64(command.GetArgumentAtIndex(0), LLDB_INVALID_ADDRESS, 0); if (addr == LLDB_INVALID_ADDRESS) @@ -513,6 +522,8 @@ case eFormatDefault: case eFormatBytes: case eFormatHex: + case eFormatPointer: + // Decode hex bytes uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 16, &success); if (!success) Modified: lldb/trunk/source/Commands/CommandObjectSyntax.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSyntax.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSyntax.cpp Fri Jul 9 15:39:50 2010 @@ -40,62 +40,20 @@ bool -CommandObjectSyntax::OldExecute +CommandObjectSyntax::Execute ( + CommandInterpreter &interpreter, Args& command, - Debugger *context, - CommandInterpreter *interpreter, CommandReturnObject &result ) { - CommandObject *cmd_obj; - - if (command.GetArgumentCount() != 0) - { - cmd_obj = interpreter->GetCommandObject(command.GetArgumentAtIndex(0)); - if (cmd_obj) - { - Stream &output_strm = result.GetOutputStream(); - if (cmd_obj->GetOptions() != NULL) - { - output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax()); - //cmd_obj->GetOptions()->GenerateOptionUsage (output_strm, cmd_obj); - output_strm.Printf ("(Try 'help %s' for more information on command options syntax.)\n", - cmd_obj->GetCommandName()); - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - else - { - output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax()); - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - } - else - { - result.AppendErrorWithFormat ("'%s' is not a known command.\n", command.GetArgumentAtIndex(0)); - result.AppendError ("Try 'help' to see a current list of commands."); - result.SetStatus (eReturnStatusFailed); - } - } - else - { - result.AppendError ("Must call 'syntax' with a valid command."); - result.SetStatus (eReturnStatusFailed); - } - return result.Succeeded(); -} - -bool -CommandObjectSyntax::Execute (Args &command, Debugger *context, CommandInterpreter *interpreter, - CommandReturnObject &result) -{ CommandObject::CommandMap::iterator pos; CommandObject *cmd_obj; const int argc = command.GetArgumentCount(); if (argc > 0) { - cmd_obj = interpreter->GetCommandObject (command.GetArgumentAtIndex(0)); + cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex(0)); bool all_okay = true; for (int i = 1; i < argc; ++i) { Modified: lldb/trunk/source/Commands/CommandObjectSyntax.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSyntax.h (original) +++ lldb/trunk/source/Commands/CommandObjectSyntax.h Fri Jul 9 15:39:50 2010 @@ -30,17 +30,10 @@ virtual ~CommandObjectSyntax (); - - bool - OldExecute (Args& command, - Debugger *context, - CommandInterpreter *interpreter, - CommandReturnObject &result); virtual bool - Execute (Args& command, - Debugger *context, - CommandInterpreter *interpreter, + Execute (CommandInterpreter &interpreter, + Args& command, CommandReturnObject &result); Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Jul 9 15:39:50 2010 @@ -173,7 +173,7 @@ strm.IndentMore(); StackFrameSP frame_sp; - int frame_idx = 0; + uint32_t frame_idx = 0; if (ascending) { Added: lldb/trunk/source/Commands/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Commands/Makefile (added) +++ lldb/trunk/source/Commands/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Core/Address.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/Address.cpp (original) +++ lldb/trunk/source/Core/Address.cpp Fri Jul 9 15:39:50 2010 @@ -241,24 +241,28 @@ } Address::Address () : + SymbolContextScope(), m_section (NULL), m_offset (LLDB_INVALID_ADDRESS) { } Address::Address (const Address& rhs) : + SymbolContextScope(rhs), m_section (rhs.m_section), m_offset (rhs.m_offset) { } Address::Address (const Section* section, addr_t offset) : + SymbolContextScope(), m_section (section), m_offset (offset) { } Address::Address (addr_t address, const SectionList * sections) : + SymbolContextScope(), m_section (NULL), m_offset (LLDB_INVALID_ADDRESS) { @@ -430,6 +434,9 @@ lldb_private::Address so_addr; switch (style) { + case DumpStyleInvalid: + return false; + case DumpStyleSectionNameOffset: if (m_section != NULL) { @@ -637,6 +644,9 @@ } } break; + + default: + break; } } Modified: lldb/trunk/source/Core/AddressRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressRange.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressRange.cpp (original) +++ lldb/trunk/source/Core/AddressRange.cpp Fri Jul 9 15:39:50 2010 @@ -146,6 +146,9 @@ switch (style) { + default: + break; + case Address::DumpStyleSectionNameOffset: case Address::DumpStyleSectionPointerOffset: s->PutChar ('['); Modified: lldb/trunk/source/Core/AddressResolverFileLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverFileLine.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressResolverFileLine.cpp (original) +++ lldb/trunk/source/Core/AddressResolverFileLine.cpp Fri Jul 9 15:39:50 2010 @@ -54,7 +54,7 @@ sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list); - for (int i = 0; i < sc_list_size; i++) + for (uint32_t i = 0; i < sc_list_size; i++) { SymbolContext sc; if (sc_list.GetContextAtIndex(i, sc)) Modified: lldb/trunk/source/Core/ArchSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/ArchSpec.cpp (original) +++ lldb/trunk/source/Core/ArchSpec.cpp Fri Jul 9 15:39:50 2010 @@ -239,6 +239,7 @@ switch (arch_type) { + case kNumArchTypes: case eArchTypeInvalid: break; @@ -334,6 +335,7 @@ { switch (m_type) { + case kNumArchTypes: case eArchTypeInvalid: break; @@ -990,7 +992,7 @@ eRegNumPPC_GCC_vscr = 110, eRegNumPPC_GCC_spe_acc = 111, eRegNumPPC_GCC_spefscr = 112, - eRegNumPPC_GCC_sfp = 113, + eRegNumPPC_GCC_sfp = 113 }; static const char * g_arm_gcc_reg_names[] = { @@ -1605,6 +1607,7 @@ { switch (m_type) { + case kNumArchTypes: case eArchTypeInvalid: break; @@ -1702,6 +1705,9 @@ } } break; + + case kNumArchTypes: + break; } const char *str = arch_name; Modified: lldb/trunk/source/Core/ConstString.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConstString.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/ConstString.cpp (original) +++ lldb/trunk/source/Core/ConstString.cpp Fri Jul 9 15:39:50 2010 @@ -85,10 +85,7 @@ Mutex::Locker locker (m_mutex); llvm::StringRef string_ref (cstr, cstr_len); llvm::StringMapEntry& entry = m_string_map.GetOrCreateValue (string_ref); - const char *ccstr = entry.getKeyData(); - llvm::StringMapEntry&reconstituted_entry = GetStringMapEntryFromKeyData (ccstr); - assert (&entry == &reconstituted_entry); - return ccstr; + return entry.getKeyData(); } return NULL; } Modified: lldb/trunk/source/Core/DataBufferMemoryMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataBufferMemoryMap.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/DataBufferMemoryMap.cpp (original) +++ lldb/trunk/source/Core/DataBufferMemoryMap.cpp Fri Jul 9 15:39:50 2010 @@ -154,12 +154,16 @@ { if ((stat.st_mode & S_IFREG) && (stat.st_size > offset)) { + const size_t max_bytes_available = stat.st_size - offset; if (length == SIZE_MAX) - length = stat.st_size - offset; - - // Cap the length if too much data was requested - if (length > stat.st_size - offset) - length = stat.st_size - offset; + { + length = max_bytes_available; + } + else if (length > max_bytes_available) + { + // Cap the length if too much data was requested + length = max_bytes_available; + } if (length > 0) { Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Fri Jul 9 15:39:50 2010 @@ -1088,7 +1088,7 @@ int size = sizeof (uint32_t) * 8; const uint8_t *src = m_start + *offset_ptr; - uint8_t byte; + uint8_t byte = 0; int bytecount = 0; while (src < m_end) @@ -1316,6 +1316,8 @@ s->Address(GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset), sizeof (addr_t)); break; + default: + case eFormatDefault: case eFormatHex: if (item_byte_size <= 8) { Modified: lldb/trunk/source/Core/Error.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Error.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/Error.cpp (original) +++ lldb/trunk/source/Core/Error.cpp Fri Jul 9 15:39:50 2010 @@ -334,7 +334,7 @@ // allocated buffer above va_list copy_args; va_copy (copy_args, args); - int length = ::vsnprintf (buf.data(), buf.size(), format, args); + size_t length = ::vsnprintf (buf.data(), buf.size(), format, args); if (length >= buf.size()) { // The error formatted string didn't fit into our buffer, resize it Modified: lldb/trunk/source/Core/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpec.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/FileSpec.cpp (original) +++ lldb/trunk/source/Core/FileSpec.cpp Fri Jul 9 15:39:50 2010 @@ -58,7 +58,7 @@ // Returns 0 if there WAS a ~ in the path but the username couldn't be resolved. // Otherwise returns the number of characters copied into dst_path. If the return // is >= dst_len, then the resolved path is too long... -int +size_t FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len) { char user_home[PATH_MAX]; @@ -70,7 +70,7 @@ // If there's no ~, then just copy src_path straight to dst_path (they may be the same string...) if (src_path[0] != '~') { - int len = strlen (src_path); + size_t len = strlen (src_path); if (len >= dst_len) { ::bcopy (src_path, dst_path, dst_len - 1); @@ -106,7 +106,7 @@ // User name of "" means the current user... struct passwd *user_entry; - const char *home_dir; + const char *home_dir = NULL; if (user_name[0] == '\0') { @@ -125,7 +125,7 @@ return ::snprintf (dst_path, dst_len, "%s%s", home_dir, remainder); } -int +size_t FileSpec::Resolve (const char *src_path, char *dst_path, size_t dst_len) { if (src_path == NULL || src_path[0] == '\0') @@ -135,7 +135,7 @@ char unglobbed_path[PATH_MAX]; if (src_path[0] == '~') { - int return_count = ResolveUsername(src_path, unglobbed_path, sizeof(unglobbed_path)); + size_t return_count = ResolveUsername(src_path, unglobbed_path, sizeof(unglobbed_path)); // If we couldn't find the user referred to, or the resultant path was too long, // then just copy over the src_path. @@ -509,16 +509,16 @@ { if (filename && filename[0]) { - return snprintf (path, max_path_length, "%s/%s", dirname, filename) < max_path_length; + return (size_t)::snprintf (path, max_path_length, "%s/%s", dirname, filename) < max_path_length; } else { - strncpy (path, dirname, max_path_length); + ::strncpy (path, dirname, max_path_length); } } else if (filename) { - strncpy (path, filename, max_path_length); + ::strncpy (path, filename, max_path_length); } else { @@ -660,7 +660,7 @@ { // Make sure we read exactly what we asked for and if we got // less, adjust the array - if (bytesRead < data_heap_ap->GetByteSize()) + if ((size_t)bytesRead < data_heap_ap->GetByteSize()) data_heap_ap->SetByteSize(bytesRead); data_sp.reset(data_heap_ap.release()); } Modified: lldb/trunk/source/Core/Language.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Language.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/Language.cpp (original) +++ lldb/trunk/source/Core/Language.cpp Fri Jul 9 15:39:50 2010 @@ -48,7 +48,7 @@ { { "python" , NULL , "Python" } } }; -static const uint32_t +static const size_t g_num_languages = sizeof(g_languages)/sizeof(LanguageStrings); Language::Language(Language::Type language) : Added: lldb/trunk/source/Core/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Core/Makefile (added) +++ lldb/trunk/source/Core/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Core/SearchFilter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/SearchFilter.cpp (original) +++ lldb/trunk/source/Core/SearchFilter.cpp Fri Jul 9 15:39:50 2010 @@ -154,9 +154,9 @@ searcher.SearchCallback (*this, empty_sc, NULL, false); else { - size_t numModules = modules.GetSize(); + const size_t numModules = modules.GetSize(); - for (int i = 0; i < numModules; i++) + for (size_t i = 0; i < numModules; i++) { ModuleSP module_sp(modules.GetModuleAtIndex(i)); if (ModulePasses(module_sp)) @@ -186,7 +186,7 @@ if (!context.module_sp) { size_t n_modules = m_target_sp->GetImages().GetSize(); - for (int i = 0; i < n_modules; i++) + for (size_t i = 0; i < n_modules; i++) { // If this is the last level supplied, then call the callback directly, // otherwise descend. @@ -395,8 +395,8 @@ // find the ones that match the file name. ModuleList matching_modules; - // const size_t num_matching_modules = m_target_sp->GetImages().FindModules(&m_module_spec, NULL, NULL, NULL, matching_modules); - for (int i = 0; i < m_target_sp->GetImages().GetSize (); i++) + const size_t num_modules = m_target_sp->GetImages().GetSize (); + for (size_t i = 0; i < num_modules; i++) { Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i); if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0) Modified: lldb/trunk/source/Core/Stream.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Stream.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/Stream.cpp (original) +++ lldb/trunk/source/Core/Stream.cpp Fri Jul 9 15:39:50 2010 @@ -67,12 +67,10 @@ if (m_flags.IsSet(eBinary)) { bool more = true; - bool negative = (sval < 0); while (more) { uint8_t byte = sval & 0x7fu; sval >>= 7; - assert((!negative && sval >= 0) || (negative && sval < 0)); /* sign bit of byte is 2nd high order bit (0x40) */ if ((sval == 0 && !(byte & 0x40)) || (sval == -1 && (byte & 0x40)) ) @@ -209,7 +207,7 @@ int bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits - int length = vsnprintf (str, sizeof(str), format, args); + size_t length = ::vsnprintf (str, sizeof(str), format, args); if (length < sizeof(str)) { va_end (args); @@ -479,16 +477,15 @@ va_start (args, format); va_copy (args, args_copy); // Copy this so we - int i; char str[1024]; int bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits - int length = vsnprintf (str, sizeof(str), format, args); + size_t length = ::vsnprintf (str, sizeof(str), format, args); if (length < sizeof(str)) { // The formatted string fit into our stack based buffer, so we can just // append that to our packet - for (i=0; i> (byte * 8), add_prefix); } else { - for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false) + for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } return bytes_written; @@ -577,15 +573,14 @@ bool add_prefix = m_flags.IsSet(eAddPrefix); int bytes_written = 0; - int byte; if (byte_order == eByteOrderLittle) { - for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) + for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } else { - for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false) + for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } return bytes_written; @@ -599,15 +594,14 @@ bool add_prefix = m_flags.IsSet(eAddPrefix); int bytes_written = 0; - int byte; if (byte_order == eByteOrderLittle) { - for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) + for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } else { - for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false) + for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } return bytes_written; @@ -675,17 +669,16 @@ int bytes_written = 0; const uint8_t *src = (const uint8_t *)s; - int i; bool binary_is_clear = m_flags.IsClear (eBinary); m_flags.Set (eBinary); if (src_byte_order == dst_byte_order) { - for (i=0;i=0; --i) + for (size_t i = src_len-1; i < src_len; --i) bytes_written += _PutHex8 (src[i], false); } if (binary_is_clear) @@ -705,17 +698,16 @@ int bytes_written = 0; const uint8_t *src = (const uint8_t *)s; - int i; bool binary_is_set = m_flags.IsSet(eBinary); m_flags.Clear(eBinary); if (src_byte_order == dst_byte_order) { - for (i=0;i=0; --i) + for (size_t i = src_len-1; i < src_len; --i) bytes_written += _PutHex8 (src[i], false); } if (binary_is_set) Modified: lldb/trunk/source/Core/StreamFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StreamFile.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/StreamFile.cpp (original) +++ lldb/trunk/source/Core/StreamFile.cpp Fri Jul 9 15:39:50 2010 @@ -24,32 +24,32 @@ StreamFile::StreamFile () : Stream (), m_file (NULL), - m_path_name (), - m_close_file (false) + m_close_file (false), + m_path_name () { } StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, FILE *f) : Stream (flags, addr_size, byte_order), m_file(f), - m_path_name (), - m_close_file(false) + m_close_file(false), + m_path_name () { } StreamFile::StreamFile(FILE *f) : Stream (), m_file(f), - m_path_name (), - m_close_file(false) + m_close_file(false), + m_path_name () { } StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, const char *path, const char *permissions) : Stream (flags, addr_size, byte_order), m_file (NULL), - m_path_name (path), - m_close_file(false) + m_close_file(false), + m_path_name (path) { Open(path, permissions); } @@ -57,8 +57,8 @@ StreamFile::StreamFile(const char *path, const char *permissions) : Stream (), m_file (NULL), - m_path_name (path), - m_close_file(false) + m_close_file(false), + m_path_name (path) { Open(path, permissions); } Modified: lldb/trunk/source/Core/StringList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StringList.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/StringList.cpp (original) +++ lldb/trunk/source/Core/StringList.cpp Fri Jul 9 15:39:50 2010 @@ -68,7 +68,7 @@ { uint32_t len = strings.GetSize(); - for (int i = 0; i < len; ++i) + for (uint32_t i = 0; i < len; ++i) m_strings.push_back (strings.GetStringAtIndex(i)); } @@ -106,7 +106,7 @@ for (++pos; pos != end; ++pos) { - int new_size = strlen (m_strings[pos].c_str()); + size_t new_size = strlen (m_strings[pos].c_str()); // First trim common_prefix if it is longer than the current element: if (common_prefix.size() > new_size) @@ -114,7 +114,7 @@ // Then trim it at the first disparity: - for (int i = 0; i < common_prefix.size(); i++) + for (size_t i = 0; i < common_prefix.size(); i++) { if (m_strings[pos][i] != common_prefix[i]) { @@ -189,7 +189,7 @@ if (GetSize() == 0) return; - int idx = 0; + size_t idx = 0; while (idx < m_strings.size()) { if (m_strings[idx].empty()) Modified: lldb/trunk/source/Core/Value.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/Value.cpp (original) +++ lldb/trunk/source/Core/Value.cpp Fri Jul 9 15:39:50 2010 @@ -616,7 +616,7 @@ data.SetData(data_sp); } - uint8_t* dst = (uint8_t*)data.PeekData (data_offset, byte_size); + uint8_t* dst = const_cast(data.PeekData (data_offset, byte_size)); if (dst != NULL) { if (address_type == eAddressTypeHost) @@ -677,6 +677,10 @@ case eValueTypeScalar: // raw scalar value break; + case eContextTypeValue: + m_value.Clear(); // TODO: Sean, fill this in + break; + default: case eValueTypeFileAddress: m_value.Clear(); @@ -757,6 +761,7 @@ case eContextTypeDCRegisterInfo: return "RegisterInfo *"; case eContextTypeDCType: return "Type *"; case eContextTypeDCVariable: return "Variable *"; + case eContextTypeValue: return "Value"; // TODO: Sean, more description here? }; return "???"; } Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Fri Jul 9 15:39:50 2010 @@ -516,6 +516,9 @@ } } break; + + default: + break; } } } @@ -579,7 +582,7 @@ { const size_t byte_size = GetByteSize(); const off_t byte_offset = GetByteOffset(); - uint8_t *dst = (uint8_t *)m_data.PeekData(byte_offset, byte_size); + uint8_t *dst = const_cast(m_data.PeekData(byte_offset, byte_size)); if (dst != NULL) { // We are decoding a float into host byte order below, so make Modified: lldb/trunk/source/Core/ValueObjectChild.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp (original) +++ lldb/trunk/source/Core/ValueObjectChild.cpp Fri Jul 9 15:39:50 2010 @@ -111,9 +111,9 @@ const char *clang_type_name = m_type_name.AsCString(); if (clang_type_name) { - char bitfield_type_name[strlen(clang_type_name) + 32]; - ::snprintf (bitfield_type_name, sizeof(bitfield_type_name), "%s:%u", clang_type_name, m_bitfield_bit_size); - m_type_name.SetCString(bitfield_type_name); + std::vector bitfield_type_name (strlen(clang_type_name) + 32, 0); + ::snprintf (bitfield_type_name.data(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size); + m_type_name.SetCString(bitfield_type_name.data()); } } } Modified: lldb/trunk/source/Expression/ClangExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpression.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangExpression.cpp Fri Jul 9 15:39:50 2010 @@ -195,9 +195,12 @@ ClangExpression::ClangExpression(const char *target_triple, ClangExpressionDeclMap *decl_map) : m_target_triple (), - m_jit_mm_ptr (NULL), + m_decl_map (decl_map), + m_clang_ap (), m_code_generator_ptr (NULL), - m_decl_map (decl_map) + m_jit_mm_ptr (NULL), + m_execution_engine (), + m_jitted_functions () { if (target_triple && target_triple[0]) m_target_triple = target_triple; Modified: lldb/trunk/source/Expression/ClangFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangFunction.cpp (original) +++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Jul 9 15:39:50 2010 @@ -43,14 +43,19 @@ //---------------------------------------------------------------------- ClangFunction::ClangFunction(const char *target_triple, ClangASTContext *ast_context, void *return_qualtype, const Address& functionAddress, const ValueList &arg_value_list) : ClangExpression (target_triple, NULL), - m_function_addr (functionAddress), m_function_ptr (NULL), - m_arg_values (arg_value_list), - m_clang_ast_context (ast_context), + m_function_addr (functionAddress), m_function_return_qual_type(return_qualtype), + m_clang_ast_context (ast_context), m_wrapper_function_name ("__lldb_caller_function"), m_wrapper_struct_name ("__lldb_caller_struct"), + m_wrapper_function_addr (), + m_wrapper_args_addrs (), + m_struct_layout (NULL), + m_arg_values (arg_value_list), + m_value_struct_size (0), m_return_offset(0), + m_return_size (0), m_compiled (false), m_JITted (false) { @@ -59,12 +64,18 @@ ClangFunction::ClangFunction(const char *target_triple, Function &function, ClangASTContext *ast_context, const ValueList &arg_value_list) : ClangExpression (target_triple, NULL), m_function_ptr (&function), - m_arg_values (arg_value_list), + m_function_addr (), + m_function_return_qual_type (), m_clang_ast_context (ast_context), - m_function_return_qual_type (NULL), m_wrapper_function_name ("__lldb_function_caller"), m_wrapper_struct_name ("__lldb_caller_struct"), - m_return_offset(0), + m_wrapper_function_addr (), + m_wrapper_args_addrs (), + m_struct_layout (NULL), + m_arg_values (arg_value_list), + m_value_struct_size (0), + m_return_offset (0), + m_return_size (0), m_compiled (false), m_JITted (false) { @@ -109,22 +120,24 @@ // to pull the defined arguments out of the function, then add the types from the // arguments list for the variable arguments. - size_t num_args = -1; + uint32_t num_args = UINT32_MAX; bool trust_function = false; // GetArgumentCount returns -1 for an unprototyped function. if (m_function_ptr) { - num_args = m_function_ptr->GetArgumentCount(); - if (num_args != -1) + int num_func_args = m_function_ptr->GetArgumentCount(); + if (num_func_args >= 0) trust_function = true; + else + num_args = num_func_args; } - if (num_args == -1) + if (num_args == UINT32_MAX) num_args = m_arg_values.GetSize(); std::string args_buffer; // This one stores the definition of all the args in "struct caller". std::string args_list_buffer; // This one stores the argument list called from the structure. - for (int i = 0; i < num_args; i++) + for (size_t i = 0; i < num_args; i++) { const char *type_string; std::string type_stdstr; @@ -157,7 +170,7 @@ char arg_buf[32]; args_buffer.append (" "); args_buffer.append (type_string); - snprintf(arg_buf, 31, "arg_%d", i); + snprintf(arg_buf, 31, "arg_%zd", i); args_buffer.push_back (' '); args_buffer.append (arg_buf); args_buffer.append (";\n"); @@ -253,8 +266,8 @@ } // Next get the call address for the function: - m_wrapper_fun_addr = GetFunctionAddress (m_wrapper_function_name.c_str()); - if (m_wrapper_fun_addr == LLDB_INVALID_ADDRESS) + m_wrapper_function_addr = GetFunctionAddress (m_wrapper_function_name.c_str()); + if (m_wrapper_function_addr == LLDB_INVALID_ADDRESS) return false; return true; @@ -322,7 +335,7 @@ return false; } - for (int i = 0; i < num_args; i++) + for (size_t i = 0; i < num_args; i++) { // FIXME: We should sanity check sizes. @@ -366,7 +379,7 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) - log->Printf ("Call Address: 0x%llx Struct Address: 0x%llx.\n", m_wrapper_fun_addr, args_addr_ref); + log->Printf ("Call Address: 0x%llx Struct Address: 0x%llx.\n", m_wrapper_function_addr, args_addr_ref); return true; } @@ -386,7 +399,7 @@ // Okay, now run the function: - Address wrapper_address (NULL, m_wrapper_fun_addr); + Address wrapper_address (NULL, m_wrapper_function_addr); ThreadPlan *new_plan = new ThreadPlanCallFunction (*exc_context.thread, wrapper_address, args_addr, Modified: lldb/trunk/source/Expression/ClangStmtVisitor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangStmtVisitor.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangStmtVisitor.cpp (original) +++ lldb/trunk/source/Expression/ClangStmtVisitor.cpp Fri Jul 9 15:39:50 2010 @@ -37,6 +37,9 @@ switch (clang_type->getTypeClass()) { + default: + break; + case clang::Type::FunctionNoProto: case clang::Type::FunctionProto: break; @@ -135,8 +138,8 @@ lldb_private::StreamString &strm ) : m_ast_context (ast_context), - m_variable_list (variable_list), m_decl_map (decl_map), + m_variable_list (variable_list), m_stream (strm) { } @@ -477,22 +480,10 @@ bool is_wide = Str->isWide(); size_t new_length = byte_length + (is_wide ? 1 : 2); + + std::string null_terminated_string (Str->getStrData(), byte_length); - uint8_t null_terminated_string[new_length]; - - memcpy(&null_terminated_string[0], Str->getStrData(), byte_length); - - if(is_wide) - { - null_terminated_string[byte_length] = '\0'; - null_terminated_string[byte_length + 1] = '\0'; - } - else - { - null_terminated_string[byte_length] = '\0'; - } - - Value *val = new Value(null_terminated_string, new_length); + Value *val = new Value((uint8_t*)null_terminated_string.c_str(), new_length); val->SetContext(Value::eContextTypeOpaqueClangQualType, Str->getType().getAsOpaquePtr()); uint32_t val_idx = m_variable_list.AppendValue(val); Modified: lldb/trunk/source/Expression/DWARFExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Expression/DWARFExpression.cpp (original) +++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Jul 9 15:39:50 2010 @@ -303,6 +303,9 @@ switch (level) { + default: + break; + case lldb::eDescriptionLevelBrief: if (offset > start_offset) s->PutChar(' '); Added: lldb/trunk/source/Expression/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Expression/Makefile (added) +++ lldb/trunk/source/Expression/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/source/Generated/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Generated/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Generated/Makefile (added) +++ lldb/trunk/source/Generated/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/source/Host/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Host/Makefile (added) +++ lldb/trunk/source/Host/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/source/Host/linux/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Host/linux/Makefile (added) +++ lldb/trunk/source/Host/linux/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Host/macosx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/Host.mm Fri Jul 9 15:39:50 2010 @@ -23,9 +23,9 @@ #include -#include "CFCBundle.h" -#include "CFCReleaser.h" -#include "CFCString.h" +#include "cfcpp/CFCBundle.h" +#include "cfcpp/CFCReleaser.h" +#include "cfcpp/CFCString.h" #include "lldb/Host/Host.h" #include "lldb/Core/ArchSpec.h" @@ -434,7 +434,7 @@ // Set the pthread name if possible if (pid == curr_pid && tid == curr_tid) { - ::pthread_setname_np (name) == 0; + ::pthread_setname_np (name); } #endif ThreadNameAccessor (false, pid, tid, name); @@ -446,21 +446,22 @@ static FileSpec g_program_filepsec; if (!g_program_filepsec) { - std::string program_fullpath; - program_fullpath.resize (PATH_MAX); + char program_fullpath[PATH_MAX]; // If DST is NULL, then return the number of bytes needed. - uint32_t len = program_fullpath.size(); - int err = _NSGetExecutablePath ((char *)program_fullpath.data(), &len); - if (err < 0) - { - // 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); - } + uint32_t len = sizeof(program_fullpath); + int err = _NSGetExecutablePath (program_fullpath, &len); 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; } @@ -505,7 +506,7 @@ struct MonitorInfo { - int handle; + uint32_t handle; pthread_t thread; Host::MonitorChildProcessCallback callback; void *callback_baton; Added: lldb/trunk/source/Host/macosx/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Host/macosx/Makefile (added) +++ lldb/trunk/source/Host/macosx/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Host/macosx/Symbols.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Host/macosx/Symbols.cpp (original) +++ lldb/trunk/source/Host/macosx/Symbols.cpp Fri Jul 9 15:39:50 2010 @@ -19,20 +19,23 @@ #include // Project includes -#include "CFCReleaser.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBuffer.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Timer.h" #include "lldb/Core/UUID.h" +#include "Host/macosx/cfcpp/CFCReleaser.h" + using namespace lldb; using namespace lldb_private; extern "C" { + CFURLRef DBGCopyFullDSYMURLForUUID (CFUUIDRef uuid, CFURLRef exec_url); CFDictionaryRef DBGCopyDSYMPropertyLists (CFURLRef dsym_url); -}; + +} static bool SkinnyMachOFileContainsArchAndUUID Added: lldb/trunk/source/Host/posix/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Host/posix/Makefile (added) +++ lldb/trunk/source/Host/posix/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Interpreter/Args.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/Args.cpp (original) +++ lldb/trunk/source/Interpreter/Args.cpp Fri Jul 9 15:39:50 2010 @@ -779,7 +779,7 @@ for (++pos; pos != end; ++pos) { - int new_size = (*pos).size(); + size_t new_size = (*pos).size(); // First trim common_prefix if it is longer than the current element: if (common_prefix.size() > new_size) @@ -787,7 +787,7 @@ // Then trim it at the first disparity: - for (int i = 0; i < common_prefix.size(); i++) + for (size_t i = 0; i < common_prefix.size(); i++) { if ((*pos)[i] != common_prefix[i]) { @@ -998,7 +998,7 @@ // So we have to build another Arg and pass that to getopt_long so it doesn't // change the one we have. - std::vector dummy_vec(GetArgumentVector(), GetArgumentVector() + GetArgumentCount() + 1); + std::vector dummy_vec (GetArgumentVector(), GetArgumentVector() + GetArgumentCount() + 1); bool failed_once = false; uint32_t dash_dash_pos = -1; @@ -1009,7 +1009,10 @@ int parse_start = optind; int long_options_index = -1; - val = ::getopt_long (dummy_vec.size() - 1,(char *const *) dummy_vec.data(), sstr.GetData(), long_options, + val = ::getopt_long (dummy_vec.size() - 1, + (char *const *) dummy_vec.data(), + sstr.GetData(), + long_options, &long_options_index); if (val == -1) Added: lldb/trunk/source/Interpreter/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Interpreter/Makefile (added) +++ lldb/trunk/source/Interpreter/Makefile Fri Jul 9 15:39:50 2010 @@ -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)" Added: lldb/trunk/source/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Makefile (added) +++ lldb/trunk/source/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/source/Plugins/ABI/MacOSX-i386/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/Makefile (added) +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/source/Plugins/ABI/SysV-x86_64/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/Makefile (added) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original) +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Fri Jul 9 15:39:50 2010 @@ -376,8 +376,7 @@ char triple[256]; if (TripleForArchSpec (arch, triple, sizeof(triple))) { - EDAssemblySyntax_t syntax = SyntaxForArchSpec (arch); - assert(!EDGetDisassembler(&m_disassembler, triple, syntax) && "No disassembler created!"); + assert(!EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch)) && "No disassembler created!"); } } Added: lldb/trunk/source/Plugins/Disassembler/llvm/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Disassembler/llvm/Makefile (added) +++ lldb/trunk/source/Plugins/Disassembler/llvm/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile (added) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ObjCTrampolineHandler.h Fri Jul 9 15:39:50 2010 @@ -16,7 +16,6 @@ #include // Other libraries and framework includes // Project includes -#include "lldb.h" #include "lldb/Expression/ClangExpression.h" #include "lldb/Expression/ClangFunction.h" #include "lldb/Host/Mutex.h" @@ -128,6 +127,6 @@ }; -}; // using namespace lldb_private +} // using namespace lldb_private #endif // lldb_ObjCTrampolineHandler_h_ Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.h Fri Jul 9 15:39:50 2010 @@ -14,8 +14,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb-types.h" -#include "lldb-enumerations.h" +#include "lldb/lldb-types.h" +#include "lldb/lldb-enumerations.h" #include "lldb/Target/ThreadPlan.h" #include "ObjCTrampolineHandler.h" @@ -90,5 +90,6 @@ lldb::addr_t m_sel_ptr; }; -}; // namespace lldb_private +} // namespace lldb_private + #endif // lldb_ThreadPlanStepThroughObjCTrampoline_h_ Added: lldb/trunk/source/Plugins/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Makefile (added) +++ lldb/trunk/source/Plugins/Makefile Fri Jul 9 15:39:50 2010 @@ -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 Added: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/Makefile (added) +++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/ObjectContainer/BSD-Archive/Makefile -------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginObjectContainerBSDArchive +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Added: lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile (added) +++ lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/ObjectContainer/Universal-Mach-O/Makefile -------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginObjectContainerUniversalMachO +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Added: lldb/trunk/source/Plugins/ObjectFile/ELF/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/Makefile (added) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/ObjectFile/ELF/Makefile --------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginObjectFileELF +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Added: lldb/trunk/source/Plugins/ObjectFile/Mach-O/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/Makefile (added) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/ObjectFile/Mach-O/Makefile -----------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginObjectFileMachO +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Added: lldb/trunk/source/Plugins/Process/MacOSX-User/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/Makefile (added) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,17 @@ +##===- source/Plugins/Process/MacOSX-User/Makefile ---------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginProcessMacOSXUser +BUILD_ARCHIVE = 1 + +Source := $(wildcard $(PROJ_SRC_DIR)/source/*.cpp) +Source += $(wildcard $(PROJ_SRC_DIR)/source/MacOSX/*.cpp) + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.h Fri Jul 9 15:39:50 2010 @@ -131,7 +131,7 @@ enum { e_actionForward, // Forward signal to inferior process - e_actionStop, // Stop when this signal is received + e_actionStop // Stop when this signal is received }; struct Action { Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Fri Jul 9 15:39:50 2010 @@ -341,7 +341,7 @@ } Error -ProcessMacOSX::DoAttach (lldb::pid_t attach_pid) +ProcessMacOSX::DoAttachToProcessWithID (lldb::pid_t attach_pid) { Error error; @@ -493,12 +493,19 @@ } Error -ProcessMacOSX::WillAttach (lldb::pid_t pid) +ProcessMacOSX::WillAttachToProcessWithID (lldb::pid_t pid) { return WillLaunchOrAttach (); } Error +ProcessMacOSX::WillAttachToProcessWithName (const char *process_name, bool wait_for_launch) +{ + return WillLaunchOrAttach (); +} + + +Error ProcessMacOSX::DoResume () { Error error; Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h Fri Jul 9 15:39:50 2010 @@ -22,8 +22,8 @@ #include "lldb/Target/Thread.h" // Project includes -#include "MachTask.h" -#include "MachException.h" +#include "MacOSX/MachTask.h" +#include "MacOSX/MachException.h" typedef enum PDLaunch { @@ -33,6 +33,7 @@ #if defined (__arm__) eLaunchSpringBoard, #endif + kNumPDLaunchTypes } PDLaunchType; @@ -99,10 +100,13 @@ DidLaunch (); virtual lldb_private::Error - WillAttach (lldb::pid_t pid); + WillAttachToProcessWithID (lldb::pid_t pid); virtual lldb_private::Error - DoAttach (lldb::pid_t pid); + WillAttachToProcessWithName (const char *process_name, bool wait_for_launch); + + virtual lldb_private::Error + DoAttachToProcessWithID (lldb::pid_t pid); virtual void DidAttach (); Modified: lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.cpp Fri Jul 9 15:39:50 2010 @@ -166,6 +166,9 @@ break; } break; + + default: + break; } return false; } @@ -197,9 +200,12 @@ const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg); if (reg_info == NULL) return false; - unw_word_t reg_value; + unw_word_t reg_value = 0; switch (value.GetType()) { + case Scalar::e_void: + return false; + case Scalar::e_sint: reg_value = value.SInt(); break; case Scalar::e_uint: reg_value = value.UInt(); break; case Scalar::e_slong: reg_value = value.SLong(); break; @@ -294,6 +300,9 @@ default: return false; } + + default: + return false; } return WriteRegisterValue (reg, value); } Modified: lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/LibUnwindRegisterContext.h Fri Jul 9 15:39:50 2010 @@ -17,7 +17,7 @@ #include "lldb/lldb-private.h" #include "lldb/Target/RegisterContext.h" -#include "libunwind.h" +#include "libunwind/include/libunwind.h" class LibUnwindRegisterContext : public lldb_private::RegisterContext { Modified: lldb/trunk/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/MacOSXLibunwindCallbacks.cpp Fri Jul 9 15:39:50 2010 @@ -21,10 +21,11 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb-enumerations.h" -#include "libunwind.h" +#include "lldb/lldb-enumerations.h" #include "llvm-c/EnhancedDisassembly.h" +#include "libunwind/include/libunwind.h" + using namespace lldb; namespace lldb_private { @@ -191,7 +192,15 @@ static int -reg_info (lldb_private::unw_addr_space_t as, lldb_private::unw_regnum_t regnum, lldb_private::unw_regtype_t *type, char *buf, size_t buflen, void *arg) +reg_info +( + lldb_private::unw_addr_space_t as, + lldb_private::unw_regnum_t regnum, + lldb_private::unw_regtype_t *type, + char *buf, + size_t buflen, + void *arg +) { if (arg == 0) return -1; Added: lldb/trunk/source/Plugins/Process/Utility/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/Makefile (added) +++ lldb/trunk/source/Plugins/Process/Utility/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/Utility/Makefile ---------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginUtility +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp Fri Jul 9 15:39:50 2010 @@ -18,7 +18,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/Target/Thread.h" // Project includes -#include "StringExtractorGDBRemote.h" +#include "Utility/StringExtractorGDBRemote.h" using namespace lldb; using namespace lldb_private; Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.h Fri Jul 9 15:39:50 2010 @@ -15,7 +15,7 @@ #include // Other libraries and framework includes -#include "libunwind.h" +#include "libunwind/include/libunwind.h" // Project includes #include "lldb/lldb-private.h" Modified: lldb/trunk/source/Plugins/Process/Utility/libunwind/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/libunwind/include/libunwind.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/libunwind/include/libunwind.h (original) +++ lldb/trunk/source/Plugins/Process/Utility/libunwind/include/libunwind.h Fri Jul 9 15:39:50 2010 @@ -56,7 +56,7 @@ struct unw_addr_space { enum unw_as_type type; - uint8_t data[]; + uint8_t data[1]; }; typedef struct unw_addr_space* unw_addr_space_t; @@ -345,7 +345,7 @@ // architecture independent register numbers enum { UNW_REG_IP = -1, // instruction pointer - UNW_REG_SP = -2, // stack pointer + UNW_REG_SP = -2 // stack pointer }; @@ -502,7 +502,7 @@ }; -}; // namespace lldb_private +} // namespace lldb_private #endif Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Jul 9 15:39:50 2010 @@ -21,7 +21,7 @@ #include "lldb/Host/TimeValue.h" // Project includes -#include "StringExtractorGDBRemote.h" +#include "Utility/StringExtractorGDBRemote.h" #include "ProcessGDBRemote.h" #include "ProcessGDBRemoteLog.h" @@ -78,7 +78,7 @@ // We only need to compute the checksum if we are sending acks if (m_send_acks) { - for (int i = 0; i < payload_length; ++i) + for (size_t i = 0; i < payload_length; ++i) checksum += payload[i]; } return checksum & 255; @@ -365,7 +365,10 @@ if (bytes_written == packet.GetSize()) { if (m_send_acks) - GetAck (1) == '+'; + { + if (GetAck (1) != '+') + return 0; + } } return bytes_written; } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Fri Jul 9 15:39:50 2010 @@ -26,7 +26,7 @@ #include "lldb/Host/Mutex.h" #include "lldb/Host/Predicate.h" -#include "StringExtractorGDBRemote.h" +#include "Utility/StringExtractorGDBRemote.h" class ProcessGDBRemote; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Fri Jul 9 15:39:50 2010 @@ -17,11 +17,11 @@ #include "lldb/Core/Scalar.h" #include "lldb/Core/StreamString.h" // Project includes -#include "StringExtractorGDBRemote.h" +#include "Utility/StringExtractorGDBRemote.h" #include "ProcessGDBRemote.h" #include "ThreadGDBRemote.h" -#include "ARM_GCC_Registers.h" -#include "ARM_DWARF_Registers.h" +#include "Utility/ARM_GCC_Registers.h" +#include "Utility/ARM_DWARF_Registers.h" using namespace lldb; using namespace lldb_private; @@ -171,7 +171,10 @@ return true; } break; - } + + default: + break; + } } return false; } @@ -219,10 +222,10 @@ else { // Get each register individually - packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg, false); + packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg); assert (packet_len < (sizeof(packet) - 1)); if (gdb_comm.SendPacketAndWaitForResponse(packet, response, 1, false)) - if (response.GetHexBytes ((uint8_t*)m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size), reg_info->byte_size, '\xcc') == reg_info->byte_size) + if (response.GetHexBytes (const_cast(m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)), reg_info->byte_size, '\xcc') == reg_info->byte_size) m_reg_valid[reg] = true; } } @@ -276,7 +279,7 @@ if (reg_info) { // Grab a pointer to where we are going to put this register - uint8_t *dst = (uint8_t *)m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size); + uint8_t *dst = const_cast(m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)); if (dst == NULL) return false; Removed: lldb/trunk/source/Plugins/Process/gdb-remote/GDBServer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBServer.cpp?rev=108008&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBServer.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBServer.cpp (removed) @@ -1,1148 +0,0 @@ -//===-- GDBServer.cpp -------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "GDBServerLog.h" -#include "GDBRemoteSession.h" - -using namespace lldb; - -//---------------------------------------------------------------------- -// Run loop modes which determine which run loop function will be called -//---------------------------------------------------------------------- -typedef enum -{ - eDCGSRunLoopModeInvalid = 0, - eDCGSRunLoopModeGetStartModeFromRemoteProtocol, - eDCGSRunLoopModeInferiorAttaching, - eDCGSRunLoopModeInferiorLaunching, - eDCGSRunLoopModeInferiorExecuting, - eDCGSRunLoopModeInferiorKillOrDetach, - eDCGSRunLoopModeExit -} GSRunLoopMode; - -typedef enum -{ - eLaunchFlavorDefault = 0, - eLaunchFlavorPosixSpawn, -#if defined (__arm__) - eLaunchFlavorSpringBoard, -#endif - eLaunchFlavorForkExec, -} GSLaunchFlavor; - -typedef lldb::shared_ptr GDBRemoteSP; - -typedef struct HandleBroadcastEventInfo -{ - TargetSP target_sp; - GDBRemoteSP remote_sp; - GSRunLoopMode mode; - - Target * - GetTarget () - { - return target_sp.get(); - } - - Process * - GetProcess() - { - if (target_sp.get()) - return target_sp->GetProcess().get(); - return NULL; - } - - GDBRemoteSession * - GetRemote () - { - return remote_sp.get(); - } - -}; - - -//---------------------------------------------------------------------- -// Global Variables -//---------------------------------------------------------------------- -static int g_lockdown_opt = 0; -static int g_applist_opt = 0; -static GSLaunchFlavor g_launch_flavor = eLaunchFlavorDefault; -int g_isatty = 0; - -//---------------------------------------------------------------------- -// Run Loop function prototypes -//---------------------------------------------------------------------- -void GSRunLoopGetStartModeFromRemote (HandleBroadcastEventInfo *info); -void GSRunLoopInferiorExecuting (HandleBroadcastEventInfo *info); - - -//---------------------------------------------------------------------- -// Get our program path and arguments from the remote connection. -// We will need to start up the remote connection without a PID, get the -// arguments, wait for the new process to finish launching and hit its -// entry point, and then return the run loop mode that should come next. -//---------------------------------------------------------------------- -void -GSRunLoopGetStartModeFromRemote (HandleBroadcastEventInfo *info) -{ - std::string packet; - - Target *target = info->GetTarget(); - GDBRemoteSession *remote = info->GetRemote(); - if (target != NULL && remote != NULL) - { - // Spin waiting to get the A packet. - while (1) - { - gdb_err_t err = gdb_err; - GDBRemoteSession::PacketEnum type; - - err = remote->HandleReceivedPacket (&type); - - // check if we tried to attach to a process - if (type == GDBRemoteSession::vattach || type == GDBRemoteSession::vattachwait) - { - if (err == gdb_success) - { - info->mode = eDCGSRunLoopModeInferiorExecuting; - return; - } - else - { - Log::STDERR ("error: attach failed."); - info->mode = eDCGSRunLoopModeExit; - return; - } - } - - if (err == gdb_success) - { - // If we got our arguments we are ready to launch using the arguments - // and any environment variables we received. - if (type == GDBRemoteSession::set_argv) - { - info->mode = eDCGSRunLoopModeInferiorLaunching; - return; - } - } - else if (err == gdb_not_connected) - { - Log::STDERR ("error: connection lost."); - info->mode = eDCGSRunLoopModeExit; - return; - } - else - { - // a catch all for any other gdb remote packets that failed - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Error getting packet.",__FUNCTION__); - continue; - } - - GDBServerLog::LogIf (GS_LOG_MINIMAL, "#### %s", __FUNCTION__); - } - } - info->mode = eDCGSRunLoopModeExit; -} - - -//---------------------------------------------------------------------- -// This run loop mode will wait for the process to launch and hit its -// entry point. It will currently ignore all events except for the -// process state changed event, where it watches for the process stopped -// or crash process state. -//---------------------------------------------------------------------- -GSRunLoopMode -GSRunLoopLaunchInferior (HandleBroadcastEventInfo *info) -{ - // The Process stuff takes a c array, the GSContext has a vector... - // So make up a c array. - Target *target = info->GetTarget(); - GDBRemoteSession *remote = info->GetRemote(); - Process* process = info->GetProcess(); - - if (process == NULL) - return eDCGSRunLoopModeExit; - - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Launching '%s'...", __FUNCTION__, target->GetExecutableModule()->GetFileSpec().GetFilename().AsCString()); - - // Our launch type hasn't been set to anything concrete, so we need to - // figure our how we are going to launch automatically. - - GSLaunchFlavor launch_flavor = g_launch_flavor; - if (launch_flavor == eLaunchFlavorDefault) - { - // Our default launch method is posix spawn - launch_flavor = eLaunchFlavorPosixSpawn; - -#if defined (__arm__) - // Check if we have an app bundle, if so launch using SpringBoard. - if (strstr(inferior_argv[0], ".app")) - { - launch_flavor = eLaunchFlavorSpringBoard; - } -#endif - } - - //ctx.SetLaunchFlavor(launch_flavor); - - const char *stdio_file = NULL; - lldb::pid_t pid = process->Launch (remote->GetARGV(), remote->GetENVP(), stdio_file, stdio_file, stdio_file); - - if (pid == LLDB_INVALID_PROCESS_ID) - { - Log::STDERR ("error: process launch failed: %s", process->GetError().AsCString()); - } - else - { - if (remote->IsConnected()) - { - // It we are connected already, the next thing gdb will do is ask - // whether the launch succeeded, and if not, whether there is an - // error code. So we need to fetch one packet from gdb before we wait - // on the stop from the target. - gdb_err_t err = gdb_err; - GDBRemoteSession::PacketEnum type; - - err = remote->HandleReceivedPacket (&type); - - if (err != gdb_success) - { - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Error getting packet.", __FUNCTION__); - return eDCGSRunLoopModeExit; - } - if (type != GDBRemoteSession::query_launch_success) - { - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Didn't get the expected qLaunchSuccess packet.", __FUNCTION__); - } - } - } - - Listener listener("GSRunLoopLaunchInferior"); - listener.StartListeningForEvents (process, Process::eBroadcastBitStateChanged); - while (process->GetID() != LLDB_INVALID_PROCESS_ID) - { - uint32_t event_mask = 0; - while (listener.WaitForEvent(NULL, &event_mask)) - { - if (event_mask & Process::eBroadcastBitStateChanged) - { - Event event; - StateType event_state; - while ((event_state = process->GetNextEvent (&event))) - if (StateIsStoppedState(event_state)) - { - GDBServerLog::LogIf (GS_LOG_EVENTS, "%s process %4.4x stopped with state %s", __FUNCTION__, pid, StateAsCString(event_state)); - - switch (event_state) - { - default: - case eStateInvalid: - case eStateUnloaded: - case eStateAttaching: - case eStateLaunching: - case eStateSuspended: - break; // Ignore - - case eStateRunning: - case eStateStepping: - // Still waiting to stop at entry point... - break; - - case eStateStopped: - case eStateCrashed: - return eDCGSRunLoopModeInferiorExecuting; - - case eStateDetached: - case eStateExited: - pid = LLDB_INVALID_PROCESS_ID; - return eDCGSRunLoopModeExit; - } - } - - if (event_state = eStateInvalid) - break; - } - } - } - - return eDCGSRunLoopModeExit; -} - - -//---------------------------------------------------------------------- -// This run loop mode will wait for the process to launch and hit its -// entry point. It will currently ignore all events except for the -// process state changed event, where it watches for the process stopped -// or crash process state. -//---------------------------------------------------------------------- -GSRunLoopMode -GSRunLoopLaunchAttaching (HandleBroadcastEventInfo *info, lldb::pid_t& pid) -{ - Process* process = info->GetProcess(); - - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s Attaching to pid %i...", __FUNCTION__, pid); - pid = process->Attach(pid); - - if (pid == LLDB_INVALID_PROCESS_ID) - return eDCGSRunLoopModeExit; - return eDCGSRunLoopModeInferiorExecuting; -} - -//---------------------------------------------------------------------- -// Watch for signals: -// SIGINT: so we can halt our inferior. (disabled for now) -// SIGPIPE: in case our child process dies -//---------------------------------------------------------------------- -lldb::pid_t g_pid; -int g_sigpipe_received = 0; -void -signal_handler(int signo) -{ - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (%s)", __FUNCTION__, Host::GetSignalAsCString(signo)); - - switch (signo) - { -// case SIGINT: -// DNBProcessKill (g_pid, signo); -// break; - - case SIGPIPE: - g_sigpipe_received = 1; - break; - } -} - -// Return the new run loop mode based off of the current process state -void -HandleProcessStateChange (HandleBroadcastEventInfo *info, bool initialize) -{ - Process *process = info->GetProcess(); - if (process == NULL) - { - info->mode = eDCGSRunLoopModeExit; - return; - } - - if (process->GetID() == LLDB_INVALID_PROCESS_ID) - { - GDBServerLog::LogIf (GS_LOG_MINIMAL, "#### %s error: pid invalid, exiting...", __FUNCTION__); - info->mode = eDCGSRunLoopModeExit; - return; - } - StateType pid_state = process->GetState (); - - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (info, initialize=%i) pid_state = %s", __FUNCTION__, (int)initialize, StateAsCString(pid_state)); - - switch (pid_state) - { - case eStateInvalid: - case eStateUnloaded: - // Something bad happened - info->mode = eDCGSRunLoopModeExit; - return; - - case eStateAttaching: - case eStateLaunching: - info->mode = eDCGSRunLoopModeInferiorExecuting; - return; - - case eStateSuspended: - case eStateCrashed: - case eStateStopped: - if (initialize == false) - { - // Compare the last stop count to our current notion of a stop count - // to make sure we don't notify more than once for a given stop. - static uint32_t g_prev_stop_id = 0; - uint32_t stop_id = process->GetStopID(); - bool pid_stop_count_changed = g_prev_stop_id != stop_id; - if (pid_stop_count_changed) - { - info->GetRemote()->FlushSTDIO(); - - if (stop_id == 1) - { - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, StateAsCString (pid_state), stop_id, g_prev_stop_id); - } - else - { - - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? YES!!!", __FUNCTION__, (int)initialize, StateAsCString (pid_state), stop_id, g_prev_stop_id); - info->GetRemote()->NotifyThatProcessStopped (); - } - } - else - { - GDBServerLog::LogIf (GS_LOG_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? skipping...", __FUNCTION__, (int)initialize, StateAsCString (pid_state), stop_id, g_prev_stop_id); - } - } - info->mode = eDCGSRunLoopModeInferiorExecuting; - return; - - case eStateStepping: - case eStateRunning: - info->mode = eDCGSRunLoopModeInferiorExecuting; - return; - - case eStateExited: - info->GetRemote()->HandlePacket_last_signal (NULL); - info->mode = eDCGSRunLoopModeExit; - return; - - } - - // Catch all... - info->mode = eDCGSRunLoopModeExit; -} - -bool -CommunicationHandleBroadcastEvent (Broadcaster *broadcaster, uint32_t event_mask, void *baton) -{ - HandleBroadcastEventInfo *info = (HandleBroadcastEventInfo *)baton; - Process *process = info->GetProcess(); - - if (process == NULL) - { - info->mode = eDCGSRunLoopModeExit; - return true; - } - - if (event_mask & Communication::eBroadcastBitPacketAvailable) - { - if (process->IsRunning()) - { - if (info->GetRemote()->HandleAsyncPacket() == gdb_not_connected) - info->mode = eDCGSRunLoopModeExit; - } - else - { - if (info->GetRemote()->HandleReceivedPacket() == gdb_not_connected) - info->mode = eDCGSRunLoopModeExit; - } - } - if (event_mask & Communication::eBroadcastBitReadThreadDidExit) - { - info->mode = eDCGSRunLoopModeExit; - } - if (event_mask & Communication::eBroadcastBitDisconnected) - { - info->mode = eDCGSRunLoopModeExit; - } - - return true; - -} - -bool -ProcessHandleBroadcastEvent (Broadcaster *broadcaster, uint32_t event_mask, void *baton) -{ - HandleBroadcastEventInfo *info = (HandleBroadcastEventInfo *)baton; - Process *process = info->GetProcess(); - if (process == NULL) - { - info->mode = eDCGSRunLoopModeExit; - return true; - } - - if (event_mask & Process::eBroadcastBitStateChanged) - { - // Consume all available process events with no timeout - Event event; - StateType process_state; - while ((process_state = process->GetNextEvent (&event)) != eStateInvalid) - { - if (StateIsStoppedState(process_state)) - info->GetRemote()->FlushSTDIO(); - HandleProcessStateChange (info, false); - - if (info->mode != eDCGSRunLoopModeInferiorExecuting) - break; - } - } - else - if (event_mask & (Process::eBroadcastBitSTDOUT | Process::eBroadcastBitSTDERR)) - { - info->GetRemote()->FlushSTDIO(); - } - return true; -} - -// This function handles the case where our inferior program is stopped and -// we are waiting for gdb remote protocol packets. When a packet occurs that -// makes the inferior run, we need to leave this function with a new state -// as the return code. -void -GSRunLoopInferiorExecuting (HandleBroadcastEventInfo *info) -{ - GDBServerLog::LogIf (GS_LOG_MINIMAL, "#### %s", __FUNCTION__); - - // Init our mode and set 'is_running' based on the current process state - HandleProcessStateChange (info, true); - - uint32_t desired_mask, acquired_mask; - Listener listener("GSRunLoopInferiorExecuting"); - - desired_mask = Communication::eBroadcastBitPacketAvailable | - Communication::eBroadcastBitReadThreadDidExit | - Communication::eBroadcastBitDisconnected; - - acquired_mask = listener.StartListeningForEvents (&(info->GetRemote()->GetPacketComm()), - desired_mask, - CommunicationHandleBroadcastEvent, - info); - - assert (acquired_mask == desired_mask); - desired_mask = GDBRemotePacket::eBroadcastBitPacketAvailable; - - acquired_mask = listener.StartListeningForEvents (&(info->GetRemote()->GetPacketComm()), - desired_mask, - CommunicationHandleBroadcastEvent, - info); - - assert (acquired_mask == desired_mask); - - desired_mask = Process::eBroadcastBitStateChanged | - Process::eBroadcastBitSTDOUT | - Process::eBroadcastBitSTDERR ; - acquired_mask = listener.StartListeningForEvents (info->GetProcess (), - desired_mask, - ProcessHandleBroadcastEvent, - info); - - assert (acquired_mask == desired_mask); - - Process *process = info->GetProcess(); - - while (process->IsAlive()) - { - if (!info->GetRemote()->IsConnected()) - { - info->mode = eDCGSRunLoopModeInferiorKillOrDetach; - break; - } - - // We want to make sure we consume all process state changes and have - // whomever is notifying us to wait for us to reset the event bit before - // continuing. - //ctx.Events().SetResetAckMask (GSContext::event_proc_state_changed); - uint32_t event_mask = 0; - Broadcaster *broadcaster = listener.WaitForEvent(NULL, &event_mask); - if (broadcaster) - { - listener.HandleBroadcastEvent(broadcaster, event_mask); - } - } -} - - -//---------------------------------------------------------------------- -// Convenience function to set up the remote listening port -// Returns 1 for success 0 for failure. -//---------------------------------------------------------------------- - -static bool -StartListening (HandleBroadcastEventInfo *info, int listen_port) -{ - if (!info->GetRemote()->IsConnected()) - { - Log::STDOUT ("Listening to port %i...\n", listen_port); - char connect_url[256]; - snprintf(connect_url, sizeof(connect_url), "listen://%i", listen_port); - - Communication &comm = info->remote_sp->GetPacketComm(); - comm.SetConnection (new ConnectionFileDescriptor); - - if (comm.Connect (connect_url)) - { - if (comm.StartReadThread()) - return true; - - Log::STDERR ("Failed to start the communication read thread.\n", connect_url); - comm.Disconnect(); - } - else - { - Log::STDERR ("Failed to connection to %s.\n", connect_url); - } - return false; - } - return true; -} - -//---------------------------------------------------------------------- -// ASL Logging callback that can be registered with DNBLogSetLogDCScriptInterpreter::Type -//---------------------------------------------------------------------- -//void -//ASLLogDCScriptInterpreter::Type(void *baton, uint32_t flags, const char *format, va_list args) -//{ -// if (format == NULL) -// return; -// static aslmsg g_aslmsg = NULL; -// if (g_aslmsg == NULL) -// { -// g_aslmsg = ::asl_new (ASL_TYPE_MSG); -// char asl_key_sender[PATH_MAX]; -// snprintf(asl_key_sender, sizeof(asl_key_sender), "com.apple.dc-gdbserver-%g", dc_gdbserverVersionNumber); -// ::asl_set (g_aslmsg, ASL_KEY_SENDER, asl_key_sender); -// } -// -// int asl_level; -// if (flags & DNBLOG_FLAG_FATAL) asl_level = ASL_LEVEL_CRIT; -// else if (flags & DNBLOG_FLAG_ERROR) asl_level = ASL_LEVEL_ERR; -// else if (flags & DNBLOG_FLAG_WARNING) asl_level = ASL_LEVEL_WARNING; -// else if (flags & DNBLOG_FLAG_VERBOSE) asl_level = ASL_LEVEL_WARNING; //ASL_LEVEL_INFO; -// else asl_level = ASL_LEVEL_WARNING; //ASL_LEVEL_DEBUG; -// -// ::asl_vlog (NULL, g_aslmsg, asl_level, format, args); -//} - -//---------------------------------------------------------------------- -// FILE based Logging callback that can be registered with -// DNBLogSetLogDCScriptInterpreter::Type -//---------------------------------------------------------------------- -void -FileLogDCScriptInterpreter::Type(void *baton, uint32_t flags, const char *format, va_list args) -{ - if (baton == NULL || format == NULL) - return; - - ::vfprintf ((FILE *)baton, format, args); - ::fprintf ((FILE *)baton, "\n"); -} - -//---------------------------------------------------------------------- -// option descriptors for getopt_long() -//---------------------------------------------------------------------- -static struct option g_long_options[] = -{ - { "arch", required_argument, NULL, 'c' }, - { "attach", required_argument, NULL, 'a' }, - { "debug", no_argument, NULL, 'g' }, - { "verbose", no_argument, NULL, 'v' }, - { "lockdown", no_argument, &g_lockdown_opt, 1 }, // short option "-k" - { "applist", no_argument, &g_applist_opt, 1 }, // short option "-t" - { "log-file", required_argument, NULL, 'l' }, - { "log-flags", required_argument, NULL, 'f' }, - { "launch", required_argument, NULL, 'x' }, // Valid values are "auto", "posix-spawn", "fork-exec", "springboard" (arm only) - { "waitfor", required_argument, NULL, 'w' }, // Wait for a process whose namet starts with ARG - { "waitfor-interval", required_argument, NULL, 'i' }, // Time in usecs to wait between sampling the pid list when waiting for a process by name - { "waitfor-duration", required_argument, NULL, 'd' }, // The time in seconds to wait for a process to show up by name - { NULL, 0, NULL, 0 } -}; - -extern const double dc_gdbserverVersionNumber; -int -main (int argc, char *argv[]) -{ - Initialize(); - Host::ThreadCreated ("[main]"); - - g_isatty = ::isatty (STDIN_FILENO); - -// signal (SIGINT, signal_handler); - signal (SIGPIPE, signal_handler); - - Log *log = GDBServerLog::GetLogIfAllCategoriesSet(GS_LOG_ALL); - const char *this_exe_name = argv[0]; - int i; - int attach_pid = LLDB_INVALID_PROCESS_ID; - for (i=0; iCreateProcess ()); - info.remote_sp.reset (new GDBRemoteSession (process_sp)); - - info.remote_sp->SetLog (log); - StreamString sstr; - sstr.Printf("ConnectionFileDescriptor(%s)", argv[0]); - - if (info.remote_sp.get() == NULL) - { - Log::STDERR ("error: failed to create a GDBRemoteSession class\n"); - return -1; - } - - - - // If we know we're waiting to attach, we don't need any of this other info. - if (start_mode != eDCGSRunLoopModeInferiorAttaching) - { - if (argc == 0 || g_lockdown_opt) - { - if (g_lockdown_opt != 0) - { - // Work around for SIGPIPE crashes due to posix_spawn issue. We have to close - // STDOUT and STDERR, else the first time we try and do any, we get SIGPIPE and - // die as posix_spawn is doing bad things with our file descriptors at the moment. - int null = open("/dev/null", O_RDWR); - dup2(null, STDOUT_FILENO); - dup2(null, STDERR_FILENO); - } - else if (g_applist_opt != 0) - { -// // List all applications we are able to see -// std::string applist_plist; -// int err = ListApplications(applist_plist, false, false); -// if (err == 0) -// { -// fputs (applist_plist.c_str(), stdout); -// } -// else -// { -// Log::STDERR ("error: ListApplications returned error %i\n", err); -// } -// // Exit with appropriate error if we were asked to list the applications -// // with no other args were given (and we weren't trying to do this over -// // lockdown) -// return err; - return 0; - } - - //DNBLogDebug("Get args from remote protocol..."); - start_mode = eDCGSRunLoopModeGetStartModeFromRemoteProtocol; - } - else - { - start_mode = eDCGSRunLoopModeInferiorLaunching; - // Fill in the argv array in the context from the rest of our args. - // Skip the name of this executable and the port number - info.remote_sp->SetArguments (argc, argv); - } - } - - if (start_mode == eDCGSRunLoopModeExit) - return -1; - - info.mode = start_mode; - - while (info.mode != eDCGSRunLoopModeExit) - { - switch (info.mode) - { - case eDCGSRunLoopModeGetStartModeFromRemoteProtocol: - #if defined (__arm__) - if (g_lockdown_opt) - { - if (!info.remote_sp->GetCommunication()->IsConnected()) - { - if (info.remote_sp->GetCommunication()->ConnectToService () != gdb_success) - { - Log::STDERR ("Failed to get connection from a remote gdb process.\n"); - info.mode = eDCGSRunLoopModeExit; - } - else if (g_applist_opt != 0) - { - // List all applications we are able to see - std::string applist_plist; - if (ListApplications(applist_plist, false, false) == 0) - { - //DNBLogDebug("Task list: %s", applist_plist.c_str()); - - info.remote_sp->GetCommunication()->Write(applist_plist.c_str(), applist_plist.size()); - // Issue a read that will never yield any data until the other side - // closes the socket so this process doesn't just exit and cause the - // socket to close prematurely on the other end and cause data loss. - std::string buf; - info.remote_sp->GetCommunication()->Read(buf); - } - info.remote_sp->GetCommunication()->Disconnect(false); - info.mode = eDCGSRunLoopModeExit; - break; - } - else - { - // Start watching for remote packets - info.remote_sp->StartReadRemoteDataThread(); - } - } - } - else -#endif - { - if (StartListening (&info, listen_port)) - Log::STDOUT ("Got a connection, waiting for process information for launching or attaching.\n"); - else - info.mode = eDCGSRunLoopModeExit; - } - - if (info.mode != eDCGSRunLoopModeExit) - GSRunLoopGetStartModeFromRemote (&info); - break; - - case eDCGSRunLoopModeInferiorAttaching: - if (!waitfor_pid_name.empty()) - { - // Set our end wait time if we are using a waitfor-duration - // option that may have been specified - - TimeValue attach_timeout_abstime; - if (waitfor_duration != 0) - { - attach_timeout_abstime = TimeValue::Now(); - attach_timeout_abstime.OffsetWithSeconds (waitfor_duration); - } - GSLaunchFlavor launch_flavor = g_launch_flavor; - if (launch_flavor == eLaunchFlavorDefault) - { - // Our default launch method is posix spawn - launch_flavor = eLaunchFlavorPosixSpawn; - -#if defined (__arm__) - // Check if we have an app bundle, if so launch using SpringBoard. - if (waitfor_pid_name.find (".app") != std::string::npos) - { - launch_flavor = eLaunchFlavorSpringBoard; - } -#endif - } - - //ctx.SetLaunchFlavor(launch_flavor); - - - lldb::pid_t pid = info.GetProcess()->Attach (waitfor_pid_name.c_str()); - if (pid == LLDB_INVALID_PROCESS_ID) - { - info.GetRemote()->GetLaunchError() = info.GetProcess()->GetError(); - Log::STDERR ("error: failed to attach to process named: \"%s\" %s", waitfor_pid_name.c_str(), info.GetRemote()->GetLaunchError().AsCString()); - info.mode = eDCGSRunLoopModeExit; - } - else - { - info.mode = eDCGSRunLoopModeInferiorExecuting; - } - } - else if (attach_pid != LLDB_INVALID_PROCESS_ID) - { - Log::STDOUT ("Attaching to process %i...\n", attach_pid); - info.mode = GSRunLoopLaunchAttaching (&info, attach_pid); - if (info.mode != eDCGSRunLoopModeInferiorExecuting) - { - const char *error_str = info.GetRemote()->GetLaunchError().AsCString(); - Log::STDERR ("error: failed to attach process %i: %s\n", attach_pid, error_str ? error_str : "unknown error."); - info.mode = eDCGSRunLoopModeExit; - } - } - else if (!attach_pid_name.empty ()) - { - lldb::pid_t pid = info.GetProcess()->Attach (waitfor_pid_name.c_str()); - if (pid == LLDB_INVALID_PROCESS_ID) - { - info.GetRemote()->GetLaunchError() = info.GetProcess()->GetError(); - Log::STDERR ("error: failed to attach to process named: \"%s\" %s", waitfor_pid_name.c_str(), info.GetRemote()->GetLaunchError().AsCString()); - info.mode = eDCGSRunLoopModeExit; - } - else - { - info.mode = eDCGSRunLoopModeInferiorExecuting; - } - } - else - { - Log::STDERR ("error: asked to attach with empty name and invalid PID."); - info.mode = eDCGSRunLoopModeExit; - } - - if (info.mode != eDCGSRunLoopModeExit) - { - if (StartListening (&info, listen_port)) - Log::STDOUT ("Got a connection, waiting for debugger instructions for process %d.\n", attach_pid); - else - info.mode = eDCGSRunLoopModeExit; - } - break; - - case eDCGSRunLoopModeInferiorLaunching: - info.mode = GSRunLoopLaunchInferior (&info); - - if (info.mode == eDCGSRunLoopModeInferiorExecuting) - { - if (StartListening (&info, listen_port)) - Log::STDOUT ("Got a connection, waiting for debugger instructions for task \"%s\".\n", argv[0]); - else - info.mode = eDCGSRunLoopModeExit; - } - else - { - Log::STDERR ("error: failed to launch process %s: %s\n", argv[0], info.GetRemote()->GetLaunchError().AsCString()); - } - break; - - case eDCGSRunLoopModeInferiorExecuting: - GSRunLoopInferiorExecuting (&info); - break; - - case eDCGSRunLoopModeInferiorKillOrDetach: - { - Process *process = info.GetProcess(); - if (process && process->IsAlive()) - { - process->Kill(SIGCONT); - process->Kill(SIGKILL); - } - } - info.mode = eDCGSRunLoopModeExit; - break; - - default: - info.mode = eDCGSRunLoopModeExit; - case eDCGSRunLoopModeExit: - break; - } - } - - return 0; -} Removed: lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.cpp?rev=108008&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.cpp (removed) @@ -1,80 +0,0 @@ -//===-- GDBServerLog.cpp ----------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -//---------------------------------------------------------------------- -// -// GDBServerLog.cpp -// liblldb -// -// Created by Greg Clayton on 6/19/09. -// -// -//---------------------------------------------------------------------- - -#include "GDBServerLog.h" - -using namespace lldb; - -static Log * -LogAccessor (bool get, Log *log) -{ - static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up - // by global constructors before other threads - // were done with it. - if (get) - { -// // Debug code below for enabling logging by default -// if (g_log == NULL) -// { -// g_log = new Log("/dev/stdout", false); -// g_log->GetMask().SetAllFlagBits(GS_LOG_ALL); -// g_log->GetOptions().Set(LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_THREAD_NAME); -// } - } - else - { - if (g_log) - delete g_log; - g_log = log; - } - - return g_log; -} - -Log * -GDBServerLog::GetLogIfAllCategoriesSet (uint32_t mask) -{ - Log *log = LogAccessor (true, NULL); - if (log && mask) - { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); - if ((log_mask & mask) != mask) - return NULL; - } - return log; -} - -void -GDBServerLog::SetLog (Log *log) -{ - LogAccessor (false, log); -} - - -void -GDBServerLog::LogIf (uint32_t mask, const char *format, ...) -{ - Log *log = GDBServerLog::GetLogIfAllCategoriesSet (mask); - if (log) - { - va_list args; - va_start (args, format); - log->VAPrintf (format, args); - va_end (args); - } -} Removed: lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.h?rev=108008&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBServerLog.h (removed) @@ -1,55 +0,0 @@ -//===-- GDBServerLog.h ------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -//---------------------------------------------------------------------- -// -// GDBServerLog.h -// liblldb -// -// Created by Greg Clayton on 6/19/09. -// -// -//---------------------------------------------------------------------- - -#ifndef liblldb_GDBServerLog_h_ -#define liblldb_GDBServerLog_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes - -#include "lldb/Core/Log.h" - -// Project includes -#define GS_LOG_VERBOSE (1u << 0) -#define GS_LOG_DEBUG (1u << 1) -#define GS_LOG_PACKETS (1u << 2) -#define GS_LOG_EVENTS (1u << 3) -#define GS_LOG_MINIMAL (1u << 4) -#define GS_LOG_ALL (UINT32_MAX) -#define GS_LOG_DEFAULT (GS_LOG_VERBOSE |\ - GS_LOG_PACKETS) - -namespace lldb { - -class GDBServerLog -{ -public: - static Log * - GetLog (uint32_t mask = 0); - - static void - SetLog (Log *log); - - static void - LogIf (uint32_t mask, const char *format, ...); -}; - -} // namespace lldb - -#endif // liblldb_GDBServerLog_h_ Added: lldb/trunk/source/Plugins/Process/gdb-remote/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/Makefile (added) +++ lldb/trunk/source/Plugins/Process/gdb-remote/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/Process/gdb-remote/Makefile -------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginProcessGDBRemote +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Jul 9 15:39:50 2010 @@ -46,12 +46,11 @@ // Project includes #include "lldb/Host/Host.h" -#include "StringExtractorGDBRemote.h" +#include "Utility/StringExtractorGDBRemote.h" #include "GDBRemoteRegisterContext.h" #include "ProcessGDBRemote.h" #include "ProcessGDBRemoteLog.h" #include "ThreadGDBRemote.h" -#include "libunwind.h" #include "MacOSXLibunwindCallbacks.h" #if defined (__i386__) || defined (__x86_64__) @@ -116,28 +115,29 @@ ProcessGDBRemote::ProcessGDBRemote(Target& target, Listener &listener) : Process (target, listener), m_dynamic_loader_ap (), - m_byte_order (eByteOrderHost), m_flags (0), m_stdio_communication ("gdb-remote.stdio"), m_stdio_mutex (Mutex::eMutexTypeRecursive), m_stdout_data (), m_arch_spec (), + m_byte_order (eByteOrderHost), m_gdb_comm(), m_debugserver_pid (LLDB_INVALID_PROCESS_ID), m_debugserver_monitor (0), + m_last_stop_packet (), m_register_info (), - m_curr_tid (LLDB_INVALID_THREAD_ID), - m_curr_tid_run (LLDB_INVALID_THREAD_ID), m_async_broadcaster ("lldb.process.gdb-remote.async-broadcaster"), m_async_thread (LLDB_INVALID_HOST_THREAD), + m_curr_tid (LLDB_INVALID_THREAD_ID), + m_curr_tid_run (LLDB_INVALID_THREAD_ID), m_z0_supported (1), m_continue_packet(), m_dispatch_queue_offsets_addr (LLDB_INVALID_ADDRESS), + m_packet_timeout (1), + m_max_memory_size (512), m_libunwind_target_type (UNW_TARGET_UNSPECIFIED), m_libunwind_addr_space (NULL), - m_waiting_for_attach (false), - m_packet_timeout (1), - m_max_memory_size (512) + m_waiting_for_attach (false) { } @@ -616,7 +616,7 @@ } Error -ProcessGDBRemote::DoAttach (lldb::pid_t attach_pid) +ProcessGDBRemote::DoAttachToProcessWithID (lldb::pid_t attach_pid) { Error error; // Clear out and clean up from any current state @@ -716,7 +716,7 @@ } Error -ProcessGDBRemote::DoAttach (const char *process_name, bool wait_for_launch) +ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait_for_launch) { Error error; // Clear out and clean up from any current state Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Fri Jul 9 15:39:50 2010 @@ -26,9 +26,9 @@ #include "lldb/Target/Thread.h" #include "GDBRemoteCommunication.h" -#include "StringExtractor.h" +#include "Utility/StringExtractor.h" #include "GDBRemoteRegisterContext.h" -#include "libunwind.h" +#include "libunwind/include/libunwind.h" class ThreadGDBRemote; @@ -94,10 +94,10 @@ WillLaunchOrAttach (); virtual lldb_private::Error - DoAttach (lldb::pid_t pid); + DoAttachToProcessWithID (lldb::pid_t pid); virtual lldb_private::Error - DoAttach (const char *process_name, bool wait_for_launch); + DoAttachToProcessWithName (const char *process_name, bool wait_for_launch); virtual void DidAttach (); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Fri Jul 9 15:39:50 2010 @@ -22,7 +22,7 @@ #include "LibUnwindRegisterContext.h" #include "ProcessGDBRemote.h" #include "ProcessGDBRemoteLog.h" -#include "StringExtractorGDBRemote.h" +#include "Utility/StringExtractorGDBRemote.h" #include "UnwindLibUnwind.h" #include "UnwindMacOSXFrameBackchain.h" @@ -104,6 +104,9 @@ else GetGDBProcess().m_continue_packet.Printf(";s:%4.4x", GetID()); break; + + default: + break; } Thread::WillResume(resume_state); return true; @@ -272,8 +275,7 @@ if (m_stop_info_stop_id != m_process.GetStopID()) { char packet[256]; - const int packet_len = snprintf(packet, sizeof(packet), "qThreadStopInfo%x", GetID()); - assert (packet_len < (sizeof(packet) - 1)); + ::snprintf(packet, sizeof(packet), "qThreadStopInfo%x", GetID()); StringExtractorGDBRemote stop_packet; if (GetGDBProcess().GetGDBRemote().SendPacketAndWaitForResponse(packet, stop_packet, 1, false)) { Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h Fri Jul 9 15:39:50 2010 @@ -14,8 +14,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" -#include "MachException.h" -#include "libunwind.h" +#include "libunwind/include/libunwind.h" class StringExtractor; class ProcessGDBRemote; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri Jul 9 15:39:50 2010 @@ -153,7 +153,6 @@ // Set the offset to that of the first DIE uint32_t offset = GetFirstDIEOffset(); - const dw_offset_t next_cu_offset = GetNextCompileUnitOffset(); DWARFDebugInfoEntry die; // Keep a flat array of the DIE for binary lookup by DIE offset Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO); @@ -206,7 +205,7 @@ break; // We are done with this compile unit! } - assert(offset <= next_cu_offset); + assert(offset <= GetNextCompileUnitOffset()); } SetDIERelations(); return m_die_array.size(); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Fri Jul 9 15:39:50 2010 @@ -69,7 +69,7 @@ DWARFDebugAranges::Range range; range.offset = set.GetCompileUnitDIEOffset(); - for (uint32_t i=0; arange_desc_ptr = set.GetDescriptor(i); ++i) + for (uint32_t i=0; (arange_desc_ptr = set.GetDescriptor(i)) != NULL; ++i) { range.lo_pc = arange_desc_ptr->address; range.hi_pc = arange_desc_ptr->address + arange_desc_ptr->length; Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/Makefile (added) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/SymbolFile/DWARF/Makefile ------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginSymbolFileDWARF +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Added: lldb/trunk/source/Plugins/SymbolFile/Symtab/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/Makefile (added) +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/SymbolFile/Symtab/Makefile -----------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginSymbolFileSymtab +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Added: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/Makefile (added) +++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Plugins/SymbolVendor/MacOSX/Makefile ---------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginSymbolVendorMacOSX +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Jul 9 15:39:50 2010 @@ -904,12 +904,6 @@ { if (class_clang_type) { - ASTContext *ast_context = getASTContext(); - IdentifierTable *identifier_table = getIdentifierTable(); - - assert (ast_context != NULL); - assert (identifier_table != NULL); - Type *clang_type = QualType::getFromOpaquePtr(class_clang_type).getTypePtr(); if (clang_type) { @@ -1157,8 +1151,6 @@ ++child_idx; } } - const unsigned num_fields = record_layout.getFieldCount(); - // Make sure index is in range... uint32_t field_idx = 0; RecordDecl::field_iterator field, field_end; @@ -1173,7 +1165,7 @@ // Figure out the type byte size (field_type_info.first) and // alignment (field_type_info.second) from the AST context. std::pair field_type_info = ast_context->getTypeInfo(field->getType()); - assert(field_idx < num_fields); + assert(field_idx < record_layout.getFieldCount()); child_byte_size = field_type_info.first / 8; Added: lldb/trunk/source/Symbol/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Symbol/Makefile (added) +++ lldb/trunk/source/Symbol/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Symbol/Makefile ------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../.. +LIBRARYNAME := lldbSymbol +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/source/Symbol/Type.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Type.cpp (original) +++ lldb/trunk/source/Symbol/Type.cpp Fri Jul 9 15:39:50 2010 @@ -393,23 +393,27 @@ { uint32_t offset = data_byte_offset; lldb::addr_t pointer_addresss = data.GetMaxU64(&offset, data_byte_size); - const size_t k_max_buf_size = length ? length : 256; - uint8_t buf[k_max_buf_size + 1]; - lldb_private::DataExtractor data(buf, k_max_buf_size, exe_ctx->process->GetByteOrder(), 4); - buf[k_max_buf_size] = '\0'; + std::vector buf; + if (length > 0) + buf.resize (length); + else + buf.resize (256); + + lldb_private::DataExtractor data(buf.data(), buf.size(), exe_ctx->process->GetByteOrder(), 4); + buf.back() = '\0'; size_t bytes_read; size_t total_cstr_len = 0; Error error; - while ((bytes_read = exe_ctx->process->ReadMemory (pointer_addresss, buf, k_max_buf_size, error)) > 0) + while ((bytes_read = exe_ctx->process->ReadMemory (pointer_addresss, buf.data(), buf.size(), error)) > 0) { - const size_t len = strlen((const char *)buf); + const size_t len = strlen((const char *)buf.data()); if (len == 0) break; if (total_cstr_len == 0) s->PutCString (" \""); data.Dump(s, 0, lldb::eFormatChar, 1, len, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0); total_cstr_len += len; - if (len < k_max_buf_size) + if (len < buf.size()) break; pointer_addresss += total_cstr_len; } @@ -507,8 +511,6 @@ ++child_idx; } } - const unsigned num_fields = record_layout.getFieldCount(); - uint32_t field_idx = 0; clang::RecordDecl::field_iterator field, field_end; for (field = record_decl->field_begin(), field_end = record_decl->field_end(); field != field_end; ++field, ++field_idx, ++child_idx) @@ -529,7 +531,7 @@ // Figure out the type byte size (field_type_info.first) and // alignment (field_type_info.second) from the AST context. std::pair field_type_info = ast_context->getTypeInfo(field_type); - assert(field_idx < num_fields); + assert(field_idx < record_layout.getFieldCount()); // Figure out the field offset within the current struct/union/class type field_bit_offset = record_layout.getFieldOffset (field_idx); field_byte_offset = field_bit_offset / 8; Added: lldb/trunk/source/Target/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Target/Makefile (added) +++ lldb/trunk/source/Target/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Target/Makefile ------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../.. +LIBRARYNAME := lldbTarget +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/source/Target/ObjCObjectPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCObjectPrinter.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Target/ObjCObjectPrinter.cpp (original) +++ lldb/trunk/source/Target/ObjCObjectPrinter.cpp Fri Jul 9 15:39:50 2010 @@ -70,30 +70,26 @@ // poor man's strcpy - size_t len = 0; - bool keep_reading = true; Error error; - while (keep_reading) + std::vector desc; + while (1) { - char byte; - - if (exe_ctx.process->ReadMemory(result_ptr + len, &byte, 1, error) != 1) - return false; + char byte = '\0'; + if (exe_ctx.process->ReadMemory(result_ptr + desc.size(), &byte, 1, error) != 1) + break; + desc.push_back(byte); + if (byte == '\0') - keep_reading = false; - else - ++len; + break; } - char desc[len + 1]; - - if (exe_ctx.process->ReadMemory(result_ptr, &desc[0], len + 1, error) != len + 1) - return false; - - str.SetCString(desc); - - return true; + if (!desc.empty()) + { + str.SetCString(desc.data()); + return true; + } + return false; } Address * Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Jul 9 15:39:50 2010 @@ -45,15 +45,11 @@ } else { - for (uint32_t idx = 0; create_callback = PluginManager::GetProcessCreateCallbackAtIndex(idx); ++idx) + for (uint32_t idx = 0; (create_callback = PluginManager::GetProcessCreateCallbackAtIndex(idx)) != NULL; ++idx) { - create_callback = PluginManager::GetProcessCreateCallbackAtIndex (idx); - if (create_callback) - { - std::auto_ptr debugger_ap(create_callback(target, listener)); - if (debugger_ap->CanDebug(target)) - return debugger_ap.release(); - } + std::auto_ptr debugger_ap(create_callback(target, listener)); + if (debugger_ap->CanDebug(target)) + return debugger_ap.release(); } } return NULL; @@ -702,7 +698,8 @@ if (break_op_size > 0) { // Clear a software breakoint instruction - uint8_t curr_break_op[break_op_size]; + uint8_t curr_break_op[8]; + assert (sizeof(curr_break_op) < break_op_size); bool break_op_found = false; // Read the breakpoint opcode @@ -731,7 +728,8 @@ if (verify) { - uint8_t verify_opcode[break_op_size]; + uint8_t verify_opcode[8]; + assert (sizeof(verify_opcode) < break_op_size); // Verify that our original opcode made it back to the inferior if (DoReadMemory (bp_addr, verify_opcode, break_op_size, error) == break_op_size) { @@ -840,9 +838,9 @@ BreakpointSiteList::collection::const_iterator pos; size_t bytes_written = 0; - addr_t intersect_addr; - size_t intersect_size; - size_t opcode_offset; + addr_t intersect_addr = 0; + size_t intersect_size = 0; + size_t opcode_offset = 0; const uint8_t *ubuf = (const uint8_t *)buf; for (pos = iter; pos != end; ++pos) @@ -1069,10 +1067,10 @@ m_target_triple.Clear(); m_abi_sp.reset(); - Error error(WillAttach (attach_pid)); + Error error (WillAttachToProcessWithID(attach_pid)); if (error.Success()) { - error = DoAttach (attach_pid); + error = DoAttachToProcessWithID (attach_pid); if (error.Success()) { error = CompleteAttach(); @@ -1099,11 +1097,11 @@ m_target_triple.Clear(); m_abi_sp.reset(); - Error error (WillAttach (process_name, wait_for_launch)); + Error error (WillAttachToProcessWithName(process_name, wait_for_launch)); if (error.Success()) { StartPrivateStateThread(); - error = DoAttach (process_name, wait_for_launch); + error = DoAttachToProcessWithName (process_name, wait_for_launch); if (error.Fail()) { if (GetID() != LLDB_INVALID_PROCESS_ID) @@ -1629,8 +1627,8 @@ EventData (), m_process_sp (), m_state (eStateInvalid), - m_update_state (false), - m_restarted (false) + m_restarted (false), + m_update_state (false) { } @@ -1638,8 +1636,8 @@ EventData (), m_process_sp (process_sp), m_state (state), - m_update_state (false), - m_restarted (false) + m_restarted (false), + m_update_state (false) { } Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Jul 9 15:39:50 2010 @@ -34,12 +34,12 @@ ThreadPlanStepRange::ThreadPlanStepRange (ThreadPlanKind kind, const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others) : ThreadPlan (ThreadPlan::eKindGeneric, name, thread, eVoteNoOpinion, eVoteNoOpinion), - m_address_range (range), m_addr_context (addr_context), + m_address_range (range), m_stop_others (stop_others), m_stack_depth (0), - m_no_more_plans (false), m_stack_id (), + m_no_more_plans (false), m_first_run_event (true) { m_stack_depth = m_thread.GetStackFrameCount(); Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Fri Jul 9 15:39:50 2010 @@ -39,13 +39,15 @@ bool stop_others ) : ThreadPlan (ThreadPlan::eKindStepUntil, "Step until", thread, eVoteNoOpinion, eVoteNoOpinion), + m_stack_depth (0), m_step_from_insn (LLDB_INVALID_ADDRESS), - m_return_addr (LLDB_INVALID_ADDRESS), m_return_bp_id(LLDB_INVALID_BREAK_ID), + m_return_addr (LLDB_INVALID_ADDRESS), m_stepped_out(false), m_should_stop(false), - m_explains_stop(false), m_ran_analyze (false), + m_explains_stop(false), + m_until_points(), m_stop_others (stop_others) { Added: lldb/trunk/source/Utility/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/source/Utility/Makefile (added) +++ lldb/trunk/source/Utility/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,14 @@ +##===- source/Utility/Makefile -----------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../.. +LIBRARYNAME := lldbUtility +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/source/Utility/StringExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractor.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Utility/StringExtractor.cpp (original) +++ lldb/trunk/source/Utility/StringExtractor.cpp Fri Jul 9 15:39:50 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "StringExtractor.h" +#include "Utility/StringExtractor.h" // C Includes // C++ Includes Modified: lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp (original) +++ lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp Fri Jul 9 15:39:50 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "StringExtractorGDBRemote.h" +#include "Utility/StringExtractorGDBRemote.h" // C Includes // C++ Includes Modified: lldb/trunk/source/Utility/StringExtractorGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractorGDBRemote.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/Utility/StringExtractorGDBRemote.h (original) +++ lldb/trunk/source/Utility/StringExtractorGDBRemote.h Fri Jul 9 15:39:50 2010 @@ -15,7 +15,7 @@ #include // Other libraries and framework includes // Project includes -#include "StringExtractor.h" +#include "Utility/StringExtractor.h" class StringExtractorGDBRemote : public StringExtractor { Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Fri Jul 9 15:39:50 2010 @@ -68,7 +68,7 @@ ObjectContainerUniversalMachO::Initialize(); ObjectFileMachO::Initialize(); ProcessGDBRemote::Initialize(); - ProcessMacOSX::Initialize(); +// ProcessMacOSX::Initialize(); #endif } } @@ -96,7 +96,7 @@ ObjectContainerUniversalMachO::Terminate(); ObjectFileMachO::Terminate(); ProcessGDBRemote::Terminate(); - ProcessMacOSX::Terminate(); +// ProcessMacOSX::Terminate(); #endif } Added: lldb/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/tools/Makefile (added) +++ lldb/trunk/tools/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,13 @@ +##===- source/Makefile -------------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := .. +DIRS := driver + +include $(LLDB_LEVEL)/Makefile Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original) +++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Jul 9 15:39:50 2010 @@ -512,7 +512,7 @@ PREBINDING = NO; PRODUCT_NAME = debugserver; STRIP_INSTALLED_PRODUCT = YES; - USER_HEADER_SEARCH_PATHS = "./source $(DERIVED_SOURCES_DIR)"; + USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)"; ZERO_LINK = NO; }; name = BuildAndIntegration; @@ -543,7 +543,7 @@ OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)"; PREBINDING = NO; PRODUCT_NAME = debugserver; - USER_HEADER_SEARCH_PATHS = "./source $(DERIVED_SOURCES_DIR)"; + USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)"; ZERO_LINK = NO; }; name = Debug; @@ -573,7 +573,7 @@ OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)"; PREBINDING = NO; PRODUCT_NAME = debugserver; - USER_HEADER_SEARCH_PATHS = "./source $(DERIVED_SOURCES_DIR)"; + USER_HEADER_SEARCH_PATHS = "./source ../../source $(DERIVED_SOURCES_DIR)"; ZERO_LINK = NO; }; name = Release; Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original) +++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Jul 9 15:39:50 2010 @@ -25,7 +25,7 @@ #include "RNBContext.h" #include "RNBServices.h" #include "RNBSocket.h" -#include "StringExtractor.h" +#include "Utility/StringExtractor.h" #include #include Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Fri Jul 9 15:39:50 2010 @@ -110,18 +110,18 @@ } } -// This function takes INDENT, which tells how many spaces to output at the front of each line; SPACES, which is -// a string that is output_max_columns long, containing spaces; and TEXT, which is the text that is to be output. -// It outputs the text, on multiple lines if necessary, to RESULT, with INDENT spaces at the front of each line. It -// breaks lines on spaces, tabs or newlines, shortening the line if necessary to not break in the middle of a word. -// It assumes that each output line should contain a maximum of OUTPUT_MAX_COLUMNS characters. +// This function takes INDENT, which tells how many spaces to output at the front +// of each line; TEXT, which is the text that is to be output. It outputs the +// text, on multiple lines if necessary, to RESULT, with INDENT spaces at the +// front of each line. It breaks lines on spaces, tabs or newlines, shortening +// the line if necessary to not break in the middle of a word. It assumes that +// each output line should contain a maximum of OUTPUT_MAX_COLUMNS characters. void -OutputFormattedUsageText (FILE *out, int indent, char *spaces, const char *text, int output_max_columns) +OutputFormattedUsageText (FILE *out, int indent, const char *text, int output_max_columns) { int len = strlen (text); std::string text_string (text); - std::string spaces_string (spaces); // Force indentation to be reasonable. if (indent >= output_max_columns) @@ -131,7 +131,7 @@ if (len + indent < output_max_columns) // Output as a single line - fprintf (out, "%s%s\n", spaces_string.substr (0, indent).c_str(), text); + fprintf (out, "%*s%s\n", indent, "", text); else { // We need to break it up into multiple lines. @@ -159,7 +159,7 @@ } sub_len = end - start; std::string substring = text_string.substr (start, sub_len); - fprintf (out, "%s%s\n", spaces_string.substr(0, indent).c_str(), substring.c_str()); + fprintf (out, "%*s%s\n", indent, "", substring.c_str()); start = end + 1; } } @@ -171,15 +171,7 @@ uint32_t screen_width = 80; uint32_t indent_level = 0; const char *name = "lldb"; - char spaces[screen_width+1]; - uint32_t i; - for (i = 0; i < screen_width; ++i) - spaces[i] = ' '; - spaces[i] = '\n'; - - std::string spaces_string (spaces); - fprintf (out, "\nUsage:\n\n"); indent_level += 2; @@ -202,7 +194,7 @@ } else { - for (int j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++) + for (uint32_t j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++) { if (this_usage_mask & 1 << j) { @@ -221,7 +213,7 @@ if (opt_set > 0) fprintf (out, "\n"); - fprintf (out, "%s%s", spaces_string.substr(0, indent_level).c_str(), name); + fprintf (out, "%*s%s", indent_level, "", name); for (uint32_t i = 0; i < num_options; ++i) { @@ -271,16 +263,16 @@ if (pos == options_seen.end()) { options_seen.insert (option_table[i].short_option); - fprintf (out, "%s-%c ", spaces_string.substr(0, indent_level).c_str(), option_table[i].short_option); + fprintf (out, "%*s-%c ", indent_level, "", option_table[i].short_option); if (option_table[i].argument_name != NULL) fprintf (out, "%s", option_table[i].argument_name); fprintf (out, "\n"); - fprintf (out, "%s--%s ", spaces_string.substr(0, indent_level).c_str(), option_table[i].long_option); + fprintf (out, "%*s--%s ", indent_level, "", option_table[i].long_option); if (option_table[i].argument_name != NULL) fprintf (out, "%s", option_table[i].argument_name); fprintf (out, "\n"); indent_level += 5; - OutputFormattedUsageText (out, indent_level, spaces, option_table[i].usage_text, screen_width); + OutputFormattedUsageText (out, indent_level, option_table[i].usage_text, screen_width); indent_level -= 5; fprintf (out, "\n"); } @@ -288,12 +280,12 @@ indent_level -= 5; - fprintf (out, "\n%s('%s ' also works, to specify the file to be debugged.)\n\n", - spaces_string.substr(0, indent_level).c_str(), name); + fprintf (out, "\n%*s('%s ' also works, to specify the file to be debugged.)\n\n", + indent_level, "", name); } void -BuildGetOptTable (lldb::OptionDefinition *expanded_option_table, struct option **getopt_table, int num_options) +BuildGetOptTable (lldb::OptionDefinition *expanded_option_table, struct option **getopt_table, uint32_t num_options) { if (num_options == 0) return; @@ -303,19 +295,19 @@ std::bitset<256> option_seen; for (i = 0, j = 0; i < num_options; ++i) - { + { char short_opt = expanded_option_table[i].short_option; - + if (option_seen.test(short_opt) == false) - { + { (*getopt_table)[j].name = expanded_option_table[i].long_option; (*getopt_table)[j].has_arg = expanded_option_table[i].option_has_arg; (*getopt_table)[j].flag = NULL; (*getopt_table)[j].val = expanded_option_table[i].short_option; option_seen.set(short_opt); ++j; - } - } + } + } (*getopt_table)[j].name = NULL; (*getopt_table)[j].has_arg = 0; @@ -327,11 +319,12 @@ Driver::OptionData::OptionData () : m_filename(), m_script_lang (lldb::eScriptLanguageDefault), + m_crash_log (), m_source_command_files (), m_debug_mode (false), + m_print_version (false), m_print_help (false), - m_print_version (false) - + m_seen_options() { } @@ -414,9 +407,10 @@ SBError error; std::string option_string; struct option *long_options = NULL; - int num_options; + uint32_t num_options; - for (num_options = 0; g_options[num_options].long_option != NULL; ++num_options); + for (num_options = 0; g_options[num_options].long_option != NULL; ++num_options) + /* Do Nothing. */; if (num_options == 0) { @@ -468,7 +462,7 @@ while (1) { int long_options_index = -1; - val = ::getopt_long (argc, (char * const *) argv, option_string.c_str(), long_options, &long_options_index); + val = ::getopt_long (argc, const_cast(argv), option_string.c_str(), long_options, &long_options_index); if (val == -1) break; @@ -787,7 +781,7 @@ const char *command_string = SBEvent::GetCStringFromEvent(event); if (command_string == NULL) - command_string == ""; + command_string = ""; SBCommandReturnObject result; if (m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true) != lldb::eReturnStatusQuit) { Modified: lldb/trunk/tools/driver/IOChannel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.cpp?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/tools/driver/IOChannel.cpp (original) +++ lldb/trunk/tools/driver/IOChannel.cpp Fri Jul 9 15:39:50 2010 @@ -68,7 +68,7 @@ const LineInfo *line_info = el_line(m_edit_line); SBStringList completions; - size_t page_size = 40; + int page_size = 40; int num_completions = m_driver->GetDebugger().GetCommandInterpreter().HandleCompletion (line_info->buffer, line_info->cursor, @@ -161,9 +161,12 @@ m_read_thread_should_exit (false), m_out_file (out), m_err_file (err), + m_command_queue (), + m_completion_key ("\t"), m_edit_line (::el_init (SBHostOS::GetProgramFileSpec().GetFileName(), in, out, err)), m_history (history_init()), - m_completion_key ("\t") + m_history_event(), + m_getting_command (false) { assert (m_edit_line); ::el_set (m_edit_line, EL_PROMPT, el_prompt); @@ -211,7 +214,7 @@ { char history_path[PATH_MAX]; ::snprintf (history_path, sizeof(history_path), "~/.%s-history", SBHostOS::GetProgramFileSpec().GetFileName()); - if (SBFileSpec::ResolvePath (history_path, history_path, sizeof(history_path)) < sizeof(history_path) - 1) + if ((size_t)SBFileSpec::ResolvePath (history_path, history_path, sizeof(history_path)) < sizeof(history_path) - 1) { const char *path_ptr = history_path; if (save) Modified: lldb/trunk/tools/driver/IOChannel.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.h?rev=108009&r1=108008&r2=108009&view=diff ============================================================================== --- lldb/trunk/tools/driver/IOChannel.h (original) +++ lldb/trunk/tools/driver/IOChannel.h Fri Jul 9 15:39:50 2010 @@ -86,7 +86,8 @@ const char * GetPrompt (); - static unsigned char ElCompletionFn (EditLine *e, int ch); + static unsigned char + ElCompletionFn (EditLine *e, int ch); bool IsGettingCommand () const; @@ -105,9 +106,12 @@ History *m_history; HistEvent m_history_event; bool m_getting_command; + void HistorySaveLoad (bool save); - unsigned char HandleCompletion (EditLine *e, int ch); + + unsigned char + HandleCompletion (EditLine *e, int ch); }; #endif // lldb_IOChannel_h_ Added: lldb/trunk/tools/driver/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Makefile?rev=108009&view=auto ============================================================================== --- lldb/trunk/tools/driver/Makefile (added) +++ lldb/trunk/tools/driver/Makefile Fri Jul 9 15:39:50 2010 @@ -0,0 +1,25 @@ +##===- tools/driver/Makefile -------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LLDB_LEVEL := ../.. + +TOOLNAME = lldb + +LD.Flags += -ledit -llldb -llldbUtility + +# # Include this here so we can get the configuration of the targets that have +# # been configured for construction. We have to do this early so we can set up +# # LINK_COMPONENTS before including Makefile.rules +include $(LLDB_LEVEL)/../../Makefile.config + +ifeq ($(HOST_OS),Darwin) + LD.Flags += -Wl,-rpath, at loader_path/../lib/ + LD.Flags += -Wl,-sectcreate -Wl,__TEXT -Wl,__info_plist -Wl,lldb-Info.plist +endif + +include $(LLDB_LEVEL)/Makefile From gclayton at apple.com Fri Jul 9 15:52:14 2010 From: gclayton at apple.com (Greg Clayton) Date: Fri, 9 Jul 2010 13:52:14 -0700 Subject: [Lldb-commits] I have merged all of Eli's linux build changes into LLDB Message-ID: I got LLDB building on Mac OS X using the LLVM make system. It isn't perfect yet, the things I have left to do: - (macosx) build debugserver on Mac OS X - (macosx) build the native process.macosx debugger plug-in - (macosx) codesign lldb and debugserver - (linux) verify that the lldb.so (lldb shared library) gets created and can be used by lldb (command line tool) If you want to try and build this on Mac OS X you will need to patch LLVM until my patch makes it into LLVM: -------------- next part -------------- A non-text attachment was scrubbed... Name: objc.patch Type: application/octet-stream Size: 6202 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20100709/103c61a7/attachment.obj -------------- next part -------------- I don't think you nee the above patch for linux. Here is some basic info: - to build it using makefiles: - checkout and build llvm and clang - checkout lldb into llvm/tools - cd llvm/tools/lldb and type "make" - there are .a files made for all directories - The LLDB API is linked into "llvm/Release/lib/lldb.so" ("llvm/Release/lib/lldb.dylib" on macosx) and is created from all the liblldb*.a files in the "llvm/Release/lib" - The "llvm/Release/bin/lldb" command line tool should link against the "llvm/Release/lib/lldb.so" Greg Clayton From eli.friedman at gmail.com Fri Jul 9 17:03:05 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 09 Jul 2010 22:03:05 -0000 Subject: [Lldb-commits] [lldb] r108024 - /lldb/trunk/source/Generated/ Message-ID: <20100709220305.E26C52A6C12C@llvm.org> Author: efriedma Date: Fri Jul 9 17:03:05 2010 New Revision: 108024 URL: http://llvm.org/viewvc/llvm-project?rev=108024&view=rev Log: Remove unnecessary directory (accidentally committed with r108009). Removed: lldb/trunk/source/Generated/ From eli.friedman at gmail.com Fri Jul 9 17:11:43 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 09 Jul 2010 22:11:43 -0000 Subject: [Lldb-commits] [lldb] r108025 - in /lldb/trunk: lib/Makefile tools/driver/Makefile Message-ID: <20100709221143.2F7EE2A6C12C@llvm.org> Author: efriedma Date: Fri Jul 9 17:11:43 2010 New Revision: 108025 URL: http://llvm.org/viewvc/llvm-project?rev=108025&view=rev Log: Make current Makefiles work on Linux (at least, they work for me). Please tell me if this breaks anything. Modified: lldb/trunk/lib/Makefile lldb/trunk/tools/driver/Makefile Modified: lldb/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=108025&r1=108024&r2=108025&view=diff ============================================================================== --- lldb/trunk/lib/Makefile (original) +++ lldb/trunk/lib/Makefile Fri Jul 9 17:11:43 2010 @@ -23,23 +23,17 @@ 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 \ @@ -58,47 +52,30 @@ 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 +include $(LLDB_LEVEL)/../../Makefile.config + +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \ + ipo selectiondag jit + +ifeq ($(HOST_OS),Darwin) + USEDLIBS += lldbHostMacOSX.a \ + lldbPluginDynamicLoaderMacOSX.a \ + lldbPluginObjectContainerUniversalMachO.a \ + lldbPluginObjectFileMachO.a \ + lldbPluginProcessGDBRemote.a \ + lldbPluginUtility.a +endif + +ifeq ($(HOST_OS),Linux) + USEDLIBS += lldbHostLinux.a +endif -LLVMLibsOptions += -Wl,-all_load -v +include $(LEVEL)/Makefile.common ifeq ($(HOST_OS),Darwin) + LLVMLibsOptions += -Wl,-all_load # set dylib internal version number to llvmCore submission number ifdef LLDB_SUBMIT_VERSION LLVMLibsOptions += -Wl,-current_version \ @@ -121,8 +98,10 @@ ifeq ($(HOST_OS), Linux) # Include everything from the .a's into the shared library. - LLVMLibsOptions := -Wl,--whole-archive $(LLDBLibsOptions) \ + ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \ -Wl,--no-whole-archive # Don't allow unresolved symbols. LLVMLibsOptions += -Wl,--no-undefined + # Link in python + LD.Flags += -lpython2.6 endif Modified: lldb/trunk/tools/driver/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Makefile?rev=108025&r1=108024&r2=108025&view=diff ============================================================================== --- lldb/trunk/tools/driver/Makefile (original) +++ lldb/trunk/tools/driver/Makefile Fri Jul 9 17:11:43 2010 @@ -22,4 +22,8 @@ LD.Flags += -Wl,-sectcreate -Wl,__TEXT -Wl,__info_plist -Wl,lldb-Info.plist endif +ifeq ($(HOST_OS),Linux) + LD.Flags += -Wl,-rpath,$(LibDir) +endif + include $(LLDB_LEVEL)/Makefile From eli.friedman at gmail.com Fri Jul 9 17:36:15 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 09 Jul 2010 22:36:15 -0000 Subject: [Lldb-commits] [lldb] r108027 - /lldb/trunk/Makefile Message-ID: <20100709223615.28A8E2A6C12C@llvm.org> Author: efriedma Date: Fri Jul 9 17:36:15 2010 New Revision: 108027 URL: http://llvm.org/viewvc/llvm-project?rev=108027&view=rev Log: Comment out test targets; they don't work on Linux because test/Makefile uses a bunch of BSD-isms. Modified: lldb/trunk/Makefile Modified: lldb/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/Makefile?rev=108027&r1=108026&r2=108027&view=diff ============================================================================== --- lldb/trunk/Makefile (original) +++ lldb/trunk/Makefile Fri Jul 9 17:36:15 2010 @@ -66,14 +66,14 @@ fi endif -test:: - @ $(MAKE) -C test +#test:: +# @ $(MAKE) -C test -report:: - @ $(MAKE) -C test report +#report:: +# @ $(MAKE) -C test report -clean:: - @ $(MAKE) -C test clean +#clean:: +# @ $(MAKE) -C test clean tags:: $(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \ From eli.friedman at gmail.com Fri Jul 9 17:53:18 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 09 Jul 2010 22:53:18 -0000 Subject: [Lldb-commits] [lldb] r108029 - in /lldb/trunk: source/API/SBThread.cpp source/Core/Communication.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.h tools/driver/IOChannel.cpp Message-ID: <20100709225319.05C352A6C12C@llvm.org> Author: efriedma Date: Fri Jul 9 17:53:18 2010 New Revision: 108029 URL: http://llvm.org/viewvc/llvm-project?rev=108029&view=rev Log: Misc warning fixes. Modified: lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h lldb/trunk/tools/driver/IOChannel.cpp Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=108029&r1=108028&r2=108029&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Jul 9 17:53:18 2010 @@ -280,7 +280,7 @@ " frame #%u: tid = 0x%4.4x, pc = 0x%llx ", frame_idx, GetThreadID(), - pc); + (long long)pc); sc->DumpStopContext (&str, &m_opaque_sp->GetProcess(), *frame.GetPCAddress()); fprintf (out, "\n"); success = true; Modified: lldb/trunk/source/Core/Communication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=108029&r1=108028&r2=108029&view=diff ============================================================================== --- lldb/trunk/source/Core/Communication.cpp (original) +++ lldb/trunk/source/Core/Communication.cpp Fri Jul 9 17:53:18 2010 @@ -28,7 +28,7 @@ Communication::Communication(const char *name) : Broadcaster (name), m_connection_ap (), - m_read_thread (NULL), + m_read_thread (LLDB_INVALID_HOST_THREAD), m_read_thread_enabled (false), m_bytes(), m_bytes_mutex (Mutex::eMutexTypeRecursive), @@ -120,7 +120,7 @@ "%p Communication::Write (dst = %p, dst_len = %zu, timeout_usec = %u) connection = %p", this, dst, dst_len, timeout_usec, m_connection_ap.get()); - if (m_read_thread != NULL) + if (m_read_thread != LLDB_INVALID_HOST_THREAD) { // We have a dedicated read thread that is getting data for us size_t cached_bytes = GetCachedBytes (dst, dst_len); @@ -219,7 +219,7 @@ bool Communication::StopReadThread (Error *error_ptr) { - if (m_read_thread == NULL) + if (m_read_thread == LLDB_INVALID_HOST_THREAD) return true; lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION, @@ -290,7 +290,7 @@ bool Communication::ReadThreadIsRunning () { - return m_read_thread != NULL; + return m_read_thread != LLDB_INVALID_HOST_THREAD; } void * Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h?rev=108029&r1=108028&r2=108029&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h Fri Jul 9 17:53:18 2010 @@ -24,8 +24,8 @@ typedef struct ValueTypeTag { ValueTypeTag() : - data(NULL), - value() + value(), + data(NULL) { value.uval = 0; } Modified: lldb/trunk/tools/driver/IOChannel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.cpp?rev=108029&r1=108028&r2=108029&view=diff ============================================================================== --- lldb/trunk/tools/driver/IOChannel.cpp (original) +++ lldb/trunk/tools/driver/IOChannel.cpp Fri Jul 9 17:53:18 2010 @@ -381,7 +381,7 @@ bool IOChannel::Stop () { - if (m_read_thread == NULL) + if (m_read_thread == LLDB_INVALID_HOST_THREAD) return true; BroadcastEventByType (eBroadcastBitThreadShouldExit); From eli.friedman at gmail.com Fri Jul 9 18:04:08 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 09 Jul 2010 23:04:08 -0000 Subject: [Lldb-commits] [lldb] r108030 - in /lldb/trunk/source: Core/DataExtractor.cpp Interpreter/StateVariable.cpp Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Message-ID: <20100709230408.B33012A6C12C@llvm.org> Author: efriedma Date: Fri Jul 9 18:04:08 2010 New Revision: 108030 URL: http://llvm.org/viewvc/llvm-project?rev=108030&view=rev Log: A few more misc warning fixes. Modified: lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/Interpreter/StateVariable.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=108030&r1=108029&r2=108030&view=diff ============================================================================== --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Fri Jul 9 18:04:08 2010 @@ -1485,10 +1485,10 @@ return start_offset; uint32_t offset; - uint32_t end_offset = offset + length; + uint32_t end_offset; uint32_t count; StreamString sstr; - for (offset = start_offset, count = 0; ValidOffset(offset) && offset < end_offset; ++count) + for (offset = start_offset, end_offset = offset + length, count = 0; ValidOffset(offset) && offset < end_offset; ++count) { if ((count % num_per_line) == 0) { Modified: lldb/trunk/source/Interpreter/StateVariable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/StateVariable.cpp?rev=108030&r1=108029&r2=108030&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/StateVariable.cpp (original) +++ lldb/trunk/source/Interpreter/StateVariable.cpp Fri Jul 9 18:04:08 2010 @@ -81,8 +81,8 @@ ) : m_name (name), m_type (eTypeStringArray), - m_help_text (help), m_string_values(), + m_help_text (help), m_verification_func_ptr (func_ptr) { if (args) Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=108030&r1=108029&r2=108030&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Fri Jul 9 18:04:08 2010 @@ -89,7 +89,7 @@ static void PrintRange(const DWARFDebugAranges::Range& range) { // Cast the address values in case the address type is compiled as 32 bit - printf("0x%8.8x: [0x%8.8llx - 0x%8.8llx)\n", range.offset, (uint64_t)range.lo_pc, (uint64_t)range.hi_pc); + printf("0x%8.8x: [0x%8.8llx - 0x%8.8llx)\n", range.offset, (long long)range.lo_pc, (long long)range.hi_pc); } //---------------------------------------------------------------------- From jingham at apple.com Fri Jul 9 21:23:31 2010 From: jingham at apple.com (Jim Ingham) Date: Sat, 10 Jul 2010 02:23:31 -0000 Subject: [Lldb-commits] [lldb] r108035 - /lldb/trunk/source/Target/ThreadPlanStepRange.cpp Message-ID: <20100710022331.6EC952A6C12C@llvm.org> Author: jingham Date: Fri Jul 9 21:23:31 2010 New Revision: 108035 URL: http://llvm.org/viewvc/llvm-project?rev=108035&view=rev Log: Properly set the PlanKind for the ThreadPlanStepRange derived classes. Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=108035&r1=108034&r2=108035&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Jul 9 21:23:31 2010 @@ -33,7 +33,7 @@ //---------------------------------------------------------------------- ThreadPlanStepRange::ThreadPlanStepRange (ThreadPlanKind kind, const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others) : - ThreadPlan (ThreadPlan::eKindGeneric, name, thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (kind, name, thread, eVoteNoOpinion, eVoteNoOpinion), m_addr_context (addr_context), m_address_range (range), m_stop_others (stop_others), From jingham at apple.com Fri Jul 9 21:27:40 2010 From: jingham at apple.com (Jim Ingham) Date: Sat, 10 Jul 2010 02:27:40 -0000 Subject: [Lldb-commits] [lldb] r108036 - in /lldb/trunk: include/lldb/Target/ThreadPlanStepInRange.h source/Commands/CommandObjectThread.cpp source/Target/ThreadPlanStepInRange.cpp Message-ID: <20100710022740.20EDB2A6C12C@llvm.org> Author: jingham Date: Fri Jul 9 21:27:39 2010 New Revision: 108036 URL: http://llvm.org/viewvc/llvm-project?rev=108036&view=rev Log: Add an "Avoid Frames matching this regular expression" to ThreadPlanStepInRange. This relies on ThreadPlanStepOut working correctly, which it doesn't currently for Inlined functions, so this feature is only partially useful until we take care of Stepping Out of inlined functions. Added an option to "thread step-in" to set the avoid regular expression. This is mostly for testing, once the Setting code is redone, we'll move this to a general setting. Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h?rev=108036&r1=108035&r2=108036&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h Fri Jul 9 21:27:39 2010 @@ -36,6 +36,8 @@ virtual bool ShouldStop (Event *event_ptr); + void SetAvoidRegexp(const char *name); + static ThreadPlan * DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, void *baton); @@ -51,6 +53,9 @@ virtual void SetFlagsToDefault (); + + bool + FrameMatchesAvoidRegexp (); private: @@ -67,6 +72,7 @@ // from step in. static uint32_t s_default_flag_values; + std::auto_ptr m_avoid_regexp_ap; DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepInRange); Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=108036&r1=108035&r2=108036&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Jul 9 21:27:39 2010 @@ -383,6 +383,12 @@ error.SetErrorStringWithFormat("Invalid enumeration value for option '%c'.\n", short_option); } break; + case 'r': + { + m_avoid_regexp.clear(); + m_avoid_regexp.assign(option_arg); + } + break; default: error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); break; @@ -397,6 +403,7 @@ Options::ResetOptionValues(); m_avoid_no_debug = true; m_run_mode = eOnlyDuringStepping; + m_avoid_regexp.clear(); } const lldb::OptionDefinition* @@ -412,6 +419,7 @@ // Instance variables to hold the values for command options. bool m_avoid_no_debug; RunMode m_run_mode; + std::string m_avoid_regexp; }; CommandObjectThreadStepWithTypeAndScope (const char *name, @@ -514,6 +522,11 @@ frame->GetSymbolContext(eSymbolContextEverything), stop_other_threads, m_options.m_avoid_no_debug); + if (new_plan && !m_options.m_avoid_regexp.empty()) + { + ThreadPlanStepInRange *step_in_range_plan = static_cast (new_plan); + step_in_range_plan->SetAvoidRegexp(m_options.m_avoid_regexp.c_str()); + } } else new_plan = thread->QueueThreadPlanForStepSingleInstruction (false, abort_other_plans, bool_stop_other_threads); @@ -621,6 +634,7 @@ { { LLDB_OPT_SET_1, false, "avoid_no_debug", 'a', required_argument, NULL, 0, "", "Should step-in step over functions with no debug information"}, { LLDB_OPT_SET_1, false, "run_mode", 'm', required_argument, g_tri_running_mode, 0, "", "Determine how to run other threads while stepping this one"}, +{ LLDB_OPT_SET_1, false, "regexp_to_avoid",'r', required_argument, NULL, 0, "", "Should step-in step over functions matching this regexp"}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=108036&r1=108035&r2=108036&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Jul 9 21:27:39 2010 @@ -17,11 +17,13 @@ #include "lldb/lldb-private-log.h" #include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" +#include "lldb/Symbol/Symbol.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanStepOut.h" #include "lldb/Target/ThreadPlanStepThrough.h" +#include "lldb/Core/RegularExpression.h" using namespace lldb; using namespace lldb_private; @@ -44,6 +46,7 @@ ThreadPlanShouldStopHere (this, ThreadPlanStepInRange::DefaultShouldStopHereCallback, NULL) { SetFlagsToDefault (); + // SetAvoidRegexp("^std\\:\\:.*"); } ThreadPlanStepInRange::~ThreadPlanStepInRange () @@ -129,6 +132,15 @@ GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values); } +void +ThreadPlanStepInRange::SetAvoidRegexp(const char *name) +{ + if (m_avoid_regexp_ap.get() == NULL) + m_avoid_regexp_ap.reset (new RegularExpression(name)); + + m_avoid_regexp_ap->Compile (name); +} + void ThreadPlanStepInRange::SetDefaultFlagValue (uint32_t new_value) { @@ -136,19 +148,53 @@ ThreadPlanStepInRange::s_default_flag_values = new_value; } +bool +ThreadPlanStepInRange::FrameMatchesAvoidRegexp () +{ + StackFrame *frame = GetThread().GetStackFrameAtIndex(0).get(); + + if (m_avoid_regexp_ap.get() != NULL) + { + SymbolContext sc = frame->GetSymbolContext(eSymbolContextSymbol); + if (sc.symbol != NULL) + { + const char *unnamed_symbol = ""; + const char *sym_name = sc.symbol->GetMangled().GetName().AsCString(unnamed_symbol); + if (strcmp (sym_name, unnamed_symbol) != 0) + return m_avoid_regexp_ap->Execute(sym_name); + } + } + return false; +} + ThreadPlan * ThreadPlanStepInRange::DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, void *baton) { + bool should_step_out = false; + StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); + if (flags.IsSet(eAvoidNoDebug)) { - StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); - if (!frame->HasDebugInformation()) + should_step_out = true; + } + + if (!should_step_out) + { + if (current_plan->GetKind() == eKindStepInRange) { - // FIXME: Make sure the ThreadPlanForStepOut does the right thing with inlined functions. - return current_plan->GetThread().QueueThreadPlanForStepOut (false, NULL, true, current_plan->StopOthers(), eVoteNo, eVoteNoOpinion); + ThreadPlanStepInRange *step_in_range_plan = static_cast (current_plan); + should_step_out = step_in_range_plan->FrameMatchesAvoidRegexp (); } } + + if (should_step_out) + { + // FIXME: Make sure the ThreadPlanForStepOut does the right thing with inlined functions. + return current_plan->GetThread().QueueThreadPlanForStepOut (false, NULL, true, + current_plan->StopOthers(), + eVoteNo, eVoteNoOpinion); + } return NULL; }