LLVM: include/llvm/DebugInfo/GSYM/GsymCreator.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H

10#define LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H

11

13#include

14#include

15#include

16#include

17

27

28namespace llvm {

29

30namespace gsym {

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

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

136

137 mutable std::mutex Mutex;

138 std::vector Funcs;

142

144 std::vectorllvm::gsym::FileEntry Files;

145 std::vector<uint8_t> UUID;

146 std::optional ValidTextRanges;

147 std::optional<uint64_t> BaseAddress;

148 bool IsSegment = false;

149 bool Finalized = false;

150 bool Quiet;

151

152

153

154

155

156

157 std::optional<uint64_t> getFirstFunctionAddress() const;

158

159

160

161

162

163 std::optional<uint64_t> getLastFunctionAddress() const;

164

165

166

167

168

169

170 std::optional<uint64_t> getBaseAddress() const;

171

172

173

174

175

176

177

178

179

180 uint8_t getAddressOffsetSize() const;

181

182

183

184

185

186

187

188

189

190 uint64_t getMaxAddressOffset() const;

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205 uint64_t calculateHeaderAndTableSize() const;

206

207

208

209

210

211

212

213

214

215

216

217

218

220

221

222

223

224

225

226

227

228

229

230

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

248

249

250

251

252

253

254

256

257

258

259

260

261

262

263

264

265

266

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

285

286

287

288

289

290

291 void setIsSegment() {

292 IsSegment = true;

293 }

294

295public:

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

314 std::optional<uint64_t> SegmentSize = std::nullopt) const;

315

316

317

318

319

321

322

323

324

325

326

327

328

329

330

331

333

334

335

336

337

338

339

340

341

343

344

345

346

347

348

349

350

351

352

353

354

357

358

359

360

361

362

363

364

366

367

368

369

370

371

372

373

375

376

377

378

379

380

381

382

384

385

386

387

388

389

390

391

392

393

395

396

397

398

400 UUID.assign(UUIDBytes.begin(), UUIDBytes.end());

401 }

402

403

404

405

406

409

410

411

412

413

415 std::function<bool(const FunctionInfo &)> const &Callback) const;

416

417

418

420

421

423 ValidTextRanges = TextRanges;

424 }

425

426

428 return ValidTextRanges;

429 }

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

451

452

453

454

455

456

457

458

459

460

461

462

464 BaseAddress = Addr;

465 }

466

467

468 bool isQuiet() const { return Quiet; }

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

491};

492

493}

494}

495

496#endif

uint64_t IntrinsicInst * II

StringSet - A set-like wrapper for the StringMap.

The AddressRanges class helps normalize address range collections.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Lightweight error class with error context and mandatory checking.

Tagged union holding either a T or a Error.

StringRef - Represent a constant reference to a string, i.e.

StringSet - A wrapper for StringMap that provides set-like functionality.

Utility for building string tables with deduplicated suffixes.

A simplified binary data writer class that doesn't require targets, target definitions,...

LLVM_ABI void addFunctionInfo(FunctionInfo &&FI)

Add a function info to this GSYM creator.

LLVM_ABI uint32_t insertString(StringRef S, bool Copy=true)

Insert a string into the GSYM string table.

void setBaseAddress(uint64_t Addr)

Set the base address to use for the GSYM file.

Definition GsymCreator.h:463

const std::optional< AddressRanges > GetValidTextRanges() const

Get the valid text ranges.

Definition GsymCreator.h:427

LLVM_ABI llvm::Expected< std::unique_ptr< GsymCreator > > createSegment(uint64_t SegmentSize, size_t &FuncIdx) const

Create a segmented GSYM creator starting with function info index FuncIdx.

LLVM_ABI llvm::Error save(StringRef Path, llvm::endianness ByteOrder, std::optional< uint64_t > SegmentSize=std::nullopt) const

Save a GSYM file to a stand alone file.

LLVM_ABI void prepareMergedFunctions(OutputAggregator &Out)

Organize merged FunctionInfo's.

LLVM_ABI StringRef getString(uint32_t Offset)

Retrieve a string from the GSYM string table given its offset.

LLVM_ABI llvm::Error loadCallSitesFromYAML(StringRef YAMLFile)

Load call site information from a YAML file.

LLVM_ABI llvm::Error encode(FileWriter &O) const

Encode a GSYM into the file writer stream at the current position.

bool isQuiet() const

Whether the transformation should be quiet, i.e. not output warnings.

Definition GsymCreator.h:468

void setUUID(llvm::ArrayRef< uint8_t > UUIDBytes)

Set the UUID value.

Definition GsymCreator.h:399

void SetValidTextRanges(AddressRanges &TextRanges)

Set valid .text address ranges that all functions must be contained in.

Definition GsymCreator.h:422

LLVM_ABI uint32_t insertFile(StringRef Path, sys::path::Style Style=sys::path::Style::native)

Insert a file into this GSYM creator.

LLVM_ABI size_t getNumFunctionInfos() const

Get the current number of FunctionInfo objects contained in this object.

LLVM_ABI bool IsValidTextAddress(uint64_t Addr) const

Check if an address is a valid code address.

LLVM_ABI void forEachFunctionInfo(std::function< bool(FunctionInfo &)> const &Callback)

Thread safe iteration over all function infos.

LLVM_ABI GsymCreator(bool Quiet=false)

This is an optimization pass for GlobalISel generic memory operations.

Files in GSYM are contained in FileEntry structs where we split the directory and basename into two d...

Function information in GSYM files encodes information for one contiguous address range.

Inline information stores the name of the inline function along with an array of address ranges.