Commit c99bafb7 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Implement SymAddrIncludeInlineTrace().

Replacing symt_get_inlinesite_depth() with SymAddrIncludeInlineTrace() as they look very (very) similar. Signed-off-by: 's avatarEric Pouech <eric.pouech@gmail.com>
parent 51c81714
...@@ -953,7 +953,6 @@ static inline struct symt_function* ...@@ -953,7 +953,6 @@ static inline struct symt_function*
extern struct symt_function* extern struct symt_function*
symt_find_inlined_site(struct module* module, symt_find_inlined_site(struct module* module,
DWORD64 addr, DWORD inline_ctx) DECLSPEC_HIDDEN; DWORD64 addr, DWORD inline_ctx) DECLSPEC_HIDDEN;
extern DWORD symt_get_inlinesite_depth(HANDLE hProcess, DWORD64 addr) DECLSPEC_HIDDEN;
/* Inline context encoding (different from what native does): /* Inline context encoding (different from what native does):
* bits 31:30: 3 ignore (includes INLINE_FRAME_CONTEXT_IGNORE=0xFFFFFFFF) * bits 31:30: 3 ignore (includes INLINE_FRAME_CONTEXT_IGNORE=0xFFFFFFFF)
......
...@@ -312,7 +312,7 @@ BOOL WINAPI StackWalkEx(DWORD MachineType, HANDLE hProcess, HANDLE hThread, ...@@ -312,7 +312,7 @@ BOOL WINAPI StackWalkEx(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
if (IFC_MODE(frame->InlineFrameContext) == IFC_MODE_INLINE) if (IFC_MODE(frame->InlineFrameContext) == IFC_MODE_INLINE)
{ {
DWORD depth = symt_get_inlinesite_depth(hProcess, addr); DWORD depth = SymAddrIncludeInlineTrace(hProcess, addr);
if (IFC_DEPTH(frame->InlineFrameContext) + 1 < depth) /* move to next inlined function? */ if (IFC_DEPTH(frame->InlineFrameContext) + 1 < depth) /* move to next inlined function? */
{ {
TRACE("found inline ctx: depth=%lu current=%lu++\n", TRACE("found inline ctx: depth=%lu current=%lu++\n",
...@@ -330,7 +330,7 @@ BOOL WINAPI StackWalkEx(DWORD MachineType, HANDLE hProcess, HANDLE hThread, ...@@ -330,7 +330,7 @@ BOOL WINAPI StackWalkEx(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
if (frame->InlineFrameContext != INLINE_FRAME_CONTEXT_IGNORE) if (frame->InlineFrameContext != INLINE_FRAME_CONTEXT_IGNORE)
{ {
addr = sw_xlat_addr(&csw, &frame->AddrPC); addr = sw_xlat_addr(&csw, &frame->AddrPC);
frame->InlineFrameContext = symt_get_inlinesite_depth(hProcess, addr) == 0 ? IFC_MODE_REGULAR : IFC_MODE_INLINE; frame->InlineFrameContext = SymAddrIncludeInlineTrace(hProcess, addr) == 0 ? IFC_MODE_REGULAR : IFC_MODE_INLINE;
TRACE("setting IFC mode to %lx\n", frame->InlineFrameContext); TRACE("setting IFC mode to %lx\n", frame->InlineFrameContext);
} }
} }
......
...@@ -1265,27 +1265,6 @@ struct symt_function* symt_find_inlined_site(struct module* module, DWORD64 addr ...@@ -1265,27 +1265,6 @@ struct symt_function* symt_find_inlined_site(struct module* module, DWORD64 addr
return NULL; return NULL;
} }
DWORD symt_get_inlinesite_depth(HANDLE hProcess, DWORD64 addr)
{
struct module_pair pair;
DWORD depth = 0;
if (module_init_pair(&pair, hProcess, addr))
{
struct symt_ht* symt = symt_find_symbol_at(pair.effective, addr);
if (symt_check_tag(&symt->symt, SymTagFunction))
{
struct symt_function* inlined = symt_find_lowest_inlined((struct symt_function*)symt, addr);
if (inlined)
{
for ( ; &inlined->symt != &symt->symt; inlined = (struct symt_function*)symt_get_upper_inlined(inlined))
++depth;
}
}
}
return depth;
}
/****************************************************************** /******************************************************************
* sym_enum * sym_enum
* *
...@@ -2797,11 +2776,31 @@ BOOL WINAPI SymGetLineFromInlineContextW(HANDLE hProcess, DWORD64 addr, ULONG in ...@@ -2797,11 +2776,31 @@ BOOL WINAPI SymGetLineFromInlineContextW(HANDLE hProcess, DWORD64 addr, ULONG in
/****************************************************************** /******************************************************************
* SymAddrIncludeInlineTrace (DBGHELP.@) * SymAddrIncludeInlineTrace (DBGHELP.@)
* *
* MSDN doesn't state that the maximum depth (of embedded inline sites) at <addr>
* is actually returned. (It just says non zero means that there are some inline site(s)).
* But this is what native actually returns.
*/ */
DWORD WINAPI SymAddrIncludeInlineTrace(HANDLE hProcess, DWORD64 addr) DWORD WINAPI SymAddrIncludeInlineTrace(HANDLE hProcess, DWORD64 addr)
{ {
FIXME("(%p, %I64x): stub\n", hProcess, addr); struct module_pair pair;
return 0; DWORD depth = 0;
TRACE("(%p, %#I64x)\n", hProcess, addr);
if (module_init_pair(&pair, hProcess, addr))
{
struct symt_ht* symt = symt_find_symbol_at(pair.effective, addr);
if (symt_check_tag(&symt->symt, SymTagFunction))
{
struct symt_function* inlined = symt_find_lowest_inlined((struct symt_function*)symt, addr);
if (inlined)
{
for ( ; &inlined->symt != &symt->symt; inlined = (struct symt_function*)symt_get_upper_inlined(inlined))
++depth;
}
}
}
return depth;
} }
/****************************************************************** /******************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment