[Lldb-commits] [lldb] r286479 - Unify Darwin and Non-Darwin printing of version output

Tim Hammerquist via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 10 13:49:27 PST 2016


Failing differently here. Progress!

2016-11-10 13:47:14.203 xcodebuild[65554:42448173] Error
Domain=NSCocoaErrorDomain Code=3840 "Unexpected character / at line 1"
UserInfo={NSDebugDescription=Unexpected character / at line 1,
kCFPropertyListOldStyleParsingError=Error Domain=NSCocoaErrorDomain
Code=3840 "Expected terminating ')' for array at line 8782"
UserInfo={NSDebugDescription=Expected terminating ')' for array at line
8782}} xcodebuild: error: Unable to read project 'lldb.xcodeproj'. Reason:
Project /Users/buildslave/jenkins/sharedspace/lldb at 2/lldb/lldb.xcodeproj
cannot be opened because the project file cannot be parsed.


On Thu, Nov 10, 2016 at 1:40 PM, Chris Bieneman <beanz at apple.com> wrote:

> I just pushed r286504, which expects the string to not be quoted. This
> should solve the bot failures.
>
> -Chris
>
> On Nov 10, 2016, at 1:30 PM, Todd Fiala <todd.fiala at gmail.com> wrote:
>
> I'm at a point where I can look at it.
>
> On Thu, Nov 10, 2016 at 12:17 PM, Tim Hammerquist <penryu at gmail.com>
> wrote:
>
>> Looks like the quotes around the lldb version string aren't properly
>> preserved in the xcodeproj file as they are in CMake.
>>
>> Can any of the LLDB devs more comfortable with plumbing the depths of
>> Xcode project configuration provide some guidance here?
>>
>> http://lab.llvm.org:8080/green/job/lldb_build_test/21828/
>>
>> /Users/buildslave/jenkins/sharedspace/lldb at 2/lldb/source/lldb.cpp:63:22:
>> error: unexpected namespace name 'lldb': expected expression
>>     g_version_str += LLDB_VERSION_STRING;
>>                      ^
>> In file included from <built-in>:356:
>> <command line>:4:29: note: expanded from here
>> #define LLDB_VERSION_STRING lldb-360.99.0
>>                             ^
>> /Users/buildslave/jenkins/sharedspace/lldb at 2/lldb/source/lldb.cpp:63:22:
>> error: invalid suffix '.0' on floating constant
>> In file included from <built-in>:356:
>> <command line>:4:40: note: expanded from here
>> #define LLDB_VERSION_STRING lldb-360.99.0
>>                                        ^
>> 2 errors generated.
>>
>>
>> On Thu, Nov 10, 2016 at 9:33 AM, Chris Bieneman via lldb-commits <
>> lldb-commits at lists.llvm.org> wrote:
>>
>>> Author: cbieneman
>>> Date: Thu Nov 10 11:33:19 2016
>>> New Revision: 286479
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=286479&view=rev
>>> Log:
>>> Unify Darwin and Non-Darwin printing of version output
>>>
>>> Summary:
>>> This change unifies and simplifies the code paths between the Darwin and
>>> non-Darwin code to print the LLDB version information.
>>>
>>> It also introduces a new variable in CMake LLDB_VERSION_STRING which can
>>> be used to specify custom version information. On Darwin this value is
>>> implicitly set based on the resource/LLDB-Info.plist file.
>>>
>>> With the LLDB_VERSION_STRING variable set to lldb-360.99.0, the -version
>>> output is:
>>>
>>> > ./bin/lldb -version
>>> lldb version 4.0.0 (lldb-360.99.0)
>>>   clang revision 286264
>>>   llvm revision 286265
>>>
>>> This behavior is unified across all target platforms.
>>>
>>> Reviewers: lldb-commits
>>>
>>> Subscribers: mgorny, tfiala
>>>
>>> Differential Revision: https://reviews.llvm.org/D26478
>>>
>>> Added:
>>>     lldb/trunk/cmake/modules/EmbedAppleVersion.cmake
>>> Modified:
>>>     lldb/trunk/lldb.xcodeproj/project.pbxproj
>>>     lldb/trunk/source/CMakeLists.txt
>>>     lldb/trunk/source/lldb.cpp
>>>
>>> Added: lldb/trunk/cmake/modules/EmbedAppleVersion.cmake
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules
>>> /EmbedAppleVersion.cmake?rev=286479&view=auto
>>> ============================================================
>>> ==================
>>> --- lldb/trunk/cmake/modules/EmbedAppleVersion.cmake (added)
>>> +++ lldb/trunk/cmake/modules/EmbedAppleVersion.cmake Thu Nov 10
>>> 11:33:19 2016
>>> @@ -0,0 +1,11 @@
>>> +execute_process(COMMAND /usr/libexec/PlistBuddy -c
>>> "Print:CFBundleVersion" ${LLDB_INFO_PLIST}
>>> +                OUTPUT_VARIABLE BundleVersion
>>> +                OUTPUT_STRIP_TRAILING_WHITESPACE)
>>> +
>>> +file(APPEND "${HEADER_FILE}.tmp"
>>> +    "#define LLDB_VERSION_STRING \"lldb-${BundleVersion}\"\n")
>>> +
>>> +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
>>> +  "${HEADER_FILE}.tmp" "${HEADER_FILE}")
>>> +
>>> +file(REMOVE "${HEADER_FILE}.tmp")
>>>
>>> Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodepro
>>> j/project.pbxproj?rev=286479&r1=286478&r2=286479&view=diff
>>> ============================================================
>>> ==================
>>> --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
>>> +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov 10 11:33:19 2016
>>> @@ -8775,6 +8775,20 @@
>>>                                         "\"$(SYSTEM_LIBRARY_DIR)/Priva
>>> teFrameworks\"",
>>>                                 );
>>>                                 GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
>>> +                               GCC_PREPROCESSOR_DEFINITIONS = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_DEBUG,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>> +                               "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]"
>>> = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_DEBUG,
>>> +                                       LLDB_DISABLE_PYTHON,
>>> +                                       NO_XPC_SERVICES,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>>                                 HEADER_SEARCH_PATHS =
>>> /usr/include/libxml2;
>>>                                 LLDB_COMPRESSION_CFLAGS = "";
>>>                                 "LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11]"
>>> = "-DHAVE_LIBCOMPRESSION=1";
>>> @@ -8820,6 +8834,20 @@
>>>                                         "\"$(SYSTEM_LIBRARY_DIR)/Priva
>>> teFrameworks\"",
>>>                                 );
>>>                                 GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
>>> +                               GCC_PREPROCESSOR_DEFINITIONS = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_RELEASE,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>> +                               "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]"
>>> = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_RELEASE,
>>> +                                       LLDB_DISABLE_PYTHON,
>>> +                                       NO_XPC_SERVICES,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>>                                 HEADER_SEARCH_PATHS =
>>> /usr/include/libxml2;
>>>                                 LLDB_COMPRESSION_CFLAGS = "";
>>>                                 "LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11]"
>>> = "-DHAVE_LIBCOMPRESSION=1";
>>> @@ -8865,6 +8893,20 @@
>>>                                         "\"$(SYSTEM_LIBRARY_DIR)/Priva
>>> teFrameworks\"",
>>>                                 );
>>>                                 GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
>>> +                               GCC_PREPROCESSOR_DEFINITIONS = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_BUILD_AND_
>>> INTEGRATION,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>> +                               "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]"
>>> = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_BUILD_AND_
>>> INTEGRATION,
>>> +                                       LLDB_DISABLE_PYTHON,
>>> +                                       NO_XPC_SERVICES,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>>                                 HEADER_SEARCH_PATHS =
>>> /usr/include/libxml2;
>>>                                 LLDB_COMPRESSION_CFLAGS = "";
>>>                                 "LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11]"
>>> = "-DHAVE_LIBCOMPRESSION=1";
>>> @@ -9864,6 +9906,20 @@
>>>                                         "\"$(SYSTEM_LIBRARY_DIR)/Priva
>>> teFrameworks\"",
>>>                                 );
>>>                                 GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
>>> +                               GCC_PREPROCESSOR_DEFINITIONS = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_DEBUG,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>> +                               "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]"
>>> = (
>>> +                                       __STDC_CONSTANT_MACROS,
>>> +                                       __STDC_LIMIT_MACROS,
>>> +                                       LLDB_CONFIGURATION_DEBUG,
>>> +                                       LLDB_DISABLE_PYTHON,
>>> +                                       NO_XPC_SERVICES,
>>> +                                       "LLDB_VERSION_STRING=\"lldb-$
>>> {CURRENT_PROJECT_VERSION}\"",
>>> +                               );
>>>                                 HEADER_SEARCH_PATHS =
>>> /usr/include/libxml2;
>>>                                 LLDB_COMPRESSION_CFLAGS = "";
>>>                                 "LLDB_COMPRESSION_CFLAGS[sdk=macosx10.11]"
>>> = "-DHAVE_LIBCOMPRESSION=1";
>>>
>>> Modified: lldb/trunk/source/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeL
>>> ists.txt?rev=286479&r1=286478&r2=286479&view=diff
>>> ============================================================
>>> ==================
>>> --- lldb/trunk/source/CMakeLists.txt (original)
>>> +++ lldb/trunk/source/CMakeLists.txt Thu Nov 10 11:33:19 2016
>>> @@ -25,21 +25,6 @@ set(lldbBase_SOURCES
>>>      lldb.cpp
>>>    )
>>>
>>> -if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
>>> -  set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
>>> -  add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
>>> -    COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
>>> -            ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj
>>> liblldb_core
>>> -            > ${LLDB_VERS_GENERATED_FILE}
>>> -    DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
>>> -            ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj)
>>> -  set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES
>>> GENERATED 1)
>>> -  # Add this to lldbBase since lldb.cpp uses the symbol defined here.
>>> -  list(APPEND lldbBase_SOURCES ${LLDB_VERS_GENERATED_FILE})
>>> -  add_custom_target(lldbGeneratedVersion
>>> -    DEPENDS ${LLDB_VERS_GENERATED_FILE})
>>> -endif()
>>> -
>>>  foreach(file
>>>          "${LLDB_SOURCE_DIR}/.git/logs/HEAD" # Git
>>>          "${LLDB_SOURCE_DIR}/.svn/wc.db"     # SVN 1.7
>>> @@ -75,14 +60,37 @@ if(DEFINED lldb_vc)
>>>    list(APPEND lldbBase_SOURCES ${version_inc})
>>>  endif()
>>>
>>> +if(APPLE)
>>> +  set(apple_version_inc "${CMAKE_CURRENT_BINARY_DIR}/AppleVersion.inc")
>>> +  set(apple_version_script "${LLDB_SOURCE_DIR}/cmake/modu
>>> les/EmbedAppleVersion.cmake")
>>> +  set(info_plist ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist)
>>> +
>>> +  # Create custom target to generate the VC revision include.
>>> +  add_custom_command(OUTPUT "${apple_version_inc}"
>>> +    DEPENDS "${apple_version_script}" "${info_plist}"
>>> +    COMMAND
>>> +    ${CMAKE_COMMAND} "-DLLDB_INFO_PLIST=${info_plist}"
>>> +                     "-DHEADER_FILE=${apple_version_inc}"
>>> +                     -P "${apple_version_script}")
>>> +
>>> +  # Mark the generated header as being generated.
>>> +  set_source_files_properties("${apple_version_inc}"
>>> +    PROPERTIES GENERATED TRUE
>>> +               HEADER_FILE_ONLY TRUE)
>>> +
>>> +  # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
>>> +  set_source_files_properties(lldb.cpp
>>> +    PROPERTIES COMPILE_DEFINITIONS "HAVE_APPLE_VERSION_INC")
>>> +  list(APPEND lldbBase_SOURCES ${apple_version_inc})
>>> +elseif(LLDB_VERSION_STRING)
>>> +  set_source_files_properties(lldb.cpp
>>> +    PROPERTIES COMPILE_DEFINITIONS "LLDB_VERSION_STRING=\"${LLDB_
>>> VERSION_STRING}\"")
>>> +endif()
>>> +
>>>  add_lldb_library(lldbBase
>>>    ${lldbBase_SOURCES}
>>>    )
>>>
>>> -if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
>>> -  add_dependencies(lldbBase lldbGeneratedVersion)
>>> -endif()
>>> -
>>>  add_subdirectory(Breakpoint)
>>>  add_subdirectory(Commands)
>>>  add_subdirectory(Core)
>>>
>>> Modified: lldb/trunk/source/lldb.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.c
>>> pp?rev=286479&r1=286478&r2=286479&view=diff
>>> ============================================================
>>> ==================
>>> --- lldb/trunk/source/lldb.cpp (original)
>>> +++ lldb/trunk/source/lldb.cpp Thu Nov 10 11:33:19 2016
>>> @@ -12,16 +12,16 @@
>>>  using namespace lldb;
>>>  using namespace lldb_private;
>>>
>>> -#if defined(__APPLE__)
>>> -extern "C" const unsigned char liblldb_coreVersionString[];
>>> -#else
>>> -
>>>  #include "clang/Basic/Version.h"
>>>
>>>  #ifdef HAVE_SVN_VERSION_INC
>>>  #  include "SVNVersion.inc"
>>>  #endif
>>>
>>> +#ifdef HAVE_APPLE_VERSION_INC
>>> +#  include "AppleVersion.inc"
>>> +#endif
>>> +
>>>  static const char *GetLLDBRevision() {
>>>  #ifdef LLDB_REVISION
>>>    return LLDB_REVISION;
>>> @@ -38,33 +38,8 @@ static const char *GetLLDBRepository() {
>>>  #endif
>>>  }
>>>
>>> -#endif
>>>
>>>  const char *lldb_private::GetVersion() {
>>> -#if defined(__APPLE__)
>>> -  static char g_version_string[32];
>>> -  if (g_version_string[0] == '\0') {
>>> -    const char *version_string =
>>> -        ::strstr((const char *)liblldb_coreVersionString, "PROJECT:");
>>> -
>>> -    if (version_string)
>>> -      version_string += sizeof("PROJECT:") - 1;
>>> -    else
>>> -      version_string = "unknown";
>>> -
>>> -    const char *newline_loc = strchr(version_string, '\n');
>>> -
>>> -    size_t version_len = sizeof(g_version_string) - 1;
>>> -
>>> -    if (newline_loc &&
>>> -        (newline_loc - version_string < static_cast<ptrdiff_t>(version
>>> _len)))
>>> -      version_len = newline_loc - version_string;
>>> -
>>> -    ::snprintf(g_version_string, version_len + 1, "%s", version_string);
>>> -  }
>>> -
>>> -  return g_version_string;
>>> -#else
>>>    // On platforms other than Darwin, report a version number in the
>>> same style
>>>    // as the clang tool.
>>>    static std::string g_version_str;
>>> @@ -81,21 +56,24 @@ const char *lldb_private::GetVersion() {
>>>      if (lldb_rev) {
>>>        g_version_str += " revision ";
>>>        g_version_str += lldb_rev;
>>> +      g_version_str += ")";
>>>      }
>>> +#ifdef LLDB_VERSION_STRING
>>> +    g_version_str += " (";
>>> +    g_version_str += LLDB_VERSION_STRING;
>>> +    g_version_str += ")";
>>> +#endif
>>>      std::string clang_rev(clang::getClangRevision());
>>>      if (clang_rev.length() > 0) {
>>> -      g_version_str += " clang revision ";
>>> +      g_version_str += "\n  clang revision ";
>>>        g_version_str += clang_rev;
>>>      }
>>>      std::string llvm_rev(clang::getLLVMRevision());
>>>      if (llvm_rev.length() > 0) {
>>> -      g_version_str += " llvm revision ";
>>> +      g_version_str += "\n  llvm revision ";
>>>        g_version_str += llvm_rev;
>>>      }
>>> -
>>> -    if (lldb_repo)
>>> -      g_version_str += ")";
>>> +
>>>    }
>>>    return g_version_str.c_str();
>>> -#endif
>>>  }
>>>
>>>
>>> _______________________________________________
>>> lldb-commits mailing list
>>> lldb-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>>
>>
>>
>>
>> --
>> Tim <penryu at gmail.com>
>>
>
>
>
> --
> -Todd
>
>
>


-- 
Tim <penryu at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161110/577f8250/attachment-0001.html>


More information about the lldb-commits mailing list