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. very odd vc 6 debugger behavior

very odd vc 6 debugger behavior

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelp
11 Posts 5 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    In VC 6 I am unable to put a breakpoint on some lines of normal looking code like int n; n= 0;-->here iT says the breakpoint is not positioned on a valid line. When I step through after putting the breakpoint on some other line, it skips the lines it didnt think are valid I rebuilt all, but no help. thanks, sb

    J J J 3 Replies Last reply
    0
    • N ns

      In VC 6 I am unable to put a breakpoint on some lines of normal looking code like int n; n= 0;-->here iT says the breakpoint is not positioned on a valid line. When I step through after putting the breakpoint on some other line, it skips the lines it didnt think are valid I rebuilt all, but no help. thanks, sb

      J Offline
      J Offline
      joelgarabedian
      wrote on last edited by
      #2

      Are you in Release config? that's a classic mistake :) Also, check you don't have a return above these statements in the same scope - the compiler will consider this redundant code. Hope this helps :)

      1 Reply Last reply
      0
      • N ns

        In VC 6 I am unable to put a breakpoint on some lines of normal looking code like int n; n= 0;-->here iT says the breakpoint is not positioned on a valid line. When I step through after putting the breakpoint on some other line, it skips the lines it didnt think are valid I rebuilt all, but no help. thanks, sb

        J Offline
        J Offline
        James R Twine
        wrote on last edited by
        #3

        If n is not used anywhere else, it may get removed by the compiler.  Yes, even in debug builds, some optimizations still take place(!).    Add code that actually deos something with it (pass it to _itot(...) for example) and see if the breakpoint works then.    The other reason is a mismatch between the code in the IDE and the application being debugged (if you can set breakpoints on blank lines, that is usually why).    Peace!

        -=- James


        If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
        Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
        DeleteFXPFiles & CheckFavorites (Please rate this post!)

        D 1 Reply Last reply
        0
        • J James R Twine

          If n is not used anywhere else, it may get removed by the compiler.  Yes, even in debug builds, some optimizations still take place(!).    Add code that actually deos something with it (pass it to _itot(...) for example) and see if the breakpoint works then.    The other reason is a mismatch between the code in the IDE and the application being debugged (if you can set breakpoints on blank lines, that is usually why).    Peace!

          -=- James


          If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
          Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
          DeleteFXPFiles & CheckFavorites (Please rate this post!)

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

          James R. Twine wrote:

          Add code that actually deos something with it (pass it to _itot(...) for example) and see if the breakpoint works then.

          Doesn't assigning it a value constitute "doing something with it?"


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          J N 2 Replies Last reply
          0
          • D David Crow

            James R. Twine wrote:

            Add code that actually deos something with it (pass it to _itot(...) for example) and see if the breakpoint works then.

            Doesn't assigning it a value constitute "doing something with it?"


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            J Offline
            J Offline
            James R Twine
            wrote on last edited by
            #5

            It should, but I know that I have seen odd things in the debugger with values that are not otherwise used.  Basically, if the release compiler would optimize it out, the debug compiler just might, too.    Odd, I know.  Welcome to VC++ 6.0! :)    Peace!

            -=- James


            If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
            Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
            DeleteFXPFiles & CheckFavorites (Please rate this post!)

            1 Reply Last reply
            0
            • N ns

              In VC 6 I am unable to put a breakpoint on some lines of normal looking code like int n; n= 0;-->here iT says the breakpoint is not positioned on a valid line. When I step through after putting the breakpoint on some other line, it skips the lines it didnt think are valid I rebuilt all, but no help. thanks, sb

              J Offline
              J Offline
              Jethro63
              wrote on last edited by
              #6

              I run into this problem all the time. Out of exasperation, I have found the following fail-safe approach: 1. Close the project. 2. Go into the project directory and delete the .NCB and the .ASP files 3. Re-open the project and re-build Everything should be straightened out now. This may seem like hitting a fly with a sledge hammer but I got so sick of this happening and I found that this just plain works. Note: I have found that it happens most often after I have used any revision control system (like SourceSafe). If you have inserted key words into the header of your code files (like "$Log:" or "$History:"), it will displace the code downward and desynchronize it with the debugging information. It does not seem to update the timestamps on the source files, however, so the debug information files do not get rebuilt. So you have to force VS to rebuild them by making them disappear... Cheers, Mark

              N 1 Reply Last reply
              0
              • J Jethro63

                I run into this problem all the time. Out of exasperation, I have found the following fail-safe approach: 1. Close the project. 2. Go into the project directory and delete the .NCB and the .ASP files 3. Re-open the project and re-build Everything should be straightened out now. This may seem like hitting a fly with a sledge hammer but I got so sick of this happening and I found that this just plain works. Note: I have found that it happens most often after I have used any revision control system (like SourceSafe). If you have inserted key words into the header of your code files (like "$Log:" or "$History:"), it will displace the code downward and desynchronize it with the debugging information. It does not seem to update the timestamps on the source files, however, so the debug information files do not get rebuilt. So you have to force VS to rebuild them by making them disappear... Cheers, Mark

                N Offline
                N Offline
                ns
                wrote on last edited by
                #7

                hmmm....deleting the ncb file and rebuilding all didn't do it. What is the aps file you mention? This is a VC 6 project , is there an aps file? thanks, sb I was so sure the ncb file trick was going to work!

                J D 3 Replies Last reply
                0
                • D David Crow

                  James R. Twine wrote:

                  Add code that actually deos something with it (pass it to _itot(...) for example) and see if the breakpoint works then.

                  Doesn't assigning it a value constitute "doing something with it?"


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  N Offline
                  N Offline
                  ns
                  wrote on last edited by
                  #8

                  I do have code that is actually doing things, and tried the breakpoints there too. That was assignment statement was just a line , one of many . On some lines it works, on others not, its bizarre. Yes, I am in release mode but I have it set up to allow debugging, and its always worked. thanks for the input, sb

                  1 Reply Last reply
                  0
                  • N ns

                    hmmm....deleting the ncb file and rebuilding all didn't do it. What is the aps file you mention? This is a VC 6 project , is there an aps file? thanks, sb I was so sure the ncb file trick was going to work!

                    J Offline
                    J Offline
                    Jethro63
                    wrote on last edited by
                    #9

                    Yes, its VS6.0 I'm talking about and I always find a file with a name the same as my project and an extension "aps". If memory serves, I also delete the "opt" file as well. I have never bothered to take the time to see which of these 3 files is really responsible. It doesn't matter because they are entirely re-buildable and it doesn't take long. If this doesn't work then you should check your optimization settings as was previously advised by another respondant. Cheers, Mark

                    1 Reply Last reply
                    0
                    • N ns

                      hmmm....deleting the ncb file and rebuilding all didn't do it. What is the aps file you mention? This is a VC 6 project , is there an aps file? thanks, sb I was so sure the ncb file trick was going to work!

                      J Offline
                      J Offline
                      Jethro63
                      wrote on last edited by
                      #10

                      One other thing: Make sure you perform a clean re-build after deleting the files, not just a build-any-out-of-date... Mark ;)

                      1 Reply Last reply
                      0
                      • N ns

                        hmmm....deleting the ncb file and rebuilding all didn't do it. What is the aps file you mention? This is a VC 6 project , is there an aps file? thanks, sb I was so sure the ncb file trick was going to work!

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

                        ns wrote:

                        What is the aps file you mention?

                        I think it is an APp Studio file.

                        ns wrote:

                        ...is there an aps file?

                        Yes, there very well could be.


                        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                        "Judge not by the eye but by the heart." - Native American Proverb

                        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