1 Reply
      Latest reply: Feb 20, 2017 1:43 AM by eskimo RSS
      ehsank Level 1 Level 1 (0 points)

        Int this piece of code blow, there are three overloading of the function Func in the class A, but

        I need to know which of these functions where called in main function.

        The vtable provide only the memory address of these three functions, but I don't know where I should check

        the foot print of these virtual functions.

         

        #include <stdio.h>

        #include <stdint.h>

         

        class A

        {

            public:

            A(){}

            virtual ~A() {}

            virtual int Func(int a) { return puts(__PRETTY_FUNCTION__); }

            virtual int Func(char a) { return puts(__PRETTY_FUNCTION__); }

            virtual int Func(float a) { return puts(__PRETTY_FUNCTION__); }

        };

         

        int main(int argc, const char **argv)

        {

            A *a = new A();

           a->Func(3);

            return 0;

        }

        • Re: track function overloading in LLDB
          eskimo Apple Staff Apple Staff (7,005 points)

          I don’t understand your question here.  For the example you posted, you can figure out which function gets called by:

          • Running the program

          • Using the debugger to step through the program

          I presume, however, that this is just an example, and you’re actually concerned about some bigger issue.  Can you explain that in more detail?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"