diff options
author | Igor Kulaychuk <igor.kulaychuk@gmail.com> | 2016-10-03 21:04:05 +0300 |
---|---|---|
committer | Mike McLaughlin <mikem@microsoft.com> | 2016-10-03 11:04:05 -0700 |
commit | 449feba048bc80faf999ad0e014497fde1d12e60 (patch) | |
tree | 856b8d7894e985150add07bccd1a383292c79eec /src/vm/gdbjit.cpp | |
parent | 89bf443d2787e1b4754718bf28e71da248ea7727 (diff) | |
download | coreclr-449feba048bc80faf999ad0e014497fde1d12e60.tar.gz coreclr-449feba048bc80faf999ad0e014497fde1d12e60.tar.bz2 coreclr-449feba048bc80faf999ad0e014497fde1d12e60.zip |
Fix DWARF linetable info provided by GDBJIT (#7444)
Extend PC to the end of function in DWARF linetable commands.
This allows the debugger to show source lines for all addresses
inside a function.
Diffstat (limited to 'src/vm/gdbjit.cpp')
-rw-r--r-- | src/vm/gdbjit.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/vm/gdbjit.cpp b/src/vm/gdbjit.cpp index d2373f01be..1a7f6b1f37 100644 --- a/src/vm/gdbjit.cpp +++ b/src/vm/gdbjit.cpp @@ -752,7 +752,7 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr) debugInfoSub.m_sub_low_pc = pCode; debugInfoSub.m_sub_high_pc = codeSize; /* Build .debug_line section */ - if (!BuildLineTable(dbgLine, pCode, symInfo, symInfoLen)) + if (!BuildLineTable(dbgLine, pCode, codeSize, symInfo, symInfoLen)) { return; } @@ -992,7 +992,7 @@ void NotifyGdb::MethodDropped(MethodDesc* MethodDescPtr) } /* Build the DWARF .debug_line section */ -bool NotifyGdb::BuildLineTable(MemBuf& buf, PCODE startAddr, SymbolsInfo* lines, unsigned nlines) +bool NotifyGdb::BuildLineTable(MemBuf& buf, PCODE startAddr, TADDR codeSize, SymbolsInfo* lines, unsigned nlines) { MemBuf fileTable, lineProg; @@ -1000,7 +1000,7 @@ bool NotifyGdb::BuildLineTable(MemBuf& buf, PCODE startAddr, SymbolsInfo* lines, if (!BuildFileTable(fileTable, lines, nlines)) return false; /* Build line info program */ - if (!BuildLineProg(lineProg, startAddr, lines, nlines)) + if (!BuildLineProg(lineProg, startAddr, codeSize, lines, nlines)) { return false; } @@ -1147,7 +1147,7 @@ bool NotifyGdb::FitIntoSpecialOpcode(int8_t line_shift, uint8_t addr_shift) } /* Build program for DWARF source line section */ -bool NotifyGdb::BuildLineProg(MemBuf& buf, PCODE startAddr, SymbolsInfo* lines, unsigned nlines) +bool NotifyGdb::BuildLineProg(MemBuf& buf, PCODE startAddr, TADDR codeSize, SymbolsInfo* lines, unsigned nlines) { static char cnv_buf[16]; @@ -1157,6 +1157,7 @@ bool NotifyGdb::BuildLineProg(MemBuf& buf, PCODE startAddr, SymbolsInfo* lines, + 6 /* set file command */ + nlines * 6 /* advance line commands */ + nlines * (4 + ADDRESS_SIZE) /* 1 extended + 1 special command */ + + 6 /* advance PC command */ + 3; /* end of sequence command */ buf.MemPtr = new (nothrow) char[buf.MemSize]; char* ptr = buf.MemPtr; @@ -1199,6 +1200,12 @@ bool NotifyGdb::BuildLineProg(MemBuf& buf, PCODE startAddr, SymbolsInfo* lines, prevAddr = lines[i].nativeOffset; } + // Advance PC to the end of function + if (prevAddr < codeSize) { + int len = Leb128Encode(static_cast<uint32_t>(codeSize - prevAddr), cnv_buf, sizeof(cnv_buf)); + IssueParamCommand(ptr, DW_LNS_advance_pc, cnv_buf, len); + } + IssueEndOfSequence(ptr); buf.MemSize = ptr - buf.MemPtr; |