
Add support for gsym files to llvm-symbolizer.
co-author @sfc-gh-sgiesecke
Notes:
There was a PR that was
approved and merged: https://github.com/llvm/llvm-project/pull/134847
and reverted: https://github.com/llvm/llvm-project/pull/139660
Due to buildbot failures:
https://lab.llvm.org/buildbot/#/builders/66/builds/13851 - it looks like
related
https://lab.llvm.org/buildbot/#/builders/51/builds/16018 - it looks like
related
https://lab.llvm.org/buildbot/#/builders/146/builds/2905 - it looks like
it's not related to changes
Fix:
To fix missing GSYM symbols
```
+ diff -u expected.new undefined.new
+_ZN4llvm4gsym10GsymReader8openFileENS_9StringRefE U
+_ZN4llvm4gsym10GsymReaderC1EOS1_ U
+_ZN4llvm4gsym10GsymReaderD1Ev U
+_ZN4llvm4gsym13GsymDIContextC1ENSt20__InternalSymbolizer10unique_ptrINS0_10GsymReaderENS2_14default_deleteIS4_EEEE U
+ echo 'Failed: unexpected symbols'
```
for script
compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
LLVMDebugInfoGSYM was added.
Please check the commit:
ba55425db9
That's the only change compare to
https://github.com/llvm/llvm-project/pull/134847
67 lines
2.1 KiB
C++
67 lines
2.1 KiB
C++
//===-- GsymDIContext.h --------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===/
|
|
|
|
#ifndef LLVM_DEBUGINFO_GSYM_GSYMDICONTEXT_H
|
|
#define LLVM_DEBUGINFO_GSYM_GSYMDICONTEXT_H
|
|
|
|
#include "llvm/DebugInfo/DIContext.h"
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace llvm {
|
|
|
|
namespace gsym {
|
|
|
|
class GsymReader;
|
|
|
|
/// GSYM DI Context
|
|
/// This data structure is the top level entity that deals with GSYM
|
|
/// symbolication.
|
|
/// This data structure exists only when there is a need for a transparent
|
|
/// interface to different symbolication formats (e.g. GSYM, PDB and DWARF).
|
|
/// More control and power over the debug information access can be had by using
|
|
/// the GSYM interfaces directly.
|
|
class GsymDIContext : public DIContext {
|
|
public:
|
|
GsymDIContext(std::unique_ptr<GsymReader> Reader);
|
|
|
|
GsymDIContext(GsymDIContext &) = delete;
|
|
GsymDIContext &operator=(GsymDIContext &) = delete;
|
|
|
|
static bool classof(const DIContext *DICtx) {
|
|
return DICtx->getKind() == CK_GSYM;
|
|
}
|
|
|
|
void dump(raw_ostream &OS, DIDumpOptions DIDumpOpts) override;
|
|
|
|
std::optional<DILineInfo> getLineInfoForAddress(
|
|
object::SectionedAddress Address,
|
|
DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
|
|
std::optional<DILineInfo>
|
|
getLineInfoForDataAddress(object::SectionedAddress Address) override;
|
|
DILineInfoTable getLineInfoForAddressRange(
|
|
object::SectionedAddress Address, uint64_t Size,
|
|
DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
|
|
DIInliningInfo getInliningInfoForAddress(
|
|
object::SectionedAddress Address,
|
|
DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
|
|
|
|
std::vector<DILocal>
|
|
getLocalsForAddress(object::SectionedAddress Address) override;
|
|
|
|
private:
|
|
const std::unique_ptr<GsymReader> Reader;
|
|
};
|
|
|
|
} // end namespace gsym
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif // LLVM_DEBUGINFO_PDB_PDBCONTEXT_H
|