List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:September 15 2008 7:22pm
Subject:Re: bzr commit into mysql-5.1-bugteam branch (vvaintroub:2678)
Bug#35987
View as plain text  
Vladislav Vaintroub skrev:

> +  hSnap= CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
> +  if (hSnap != INVALID_HANDLE_VALUE)
> +  {
> +    BOOL ret;
> +    MODULEENTRY32 mod;
> +    mod.dwSize= sizeof(MODULEENTRY32);
> +    for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap,
> &mod))
> +    {
> +      char *module_dir= mod.szExePath;
> +      char *p= strrchr(module_dir,'\\');
> +      if (!p)
> +      {
> +        /*
> +          Path separator was not found. Not known to happen, if ever happens,
> +          will indicate current directory.
> +        */
> +        module_dir[0]= '.';
> +        p= module_dir + 1;
> +      }
> +      *p++= ';';
> +      *p= '\0';

magnus: still feels like this could potentially go wrong. Will look more 
tomorrow. But maybe I'm just overly careful?

> +
> +      if (!strstr(path, module_dir))
> +      {
> +        strncat(path, module_dir, size);
> +      }
> +    }
> +    CloseHandle(hSnap);
> +  }
> +
> +  /* Add _NT_SYMBOL_PATH, if present. */
> +  envvar= getenv("_NT_SYMBOL_PATH");
> +  if(envvar)
> +  {
> +    strncat(path, envvar, size);
> +  }
> +}
> +
> +#define MAX_SYMBOL_PATH 32768
> +
>  /* Platform SDK in VS2003 does not have definition for SYMOPT_NO_PROMPTS*/
>  #ifndef SYMOPT_NO_PROMPTS
>  #define SYMOPT_NO_PROMPTS 0
> @@ -365,6 +423,7 @@ void print_stacktrace(gptr unused1, ulon
>    int     i;
>    CONTEXT context;
>    STACKFRAME64 frame={0};
> +  static char symbol_path[MAX_SYMBOL_PATH+1];
>  
>    if(!exception_ptrs || !init_dbghelp_functions())
>      return;
> @@ -373,7 +432,8 @@ void print_stacktrace(gptr unused1, ulon
>    context = *(exception_ptrs->ContextRecord);
>    /*Initialize symbols.*/
>   
> pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
> -  pSymInitialize(hProcess,NULL,TRUE);
> +  get_symbol_path(symbol_path, MAX_SYMBOL_PATH);
> +  pSymInitialize(hProcess, symbol_path, TRUE);
>  
>    /*Prepare stackframe for the first StackWalk64 call*/
>    frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat;
> 
> 

Thread
bzr commit into mysql-5.1-bugteam branch (vvaintroub:2678) Bug#35987Vladislav Vaintroub15 Sep
  • Re: bzr commit into mysql-5.1-bugteam branch (vvaintroub:2678)Bug#35987Magnus Svensson15 Sep
    • RE: bzr commit into mysql-5.1-bugteam branch (vvaintroub:2678)Bug#35987Vladislav Vaintroub15 Sep
      • Re: bzr commit into mysql-5.1-bugteam branch (vvaintroub:2678)Bug#35987Magnus Svensson16 Sep
        • RE: bzr commit into mysql-5.1-bugteam branch (vvaintroub:2678)Bug#35987Vladislav Vaintroub16 Sep
          • Re: bzr commit into mysql-5.1-bugteam branch (vvaintroub:2678)Bug#35987Magnus Svensson16 Sep