Tapatalk

Unable to debug with Windbg for Visual C++ 2010 Express

Unable to debug with Windbg for Visual C++ 2010 Express

6

    Jul 15, 2011#1

    I am trying to get Windbg to work. There are two problems.

    First I cannot get Windbg to even start.
    I am using "Microsoft Visual C++ 2010 Express - ENU" version. I new configs from previous VS. Got compiler and linker working. But it won't run the debuger.

    Second I am trying to debug a DLL plugin for another application. And need to run the host application and then attach to the dll.
    At least that is the way codewarior worked.

    I assume that the config Debug section is what I need to change to get the debuger to work. But havn't got a clue whats wrong. I have just put some general command line commands in to see if they will get run. But nothing is happing. No messages from UEStudio or otherwise.

    Has anyone got any debugger to work for a DLL? Runing on Windows 7 pro 64 bit.

    The start debugger section has:

    [Start Debugger]
    Cmd0 = $(Debugger) $T
    Depends =$T
    ShowWindow =0
    Title = Debug $T

    6,685587
    Grand MasterGrand Master
    6,685587

      Jul 20, 2011#2

      Before you try to find out why debugging fails from within UEStudio, you should check if debugging with Windbg works at all. Start Windbg itself directly, load your project and start debugging. As long as this does not work, it is useless to play with the configs file of UEStudio.

      I don't have Visual Studio C++ 2010 and therefore can't help with more detailed information.

      You might use internet search engines to get help on your second question with debugging a DLL. The webpage Windows Debuggers: Part 1: A WinDbg Tutorial and the other parts might be helpful for you.

      6

        Jul 20, 2011#3

        Thanks Mofi. But I have a already tried searching MSN. I can get Windbg to sort of work. In that I can get it to load the application but thats about it as it just complains about not having symbols. I am trying to develop a plugin for Vissim. I cannot find any thing on MSN on how to debug a DLL. The Windbg has a lot of features for debugging systems of multiprograms and processes across networks etc. And there is lots of documentation on that. But cannot locate anything on how to debug a DLL. CodeWarior 8 works, sort of but is buggy. Once I have run a debug sesion. The next I try to debug it wont load the application. Reports unknown failure. Then I have to do a windows restart to debug again. Pain. I am running Windows pro 64 bit. CodeWarrior is pre windows 7 or 64 bit processors so I didn't expect it to work at all. I have the free version of VisualStudio I downloaded it for the compiler to use with UEStudio. Havn't tried it though. Mocrosoft documentation sucks. They just keep getting worse and worse. Any I was kinda hopping some one had gotten this to work. I did finally get the debuger to load. There was a spelling in the [Start Debugger] was [Start Debug] think I fat fingered that at some point as the origional config I start with was right. But I am having a problem with the folder settings. Vissim is looking for it's dlls in my debug folder. Not sure where that is getting set.

        6,685587
        Grand MasterGrand Master
        6,685587

          Jul 21, 2011#4

          Usually there are 2 build modes preconfigured: a debug and a release mode. Open in UEStudio Project - Project Settings and switch to tab Settings. On bottom right corner you can select which version is created on build, the debug or the release version. The build version can be also selected from BUILD toolbar. Click on button Compiler Options to open the options dialog. You can set there at bottom the directories used for the debug version and for the release version. Usually subdirectory Debug in project directory is used for the debug version and Release for the release version. You can enter here any relative or absolute path.

          You need to build the debug version of your plugin DLL. And for debugging the DLL, it is necessary that your dll.pdb is in the same directory as the DLL. You have to configure in Vissim either the path to your plugin in the Debug directory or you change in the compiler options that debug directory is the directory where Vissim expects your plugin DLL.

          You don't need all the symbol files of Windows libraries and of Vissim do debug your plugin DLL. So ignore all the warnings of Windbg about the missing symbol files.

          By searching for Windbg debug "plugin DLL" with Google I found several articles about how to debug a plugin DLL. Perhaps one of them is useful for you. What you should avoid is that Vissim loads any other plugin than yours to make debugging your plugin easier.

          If you think you don't need step by step debugging, it might be easier to add to your plugin code which prints messages into a file with fixed path to create a pseudo debug log with enough information to find out what is going wrong. Alternatively you could just add TRACE commands to your code and use DebugView of SysInternals to get a log of all debug messages from within your plugin.

          6

            Jul 21, 2011#5

            Thanks Mofi.

            I will try Google. I just looked on MSN out of habbit.

            The problem with making the debug directory the vissim folder is that it would put all the obj files there. I changed my config to be able to put the dll and pdb file in the vissim folder. That was a bit tricky as I don't wont run as admin. Spent quit a bit of time finding the app to creat groups on my computer. But was able to create a development group to be able to give development access to specific system folders. Sense I use the internet I wont that extra protection. I don't think the windbg I got is compatible with UEStudio. It doesn't seam intergrated. It opens it's own window. Is that normal. It is the one UEStudio downloaded. I was hopping for better integration like CodeWarrior or Visual Studio where I can set break points on my source lines in the editor. There is a Windbg SDK. Havn't looked it it much. But it looks like it might allow control of Windbg from another program. A lot of is to add extension to Windbg though.

            6,685587
            Grand MasterGrand Master
            6,685587

              Jul 22, 2011#6

              If Advanced - Configuration - IDE - Debugger - WinDbg is correct configured and in your case option Use WinDbg as default debugger is also enabled, you should be able to debug from within UEStudio using the DEBUG toolbar. Read the help for this configuration dialog if not already done. There is also a help page for the Debugger Toolbar, but I think the commands are self-explaining. And there is the IDM power tip Quickstart guide: Using the integrated debugger.

              BTW: You could also contact IDM support by email and ask for help. The IDM developers are also using UEStudio with integrated WinDbg and therefore can surely help. Well, IDM is compiling with Visual Studio 2008 as I can see on the DLL dependency on Microsoft Visual C++ 2008 Redistributable, but that should not make the difference.

              6

                Apr 02, 2013#7

                As it turns out I had to run the x64 bit WinDbg to get it to work. But still cannot figure out how to get it to debug a DLL from UEStudio. By hand I have to build and run the application and then use task manager to find the process ID and attach to the process ID. That works but is a bit of a pain. I solved the symbol problem. I do not know what happened to my access protects. But for some reason my DLL file got some protection status that even as admin I could not move or delete it. I had to boot up standalone mode to get rid of the DLL file. If there was an error in the build I never saw it. But the old file was not being replaced. I didn't notice that the file time stamp wasn't changing. I had other projects that need to be completed so this one got put on the back burner. That was the reason I couldn't see the source code. The dll file in the folder was from an older version of application that was built in a different folder. Thought it might help someone if I posted about the protection problem. I am running Windows 7 pro 64 bit. The file was showing me (my user name) as owner. It would not let me delete it. Logged in as admin but nevertheless could not delete it. It was complaining about access rights. Makes no sense. Back to figuring out how to get debug to work from the project.