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. debugger position does not correspond source code

debugger position does not correspond source code

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiodebuggingcsharpc++question
16 Posts 6 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.
  • E ed welch

    My Visual studio debug sessions are suddenly behaving erratically. The debugger position does not correspond with the c++ source code line, it's sometimes one line off. This used to work fine. I'm VS 2005 SP1. Any ideas what might be wrong?

    A Offline
    A Offline
    Alan Balkany
    wrote on last edited by
    #7

    The standard solution to this problem is to select "Rebuild Solution" in Visual Studio. Sometimes the source gets out of sync with the stored debugging information, and Rebuild Solution brings it up to date.

    E 1 Reply Last reply
    0
    • D David Crow

      Have you removed all temporary files, including the Debug folder, and rebuilt the project?

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      E Offline
      E Offline
      ed welch
      wrote on last edited by
      #8

      yes

      D 1 Reply Last reply
      0
      • S Souldrift

        This may be too simple a solution but what you describe usually occurs when you start debugging a release version. Is your active configuration 'Debug' ? Souldrift

        modified on Monday, August 24, 2009 9:53 AM

        E Offline
        E Offline
        ed welch
        wrote on last edited by
        #9

        Yes, I know about that, but it's definately debug version

        1 Reply Last reply
        0
        • A Alan Balkany

          The standard solution to this problem is to select "Rebuild Solution" in Visual Studio. Sometimes the source gets out of sync with the stored debugging information, and Rebuild Solution brings it up to date.

          E Offline
          E Offline
          ed welch
          wrote on last edited by
          #10

          Yeah, that's the first thing I tried. But I notice when I moved the function that I was debugging to a different position in the file that the problem went away. Seems like VS just doesn't like my source code

          1 Reply Last reply
          0
          • E ed welch

            My Visual studio debug sessions are suddenly behaving erratically. The debugger position does not correspond with the c++ source code line, it's sometimes one line off. This used to work fine. I'm VS 2005 SP1. Any ideas what might be wrong?

            A Offline
            A Offline
            amatecki
            wrote on last edited by
            #11

            hi, it may be cause of fault in encoding of lines endings in Your source file, ie. from any reason at end of line instead of standard windows CRLF code ('\x0D','\x0A') appear the CR code ('\x0D'). Debugger counts line endings and if any encoding of line end differs from the other it may results in wrong line highlighting. To eliminate this problem You can use any text tool that can re-encode the line endings in Your source file to standard windows encoding or You can use Visual Studio editor feature "Save With Encoding" into "Save File As..." dialog. I would try first in VS do "Save File As..." -> Unix/Macintosh and next "Save File As..." -> Windows.

            modified on Tuesday, August 25, 2009 9:28 AM

            E 1 Reply Last reply
            0
            • A amatecki

              hi, it may be cause of fault in encoding of lines endings in Your source file, ie. from any reason at end of line instead of standard windows CRLF code ('\x0D','\x0A') appear the CR code ('\x0D'). Debugger counts line endings and if any encoding of line end differs from the other it may results in wrong line highlighting. To eliminate this problem You can use any text tool that can re-encode the line endings in Your source file to standard windows encoding or You can use Visual Studio editor feature "Save With Encoding" into "Save File As..." dialog. I would try first in VS do "Save File As..." -> Unix/Macintosh and next "Save File As..." -> Windows.

              modified on Tuesday, August 25, 2009 9:28 AM

              E Offline
              E Offline
              ed welch
              wrote on last edited by
              #12

              You know I have a switch statement like this: switch (keyCode) { case 0x10: maybe it's somehow recognising the 0x10 as a new line return. That makes sense becuase it's only after this switch statement that the error occurs

              D A 2 Replies Last reply
              0
              • E ed welch

                You know I have a switch statement like this: switch (keyCode) { case 0x10: maybe it's somehow recognising the 0x10 as a new line return. That makes sense becuase it's only after this switch statement that the error occurs

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #13

                ed welch wrote:

                You know I have a switch statement like this: switch (keyCode) { case 0x10: maybe it's somehow recognising the 0x10 as a new line return.

                No, not possible.

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                E 1 Reply Last reply
                0
                • E ed welch

                  yes

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #14

                  What about optimizations?

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  1 Reply Last reply
                  0
                  • D David Crow

                    ed welch wrote:

                    You know I have a switch statement like this: switch (keyCode) { case 0x10: maybe it's somehow recognising the 0x10 as a new line return.

                    No, not possible.

                    "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    E Offline
                    E Offline
                    ed welch
                    wrote on last edited by
                    #15

                    The code after that switch statement is giving the error, so it definately looks like it to me

                    1 Reply Last reply
                    0
                    • E ed welch

                      You know I have a switch statement like this: switch (keyCode) { case 0x10: maybe it's somehow recognising the 0x10 as a new line return. That makes sense becuase it's only after this switch statement that the error occurs

                      A Offline
                      A Offline
                      amatecki
                      wrote on last edited by
                      #16

                      Sorry for my mistake, proper hex values of CRLF are: '\x0D' for CR and '\x0A' for LF. Values which I wrote earlier are related decimal values 13 and 10 respectively. I was thinking about hex values but wrote decimal :) it happens. In Your switch condition there is actually decimal value of 16 but not 10 as You expected. So, it not may be the cause of problem.

                      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