Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Breakpoints in Wincore.cpp

Breakpoints in Wincore.cpp

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studioadobedata-structures
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3677987
    wrote on last edited by
    #1

    I have been trying to correct an assertion failure in an MFC app for the last few days. It's been really fun... while the rest of you have been doing boring things like riding your outlandish motorcycles or bar-hopping with your chubby girlfriends, I get to really spend some quality time trying to comprehend things like "___Afx_4_U_T_q_HowDoesThisEvenCompile_". Anyhoo... an assertion fails somewhere in Wincore.cpp (a local called pMap comes up as 0, implying a call from the wrong thread, I am thinking). When the failure occurs, Visual Studio breaks into Wincore.cpp (which it finds and opens) and does a good job of debugging. It shows a call stack, "Watch" and "Quickwatch" seem to work, etc. The problem arises when I try to do some manual editing to Wincore.cpp, or even just set a breakpoint in Wincore.cpp. It quickly becomes obvious that even though Visual Studio itself found and opened this file just a moment ago, it is not actually using the copy of Wincore.cpp that I am seeing as part of the build process. So, I can make garbage edits to it, do a "Rebuild All," and still get no errors. This seems completely wrong to me and provokes my ire at a very fundamental level. I mean, I guess Microsoft and I have different definitions of terms like "compile" and "source code." When I try to simply set a breakpoint in Wincore.cpp without changing it, the breakpoint's red dot indicator goes "hollow" at runtime. When I hover over the breakpoint, Visual Studio tells me that the source code is different from that used in compilation. If I check "allow location to be different" in the breakpoint properties, then the breakpoint gets hit, but Visual Studio claims to have no source code. It prompts me to browse to the original source code. Strangely, there is a text field in this dialog showing where the source code originally resided, and this is some path on F:-drive (which, in my case, is a removable flash drive that isn't even present in the system). I'm not sure how much more "original" I can get than the file I'm TRYING to use, which is in a subfolder of C:\Program Files\Microsoft Visual Studio 2008\ and was opened up for me by Visual Studio. Am I expected to e-mail Raymond Chen for the copy on his hard drive perhaps? Generally, I don't need to edit Wincore.cpp; I would never do this permanently. Also, I suppose I haven't had much experience setting breakpoints in that file. However, I think that what I am trying to do should be possible, and I think that Visual Studio's behavior is very misleading. Am I

    R S L 3 Replies Last reply
    0
    • U User 3677987

      I have been trying to correct an assertion failure in an MFC app for the last few days. It's been really fun... while the rest of you have been doing boring things like riding your outlandish motorcycles or bar-hopping with your chubby girlfriends, I get to really spend some quality time trying to comprehend things like "___Afx_4_U_T_q_HowDoesThisEvenCompile_". Anyhoo... an assertion fails somewhere in Wincore.cpp (a local called pMap comes up as 0, implying a call from the wrong thread, I am thinking). When the failure occurs, Visual Studio breaks into Wincore.cpp (which it finds and opens) and does a good job of debugging. It shows a call stack, "Watch" and "Quickwatch" seem to work, etc. The problem arises when I try to do some manual editing to Wincore.cpp, or even just set a breakpoint in Wincore.cpp. It quickly becomes obvious that even though Visual Studio itself found and opened this file just a moment ago, it is not actually using the copy of Wincore.cpp that I am seeing as part of the build process. So, I can make garbage edits to it, do a "Rebuild All," and still get no errors. This seems completely wrong to me and provokes my ire at a very fundamental level. I mean, I guess Microsoft and I have different definitions of terms like "compile" and "source code." When I try to simply set a breakpoint in Wincore.cpp without changing it, the breakpoint's red dot indicator goes "hollow" at runtime. When I hover over the breakpoint, Visual Studio tells me that the source code is different from that used in compilation. If I check "allow location to be different" in the breakpoint properties, then the breakpoint gets hit, but Visual Studio claims to have no source code. It prompts me to browse to the original source code. Strangely, there is a text field in this dialog showing where the source code originally resided, and this is some path on F:-drive (which, in my case, is a removable flash drive that isn't even present in the system). I'm not sure how much more "original" I can get than the file I'm TRYING to use, which is in a subfolder of C:\Program Files\Microsoft Visual Studio 2008\ and was opened up for me by Visual Studio. Am I expected to e-mail Raymond Chen for the copy on his hard drive perhaps? Generally, I don't need to edit Wincore.cpp; I would never do this permanently. Also, I suppose I haven't had much experience setting breakpoints in that file. However, I think that what I am trying to do should be possible, and I think that Visual Studio's behavior is very misleading. Am I

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      I see you're using VS 2008. I know that when an MFC application initialises, the function AfxGetThread() in thrdcore.cpp will be called. I was able to set a breakpoint on that function, without even opening the file. I chose Debug->New BreakPoint->Break at function-> enter function name as AfxGetThread() and set line and character as 1 each. When I hit F5, the debugger opened thrdcore.cpp and broke at the beginning of AfxGetThread(). You might want to try it with the function of your interest located in wincore.cpp. The IDE will open the correct file (that it is using), and break at the location of your interest. You might as well consider using "Advanced breakpoints" (just do a search). :)

      “Follow your bliss.” – Joseph Campbell

      1 Reply Last reply
      0
      • U User 3677987

        I have been trying to correct an assertion failure in an MFC app for the last few days. It's been really fun... while the rest of you have been doing boring things like riding your outlandish motorcycles or bar-hopping with your chubby girlfriends, I get to really spend some quality time trying to comprehend things like "___Afx_4_U_T_q_HowDoesThisEvenCompile_". Anyhoo... an assertion fails somewhere in Wincore.cpp (a local called pMap comes up as 0, implying a call from the wrong thread, I am thinking). When the failure occurs, Visual Studio breaks into Wincore.cpp (which it finds and opens) and does a good job of debugging. It shows a call stack, "Watch" and "Quickwatch" seem to work, etc. The problem arises when I try to do some manual editing to Wincore.cpp, or even just set a breakpoint in Wincore.cpp. It quickly becomes obvious that even though Visual Studio itself found and opened this file just a moment ago, it is not actually using the copy of Wincore.cpp that I am seeing as part of the build process. So, I can make garbage edits to it, do a "Rebuild All," and still get no errors. This seems completely wrong to me and provokes my ire at a very fundamental level. I mean, I guess Microsoft and I have different definitions of terms like "compile" and "source code." When I try to simply set a breakpoint in Wincore.cpp without changing it, the breakpoint's red dot indicator goes "hollow" at runtime. When I hover over the breakpoint, Visual Studio tells me that the source code is different from that used in compilation. If I check "allow location to be different" in the breakpoint properties, then the breakpoint gets hit, but Visual Studio claims to have no source code. It prompts me to browse to the original source code. Strangely, there is a text field in this dialog showing where the source code originally resided, and this is some path on F:-drive (which, in my case, is a removable flash drive that isn't even present in the system). I'm not sure how much more "original" I can get than the file I'm TRYING to use, which is in a subfolder of C:\Program Files\Microsoft Visual Studio 2008\ and was opened up for me by Visual Studio. Am I expected to e-mail Raymond Chen for the copy on his hard drive perhaps? Generally, I don't need to edit Wincore.cpp; I would never do this permanently. Also, I suppose I haven't had much experience setting breakpoints in that file. However, I think that what I am trying to do should be possible, and I think that Visual Studio's behavior is very misleading. Am I

        S Offline
        S Offline
        sashoalm
        wrote on last edited by
        #3

        Member 3680785 wrote:

        It quickly becomes obvious that even though Visual Studio itself found and opened this file just a moment ago, it is not actually using the copy of Wincore.cpp that I am seeing as part of the build process. So, I can make garbage edits to it, do a "Rebuild All," and still get no errors. This seems completely wrong to me and provokes my ire at a very fundamental level. I mean, I guess Microsoft and I have different definitions of terms like "compile" and "source code."

        I think that wincore.cpp is provided for debugging purposes only, MFC can't be compiled easily from the source. What your app links to is the debug versions of MFC dlls. As for VS finding the source that's probably because it is referenced in the dll or some pch file or some such.

        There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal

        1 Reply Last reply
        0
        • U User 3677987

          I have been trying to correct an assertion failure in an MFC app for the last few days. It's been really fun... while the rest of you have been doing boring things like riding your outlandish motorcycles or bar-hopping with your chubby girlfriends, I get to really spend some quality time trying to comprehend things like "___Afx_4_U_T_q_HowDoesThisEvenCompile_". Anyhoo... an assertion fails somewhere in Wincore.cpp (a local called pMap comes up as 0, implying a call from the wrong thread, I am thinking). When the failure occurs, Visual Studio breaks into Wincore.cpp (which it finds and opens) and does a good job of debugging. It shows a call stack, "Watch" and "Quickwatch" seem to work, etc. The problem arises when I try to do some manual editing to Wincore.cpp, or even just set a breakpoint in Wincore.cpp. It quickly becomes obvious that even though Visual Studio itself found and opened this file just a moment ago, it is not actually using the copy of Wincore.cpp that I am seeing as part of the build process. So, I can make garbage edits to it, do a "Rebuild All," and still get no errors. This seems completely wrong to me and provokes my ire at a very fundamental level. I mean, I guess Microsoft and I have different definitions of terms like "compile" and "source code." When I try to simply set a breakpoint in Wincore.cpp without changing it, the breakpoint's red dot indicator goes "hollow" at runtime. When I hover over the breakpoint, Visual Studio tells me that the source code is different from that used in compilation. If I check "allow location to be different" in the breakpoint properties, then the breakpoint gets hit, but Visual Studio claims to have no source code. It prompts me to browse to the original source code. Strangely, there is a text field in this dialog showing where the source code originally resided, and this is some path on F:-drive (which, in my case, is a removable flash drive that isn't even present in the system). I'm not sure how much more "original" I can get than the file I'm TRYING to use, which is in a subfolder of C:\Program Files\Microsoft Visual Studio 2008\ and was opened up for me by Visual Studio. Am I expected to e-mail Raymond Chen for the copy on his hard drive perhaps? Generally, I don't need to edit Wincore.cpp; I would never do this permanently. Also, I suppose I haven't had much experience setting breakpoints in that file. However, I think that what I am trying to do should be possible, and I think that Visual Studio's behavior is very misleading. Am I

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi, I just wanted to add some observations. You state in your message novel that the variable pMap is NULL. I recognize this variable name as possibly being the internel MFC CHandleMap. If this variable is NULL then you are incorrectly accessing MFC objects across a thread boundry. I would suggest that you research the following: Description of CWnd derived MFC objects and multithreaded applications in Visual C++[^] Inside MFC: Handle Maps and Temporary Objects[^] Best Wishes, -David Delaune

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups