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. Break when address reading

Break when address reading

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialdebuggingperformance
8 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.
  • U Offline
    U Offline
    User 13049321
    wrote on last edited by
    #1

    I know how to break execution when the memory at the specified address changes. ------------------------------ Menu->Debug->Windows->Breakpoints: New: New Data Breakpoints ------------------------------ But, I want to break execution when the memory at the specified address reads. For example

    int g_iNum = 123;

    void Fun1()
    {
    int iTemp;

    iTemp = g_iNum; // Break execution at here, where is when the memory at the g_iNum's address being reads.

    }

    V L Richard Andrew x64R _ 4 Replies Last reply
    0
    • U User 13049321

      I know how to break execution when the memory at the specified address changes. ------------------------------ Menu->Debug->Windows->Breakpoints: New: New Data Breakpoints ------------------------------ But, I want to break execution when the memory at the specified address reads. For example

      int g_iNum = 123;

      void Fun1()
      {
      int iTemp;

      iTemp = g_iNum; // Break execution at here, where is when the memory at the g_iNum's address being reads.

      }

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      Perhaps, something like Function Breakpoint?

      U 1 Reply Last reply
      0
      • U User 13049321

        I know how to break execution when the memory at the specified address changes. ------------------------------ Menu->Debug->Windows->Breakpoints: New: New Data Breakpoints ------------------------------ But, I want to break execution when the memory at the specified address reads. For example

        int g_iNum = 123;

        void Fun1()
        {
        int iTemp;

        iTemp = g_iNum; // Break execution at here, where is when the memory at the g_iNum's address being reads.

        }

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #3

        You have supplied no way to answer your question as you have not told us what system you are talking about. Hence I can only tell you it is called a watchpoint watchpoint - Wiktionary[^] This is what you are wanting isn't it ===> "A debugging mechanism whereby execution is suspended every time a specified memory location is modified; or, any of various similar such mechanisms." No way to answer you any deeper than that.

        In vino veritas

        U 1 Reply Last reply
        0
        • U User 13049321

          I know how to break execution when the memory at the specified address changes. ------------------------------ Menu->Debug->Windows->Breakpoints: New: New Data Breakpoints ------------------------------ But, I want to break execution when the memory at the specified address reads. For example

          int g_iNum = 123;

          void Fun1()
          {
          int iTemp;

          iTemp = g_iNum; // Break execution at here, where is when the memory at the g_iNum's address being reads.

          }

          Richard Andrew x64R Offline
          Richard Andrew x64R Offline
          Richard Andrew x64
          wrote on last edited by
          #4

          You might want to investigate Guard Pages: Creating Guard Pages | Microsoft Docs[^]

          The difficult we do right away... ...the impossible takes slightly longer.

          U 1 Reply Last reply
          0
          • V Victor Nijegorodov

            Perhaps, something like Function Breakpoint?

            U Offline
            U Offline
            User 13049321
            wrote on last edited by
            #5

            Use Windbg "ba r1 0000ffff" can break when address(0x0000ffff) reads. But I don't know how to find where of code.

            1 Reply Last reply
            0
            • L leon de boer

              You have supplied no way to answer your question as you have not told us what system you are talking about. Hence I can only tell you it is called a watchpoint watchpoint - Wiktionary[^] This is what you are wanting isn't it ===> "A debugging mechanism whereby execution is suspended every time a specified memory location is modified; or, any of various similar such mechanisms." No way to answer you any deeper than that.

              In vino veritas

              U Offline
              U Offline
              User 13049321
              wrote on last edited by
              #6

              Windows10, Visual Studio, C++ ---------------------------- Use Windbg "ba r1 0000ffff" can break when address(0x0000ffff) reads. But I don't know how to localition the source code.

              1 Reply Last reply
              0
              • Richard Andrew x64R Richard Andrew x64

                You might want to investigate Guard Pages: Creating Guard Pages | Microsoft Docs[^]

                The difficult we do right away... ...the impossible takes slightly longer.

                U Offline
                U Offline
                User 13049321
                wrote on last edited by
                #7

                Use Windbg "ba r1 0000ffff" can break when address(0x0000ffff) reads. But I don't know how to open and location the source code.

                1 Reply Last reply
                0
                • U User 13049321

                  I know how to break execution when the memory at the specified address changes. ------------------------------ Menu->Debug->Windows->Breakpoints: New: New Data Breakpoints ------------------------------ But, I want to break execution when the memory at the specified address reads. For example

                  int g_iNum = 123;

                  void Fun1()
                  {
                  int iTemp;

                  iTemp = g_iNum; // Break execution at here, where is when the memory at the g_iNum's address being reads.

                  }

                  _ Offline
                  _ Offline
                  _Superman_
                  wrote on last edited by
                  #8

                  The first thing that came to mind is to search for g_iNum in the entire code base and put breakpoints where ever it is being accessed. ;P

                  «_Superman_»  _I love work. It gives me something to do between weekends.

                  _Microsoft MVP (Visual C++) (October 2009 - September 2013)

                  Polymorphism in C

                  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