summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2013-06-19 21:27:27 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2013-06-19 21:27:27 +0000
commit4df4bccc71ea0477836db9a417d3da202c2baa09 (patch)
treecae06e4ddbe69091a89822f65dc2c914f06769d1 /lib
parent07969dc8aed62fcd5c5760b2ec331275479f4a80 (diff)
downloadllvm-4df4bccc71ea0477836db9a417d3da202c2baa09.tar.gz
llvm-4df4bccc71ea0477836db9a417d3da202c2baa09.tar.bz2
llvm-4df4bccc71ea0477836db9a417d3da202c2baa09.tar.xz
[MC/DWARF] Generate multiple .debug_line entries for adjacent .loc directives
The compiler occasionally generates multiple .loc directives in a row (at the same instruction address). These need to be transformed into multple actual .debug_line table entries, since they are used to signal certain information to the debugger (e.g. if the opening brace of a function body is on the same line as the declaration). The MCAsmStreamer version of EmitDwarfLocDirective handles this correctly by emitting a .loc directive every time it is called. However, the MCObjectStream version simply defaults to recording the information and emitting only a single table entry later, e.g. when EmitInstruction is called. This patch introduces a MCAsmStreamer::EmitDwarfLocDirective version that emits a line table entry for a .loc directive that may already be pending before recording the new directive. (This is similar to how this is handled in GNU as.) With this patch (and the code alignment factor patch) applied, I'm now getting identical DWARF .debug sections for all test-suite object files on PowerPC for the internal and the external assembler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCObjectStreamer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp
index 2d7657c591..a1ed01cebc 100644
--- a/lib/MC/MCObjectStreamer.cpp
+++ b/lib/MC/MCObjectStreamer.cpp
@@ -259,6 +259,19 @@ void MCObjectStreamer::EmitBundleUnlock() {
llvm_unreachable(BundlingNotImplementedMsg);
}
+void MCObjectStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
+ unsigned Column, unsigned Flags,
+ unsigned Isa,
+ unsigned Discriminator,
+ StringRef FileName) {
+ // In case we see two .loc directives in a row, make sure the
+ // first one gets a line entry.
+ MCLineEntry::Make(this, getCurrentSection().first);
+
+ this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
+ Isa, Discriminator, FileName);
+}
+
void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
const MCSymbol *LastLabel,
const MCSymbol *Label,