Note that most of UNIX debug formats store the source filename, whereas the PDB format stores the object filename (and returns it in SymGetTypeInfo)
As of today, dbghelp stores either the object or the source filename of a compiland, depending on the debug format used.
There's not enough data (for example in dwarf) to reconstruct the real object filename, so I'd rather let native dbghelp return a source filename instead of an object filename.
dbghelp's tests have been adjusted accordingly.
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/tests/dbghelp.c | 20 ++++++++++++-------- dlls/dbghelp/type.c | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/dbghelp/tests/dbghelp.c b/dlls/dbghelp/tests/dbghelp.c index b43acf2dda9..141b1bdadd8 100644 --- a/dlls/dbghelp/tests/dbghelp.c +++ b/dlls/dbghelp/tests/dbghelp.c @@ -168,17 +168,25 @@ static BOOL isobjfile(const char* str, WCHAR* name) BOOL ret = FALSE; if ((nameW = HeapAlloc(GetProcessHeap(), 0, (sz + 4) * sizeof(WCHAR))) != NULL) { + /* native dbghelp (incorrectly) returns source filename instead of object filename here */ MultiByteToWideChar(CP_ACP, 0, str, -1, nameW, sz); nameW[sz - 1] = '.'; - nameW[sz + 0] = 'o'; + nameW[sz + 0] = 'c'; nameW[sz + 1] = '\0'; ret = endswithW(name, nameW); if (!ret) { - nameW[sz + 1] = 'b'; - nameW[sz + 2] = 'j'; - nameW[sz + 3] = '\0'; + nameW[sz - 1] = '.'; + nameW[sz + 0] = 'o'; + nameW[sz + 1] = '\0'; ret = endswithW(name, nameW); + if (!ret) + { + nameW[sz + 1] = 'b'; + nameW[sz + 2] = 'j'; + nameW[sz + 3] = '\0'; + ret = endswithW(name, nameW); + } } HeapFree(GetProcessHeap(), 0, nameW); } @@ -414,11 +422,9 @@ static void test_symbols(const struct debuggee* dbg) ok(ret, "SymGetTypeInfo failed: %u\n", GetLastError()); ok(tag == SymTagCompiland, "Wrong tag %u\n", tag); ret = SymGetTypeInfo(dbg->hProcess, dbg->base, type, TI_GET_SYMNAME, &name); - todo_wine ok(ret, "SymGetTypeInfo failed: %u\n", GetLastError()); if (ret) { - todo_wine ok(isobjfile("debuggee1", name), "Wrong compiland name %ls\n", name); HeapFree(GetProcessHeap(), 0, name); } @@ -453,11 +459,9 @@ static void test_symbols(const struct debuggee* dbg) ok(ret, "SymGetTypeInfo failed: %u\n", GetLastError()); ok(tag == SymTagCompiland, "Wrong tag %u\n", tag); ret = SymGetTypeInfo(dbg->hProcess, dbg->base, type, TI_GET_SYMNAME, &name); - todo_wine ok(ret, "SymGetTypeInfo failed: %u\n", GetLastError()); if (ret) { - todo_wine ok(isobjfile("debuggee1", name), "Wrong compiland name %ls\n", name); HeapFree(GetProcessHeap(), 0, name); } diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 374b69aeb08..e6d0ad3e927 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -761,7 +761,8 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
case TI_GET_SYMNAME: { - const char* name = symt_get_name(type); + const char* name = (type->tag == SymTagCompiland) ? + source_get(module, ((const struct symt_compiland*)type)->source) : symt_get_name(type); if (!name) return FALSE; len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0); X(WCHAR*) = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));