0

I am using Visual studio 2013 always encountered a break point when compiling my code in debug mode. Before this post I gone through this and this.

I went through [DEBUG-> Windows-> Breakpoints] there is no break point available to delete any.

Below screenshot for how my exe triggering breakpoint at time of compilation. Yes, my project contains numerous libraries and this break point triggering only to library files. Could anyone help me to fix it, i googled a lot but can't?

enter image description here

Here is my Call stack copy:

    ntdll.dll!770cfe2c()    Unknown
        [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
        [External Code] 

DemoProj.exe!CryptoPP::MessageQueue::TransferTo2(CryptoPP::BufferedTransformation & target, unsigned __int64 & transferBytes, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel, bool blocking) Line 27  C++
DemoProj.exe!CryptoPP::BufferedTransformation::Get(unsigned char * outString, unsigned int getMax) Line 420 C++

When i debugging my code getting a error i.g "UMEngx86.dll'. Cannot find or open the PDB file."

'DemoProj.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'DemoProj.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sysfer.dll'. Cannot find or open the PDB file.
'DemoProj.exe' (Win32): Loaded 'C:\ProgramData\Symantec\Symantec Endpoint Protection\12.1.4112.4156.105\Data\Definitions\BASHDefs\20160125.011\UMEngx86.dll'. Cannot find or open the PDB file.
'DemoProj.exe' (Win32): Loaded 'C:\~…\release\log4cplus.dll'. Module was built without symbols.

I also read this document about this issue. Still need help from export.

Community
  • 1
  • 1
Kulamani
  • 509
  • 6
  • 13
  • At time of compilation? You mean your exe is triggering a breakpoint when executing, surely? Break when the exception is thrown and get a stack trace to see what's going on. – Steve Feb 04 '16 at 12:44
  • Yes, @Steve i simply click over local windows debugger and encountered this break point during compilation. – Kulamani Feb 04 '16 at 12:47
  • There can be hard coded breakpoints or the app could be calling the DebugBreak function. You can get breakpoints without setting one in a debugger. – Steve Feb 04 '16 at 12:48
  • @Kulamani: The locals window has nothing to do with compilation. I think you might be getting your terminology confused perhaps. – Steve Feb 04 '16 at 12:50
  • @Alex, yes as you commented i deleted .pdb from folder and compile again. Then again it created a new .pdb file and trigger the same breakpoints again. – Kulamani Feb 04 '16 at 12:51
  • @Kulamani: Post the stack trace! It's helpful to see the code path to the breakpoint, And I think you mean "debugging", not "compiling". – Steve Feb 04 '16 at 12:52
  • @Steve, yes right! i mean compile by clicking over " local windows debugger" – Kulamani Feb 04 '16 at 12:53
  • Could it be, that your code throws an exception? VisualStudio breaks when an uncatched exception is thrown... – Alex H Feb 04 '16 at 12:53
  • @Kulamani: Seriously, post a stack trace. – Steve Feb 04 '16 at 12:54
  • @Steve: yes for the both case "debugging" and "compiling" it happening. i am little new to SO. How can i post stack track? Should i edit my post to send "call stack trace". – Kulamani Feb 04 '16 at 13:10
  • @Kulamani: When the dialog you posted appears click "Break". Then to get the call stack window: "To open the Call Stack window in Visual Studio, from the Debug menu, choose Windows>Call Stack". Copy the contents and post it here. – Steve Feb 04 '16 at 13:13
  • @Steve: Here copy of my call stack: "DemoProj.exe!CryptoPP::MessageQueue::TransferTo2(CryptoPP::BufferedTransformation & target, unsigned __int64 & transferBytes, const std::basic_string,std::allocator > & channel, bool blocking) Line 27 C++ DemoProj.exe!CryptoPP::BufferedTransformation::Get(unsigned char * outString, unsigned int getMax) Line 420 C++ " – Kulamani Feb 04 '16 at 13:16
  • @Kulamani: I can't read that without formatting. Can you add it to your post? – Steve Feb 04 '16 at 13:18
  • 1
    @Kulamani: OK, getting closer. Set up the symbol server. Follow the instructions here: https://msdn.microsoft.com/library/b8ttk8zy(v=vs.100).aspx Once you've done that update the stack and post a comment so I'll get notified. – Steve Feb 04 '16 at 13:38
  • I'm guessing ntdll.dll!770cfe2c is the DebugBreak function. – Steve Feb 04 '16 at 13:45
  • Thanks @Steve your guidance resolve my issue on that call stack track. But again one more breakpoint appearing at another line. I am trying to follow same process but, not happening. Will notify soon after done. – Kulamani Feb 04 '16 at 13:58
  • @Kulamani: What I posted shouldn't have resolved any problems. Perhaps the error is happening non-deterministically (seemingly so). This suggests something like heap corruption. Perhaps it's not the DebugBreak function after all but a breakpoint triggered by the heap manager. Setup the symbol server so we know, ntdll.dll!770cfe2c tells us nothing, with the symbol server setup we'll get a function name. – Steve Feb 04 '16 at 14:02
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/102604/discussion-between-kulamani-and-steve). – Kulamani Feb 04 '16 at 14:06
  • @Kulamani: It's not time for that yet. All I'd say is setup a symbol server. – Steve Feb 04 '16 at 14:07
  • Did you solve the problem? – Steve Feb 09 '16 at 12:43
  • @Steve i have added some debugging ouput to my question explanation which is to complex me to understand. Could you have looks over it. – Kulamani Feb 12 '16 at 14:18
  • @Kulamani: There is nothing of consequence in there I'm afraid. – Steve Feb 13 '16 at 07:21
  • @Kulamani: It's a heap error as discussed earlier in the chat. Run some sort of heap debugging tool. I'd just use the page heap, again as discussed. – Steve Feb 13 '16 at 07:22

1 Answers1

0

Finally, i able to solve my won problem.

  1. What was the problem?

A: It was a heap memory corruption, so Heap manager thrown a exception by triggering a automatic break point.

  1. Where you did mistake?

Ans: I am explaining my mistake with simple example;

#include "stdafx.h"
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    char *buffer = "Simple Heap Error Demo"; 
    int len = strlen(buffer); 
    char *plaintext = new char[len];  //Here i mistaken

    /*It should be char *plaintext = new char[len + 1]; because i need one more memory cell for NULL character, that i forgotten and later i am trying to delete [] palintext. */

    memcpy(plaintext, buffer, len);

    plaintext[len] = '\0';

    cout << "\nplaintext: " << plaintext;

    if (plaintext != NULL);
    delete[] plaintext;     //Exception thrown here 

    system("pause");
    //cout << "\nplaintext: " << plaintext;
    return 0;
}
  1. How you solved your problem?

Ans: First i neatly debug my project using WinDbg found where exactly heap corruption exception happening. Then i wrote a simple separate program related to same scenario and able to fix my problem.

A special thanks to Steve who helped me to resolve my issue.

Community
  • 1
  • 1
Kulamani
  • 509
  • 6
  • 13