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. regarding MSVC debugger

regarding MSVC debugger

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingperformancetutorial
7 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.
  • M Offline
    M Offline
    mukhopadhyay somenath
    wrote on last edited by
    #1

    hello, lets take the following example. class A { virtual void fun(){} }; class B: public A { void fun(); virtual void funB(){} }; class C:public B { void fun(){} void funB(){} }; now if we define an object of class C, and if we debug the application using MSVC debugger, then inside the object of C, the vtable will show the pointer to only fun(). although in actual memory of the vtable the pointer to funB() will be there, it is not displayed in the debugger's vftable entry. i am curious to know why it is like this. somenath m

    M A L 3 Replies Last reply
    0
    • M mukhopadhyay somenath

      hello, lets take the following example. class A { virtual void fun(){} }; class B: public A { void fun(); virtual void funB(){} }; class C:public B { void fun(){} void funB(){} }; now if we define an object of class C, and if we debug the application using MSVC debugger, then inside the object of C, the vtable will show the pointer to only fun(). although in actual memory of the vtable the pointer to funB() will be there, it is not displayed in the debugger's vftable entry. i am curious to know why it is like this. somenath m

      M Offline
      M Offline
      mirex
      wrote on last edited by
      #2

      To me is mystery why did it compiled, because in class C you try to override fun(), even though you should not be able, because it is already overriden in class B and its not virtual anymore. I cant help you about the rest, because MSVC does not show pointers to funcs to me at all.

      L 2 Replies Last reply
      0
      • M mukhopadhyay somenath

        hello, lets take the following example. class A { virtual void fun(){} }; class B: public A { void fun(); virtual void funB(){} }; class C:public B { void fun(){} void funB(){} }; now if we define an object of class C, and if we debug the application using MSVC debugger, then inside the object of C, the vtable will show the pointer to only fun(). although in actual memory of the vtable the pointer to funB() will be there, it is not displayed in the debugger's vftable entry. i am curious to know why it is like this. somenath m

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Hi Somenath, now if we define an object of class C, and if we debug the application using MSVC debugger, then inside the object of C, the vtable will show the pointer to only fun(). =>Class C object will contain vptr pointing to virtual table for class C and as thee are 2 virtual functions and first declared function is fun(), vptr will contain address of this class C "fun()". although in actual memory of the vtable the pointer to funB() will be there, it is not displayed in the debugger's vftable entry. i am curious to know why it is like this. =>yes as object C will contain only one ptr. class B: public A { void fun(); // modify this as void fun(){};-> add braces / def. virtual void funB(){} };

        M 1 Reply Last reply
        0
        • M mukhopadhyay somenath

          hello, lets take the following example. class A { virtual void fun(){} }; class B: public A { void fun(); virtual void funB(){} }; class C:public B { void fun(){} void funB(){} }; now if we define an object of class C, and if we debug the application using MSVC debugger, then inside the object of C, the vtable will show the pointer to only fun(). although in actual memory of the vtable the pointer to funB() will be there, it is not displayed in the debugger's vftable entry. i am curious to know why it is like this. somenath m

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

          Hi Somenath, now if we define an object of class C, and if we debug the application using MSVC debugger, then inside the object of C, the vtable will show the pointer to only fun(). =>Class C object will contain vptr pointing to virtual table for class C and as thee are 2 virtual functions and first declared function is fun(), vptr will contain address of this class C "fun()". although in actual memory of the vtable the pointer to funB() will be there, it is not displayed in the debugger's vftable entry. i am curious to know why it is like this. =>yes as object C will contain only one ptr. class B: public A { void fun(); // modify this as void fun(){};-> add braces / def. virtual void funB(){} };

          1 Reply Last reply
          0
          • M mirex

            To me is mystery why did it compiled, because in class C you try to override fun(), even though you should not be able, because it is already overriden in class B and its not virtual anymore. I cant help you about the rest, because MSVC does not show pointers to funcs to me at all.

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

            Hi Somu, It will not give you compile error because it is virtual function mechanism(run time binding), So it will raise Linker error. Deelip Patil

            1 Reply Last reply
            0
            • M mirex

              To me is mystery why did it compiled, because in class C you try to override fun(), even though you should not be able, because it is already overriden in class B and its not virtual anymore. I cant help you about the rest, because MSVC does not show pointers to funcs to me at all.

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

              Hi Somu, It will not give you compile error because it is virtual function mechanism(run time binding), So it will raise Linker error. Deelip Patil

              1 Reply Last reply
              0
              • A Anonymous

                Hi Somenath, now if we define an object of class C, and if we debug the application using MSVC debugger, then inside the object of C, the vtable will show the pointer to only fun(). =>Class C object will contain vptr pointing to virtual table for class C and as thee are 2 virtual functions and first declared function is fun(), vptr will contain address of this class C "fun()". although in actual memory of the vtable the pointer to funB() will be there, it is not displayed in the debugger's vftable entry. i am curious to know why it is like this. =>yes as object C will contain only one ptr. class B: public A { void fun(); // modify this as void fun(){};-> add braces / def. virtual void funB(){} };

                M Offline
                M Offline
                mukhopadhyay somenath
                wrote on last edited by
                #7

                Hi Dilip, consider the problem as mentioned below. class A { public: virtual void fun(){} }; class B: public A { public: virtual void fun(){}; virtual void funB(){} }; class C:public B { public: virtual void fun(){} virtual void funB(){cout<<"This is in class c's funB()"<

                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