title: C++ GDB breakpoint for member functions
body: <p>I am having trouble with using GDB on my c++ program. I want to set up a break point for my class member function and I'm not sure on the syntax of how to do it. My program is working find right now and I'm just trying to learn to use GDB. My problem is all the information I find on line only really deals with just a main() file and no other functions or classes and if they involve classes its only using a function with a void return statement. </p>
  
  <p>I have a binary search tree class. I want to set a break point at a function in my program.
  here's the section of my header file.</p>
  
  <pre><code>class BST
  {
      BST()
      ...
      private:
      int add((BST * root, BST *src);
  }
  </code></pre>
  
  <p>I am telneting into a command line linux server for school.
  I can get GDB running with my program just fine with g++ -g *.cpp (there are other files that are working fine) and the file is saved as a.out.
  I run GDB with</p>
  
  <pre><code>gdb ./a.out
  </code></pre>
  
  <p>and I get into GDB. I can get a break point for the void display function just fine with </p>
  
  <pre><code>b BST::disp_block()
  </code></pre>
  
  <p>but how do I do it with the add function I have tried </p>
  
  <pre><code>b BST::int add(BST*, BST *)
  b int BST::add(BST*, BST *)
  b BST::add(BST*, BST *)
  </code></pre>
  
  <p>and I even tried with the argument names</p>
  
  <pre><code>b BST::int add(BST * root, BST * src)
  b int BST::add(BST * root, BST * src)
  b BST::add(BST * root, BST * src)
  </code></pre>
  
  <p>and I keep getting the error</p>
  
  <pre><code>Function "____" not defined.
  Make break point pending on future shared library load? (y or [n])
  </code></pre>
  
  <p>How do I set up a break point for a member function like this one? Im assuming watch points would be the same format, if not could you explain that too.</p>