dbghelp: Internal search routines can now be case sensitive/insensitive.

- Now handling option SYMOPT_CASE_INSENSITIVE for symbol search.
- Quick implementation of SymSearch on top of SymEnumSymbols (should
  be the other way around).
This commit is contained in:
Eric Pouech 2005-12-26 12:57:26 +01:00 committed by Alexandre Julliard
parent def7563526
commit a959732fff
3 changed files with 53 additions and 5 deletions

View File

@ -86,7 +86,7 @@
@ stdcall SymRegisterCallback(long ptr ptr) @ stdcall SymRegisterCallback(long ptr ptr)
@ stdcall SymRegisterFunctionEntryCallback64(ptr ptr double) @ stdcall SymRegisterFunctionEntryCallback64(ptr ptr double)
@ stdcall SymRegisterFunctionEntryCallback(ptr ptr ptr) @ stdcall SymRegisterFunctionEntryCallback(ptr ptr ptr)
@ stub SymSearch @ stdcall SymSearch(long double long long str double ptr ptr long)
@ stdcall SymSetContext(long ptr ptr) @ stdcall SymSetContext(long ptr ptr)
@ stdcall SymSetOptions(long) @ stdcall SymSetOptions(long)
@ stdcall SymSetParentWindow(long) @ stdcall SymSetParentWindow(long)

View File

@ -738,7 +738,8 @@ static BOOL symt_enum_locals(struct process* pcs, const char* mask,
BOOL ret; BOOL ret;
regex_t preg; regex_t preg;
compile_regex(mask ? mask : "*", -1, &preg, FALSE); compile_regex(mask ? mask : "*", -1, &preg,
dbghelp_options & SYMOPT_CASE_INSENSITIVE);
ret = symt_enum_locals_helper(pcs, module, &preg, EnumSymbolsCallback, ret = symt_enum_locals_helper(pcs, module, &preg, EnumSymbolsCallback,
UserContext, sym_info, UserContext, sym_info,
&((struct symt_function*)sym)->vchildren); &((struct symt_function*)sym)->vchildren);
@ -785,8 +786,10 @@ BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask,
if (bang == Mask) return FALSE; if (bang == Mask) return FALSE;
compile_regex(Mask, bang - Mask, &mod_regex, FALSE); compile_regex(Mask, bang - Mask, &mod_regex,
compile_regex(bang + 1, -1, &sym_regex, FALSE); dbghelp_options & SYMOPT_CASE_INSENSITIVE);
compile_regex(bang + 1, -1, &sym_regex,
dbghelp_options & SYMOPT_CASE_INSENSITIVE);
for (module = pcs->lmodules; module; module = module->next) for (module = pcs->lmodules; module; module = module->next)
{ {
@ -829,7 +832,8 @@ BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask,
Mask = bang + 1; Mask = bang + 1;
} }
compile_regex(Mask ? Mask : "*", -1, &sym_regex, FALSE); compile_regex(Mask ? Mask : "*", -1, &sym_regex,
dbghelp_options & SYMOPT_CASE_INSENSITIVE);
symt_enum_module(module, &sym_regex, EnumSymbolsCallback, UserContext); symt_enum_module(module, &sym_regex, EnumSymbolsCallback, UserContext);
regfree(&sym_regex); regfree(&sym_regex);
@ -1311,3 +1315,42 @@ BOOL WINAPI SymMatchString(PCSTR string, PCSTR re, BOOL _case)
return ret; return ret;
} }
/******************************************************************
* SymSearch (DBGHELP.@)
*/
BOOL WINAPI SymSearch(HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index,
DWORD SymTag, PCSTR Mask, DWORD64 Address,
PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
PVOID UserContext, DWORD Options)
{
TRACE("(%p %s %lu %lu %s %s %p %p %lx)\n",
hProcess, wine_dbgstr_longlong(BaseOfDll), Index, SymTag, Mask,
wine_dbgstr_longlong(Address), EnumSymbolsCallback,
UserContext, Options);
if (Index != 0)
{
FIXME("Unsupported searching for a given Index (%lu)\n", Index);
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (SymTag != 0)
{
FIXME("Unsupported searching for a given SymTag (%lu)\n", SymTag);
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (Address != 0)
{
FIXME("Unsupported searching for a given Address (%s)\n", wine_dbgstr_longlong(Address));
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (Options != SYMSEARCH_GLOBALSONLY)
{
FIXME("Unsupported searching with options (%lx)\n", Options);
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return SymEnumSymbols(hProcess, BaseOfDll, Mask, EnumSymbolsCallback, UserContext);
}

View File

@ -800,6 +800,10 @@ typedef struct _TI_FINDCHILDREN_PARAMS
#define UNDNAME_NO_ARGUMENTS (0x2000) #define UNDNAME_NO_ARGUMENTS (0x2000)
#define UNDNAME_NO_SPECIAL_SYMS (0x4000) #define UNDNAME_NO_SPECIAL_SYMS (0x4000)
#define SYMSEARCH_MASKOBJS 0x01
#define SYMSEARCH_RECURSE 0x02
#define SYMSEARCH_GLOBALSONLY 0x04
BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID); BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID); typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID); BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
@ -822,6 +826,7 @@ BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
DWORD WINAPI UnDecorateSymbolName(LPCSTR, LPSTR, DWORD, DWORD); DWORD WINAPI UnDecorateSymbolName(LPCSTR, LPSTR, DWORD, DWORD);
BOOL WINAPI SymMatchString(PCSTR string, PCSTR re, BOOL _case); BOOL WINAPI SymMatchString(PCSTR string, PCSTR re, BOOL _case);
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case); BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case);
BOOL WINAPI SymSearch(HANDLE, ULONG64, DWORD, DWORD, PCSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID, DWORD);
/************************* /*************************
* Source Files * * Source Files *