1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
//===- SourceLanguage.h - Interact with source languages --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the abstract SourceLanguage interface, which is used by the
// LLVM debugger to parse source-language expressions and render program objects
// into a human readable string. In general, these classes perform all of the
// analysis and interpretation of the language-specific debugger information.
//
// This interface is designed to be completely stateless, so all methods are
// const.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGGER_SOURCELANGUAGE_H
#define LLVM_DEBUGGER_SOURCELANGUAGE_H
#include <string>
namespace llvm {
class GlobalVariable;
class SourceFileInfo;
class SourceFunctionInfo;
class ProgramInfo;
class RuntimeInfo;
struct SourceLanguage {
virtual ~SourceLanguage() {}
/// getSourceLanguageName - This method is used to implement the 'show
/// language' command in the debugger.
virtual const char *getSourceLanguageName() const = 0;
//===------------------------------------------------------------------===//
// Methods used to implement debugger hooks.
//
/// printInfo - Implementing this method allows the debugger to use
/// language-specific 'info' extensions, e.g., 'info selectors' for objc.
/// This method should return true if the specified string is recognized.
///
virtual bool printInfo(const std::string &What) const {
return false;
}
/// lookupFunction - Given a textual function name, return the
/// SourceFunctionInfo descriptor for that function, or null if it cannot be
/// found. If the program is currently running, the RuntimeInfo object
/// provides information about the current evaluation context, otherwise it
/// will be null.
///
virtual SourceFunctionInfo *lookupFunction(const std::string &FunctionName,
ProgramInfo &PI,
RuntimeInfo *RI = 0) const {
return 0;
}
//===------------------------------------------------------------------===//
// Methods used to parse various pieces of program information.
//
/// createSourceFileInfo - This method can be implemented by the front-end
/// if it needs to keep track of information beyond what the debugger
/// requires.
virtual SourceFileInfo *
createSourceFileInfo(const GlobalVariable *Desc, ProgramInfo &PI) const;
/// createSourceFunctionInfo - This method can be implemented by the derived
/// SourceLanguage if it needs to keep track of more information than the
/// SourceFunctionInfo has.
virtual SourceFunctionInfo *
createSourceFunctionInfo(const GlobalVariable *Desc, ProgramInfo &PI) const;
//===------------------------------------------------------------------===//
// Static methods used to get instances of various source languages.
//
/// get - This method returns a source-language instance for the specified
/// Dwarf 3 language identifier. If the language is unknown, an object is
/// returned that can support some minimal operations, but is not terribly
/// bright.
static const SourceLanguage &get(unsigned ID);
/// get*Instance() - These methods return specific instances of languages.
///
static const SourceLanguage &getCFamilyInstance();
static const SourceLanguage &getCPlusPlusInstance();
static const SourceLanguage &getUnknownLanguageInstance();
};
}
#endif
|