[Lldb-commits] [lldb] r232673 - Move some functions from source/lldb.cpp to Utility.
Zachary Turner
zturner at google.com
Wed Mar 18 14:31:45 PDT 2015
Author: zturner
Date: Wed Mar 18 16:31:45 2015
New Revision: 232673
URL: http://llvm.org/viewvc/llvm-project?rev=232673&view=rev
Log:
Move some functions from source/lldb.cpp to Utility.
Specifically, there were some functions for converting enums
to strings and a function for matching a string using a specific
matching algorithm. This moves those functions to more appropriate
headers in lldb/Utility and updates references to include the
new headers.
Added:
lldb/trunk/include/lldb/Utility/ConvertEnum.h
lldb/trunk/include/lldb/Utility/NameMatches.h
lldb/trunk/source/Utility/ConvertEnum.cpp
lldb/trunk/source/Utility/NameMatches.cpp
Modified:
lldb/trunk/include/lldb/lldb-private.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Core/Section.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadList.cpp
lldb/trunk/source/Target/ThreadPlan.cpp
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/source/lldb.cpp
Added: lldb/trunk/include/lldb/Utility/ConvertEnum.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ConvertEnum.h?rev=232673&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Utility/ConvertEnum.h (added)
+++ lldb/trunk/include/lldb/Utility/ConvertEnum.h Wed Mar 18 16:31:45 2015
@@ -0,0 +1,22 @@
+//===-- ConvertEnum.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLDB_UTILITY_CONVERTENUM_H
+#define LLDB_UTILITY_CONVERTENUM_H
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+
+namespace lldb_private
+{
+
+const char *GetVoteAsCString(Vote vote);
+const char *GetSectionTypeAsCString(lldb::SectionType sect_type);
+}
+
+#endif
Added: lldb/trunk/include/lldb/Utility/NameMatches.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/NameMatches.h?rev=232673&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Utility/NameMatches.h (added)
+++ lldb/trunk/include/lldb/Utility/NameMatches.h Wed Mar 18 16:31:45 2015
@@ -0,0 +1,19 @@
+//===-- NameMatches.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLDB_UTILITY_NAMEMATCHES_H
+#define LLDB_UTILITY_NAMEMATCHES_H
+
+#include "lldb/lldb-private-enumerations.h"
+
+namespace lldb_private
+{
+bool NameMatches(const char *name, NameMatchType match_type, const char *match);
+}
+
+#endif
Modified: lldb/trunk/include/lldb/lldb-private.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private.h?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private.h (original)
+++ lldb/trunk/include/lldb/lldb-private.h Wed Mar 18 16:31:45 2015
@@ -94,15 +94,6 @@ TerminateLLGS();
const char *
GetVersion ();
-const char *
-GetVoteAsCString (Vote vote);
-
-const char *
-GetSectionTypeAsCString (lldb::SectionType sect_type);
-
-bool
-NameMatches (const char *name, NameMatchType match_type, const char *match);
-
} // namespace lldb_private
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Mar 18 16:31:45 2015
@@ -684,6 +684,8 @@
33E5E8461A6736D30024ED68 /* StringConvert.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33E5E8451A6736D30024ED68 /* StringConvert.h */; };
33E5E8471A674FB60024ED68 /* StringConvert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33E5E8411A672A240024ED68 /* StringConvert.cpp */; };
3F8160A61AB9F7DD001DA9DF /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F8160A51AB9F7DD001DA9DF /* Logging.cpp */; };
+ 3F8169191ABA2419001DA9DF /* ConvertEnum.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F8169171ABA2419001DA9DF /* ConvertEnum.cpp */; };
+ 3F81691A1ABA2419001DA9DF /* NameMatches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F8169181ABA2419001DA9DF /* NameMatches.cpp */; };
3FDFDDBD199C3A06009756A7 /* FileAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FDFDDBC199C3A06009756A7 /* FileAction.cpp */; };
3FDFDDBF199D345E009756A7 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FDFDDBE199D345E009756A7 /* FileCache.cpp */; };
3FDFDDC6199D37ED009756A7 /* FileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FDFDDC5199D37ED009756A7 /* FileSystem.cpp */; };
@@ -2159,6 +2161,10 @@
3F5E8AF31A40D4A500A73232 /* PipeBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PipeBase.h; path = include/lldb/Host/PipeBase.h; sourceTree = "<group>"; };
3F8160A51AB9F7DD001DA9DF /* Logging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Logging.cpp; path = source/Core/Logging.cpp; sourceTree = "<group>"; };
3F8160A71AB9F809001DA9DF /* Logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = include/lldb/Core/Logging.h; sourceTree = "<group>"; };
+ 3F8169171ABA2419001DA9DF /* ConvertEnum.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConvertEnum.cpp; path = source/Utility/ConvertEnum.cpp; sourceTree = "<group>"; };
+ 3F8169181ABA2419001DA9DF /* NameMatches.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NameMatches.cpp; path = source/Utility/NameMatches.cpp; sourceTree = "<group>"; };
+ 3F81691B1ABA242B001DA9DF /* ConvertEnum.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ConvertEnum.h; path = include/lldb/Utility/ConvertEnum.h; sourceTree = "<group>"; };
+ 3F81691C1ABA242B001DA9DF /* NameMatches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NameMatches.h; path = include/lldb/Utility/NameMatches.h; sourceTree = "<group>"; };
3FDFD6C3199C396E009756A7 /* FileAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileAction.h; path = include/lldb/Target/FileAction.h; sourceTree = "<group>"; };
3FDFDDBC199C3A06009756A7 /* FileAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileAction.cpp; path = source/Target/FileAction.cpp; sourceTree = "<group>"; };
3FDFDDBE199D345E009756A7 /* FileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileCache.cpp; path = source/Host/common/FileCache.cpp; sourceTree = "<group>"; };
@@ -3466,6 +3472,8 @@
264A12FE137252C700875C42 /* ARM64_DWARF_Registers.cpp */,
26F996A8119B79C300412154 /* ARM_GCC_Registers.h */,
264723A511FA076E00DE380C /* CleanUp.h */,
+ 3F81691B1ABA242B001DA9DF /* ConvertEnum.h */,
+ 3F8169171ABA2419001DA9DF /* ConvertEnum.cpp */,
4C73152119B7D71700F865A4 /* Iterable.h */,
942829541A89614000521B30 /* JSON.h */,
942829551A89614C00521B30 /* JSON.cpp */,
@@ -3473,6 +3481,8 @@
943BDEFD1AA7B2F800789CE8 /* LLDBAssert.cpp */,
26D1804416CEE12500EDFB5B /* KQueue.h */,
26D1803C16CEBFD300EDFB5B /* KQueue.cpp */,
+ 3F81691C1ABA242B001DA9DF /* NameMatches.h */,
+ 3F8169181ABA2419001DA9DF /* NameMatches.cpp */,
94031A9F13CF5B3D00DCFF3C /* PriorityPointerPair.h */,
94F6C4D119C264C70049D089 /* ProcessStructReader.h */,
2682F16B115EDA0D00CCFF99 /* PseudoTerminal.h */,
@@ -5942,6 +5952,7 @@
2689004C13353E0400698AC0 /* SourceManager.cpp in Sources */,
2689004D13353E0400698AC0 /* State.cpp in Sources */,
94D0B10D16D5535900EA9C70 /* LibStdcpp.cpp in Sources */,
+ 3F81691A1ABA2419001DA9DF /* NameMatches.cpp in Sources */,
AF0E22F018A09FB20009B7D1 /* AppleGetItemInfoHandler.cpp in Sources */,
2689004E13353E0400698AC0 /* Stream.cpp in Sources */,
9439FB1A19EF140C006FD6A4 /* NSIndexPath.cpp in Sources */,
@@ -6120,6 +6131,7 @@
268900EF13353E6F00698AC0 /* Platform.cpp in Sources */,
268900F013353E6F00698AC0 /* Process.cpp in Sources */,
26BC17AD18C7F4CB00D2196D /* RegisterContextPOSIXCore_mips64.cpp in Sources */,
+ 3F8169191ABA2419001DA9DF /* ConvertEnum.cpp in Sources */,
268900F113353E6F00698AC0 /* RegisterContext.cpp in Sources */,
6D55BAED1A8CD0A800A70529 /* PlatformAndroid.cpp in Sources */,
268900F213353E6F00698AC0 /* SectionLoadList.cpp in Sources */,
Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Wed Mar 18 16:31:45 2015
@@ -18,7 +18,7 @@
#include "llvm/Support/COFF.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/Host.h"
-#include "lldb/Utility/SafeMachO.h"
+
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/StringList.h"
#include "lldb/Host/Endian.h"
@@ -27,6 +27,8 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/NameMatches.h"
+#include "lldb/Utility/SafeMachO.h"
#include "Plugins/Process/Utility/ARMDefines.h"
#include "Plugins/Process/Utility/InstructionUtils.h"
Modified: lldb/trunk/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Wed Mar 18 16:31:45 2015
@@ -27,6 +27,7 @@
#include "lldb/Host/ThisThread.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/NameMatches.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
Modified: lldb/trunk/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Core/Section.cpp (original)
+++ lldb/trunk/source/Core/Section.cpp Wed Mar 18 16:31:45 2015
@@ -12,6 +12,7 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ConvertEnum.h"
#include <limits>
Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Wed Mar 18 16:31:45 2015
@@ -55,6 +55,7 @@
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/NameMatches.h"
#include "cfcpp/CFCBundle.h"
#include "cfcpp/CFCMutableArray.h"
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Mar 18 16:31:45 2015
@@ -51,6 +51,7 @@
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanBase.h"
#include "lldb/Target/UnixSignals.h"
+#include "lldb/Utility/NameMatches.h"
#include "Plugins/Process/Utility/InferiorCallPOSIX.h"
using namespace lldb;
Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Wed Mar 18 16:31:45 2015
@@ -17,6 +17,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/ConvertEnum.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlan.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlan.cpp Wed Mar 18 16:31:45 2015
@@ -22,6 +22,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ConvertEnum.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Wed Mar 18 16:31:45 2015
@@ -3,10 +3,12 @@ set(LLVM_NO_RTTI 1)
add_lldb_library(lldbUtility
ARM_DWARF_Registers.cpp
ARM64_DWARF_Registers.cpp
+ ConvertEnum.cpp
JSON.cpp
KQueue.cpp
LLDBAssert.cpp
ModuleCache.cpp
+ NameMatches.cpp
PseudoTerminal.cpp
Range.cpp
RegisterNumber.cpp
Added: lldb/trunk/source/Utility/ConvertEnum.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ConvertEnum.cpp?rev=232673&view=auto
==============================================================================
--- lldb/trunk/source/Utility/ConvertEnum.cpp (added)
+++ lldb/trunk/source/Utility/ConvertEnum.cpp Wed Mar 18 16:31:45 2015
@@ -0,0 +1,110 @@
+//===-- ConvertEnum.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/Utility/ConvertEnum.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+const char *
+lldb_private::GetVoteAsCString(Vote vote)
+{
+ switch (vote)
+ {
+ case eVoteNo:
+ return "no";
+ case eVoteNoOpinion:
+ return "no opinion";
+ case eVoteYes:
+ return "yes";
+ }
+ return "invalid";
+}
+
+const char *
+lldb_private::GetSectionTypeAsCString(lldb::SectionType sect_type)
+{
+ switch (sect_type)
+ {
+ case eSectionTypeInvalid:
+ return "invalid";
+ case eSectionTypeCode:
+ return "code";
+ case eSectionTypeContainer:
+ return "container";
+ case eSectionTypeData:
+ return "data";
+ case eSectionTypeDataCString:
+ return "data-cstr";
+ case eSectionTypeDataCStringPointers:
+ return "data-cstr-ptr";
+ case eSectionTypeDataSymbolAddress:
+ return "data-symbol-addr";
+ case eSectionTypeData4:
+ return "data-4-byte";
+ case eSectionTypeData8:
+ return "data-8-byte";
+ case eSectionTypeData16:
+ return "data-16-byte";
+ case eSectionTypeDataPointers:
+ return "data-ptrs";
+ case eSectionTypeDebug:
+ return "debug";
+ case eSectionTypeZeroFill:
+ return "zero-fill";
+ case eSectionTypeDataObjCMessageRefs:
+ return "objc-message-refs";
+ case eSectionTypeDataObjCCFStrings:
+ return "objc-cfstrings";
+ case eSectionTypeDWARFDebugAbbrev:
+ return "dwarf-abbrev";
+ case eSectionTypeDWARFDebugAranges:
+ return "dwarf-aranges";
+ case eSectionTypeDWARFDebugFrame:
+ return "dwarf-frame";
+ case eSectionTypeDWARFDebugInfo:
+ return "dwarf-info";
+ case eSectionTypeDWARFDebugLine:
+ return "dwarf-line";
+ case eSectionTypeDWARFDebugLoc:
+ return "dwarf-loc";
+ case eSectionTypeDWARFDebugMacInfo:
+ return "dwarf-macinfo";
+ case eSectionTypeDWARFDebugPubNames:
+ return "dwarf-pubnames";
+ case eSectionTypeDWARFDebugPubTypes:
+ return "dwarf-pubtypes";
+ case eSectionTypeDWARFDebugRanges:
+ return "dwarf-ranges";
+ case eSectionTypeDWARFDebugStr:
+ return "dwarf-str";
+ case eSectionTypeELFSymbolTable:
+ return "elf-symbol-table";
+ case eSectionTypeELFDynamicSymbols:
+ return "elf-dynamic-symbols";
+ case eSectionTypeELFRelocationEntries:
+ return "elf-relocation-entries";
+ case eSectionTypeELFDynamicLinkInfo:
+ return "elf-dynamic-link-info";
+ case eSectionTypeDWARFAppleNames:
+ return "apple-names";
+ case eSectionTypeDWARFAppleTypes:
+ return "apple-types";
+ case eSectionTypeDWARFAppleNamespaces:
+ return "apple-namespaces";
+ case eSectionTypeDWARFAppleObjC:
+ return "apple-objc";
+ case eSectionTypeEHFrame:
+ return "eh-frame";
+ case eSectionTypeCompactUnwind:
+ return "compact-unwind";
+ case eSectionTypeOther:
+ return "regular";
+ }
+ return "unknown";
+}
Added: lldb/trunk/source/Utility/NameMatches.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/NameMatches.cpp?rev=232673&view=auto
==============================================================================
--- lldb/trunk/source/Utility/NameMatches.cpp (added)
+++ lldb/trunk/source/Utility/NameMatches.cpp Wed Mar 18 16:31:45 2015
@@ -0,0 +1,50 @@
+//===-- NameMatches.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/Core/RegularExpression.h"
+#include "lldb/Utility/NameMatches.h"
+
+#include "llvm/ADT/StringRef.h"
+
+using namespace lldb_private;
+
+bool
+lldb_private::NameMatches(const char *name, NameMatchType match_type, const char *match)
+{
+ if (match_type == eNameMatchIgnore)
+ return true;
+
+ if (name == match)
+ return true;
+
+ if (name && match)
+ {
+ llvm::StringRef name_sref(name);
+ llvm::StringRef match_sref(match);
+ switch (match_type)
+ {
+ case eNameMatchIgnore: // This case cannot occur: tested before
+ return true;
+ case eNameMatchEquals:
+ return name_sref == match_sref;
+ case eNameMatchContains:
+ return name_sref.find(match_sref) != llvm::StringRef::npos;
+ case eNameMatchStartsWith:
+ return name_sref.startswith(match_sref);
+ case eNameMatchEndsWith:
+ return name_sref.endswith(match_sref);
+ case eNameMatchRegularExpression:
+ {
+ RegularExpression regex(match);
+ return regex.Execute(name);
+ }
+ break;
+ }
+ }
+ return false;
+}
Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=232673&r1=232672&r2=232673&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Wed Mar 18 16:31:45 2015
@@ -466,97 +466,3 @@ lldb_private::GetVersion ()
return g_version_str.c_str();
#endif
}
-
-const char *
-lldb_private::GetVoteAsCString (Vote vote)
-{
- switch (vote)
- {
- case eVoteNo: return "no";
- case eVoteNoOpinion: return "no opinion";
- case eVoteYes: return "yes";
- }
- return "invalid";
-}
-
-
-const char *
-lldb_private::GetSectionTypeAsCString (SectionType sect_type)
-{
- switch (sect_type)
- {
- case eSectionTypeInvalid: return "invalid";
- case eSectionTypeCode: return "code";
- case eSectionTypeContainer: return "container";
- case eSectionTypeData: return "data";
- case eSectionTypeDataCString: return "data-cstr";
- case eSectionTypeDataCStringPointers: return "data-cstr-ptr";
- case eSectionTypeDataSymbolAddress: return "data-symbol-addr";
- case eSectionTypeData4: return "data-4-byte";
- case eSectionTypeData8: return "data-8-byte";
- case eSectionTypeData16: return "data-16-byte";
- case eSectionTypeDataPointers: return "data-ptrs";
- case eSectionTypeDebug: return "debug";
- case eSectionTypeZeroFill: return "zero-fill";
- case eSectionTypeDataObjCMessageRefs: return "objc-message-refs";
- case eSectionTypeDataObjCCFStrings: return "objc-cfstrings";
- case eSectionTypeDWARFDebugAbbrev: return "dwarf-abbrev";
- case eSectionTypeDWARFDebugAranges: return "dwarf-aranges";
- case eSectionTypeDWARFDebugFrame: return "dwarf-frame";
- case eSectionTypeDWARFDebugInfo: return "dwarf-info";
- case eSectionTypeDWARFDebugLine: return "dwarf-line";
- case eSectionTypeDWARFDebugLoc: return "dwarf-loc";
- case eSectionTypeDWARFDebugMacInfo: return "dwarf-macinfo";
- case eSectionTypeDWARFDebugPubNames: return "dwarf-pubnames";
- case eSectionTypeDWARFDebugPubTypes: return "dwarf-pubtypes";
- case eSectionTypeDWARFDebugRanges: return "dwarf-ranges";
- case eSectionTypeDWARFDebugStr: return "dwarf-str";
- case eSectionTypeELFSymbolTable: return "elf-symbol-table";
- case eSectionTypeELFDynamicSymbols: return "elf-dynamic-symbols";
- case eSectionTypeELFRelocationEntries: return "elf-relocation-entries";
- case eSectionTypeELFDynamicLinkInfo: return "elf-dynamic-link-info";
- case eSectionTypeDWARFAppleNames: return "apple-names";
- case eSectionTypeDWARFAppleTypes: return "apple-types";
- case eSectionTypeDWARFAppleNamespaces: return "apple-namespaces";
- case eSectionTypeDWARFAppleObjC: return "apple-objc";
- case eSectionTypeEHFrame: return "eh-frame";
- case eSectionTypeCompactUnwind: return "compact-unwind";
- case eSectionTypeOther: return "regular";
- }
- return "unknown";
-
-}
-
-bool
-lldb_private::NameMatches (const char *name,
- NameMatchType match_type,
- const char *match)
-{
- if (match_type == eNameMatchIgnore)
- return true;
-
- if (name == match)
- return true;
-
- if (name && match)
- {
- llvm::StringRef name_sref(name);
- llvm::StringRef match_sref(match);
- switch (match_type)
- {
- case eNameMatchIgnore: // This case cannot occur: tested before
- return true;
- case eNameMatchEquals: return name_sref == match_sref;
- case eNameMatchContains: return name_sref.find (match_sref) != llvm::StringRef::npos;
- case eNameMatchStartsWith: return name_sref.startswith (match_sref);
- case eNameMatchEndsWith: return name_sref.endswith (match_sref);
- case eNameMatchRegularExpression:
- {
- RegularExpression regex (match);
- return regex.Execute (name);
- }
- break;
- }
- }
- return false;
-}
More information about the lldb-commits
mailing list