summaryrefslogtreecommitdiff
path: root/src/vm/gdbjit.h
diff options
context:
space:
mode:
authorIgor Kulaychuk <igor.kulaychuk@gmail.com>2016-11-08 19:24:08 +0300
committerJan Vorlicek <janvorli@microsoft.com>2016-11-08 08:24:08 -0800
commita136b2e5c26c46882eb70ed59b424673965b58ce (patch)
tree1278cf097fefff8989f66faf76cc6b8555b92531 /src/vm/gdbjit.h
parente3a9a38aae7146060d0c8c06758b20c81d6d6c22 (diff)
downloadcoreclr-a136b2e5c26c46882eb70ed59b424673965b58ce.tar.gz
coreclr-a136b2e5c26c46882eb70ed59b424673965b58ce.tar.bz2
coreclr-a136b2e5c26c46882eb70ed59b424673965b58ce.zip
[Linux][GDB-JIT] Fix lldb stepping issues (#7777)
* Pass more info about source to native line mapping from SymbolReader Pass mapping info for zero and HiddenLine line numbers. Also supply ICorDebugInfo::SourceTypes info for each line. Lines are reorganized to have ascending native addresses. * Fix DWARF line info generation for negative line change * Add prologue_end and epilogue_begin to DWARF line info * Generate DWARF method description for each code range with PROLOG and EPILOG * Map each called __thunk symbol as a separate section Special .thunk sections from different methods may overlap which prevent the debugger from correctly resolving symbols (__thunk_*) from those sections. Mapping each called __thunk symbol as a separate section (.thunk_#) allows the debugger to resolve __thunk* symbols correctly. The code for searching first valid line number of a method now checks only line numbers. There is no need for additional check of non-empty filename. If no valid line number was found then do not generate debug info at all. * Fix buffer overrun when generating ELF symbol name * Fix memory leak when generating ELF symbol name * Fix memory leak when NotifyGdb::MethodCompiled fails Manage array of FunctionMember pointers with NewArrayHolder. * Refactor counting number of ELF sections in GDBJIT * Refactor building ELF section names and headers * Refactor hardcoded ELF section indeces * Refactor memory allocation for ELF section names When currently allocated memory is not enough for next section name, the memory is reallocated with some extra amount which grows twice on each reallocation.
Diffstat (limited to 'src/vm/gdbjit.h')
-rw-r--r--src/vm/gdbjit.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/vm/gdbjit.h b/src/vm/gdbjit.h
index 133cc79986..ca963e4273 100644
--- a/src/vm/gdbjit.h
+++ b/src/vm/gdbjit.h
@@ -105,10 +105,13 @@ struct __attribute__((packed)) DwarfLineNumHeader
uint8_t m_std_num_arg[DW_LNS_MAX];
};
+const ULONG32 HiddenLine = 0x00feefee;
+
struct SymbolsInfo
{
int lineNumber, ilOffset, nativeOffset, fileIndex;
char fileName[2*MAX_PATH_FNAME];
+ ICorDebugInfo::SourceTypes source;
};
class DwarfDumpable
@@ -351,7 +354,10 @@ public:
typedef MapSHash<TypeKey*, TypeInfoBase*, DeleteValuesOnDestructSHashTraits<TypeKeyHashTraits<TypeInfoBase*>>> TK_TypeInfoMap;
typedef TK_TypeInfoMap* PTK_TypeInfoMap;
-
+ typedef SetSHash< TADDR,
+ NoRemoveSHashTraits <
+ NonDacAwareSHashTraits< SetSHashTraits <TADDR> >
+ > > AddrSet;
private:
struct MemBuf
@@ -360,11 +366,27 @@ private:
unsigned MemSize;
MemBuf() : MemPtr(0), MemSize(0)
{}
+ bool Resize(unsigned newSize)
+ {
+ if (newSize == 0)
+ {
+ MemPtr = nullptr;
+ MemSize = 0;
+ return true;
+ }
+ char *tmp = new (nothrow) char [newSize];
+ if (tmp == nullptr)
+ return false;
+ memmove(tmp, MemPtr.GetValue(), newSize < MemSize ? newSize : MemSize);
+ MemPtr = tmp;
+ MemSize = newSize;
+ return true;
+ }
};
+ static int GetSectionIndex(const char *sectName);
static bool BuildELFHeader(MemBuf& buf);
- static bool BuildSectionNameTable(MemBuf& buf);
- static bool BuildSectionTable(MemBuf& buf);
+ static bool BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf);
static bool BuildSymbolTableSection(MemBuf& buf, PCODE addr, TADDR codeSize);
static bool BuildStringTableSection(MemBuf& strTab);
static bool BuildDebugStrings(MemBuf& buf, PTK_TypeInfoMap pTypeMap);
@@ -374,12 +396,10 @@ private:
static bool BuildLineTable(MemBuf& buf, PCODE startAddr, TADDR codeSize, SymbolsInfo* lines, unsigned nlines);
static bool BuildFileTable(MemBuf& buf, SymbolsInfo* lines, unsigned nlines);
static bool BuildLineProg(MemBuf& buf, PCODE startAddr, TADDR codeSize, SymbolsInfo* lines, unsigned nlines);
- static bool FitIntoSpecialOpcode(int8_t line_shift, uint8_t addr_shift);
static void IssueSetAddress(char*& ptr, PCODE addr);
static void IssueEndOfSequence(char*& ptr);
static void IssueSimpleCommand(char*& ptr, uint8_t command);
static void IssueParamCommand(char*& ptr, uint8_t command, char* param, int param_len);
- static void IssueSpecialCommand(char*& ptr, int8_t line_shift, uint8_t addr_shift);
static void SplitPathname(const char* path, const char*& pathName, const char*& fileName);
static bool CollectCalledMethods(CalledMethod* pCM);
#ifdef _DEBUG