[Lldb-commits] LLDB Windows Driver Patch
Hello, As an extension of our PlatformWindows patch, we would like to submit some changes to the LLDB Command Line Driver allowing it to cleanly build and run on Windows. This patch will not show any change in functionality for non windows hosts. Without any Windows specific testing in place we have simply loaded an elf file and viewed its sections, etc to confirm that it functions properly. An work-in-progress wrapper for EditLine functionality has been created, leaving the main driver code minimally modified. Also a minimal abstraction of the pthread code has been made. Our intention is to later revise the threading code and instead use the existing threading classes of LLDB. The Linux test suite passes successfully after application of this patch. This patch is based on trunk revision, https://llvm.org/svn/llvm-project/lldb/trunk@191399 Thanks, Aidan Dodds diff --git tools/CMakeLists.txt tools/CMakeLists.txt index b1989f8..43163f6 100644 --- tools/CMakeLists.txt +++ tools/CMakeLists.txt @@ -1,7 +1,7 @@ -if (CMAKE_SYSTEM_NAME MATCHES Darwin) - add_subdirectory(debugserver) -endif() -if (NOT CMAKE_SYSTEM_NAME MATCHES Windows) - add_subdirectory(driver) - add_subdirectory(lldb-platform) -endif() +if (CMAKE_SYSTEM_NAME MATCHES Darwin) + add_subdirectory(debugserver) +endif() +add_subdirectory(driver) +if (NOT CMAKE_SYSTEM_NAME MATCHES Windows) + add_subdirectory(lldb-platform) +endif() diff --git tools/driver/CMakeLists.txt tools/driver/CMakeLists.txt index c70a2db..aa4c798 100644 --- tools/driver/CMakeLists.txt +++ tools/driver/CMakeLists.txt @@ -1,18 +1,22 @@ -set(LLVM_NO_RTTI 1) -add_lldb_executable(lldb - Driver.cpp - #DriverEvents.cpp - #DriverOptions.cpp - #DriverPosix.cpp - IOChannel.cpp - ) - -target_link_libraries(lldb liblldb) -# TODO: why isn't this done by add_lldb_executable? -#target_link_libraries(lldb ${LLDB_USED_LIBS}) -#llvm_config(lldb ${LLVM_LINK_COMPONENTS}) - -set_target_properties(lldb PROPERTIES VERSION ${LLDB_VERSION}) - -install(TARGETS lldb - RUNTIME DESTINATION bin) +set(LLVM_NO_RTTI 1) +add_lldb_executable(lldb + Driver.cpp + #DriverEvents.cpp + #DriverOptions.cpp + #DriverPosix.cpp + IOChannel.cpp + ELWrapper.cpp + Mutex.cpp + Platform.cpp + GetOptWrapper.cpp + ) + +target_link_libraries(lldb liblldb) +# TODO: why isn't this done by add_lldb_executable? +#target_link_libraries(lldb ${LLDB_USED_LIBS}) +#llvm_config(lldb ${LLVM_LINK_COMPONENTS}) + +set_target_properties(lldb PROPERTIES VERSION ${LLDB_VERSION}) + +install(TARGETS lldb + RUNTIME DESTINATION bin) diff --git tools/driver/Driver.cpp tools/driver/Driver.cpp index a4fc67f..98977ba 100644 --- tools/driver/Driver.cpp +++ tools/driver/Driver.cpp @@ -9,16 +9,11 @@ #include Driver.h -#include getopt.h -#include libgen.h -#include sys/ioctl.h -#include termios.h -#include unistd.h +#include stdio.h #include string.h #include stdlib.h #include limits.h #include fcntl.h -#include inttypes.h #include string @@ -155,7 +150,9 @@ Driver::CloseIOChannelFile () // Write an End of File sequence to the file descriptor to ensure any // read functions can exit. char eof_str[] = \x04; -::write (m_editline_pty.GetMasterFileDescriptor(), eof_str, strlen(eof_str)); +int mfd = m_editline_pty.GetMasterFileDescriptor(); +if ( mfd != -1 ) +::write (m_editline_pty.GetMasterFileDescriptor(), eof_str, strlen(eof_str)); m_editline_pty.CloseMasterFileDescriptor(); @@ -569,7 +566,7 @@ Driver::GetDebugMode() const // if the user only wanted help or version information. SBError -Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool exit) +Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool exiting) { ResetOptionValues (); @@ -802,12 +799,12 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool exit) if (error.Fail() || m_option_data.m_print_help) { ShowUsage (out_fh, g_options, m_option_data); -exit = true; +exiting = true; } else if (m_option_data.m_print_version) { ::fprintf (out_fh, %s\n, m_debugger.GetVersionString()); -exit = true; +exiting = true; } else if (m_option_data.m_print_python_path) { @@ -825,7 +822,7 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool exit) } else ::fprintf (out_fh, COULD NOT FIND PATH\n); -exit = true; +exiting = true; } else if (m_option_data.m_process_name.empty() m_option_data.m_process_pid == LLDB_INVALID_PROCESS_ID) { @@ -1311,6 +1308,12 @@ Driver::EditLineInputReaderCallback void Driver::MainLoop () { +#if defined( _MSC_VER ) +m_editline_slave_fh = stdin; +FILE *editline_output_slave_fh = stdout; +lldb_utility::PseudoTerminal editline_output_pty; +#else + char error_str[1024]; if (m_editline_pty.OpenFirstAvailableMaster(O_RDWR|O_NOCTTY, error_str,
[Lldb-commits] [lldb] r191556 - Convert ClangASTType::GetTypeName over to return a ConstString to be consistent with
Author: jingham Date: Fri Sep 27 15:59:37 2013 New Revision: 191556 URL: http://llvm.org/viewvc/llvm-project?rev=191556view=rev Log: Convert ClangASTType::GetTypeName over to return a ConstString to be consistent with the other Get*TypeName functions. Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h lldb/trunk/source/Expression/ClangFunction.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ClangASTType.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=191556r1=191555r2=191556view=diff == --- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Fri Sep 27 15:59:37 2013 @@ -249,7 +249,7 @@ public: ConstString GetConstTypeName () const; -std::string +ConstString GetTypeName () const; uint32_t Modified: lldb/trunk/source/Expression/ClangFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=191556r1=191555r2=191556view=diff == --- lldb/trunk/source/Expression/ClangFunction.cpp (original) +++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Sep 27 15:59:37 2013 @@ -111,7 +111,7 @@ ClangFunction::CompileFunction (Stream // FIXME: How does clang tell us there's no return value? We need to handle that case. unsigned num_errors = 0; -std::string return_type_str (m_function_return_type.GetTypeName()); +std::string return_type_str (m_function_return_type.GetTypeName().AsCString()); // Cons up the function we're going to wrap our call in, then compile it... // We declare the function extern C because the compiler might be in C++ Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=191556r1=191555r2=191556view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Sep 27 15:59:37 2013 @@ -2465,22 +2465,21 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD if (class_language == eLanguageTypeObjC) { -std::string class_str (clang_type.GetTypeName()); -if (!class_str.empty()) +ConstString class_name (clang_type.GetTypeName()); +if (class_name) { DIEArray method_die_offsets; if (m_using_apple_tables) { if (m_apple_objc_ap.get()) - m_apple_objc_ap-FindByName(class_str.c_str(), method_die_offsets); + m_apple_objc_ap-FindByName(class_name.GetCString(), method_die_offsets); } else { if (!m_indexed) Index (); -ConstString class_name (class_str.c_str()); m_objc_class_selectors_index.Find (class_name, method_die_offsets); } @@ -2502,7 +2501,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD if (m_using_apple_tables) { GetObjectFile()-GetModule()-ReportErrorIfModifyDetected (the DWARF debug information has been modified (.apple_objc accelerator table had bad die 0x%8.8x for '%s')\n, - die_offset, class_str.c_str()); + die_offset, class_name.GetCString()); } } } Modified: lldb/trunk/source/Symbol/ClangASTType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=191556r1=191555r2=191556view=diff == --- lldb/trunk/source/Symbol/ClangASTType.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTType.cpp Fri Sep 27 15:59:37 2013 @@ -1065,14 +1065,14 @@
[Lldb-commits] [lldb] r191568 - Fix OS Version reporting bug detected by TestPlatform for some Linux 3.x kernels that do not report the update version
Author: dmalea Date: Fri Sep 27 16:34:03 2013 New Revision: 191568 URL: http://llvm.org/viewvc/llvm-project?rev=191568view=rev Log: Fix OS Version reporting bug detected by TestPlatform for some Linux 3.x kernels that do not report the update version - should resolve the current failure on the Linux clang buildbot Modified: lldb/trunk/source/Host/linux/Host.cpp Modified: lldb/trunk/source/Host/linux/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Host.cpp?rev=191568r1=191567r2=191568view=diff == --- lldb/trunk/source/Host/linux/Host.cpp (original) +++ lldb/trunk/source/Host/linux/Host.cpp Fri Sep 27 16:34:03 2013 @@ -213,7 +213,14 @@ Host::GetOSVersion(uint32_t major, return false; status = sscanf(un.release, %u.%u.%u, major, minor, update); -return status == 3; +if (status == 3) +return true; + +// Some kernels omit the update version, so try looking for just X.Y and +// set update to 0. +update = 0; +status = sscanf(un.release, %u.%u, major, minor); +return status == 2; } lldb::DataBufferSP ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits