How to compile a VB6 program with extra debugging information? - vb6

How to compile a VB6 program with extra debugging information (PDB file / symbols)?
If I just choose "Make DLL" from the File menu, no PDB file is created.

From https://support.smartbear.com/viewarticle/2357/
Compiling Microsoft Visual Basic 6.0 Applications With Debug Information
This topic explains how to compile Microsoft Visual Basic 6.0
applications with debug information...
Visual Basic may include debug information in the executable file, or
add debug info to an external PDB file. ...if you compile a release
version of your product, it is recommended to generate debug
information as an external file. This will decrease the overall size
of your executable.
To specify the way in which debug information will be generated, use
the Link environment variable. If this variable is not defined, Visual
Basic will generate an external PDB file. Else, the compiler will
include the debug information in the executable. For more information
on this, see Visual Basic documentation.
To compile your Visual Basic application ... follow these steps:
If you compile a release version of your product, make certain that the Link environment variable is not defined. If this
environment variable exists, Visual Basic will embed debug information
in the executable and thus the overall size of your application will
increase.
Open your project in Microsoft Visual Basic.
Select Project | Project Properties from Visual Basic’s main menu. This will open the Project Properties dialog.
Move to the Compile tabbed page and select the Create Symbolic Debug Info check box:
Press OK to close the dialog.
Recompile your application.
There is no need to ship the generated PDB files along with your
application.

Related

How to debug a shared library (.so) in VS2019 (NDK Projekt)

I have a NDK Project in Visual Studio 2019 which uses several shared libraries.
In the project which contains the android_main function i can set breakpoints and use them without problems. If I set a breakpoint in one of my shared libraries (.so) and start the debugger I get this message:
The breakpoint will not currently be hit. Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained.
How can I load the missing symbols?
I'm using the platform toolset Clang 5.0
What I tried so far:
With this command I proved that symbols are present:
llvm-nm -D libMySharedLib.so
In the modules window (in debug mode) I can see that symbols are loaded for my .so module.
What I'm guessing is wrong:
With NDK typically such problems show up when the debugging info is being stripped away. There is also an option to disable this behavior which is called "donotstrip" in Android Studio. But I'm on Visual Studio.
Apparently, in Visual Studio, when starting the debugger, the respective shared library (.so) project must be set as "Startup Project". Only the breakpoints of the current Startup Project are reached or those breakpoints that are contained in .cpp files, which in turn are part of the respective Startup Project. This is of course not very comfortable and if someone here knows a better solution, a corresponding comment would be very helpful.
Anyway, if a shared library project is to be launched, the appropriate path and name of the .apk file must be set under "Configuration Properties"->"Debugging"->"Package to Launch".

Ignore other DLL Files when debugging DLL Project with target application (Visual Studio 2019)

I have a C++ DLL project in Visual Studio I've downloaded, which is a plugin module for another existing program (a media Player). The DLL created by this project is saved into the addon folder, is loaded by the media player and works great with no issues. However, I would like to be able to step through the code in the library while the player is running to understand how the code works.
The problem is that when I setup the project to launch the media player and step through the DLL project code, it starts fine and I can set breakpoints. But at certain times, the Visual Studio debugger tries to access other loaded DLLs inside the media player, which I don't have source code for, and it crashes the whole thing with an "access violation writing location blah blah blah" error. I have no interest in trying to access any other libraries the program is loading other than the one I have the source code for, so is there any way to prevent the Visual Studio Debugger from trying to hook into these other libraries? I know the error is not due to anything in the DLL project itself because it runs absolutely fine if I just tell it to "Start Without Debugging."
I have the source code for, so is there any way to prevent the Visual
Studio Debugger from trying to hook into these other libraries?
Please try these steps:
Suggestion
1) check Enable Just My Code under Tools-->Options-->Debugging-->General
2) enter Tools-->Options-->Debugging-->Symbols-->choose All modules, unless excluded and then click Specify excluded modules
then input the name of the dlls you want to exclude. Their symbols will not be loaded when you debug your application.
3) do not forget to uncheck option Warn if no user code on launch(managed only) under Tools-->Options-->Debugging-->General

How to set up ReSharper to allow you to navigate to third-party DLL files and view source lines of code?

This confusing feature in ReSharper claims to let you browse external sources from within Visual Studio, see External Sources (ReSharper Web Help).
But, I don't understand what values to set for the folder substitution option. (Resharper - Options - External Sources - Advanced)
When I try navigating to source, I keep getting the message:
PdbNavigator: No sources found in debugging information for in assembly
(This is almost a duplicate of Stack Overflow question Visual Studio - Attach source code to reference, but that post did not explain HOW to attach external sources.
This is tricky, and I finally figured it out:
Click "Show current path settings and PDB files binding" and look at where the PDB points to for source.
Add a folder substitution where the source code is where the PDB says the source code is (probably a path not on your computer, but on the system that compiled the DLL file and PDB). Set the target to the source you downloaded.
Here's a screenshot:

Prevent debugging projects that are added as reference in Visual Studio

I have a project that is auto generated. This project is referenced by my web app in visual studio. When i step through the code in debug mode the code from this project gets stepped into. Is there a way I can skip this code in debug mode.
I can't use System.Diagnostics.DebuggerStepThroughAttribute since the code will get replaced every time my datasource changes.
Thanks,
i think you should remove pdb files of the project which you don't want to debug.
A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program.
similar question/answer : Can you debug a .NET app with ONLY the source code of one file?

Visual Studio cannot find CPPUNIT debugging database

I am using Visual Studio 2008 with CPPUNIT. I already compiled CPPUNIT and added the CPPUNIT path to Include and Library path. Currently, I can compile my program with CPPUNIT library.
However, the linker generates the following warning:
Warning 2 warning LNK4099: PDB 'vc90.pdb' was not found with
'C:\Program Files\cppunit\cppunit-1.12.1\lib\cppunitd.lib' or at
'c:\Users\hide1713\Desktop\3d_tank\cpp_pj\bin\vc90.pdb'; linking
object as if no debug info cppunitd.lib GameUnitTest
There's a cppunitd_dll.pdb file along with cppunitd.lib. How do I tell the linker where to find the CPPUNIT debug database?
Thanks all.
In your CppUnit project, be sure you have your compiler emitting a program database file that's compatible with your main project. In the CppUnit project properties window, under the Config properties / C++ / General tree, you'll see the Debug Information Format box. Select "Program Database /Zi" or whatever value exactly matches the same setting on your main project. You'll then have to recompile them both, of course.

Resources