28
28
#include < memory>
29
29
#include < set>
30
30
#include < string>
31
+ #include < string_view>
31
32
#include < unordered_map>
32
33
#include < vector>
33
34
34
- #include " absl/strings/string_view.h"
35
35
#include " absl/strings/strip.h"
36
36
#include " capstone/capstone.h"
37
37
@@ -69,21 +69,21 @@ enum class DataSource {
69
69
70
70
class InputFile {
71
71
public:
72
- InputFile (absl ::string_view filename) : filename_(filename) {}
72
+ InputFile (std ::string_view filename) : filename_(filename) {}
73
73
InputFile (const InputFile&) = delete ;
74
74
InputFile& operator =(const InputFile&) = delete ;
75
- virtual bool TryOpen (absl ::string_view filename,
75
+ virtual bool TryOpen (std ::string_view filename,
76
76
std::unique_ptr<InputFile>& file) = 0;
77
77
virtual ~InputFile () {}
78
78
79
79
const std::string& filename () const { return filename_; }
80
- absl ::string_view data () const { return data_; }
80
+ std ::string_view data () const { return data_; }
81
81
82
82
private:
83
83
const std::string filename_;
84
84
85
85
protected:
86
- absl ::string_view data_;
86
+ std ::string_view data_;
87
87
};
88
88
89
89
class InputFileFactory {
@@ -129,34 +129,34 @@ class RangeSink {
129
129
// If vmsize or filesize is zero, this mapping is presumed not to exist in
130
130
// that domain. For example, .bss mappings don't exist in the file, and
131
131
// .debug_* mappings don't exist in memory.
132
- void AddRange (const char *analyzer, absl ::string_view name, uint64_t vmaddr,
132
+ void AddRange (const char *analyzer, std ::string_view name, uint64_t vmaddr,
133
133
uint64_t vmsize, uint64_t fileoff, uint64_t filesize);
134
134
135
- void AddRange (const char *analyzer, absl ::string_view name, uint64_t vmaddr,
136
- uint64_t vmsize, absl ::string_view file_range) {
135
+ void AddRange (const char *analyzer, std ::string_view name, uint64_t vmaddr,
136
+ uint64_t vmsize, std ::string_view file_range) {
137
137
AddRange (analyzer, name, vmaddr, vmsize,
138
138
file_range.data () - file_->data ().data (), file_range.size ());
139
139
}
140
140
141
- void AddFileRange (const char * analyzer, absl ::string_view name,
141
+ void AddFileRange (const char * analyzer, std ::string_view name,
142
142
uint64_t fileoff, uint64_t filesize);
143
143
144
144
// Like AddFileRange(), but the label is whatever label was previously
145
145
// assigned to VM address |label_from_vmaddr|. If no existing label is
146
146
// assigned to |label_from_vmaddr|, this function does nothing.
147
147
void AddFileRangeForVMAddr (const char * analyzer, uint64_t label_from_vmaddr,
148
- absl ::string_view file_range);
148
+ std ::string_view file_range);
149
149
void AddVMRangeForVMAddr (const char * analyzer, uint64_t label_from_vmaddr,
150
150
uint64_t addr, uint64_t size);
151
151
152
152
// Applies this label from |from_file_range| to |file_range|, but only if the
153
153
// entire |from_file_range| has a single label. If not, this does nothing.
154
154
void AddFileRangeForFileRange (const char * analyzer,
155
- absl ::string_view from_file_range,
156
- absl ::string_view file_range);
155
+ std ::string_view from_file_range,
156
+ std ::string_view file_range);
157
157
158
- void AddFileRange (const char * analyzer, absl ::string_view name,
159
- absl ::string_view file_range) {
158
+ void AddFileRange (const char * analyzer, std ::string_view name,
159
+ std ::string_view file_range) {
160
160
// When separate debug files are being used, the DWARF analyzer will try to
161
161
// add sections of the debug file. We want to prevent this because we only
162
162
// want to profile the main file (not the debug file), so we filter these
@@ -202,21 +202,21 @@ class RangeSink {
202
202
// Translates the given pointer (which must be within the range of
203
203
// input_file().data()) to a VM address.
204
204
uint64_t TranslateFileToVM (const char * ptr);
205
- absl ::string_view TranslateVMToFile (uint64_t address);
205
+ std ::string_view TranslateVMToFile (uint64_t address);
206
206
const DualMap* Translator () { return translator_; }
207
207
208
208
209
209
// Decompresses zlib-formatted data and returns the decompressed data.
210
210
// Since the decompressed data is not actually part of the file, any
211
211
// Add*Range() calls to this region will be no-ops.
212
- absl ::string_view ZlibDecompress (absl ::string_view contents,
212
+ std ::string_view ZlibDecompress (std ::string_view contents,
213
213
uint64_t uncompressed_size);
214
214
215
215
static constexpr uint64_t kUnknownSize = RangeMap::kUnknownSize ;
216
216
217
217
private:
218
218
bool FileContainsPointer (const void * ptr) const {
219
- absl ::string_view file_data = file_->data ();
219
+ std ::string_view file_data = file_->data ();
220
220
return ptr >= file_data.data () && ptr < file_data.data () + file_data.size ();
221
221
}
222
222
@@ -246,15 +246,15 @@ class NameMunger {
246
246
// Adds a regex that will be applied to all names. All regexes will be
247
247
// applied in sequence.
248
248
void AddRegex (const std::string& regex, const std::string& replacement);
249
- std::string Munge (absl ::string_view name) const ;
249
+ std::string Munge (std ::string_view name) const ;
250
250
251
251
bool IsEmpty () const { return regexes_.empty (); }
252
252
253
253
private:
254
254
std::vector<std::pair<std::unique_ptr<ReImpl>, std::string>> regexes_;
255
255
};
256
256
257
- typedef std::map<absl ::string_view, std::pair<uint64_t , uint64_t >> SymbolTable;
257
+ typedef std::map<std ::string_view, std::pair<uint64_t , uint64_t >> SymbolTable;
258
258
259
259
// Represents an object/executable file in a format like ELF, Mach-O, PE, etc.
260
260
// To support a new file type, implement this interface.
@@ -271,7 +271,7 @@ class ObjectFile {
271
271
// given here, otherwise it is |this|.
272
272
virtual void ProcessFile (const std::vector<RangeSink*>& sinks) const = 0;
273
273
274
- virtual bool GetDisassemblyInfo (absl ::string_view symbol,
274
+ virtual bool GetDisassemblyInfo (std ::string_view symbol,
275
275
DataSource symbol_source,
276
276
DisassemblyInfo* info) const = 0;
277
277
@@ -307,12 +307,12 @@ inline void ReadDWARFCompileUnits(const dwarf::File& file, const DualMap& map,
307
307
}
308
308
void ReadDWARFInlines (const dwarf::File& file, RangeSink* sink,
309
309
bool include_line);
310
- void ReadEhFrame (absl ::string_view contents, RangeSink* sink);
311
- void ReadEhFrameHdr (absl ::string_view contents, RangeSink* sink);
310
+ void ReadEhFrame (std ::string_view contents, RangeSink* sink);
311
+ void ReadEhFrameHdr (std ::string_view contents, RangeSink* sink);
312
312
313
313
// Demangle C++ symbols according to the Itanium ABI. The |source| argument
314
314
// controls what demangling mode we are using.
315
- std::string ItaniumDemangle (absl ::string_view symbol, DataSource source);
315
+ std::string ItaniumDemangle (std ::string_view symbol, DataSource source);
316
316
317
317
318
318
// DualMap /////////////////////////////////////////////////////////////////////
@@ -325,7 +325,7 @@ struct DualMap {
325
325
};
326
326
327
327
struct DisassemblyInfo {
328
- absl ::string_view text;
328
+ std ::string_view text;
329
329
DualMap symbol_map;
330
330
cs_arch arch;
331
331
cs_mode mode;
@@ -398,17 +398,17 @@ struct RollupOutput {
398
398
RollupOutput (const RollupOutput&) = delete ;
399
399
RollupOutput& operator =(const RollupOutput&) = delete ;
400
400
401
- void AddDataSourceName (absl ::string_view name) {
401
+ void AddDataSourceName (std ::string_view name) {
402
402
source_names_.emplace_back (std::string (name));
403
403
}
404
404
405
405
const std::vector<std::string>& source_names () const { return source_names_; }
406
406
void Print (const OutputOptions& options, std::ostream* out);
407
- void SetDisassembly (absl ::string_view disassembly) {
407
+ void SetDisassembly (std ::string_view disassembly) {
408
408
disassembly_ = std::string (disassembly);
409
409
}
410
410
411
- absl ::string_view GetDisassembly () { return disassembly_; }
411
+ std ::string_view GetDisassembly () { return disassembly_; }
412
412
413
413
// For debugging.
414
414
const RollupRow& toplevel_row () const { return toplevel_row_; }
0 commit comments