vb6 debugging .exe to .dll - vb6

Probably a question that has been asked before. Please guide me to any questions that might answer my question...
I have a VB6 .exe that calls a VB6 .dll. I would like to debug the .dll from the .exe code.
Any ideas on how to achieve that? It has been a very long time since I have played with vb6.
Thanks

Open both VB6 projects in one VB6 IDE (a VB Project Group ... creates and uses a file extension of .vbg if I remember correctly). Also, set debugging to Break in Class Module.

You need access to the DLL symbols (usually a PDB file). Make sure that the dll symbols are being generated.
If you open the dll as raw text and go to the end of the file, you can find the path where the pdb file is expected to be located.

I think you have to add the dll project to the to the exe project (File->Add project) to step into the dll code.
Update:
Yes, I think you'll also need to remove the reference to compiled dll.

I'm facing a similar issue and I have been following all the steps you have provided. Nothing is moving. I'm not winning.
I think you have to add the dll project to the to the exe project (File->Add project) to step into the dll code. You'll also need to remove the reference to compiled dll.

Related

How to use third party SDKs/Libraries in Visual Studio (2010) projects? (OpenGL/FreeGLUT/GLEW)

For the last two years I have been using Java and NetBeans, where all I need to do to add a new third party library to my project is throw in the .jar file and NetBeans does the rest.
Recently I have switch to C++ and Visual Studio and I am having a really hard time getting a project to compile using OpenGL, GLUT and GLEW due to 'Missing reference' errors.
Some tutorials tell me I need to download the projects for GLUT/GLEW and run them (that didn't work), some tutorials tell me I need to add a .dll file to my Win32 folder, others say just put the header files in the same directory as your project and some say I need to install these libraries in to Visual Studio itself, not just to my project.
None of these approaches have worked thus far.
All I want is for this one project to use these libraries. This is throwing a major spanner in the works for me at the moment, any help would be appreciated.
Sorry, I don't have an easy answer for you. I've been using OpenGL on Windows for years, and it can be a pain.
MS doesn't even (really) support OpenGL, the headers that come with Windows are the old 1.x ones - and they have no plans on changing that (they want to you use DX).
So, I would start small.
First, get a basically empty Win32 console "Hello World" app running.
Then, just add one component, like Glut.
Then, do the same - keeping it compiling / linking - incrementally add other components.
Wherever they tell you to put headers, libraries, DLLs, etc, it needs to be reflected in your project file. So:
add the location of the header files to "C/C++->Additional Include Directories"
add the .lib files to the "Linker->Input->Additional Dependencies"
(it still won't find them so) add the location of the .lib files to "Linker->General->Additional Library Directories"
With all that in place it should compile and link, but may not run still because it can't find the DLLs (that go along with the .lib files).
The shortest path to getting running might just be to dump the DLLs in the Windows/System32 folder. But in the long run that can be problematic as other apps may overwrite it (or see you as overwriting theirs).
What I do with specific DLLs is just load them explicitly in my application so I know for sure what DLL I'm getting (I don't do much Windows-specific GL, but when I did, I had my own \OpenGL directory with the versions of .h files, libs and DLLs I wanted).
Good Luck!
Oh, LoadLibrary() will load a DLL, etc.

VB6 Application Compiled files

I'm new at VB6 and now the source code of a web application by the outsource is giving me error on every control.
So I check with the outsource and he asked me to check the compiled .exe file.
Any idea about compiled .exe file? Is it same as publishing in vb.net?
Thanks in advance.
I think they are the same (not sure about VB.net) but you can easily make an EXE by clicking on the Make "ProjectName".exe item in the file menu, specify the path and VIOLA! run it from there.
Tutorial Here

visual studio 2010 c# simple compile help

Hey I developed a small application and would like to compile it, however it comes with loads of extra stuff I dont want. All I want is a stand alone .exe file but instead I am getting pdb vshost.exe files etc. Is there anyway to get rid of these as I just want 1 .exe
Just copy/paste the exe file out. VS uses those files internally, and one is full of debugging symbols. Your going to want it if you plan on stepping into the code.
All these ''extra stuff'' is not required to run your ''small application''. You can verify that by copying the .exe file to a location where it will be standing alone indeed.
If it is not standing alone, as you say in the comment below: perhaps part of your code does compile to .dll, or you reference external dlls? Could you supply a list of filenames of files that are created?

Can I use pdb files to step through a 3rd party assembly?

my friend has made a really helpful class library which I use all the time. I usually use Reflector to see what his code does.
What I really wanted to do was to step through his code while I'm debugging. So he gave me his .pdb file.
Foo.dll (release configuration, compile)
Foo.pdb
Now, I'm not sure how I can get it to auto break into his code when it throws an exception (his code, at various points, thorws exceptions .. like A first chance exception of type 'System.Web.HttpException' occurred in Foo.dll ...
Can I do this? Do i need to setup something with the Symbol Server settings in Visual Studio ? Do i need to get the dll compiled into Debug Configuration and be passed the .dll and .pdb files? Or (and i'm really afraid of this one) .. do i need to have both the .dll, .pdb AND his source code ...
I also had a look at this previous SO question, but it sorta didn't help (but proof I've tried to search before asking a question).
Can someone help me please?
Yes you can, if your friend indexes those PDB's, so that the debugger knows where to find the appropriate source in a source-control system, and if your friend uploads those pdb's to a symbol-server, you can perfectly step through the code while debugging.
I have done this for some projects at work, and this works like a charm.
More info about setting up a symbol server:
Source server helps you kill bugs
Setting up a symbol server
Using symstore
The answer is in in the linked question, though perhaps it's not blindingly obvious, so I'll say it: yes, you need to have the source code in order to step through the source code. The PDB file only tells the debugger what line of what source file corresponds to a particular machine instruction.
You don't need to set up a "symbol server" or anything like that. Just get him to send you the source. When you load the PDB file Visual Studio will prompt for the location of the source files if they're not at the same path.
I guess you posted link to another question just to prove that you have searched because that question does have an answer to your question.

Attaching to a foreign executable in Visual C++ 2003

I have an executable (compiled by someone else) that is hitting an assertion near my code. I work on the code in Visual C++ 2003, but I don't have a project file for this particular executable (the code is used to build many different tools). Is it possible to launch the binary in Visual C++'s debugger and just tell it where the sources are? I've done this before in GDB, so I know it ought to be possible.
Without the PDB symbols for that application you're going to have a tough time making heads or tails of what is going on and where. I think any source code information is going to be only in that PDB file that was created when whoever built that application.
This is assuming that the PDB file was EVER created for this application - which is not the default configuration for release mode VC++ projects I think. Since you're asserting, I guessing this is a debug configuration?
Short of any other answers, I would try attaching to the executable process in Visual Studio, setting a break point in your code and when you step into the process you don't have source to, it should ask for a source file.
Yes, it's possible. Just set up an empty project and specify the desired .exe file as debug target. I don't remember exactly how, but I know it's doable, because I used to set winamp.exe as debug target when I developed plug-ins for Winamp.
Since you don't have the source file it will only show the assembly code, but that might still be useful as you can also inspect memory, registers, etc.
Update
If you are debugging an assertion in your own program you should be able to see the source just fine, since the path to the source file is stored in the executable when you compile it with debug information.

Resources