Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Debug Qt vs memory edit
Qt 6.11 is out! See what's new in the release blog

Debug Qt vs memory edit

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.7k 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.
  • Kh_nguyen719K Offline
    Kh_nguyen719K Offline
    Kh_nguyen719
    wrote on last edited by Kh_nguyen719
    #1

    Hi all,
    I have a question about debugging on Qt - Ubuntu 64bits. Currently, I have a code as follows:
    int a = 257;
    char* p = (char*)&a;
    However, my issue is printf pointer's address and address of object is different.
    Address of pointer - printf: prinntf("%p", p) - Result: 0x7ffef7ccd694
    Address of pointer - open memory edit: 7ffef7ccd698
    Who can explain this issue help me? Thanks for advanced.

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, the 1st address is what the pointer points to (the value of the pointer) and the 2nd address is the address to the pointer itself.

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        First of all there's no pointers in your example. %p is for printing pointers and p is not a pointer.
        If you want to print the value of p, which is the truncated address of a, you would use printf("%d", p).
        If you want to print the address of p you would use printf("%p", &p).

        1 Reply Last reply
        0
        • Kh_nguyen719K Offline
          Kh_nguyen719K Offline
          Kh_nguyen719
          wrote on last edited by
          #4

          Thank all,
          I also wanna ask more a question. If I wanna watch value at address what the pointer point to - value of pointer - in memory edit
          So what to it will be show how on Qt instead of printf address and then pass those address to memory edit ? Because when open memory edit, it is address of pointer - not address pointer points to.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved