GenDwarfForAssembly("g", cl::desc("Generate dwarf debugging info for assembly "
"source files"));
+static cl::opt<int>
+DwarfVersion("dwarf-version", cl::desc("Dwarf version"), cl::init(4));
+
static cl::opt<std::string>
DebugCompilationDir("fdebug-compilation-dir",
cl::desc("Specifies the debug info's compilation dir"));
Error);
if (!TheTarget) {
errs() << ProgName << ": " << Error;
- return 0;
+ return nullptr;
}
// Update the triple name and return the found target.
if (!Err.empty()) {
errs() << Err << '\n';
delete Out;
- return 0;
+ return nullptr;
}
return Out;
Ctx.setAllowTemporaryLabels(false);
Ctx.setGenDwarfForAssembly(GenDwarfForAssembly);
+ if (DwarfVersion < 2 || DwarfVersion > 4) {
+ errs() << ProgName << ": Dwarf version " << DwarfVersion
+ << " is not supported." << '\n';
+ return 1;
+ }
+ Ctx.setDwarfVersion(DwarfVersion);
if (!DwarfDebugFlags.empty())
Ctx.setDwarfDebugFlags(StringRef(DwarfDebugFlags));
if (!DwarfDebugProducer.empty())
std::unique_ptr<MCSubtargetInfo> STI(
TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
- MCInstPrinter *IP = NULL;
+ MCInstPrinter *IP = nullptr;
if (FileType == OFT_AssemblyFile) {
IP =
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);
- MCCodeEmitter *CE = 0;
- MCAsmBackend *MAB = 0;
+ MCCodeEmitter *CE = nullptr;
+ MCAsmBackend *MAB = nullptr;
if (ShowEncoding) {
CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
}
Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/ true,
- /*UseCFI*/ true,
- /*useDwarfDirectory*/
- true, IP, CE, MAB, ShowInst));
+ /*useDwarfDirectory*/ true, IP, CE,
+ MAB, ShowInst));
} else if (FileType == OFT_Null) {
Str.reset(createNullStreamer(Ctx));