2010-06-09 00:52:24 +08:00
|
|
|
//===-- lldb.cpp ------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/lldb-private.h"
|
2011-03-05 09:04:56 +08:00
|
|
|
|
2010-12-17 05:33:41 +08:00
|
|
|
using namespace lldb;
|
2010-06-09 00:52:24 +08:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
2013-03-01 02:09:18 +08:00
|
|
|
#include "clang/Basic/Version.h"
|
|
|
|
|
2016-09-24 07:33:52 +08:00
|
|
|
#ifdef HAVE_SVN_VERSION_INC
|
|
|
|
# include "SVNVersion.inc"
|
|
|
|
#endif
|
|
|
|
|
2016-11-11 01:33:19 +08:00
|
|
|
#ifdef HAVE_APPLE_VERSION_INC
|
|
|
|
# include "AppleVersion.inc"
|
|
|
|
#endif
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
static const char *GetLLDBRevision() {
|
2013-03-01 02:09:18 +08:00
|
|
|
#ifdef LLDB_REVISION
|
2016-09-07 04:57:50 +08:00
|
|
|
return LLDB_REVISION;
|
2013-03-01 02:09:18 +08:00
|
|
|
#else
|
2016-09-07 04:57:50 +08:00
|
|
|
return NULL;
|
2013-03-01 02:09:18 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
static const char *GetLLDBRepository() {
|
2013-03-01 02:09:18 +08:00
|
|
|
#ifdef LLDB_REPOSITORY
|
2016-09-07 04:57:50 +08:00
|
|
|
return LLDB_REPOSITORY;
|
2013-03-01 02:09:18 +08:00
|
|
|
#else
|
2016-09-07 04:57:50 +08:00
|
|
|
return NULL;
|
2013-03-01 02:09:18 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-03-01 00:51:15 +08:00
|
|
|
|
2016-11-11 05:30:16 +08:00
|
|
|
#define QUOTE(str) #str
|
|
|
|
#define EXPAND_AND_QUOTE(str) QUOTE(str)
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *lldb_private::GetVersion() {
|
|
|
|
// On platforms other than Darwin, report a version number in the same style
|
|
|
|
// as the clang tool.
|
|
|
|
static std::string g_version_str;
|
|
|
|
if (g_version_str.empty()) {
|
2016-11-15 06:43:08 +08:00
|
|
|
|
|
|
|
#ifdef LLDB_VERSION_STRING
|
|
|
|
g_version_str += EXPAND_AND_QUOTE(LLDB_VERSION_STRING);
|
|
|
|
#else
|
2016-09-07 04:57:50 +08:00
|
|
|
g_version_str += "lldb version ";
|
|
|
|
g_version_str += CLANG_VERSION_STRING;
|
2016-11-15 06:43:08 +08:00
|
|
|
#endif
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *lldb_repo = GetLLDBRepository();
|
|
|
|
const char *lldb_rev = GetLLDBRevision();
|
2016-11-15 06:43:08 +08:00
|
|
|
if (lldb_repo || lldb_rev) {
|
|
|
|
g_version_str += " (";
|
|
|
|
if (lldb_repo)
|
|
|
|
g_version_str += lldb_repo;
|
|
|
|
if (lldb_rev) {
|
|
|
|
g_version_str += " revision ";
|
|
|
|
g_version_str += lldb_rev;
|
|
|
|
}
|
2016-11-11 01:33:19 +08:00
|
|
|
g_version_str += ")";
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-11-15 06:43:08 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
std::string clang_rev(clang::getClangRevision());
|
|
|
|
if (clang_rev.length() > 0) {
|
2016-11-11 01:33:19 +08:00
|
|
|
g_version_str += "\n clang revision ";
|
2016-09-07 04:57:50 +08:00
|
|
|
g_version_str += clang_rev;
|
|
|
|
}
|
|
|
|
std::string llvm_rev(clang::getLLVMRevision());
|
|
|
|
if (llvm_rev.length() > 0) {
|
2016-11-11 01:33:19 +08:00
|
|
|
g_version_str += "\n llvm revision ";
|
2016-09-07 04:57:50 +08:00
|
|
|
g_version_str += llvm_rev;
|
|
|
|
}
|
2016-11-11 01:33:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return g_version_str.c_str();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|