-
June 23rd, 2020, 12:16 PM
#1
debug in release mode
Hello,
I have a multiple solutions (around 8 solutions ) and each of them have multiple projects.
I am using the incredibuild and built all the solutions in the Release mode.
Now when i try to attach the solution which i want to debug, and try to put the breakpoint in it:
I get error :
"Breakpoint currently will not be hit. No symbols have been loaded for this document"
Not sure what I need to do. I use all the project settings ( which was already there) and since it is huge project, I am bit stuck the moment with this issue.
Forgot to mention, that, I am using Debug -> "Attach to Process" to debug. Because I want to run to some scenario and put breakpoint after that.
Just to let you know (about my expertise level), I am also bit new to visual studio env (eventhough i used c++ with eclipse earlier)
Thanks a lot
Any suggestions will help me a lot
Pdk
Last edited by pdk5; June 23rd, 2020 at 12:22 PM.
-
June 23rd, 2020, 12:24 PM
#2
Re: debug in release mode
Why debug in release mode?
Did you compile and link to include debug info?
Is there a reason you're using attach rather than starting the app in the debugger?
-
June 23rd, 2020, 12:28 PM
#3
Re: debug in release mode
Re-build the soultion using Debug mode. Release mode strips away debug info etc and does code optimisation. You should only compile as Release when you're happy with the solution - for final testing as Release build. Debug mode is what you use when you are developing and debugging. Release (as it's name implies) is for the 'final' release build. Note that Debug build can run slower than Release build - so don't do performance testing with Debug build.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
June 23rd, 2020, 12:57 PM
#4
Re: debug in release mode
@ kaud and GCDEF : Thanks a lot for the comments and inputs:
Yes, I usually debug in debug mode. But this is special case, where i need to use the third party tool (with lot of settings). that can only be attached in Release mode. I am new to this project (so collegues had told me, that i can only use Release mode for this setup). So what they tell must be true.
So i want to debug in Release mode, only this particular case.
My collegue had told me earlier, i can still put breakpoint and debug in release mode.
Last edited by pdk5; June 23rd, 2020 at 01:17 PM.
-
June 23rd, 2020, 02:59 PM
#5
Re: debug in release mode
Originally Posted by pdk5
@ kaud and GCDEF : Thanks a lot for the comments and inputs:
Yes, I usually debug in debug mode. But this is special case, where i need to use the third party tool (with lot of settings). that can only be attached in Release mode. I am new to this project (so collegues had told me, that i can only use Release mode for this setup). So what they tell must be true.
So i want to debug in Release mode, only this particular case.
My collegue had told me earlier, i can still put breakpoint and debug in release mode.
Are you trying to debug a third party tool? You can't do that unless you have a debug version of it including their pdb file.
-
June 23rd, 2020, 03:27 PM
#6
Re: debug in release mode
Originally Posted by pdk5
Any suggestions will help me a lot
It's perfectly possible to debug without a debugger. Just put traces in the (release mode) code and go with the flow.
-
June 23rd, 2020, 11:53 PM
#7
Re: debug in release mode
Im not debugging third party tool. Third party tool produces some kind of input to our application.
-
June 24th, 2020, 12:24 AM
#8
Re: debug in release mode
@pdk5. Read up on the differences between debug and release builds. The release build is usually optimized (e.g. the compiled binary may not match the source code). The debug build isn't optimized and debug symbols are generated. The symbols are essentally pointers from the binary to the code.
There's a lot going on when you are debugging and what happens when break points are set, how the symbols are used to find the positions in the code and so on, but what is imoprtant is the symbols match the binaries.
Now it is an option to create a release build with symbols, but with optimizations, you'll often be stepping through blamk lines of code (because the optimizations are performed by the compiler amd not reflected by the code).
At any rate it is curious that the 3rd party dll can't be compiled in anything but the release build. That seems odd to me as it should be able to be compiled in debug or release.
-
June 24th, 2020, 07:36 AM
#9
Re: debug in release mode
Originally Posted by pdk5
Im not debugging third party tool. Third party tool produces some kind of input to our application.
Can you explain in more detail what you're trying to do? If you're not debugging the third-party app, why not just debug yours? Why the need to attach to anything?
-
June 24th, 2020, 11:11 AM
#10
Re: debug in release mode
@Arjay: Thanks a lot for the info and patience to explain in detail helped a lot
I am just still almost new comer in the company who have quite exp people around in same company.
As per them, the third party application will only work with the Release version of our application (I donot know the history).
Anyway (I am now able to get to the point where the exception is thrown with the Release build). I didnot have to do anything as our build setup had already setup to generate min debug info for the Release mode. I was giving the debug exe name and i figured out this issue.
Now at least i have the call stack . I need to debug further ofcourse with the help of others (I am not familiar in that part of the code)
@Kaud, GCDEF and Arjay: It was very helpful to discuss and correct my opions. Thankyou again
-
June 24th, 2020, 11:48 AM
#11
Re: debug in release mode
Originally Posted by pdk5
As per them, the third party application will only work with the Release version of our application (I donot know the history).
That doesn't make much sense either.
-
June 27th, 2020, 05:24 AM
#12
Re: debug in release mode
Thankyou GCDEF, I'll update the thread if i come to know about this ..
It is difficult to get clarifications (on all my doubts)when working remotely and collegues are bit busy
Thankyou ,
-
June 28th, 2020, 04:09 AM
#13
Re: debug in release mode
Originally Posted by pdk5
It is difficult to get clarifications (on all my doubts)when working remotely and collegues are bit busy
I seems you've disregarded my advice (in #6) completely. That's a mistake. Ask a college familiar with the application for the most likely bug location. With a little bit of luck a few narrowing traces will lead you to the exact spot.
Narrowing traces works like a binary search, logarithmically by successive halving. It allows you to quickly track down any bug in large unfamiliar code bases and at the same time get a feel for the overall structure of the application. Tracing really is the ultimate debugger.
My advice is to stop struggling with the tools. Put your doubts aside and concentrate on tracing down the bug instead.
I know my position is somewhat controversial but my point is that just because there's a tool called debugger doesn't mean it's the only way to debug code. Using a debugger is often the easiest and fastest way to find bugs but not always.
Last edited by wolle; June 28th, 2020 at 11:52 PM.
-
June 29th, 2020, 04:53 PM
#14
Re: debug in release mode
@wolle: Thanks a lot for the advice, will try that.
Somehow I missed it, very sorry about it .
Thankyou very much for the inputs and very helpful for me.
-
June 29th, 2020, 10:29 PM
#15
Re: debug in release mode
Originally Posted by pdk5
will try that.
Tracing means you temporarily modify the source code. Make sure you're permitted to do so.
Tag all traces you put in with comments so they can be easily located later and removed/commented out when the bug is fixed.
Good luck!
Last edited by wolle; June 29th, 2020 at 11:20 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|