Im using Visual Studio 2005, I'm trying to build a release version of
an exe and this exe will be deployed on a shared drive. However I'm
doing a build on my own workspace, so the output pdb path is set in
the .vcproj file for the release mode:
$(TargetDir)/prm.pdb
the $(TargetDir) is set to a path that is my work space specific.
Once I moved the exe, the pdb, and other dlls to the shared drive
area, the exe is still looking for the pdb file in my workspace path
(which doesn't exist for people running in their PC)
Any idea how I can make this flexible? (I'm a newbie at VS8, only
recently upgraded to VS6, and we had no such problem) Am i looking at
the right place?
Appreciate your help, I really need the PDB file at run time.
-Karen
A few possible tricks:
1) Use /pdbpath:none on your linker's commandline, per
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vc.debugger&tid=7055258b-1943-4d70-83e4-dd1fc587a372&cat=en_US_20e648a8-8c61-4ea2-a166-21b816cb6397&lang=en&cr=US&sloc=&p=1
or
http://www.tech-archive.net/Archive/Development/microsoft.public.development.device.drivers/2006-11/msg00718.html
2) If you're using dbghelp.dll to load your PDB, try calling
SymSetOptions(SYMOPT_LOAD_ANYTHING);
This may help force it to load things, even if the full path
differs.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
1>Compiling...
1>cl : Command line warning D9002 : ignoring unknown option '/
pdbpath:none'
1>stdafx.cpp
1>Compiling...
1>cl : Command line warning D9002 : ignoring unknown option '/
pdbpath:none'
On Mar 24, 1:48 pm, nat...@visi.com (Nathan Mates) wrote:
> In article <80231843-aeef-4e39-8d0e-075001118...@u72g2000hsf.googlegroups.com>,
>
> Karen <karen.b....@gmail.com> wrote:
> >Actually my question really comes down to, how do you make your exe to
> >read the pdb from the current directory rather than from the directory
> >you built it?
>
> A few possible tricks:
>
> 1) Use /pdbpath:none on your linker's commandline, perhttp://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg...
> orhttp://www.tech-archive.net/Archive/Development/microsoft.public.deve...
>
> 2) If you're using dbghelp.dll to load your PDB, try calling
> SymSetOptions(SYMOPT_LOAD_ANYTHING);
>
> This may help force it to load things, even if the full path
> differs.
>
> Nathan Mates
>
> --
> <*> Nathan Mates - personal webpagehttp://www.visi.com/~nathan/
> # Programmer at Pandemic Studios --http://www.pandemicstudios.com/
It looks like you put /pdbpath:none on the commandline for the
compiler -- for C/C++ files. You need to put it on the commandline for
the *linker* instead.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
The reason I need the PDB so badly is I'm using a StackWalker code
from codeproject.com to dump real time stack trace.
On Mar 24, 3:56 pm, nat...@visi.com (Nathan Mates) wrote:
> In article <42c8ed02-f14d-4b5b-a786-f728b4a00...@k13g2000hse.googlegroups.com>,
>
> Karen <karen.b....@gmail.com> wrote:
> >Hi Thanks for the tip. I've tried the /pdbpath:none ... but i get the
> >following. Does it only work for certain compiler?
>
> It looks like you put /pdbpath:none on the commandline for the
> compiler -- for C/C++ files. You need to put it on the commandline for
> the *linker* instead.
>
> Nathan Mates
> --
> <*> Nathan Mates - personal webpagehttp://www.visi.com/~nathan/
> # Programmer at Pandemic Studios --http://www.pandemicstudios.com/
>The reason I need the PDB so badly is I'm using a StackWalker code
>from codeproject.com to dump real time stack trace.
Go back to my first posting earlier today, where I mentioned
two things to try: (1) the /pdbpath:none . And (2), flags to pass to
SymSetOptions(). You focused on #1.
For what it's worth, in my projects, my code to do the stack
walking includes this code:
BOOL libSuccess = SymInitialize(g_hProcess, useSearchPath, true);
if(libSuccess)
{
DWORD curOpts = SymGetOptions();
#ifdef DEBUG
curOpts |= SYMOPT_DEBUG;
#endif
curOpts &= ~SYMOPT_DEFERRED_LOADS;
curOpts &= ~SYMOPT_EXACT_SYMBOLS;
SymSetOptions(curOpts | SYMOPT_LOAD_LINES | SYMOPT_LOAD_ANYTHING | SYMOPT_NO_PROMPTS | SYMOPT_CASE_INSENSITIVE | SYMOPT_AUTO_PUBLICS);
// [Re]load symbols for all files
SymRefreshModuleList(g_hProcess);
[...]
The LOAD_ANYTHING flag is what I was pointing out earlier.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
> The reason I need the PDB so badly is I'm using a StackWalker code
> from codeproject.com to dump real time stack trace.
Have you specified the "SymBuildPath" option!
Then the current directory and the directory of the EXE is already in
the search path!
Then it should find your PDB!
--
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/
DWORD symOptions = this->pSGO(); // SymGetOptions
symOptions |= SYMOPT_LOAD_LINES;
symOptions |= SYMOPT_FAIL_CRITICAL_ERRORS;
symOptions |= SYMOPT_LOAD_ANYTHING;
symOptions |= SYMOPT_NO_PROMPTS;
symOptions |= SYMOPT_CASE_INSENSITIVE;
symOptions |= SYMOPT_AUTO_PUBLICS;
// SymSetOptions
symOptions = this->pSSO(symOptions);
char buf[StackWalker::STACKWALK_MAX_NAMELEN] = {0};
if (this->pSGSP != NULL)
{
if (this->pSGSP(m_hProcess, buf,
StackWalker::STACKWALK_MAX_NAMELEN) == FALSE)
this->m_parent->OnDbgHelpErr("SymGetSearchPath",
GetLastError(), 0);
}
char szUserName[1024] = {0};
DWORD dwSize = 1024;
GetUserNameA(szUserName, &dwSize);
this->m_parent->OnSymInit(buf, symOptions, szUserName);
the pSGO() and pSSO() are declared and defined as follows
// SymGetOptions()
typedef DWORD (__stdcall *tSGO)( VOID );
tSGO pSGO;
// SymSetOptions()
typedef DWORD (__stdcall *tSSO)( IN DWORD SymOptions );
tSSO pSSO;
pSGO = (tSGO) GetProcAddress(m_hDbhHelp, "SymGetOptions" );
pSSO = (tSSO) GetProcAddress(m_hDbhHelp, "SymSetOptions" );
On Mar 24, 6:08 pm, nat...@visi.com (Nathan Mates) wrote:
> In article <6d1d5408-015a-4d5b-bd91-0d27353af...@a23g2000hsc.googlegroups.com>,
> <*> Nathan Mates - personal webpagehttp://www.visi.com/~nathan/
> # Programmer at Pandemic Studios --http://www.pandemicstudios.com/
On Mar 25, 1:21 pm, "Jochen Kalmbach [MVP]" <nospam-
I thought you are using the StackWalker from CodeProject, aren't you?
http://www.codeproject.com/KB/threads/StackWalker.aspx
If you use the default constructor, then this option is already
activated. If not, you need to be sure to set "SymBuildPath"!
Hi, yes I'm using the default constructor. Just one concern, we use
vs2005, so I guess we'll use dbghelp.h that shipped with vs8. Will
there be things I need to concern with? I won't be able to manipulate
the SymOptions from above posts in StackWalker code anymore?
#if _MSC_VER >= 1300
#include <dbghelp.h>
#else
// inline the important dbghelp.h-declarations...
typedef enum {
SymNone = 0,
SymCoff,
SymCv,
SymPdb,
SymExport,
SymDeferred,
......
> Hi, yes I'm using the default constructor. Just one concern, we use
> vs2005, so I guess we'll use dbghelp.h that shipped with vs8.
No. Normally, you are using the dbhelp.dll which wa shipped with the OS,
Please download the latest "Debugging Tools for Windows" and use th
edbhelp.dll from there!
> Will
> there be things I need to concern with? I won't be able to manipulate
> the SymOptions from above posts in StackWalker code anymore?
By default, the correct path is already set, you don't need to set
additions options...
Thank you for your quick turnaround ... I already got the dbghelp.dll
from Debugging Tools for Windows. The only reason it's not dumping
stack because it's not reading the pdb from the same directory. For
example, the deployed directory contains:
prm.exe
prm.pdb
...
however it was still trying to load the entire path of the prm.pdb
that is hardwired in the exe, i.e. $(TargetDir)/prm.pdb
where $(TargetDir) is my workspace path.
This works OK in my PC but won't work in user's pc. As a temporary
workaround, I mirrored the directory structure in the user's PC and
put the PDB there, i.e.
C:\view\CrashMar2008\PRM\bin\edg rw\prm.pdb
(As described in the posts above)
So I put in the linker options /pdbpath:none and the LOAD_ANYTHING
option. Still no luck.
Again, I had no such issues in VS6, I don't understand why VS8 is like
this. In VS6 we've also give similar directory structure as the pdb
path.
Thanks very much for your help... I really wish I can resolve this so
I'm not intruding the user's PC =(