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.
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.
int add((BST * root, BST *src);
b BST::int add(BST*, BST *)
b int BST::add(BST*, BST *)
b BST::add(BST*, BST *)
b BST::int add(BST * root, BST * src)
b int BST::add(BST * root, BST * src)
b BST::add(BST * root, BST * src)
Function "____" not defined.
Make break point pending on future shared library load? (y or [n])
As Dark Falcon said,
break BST::add should work if you don't have overloads.
You can also type:
(gdb) break 'BST::add(<TAB>
(note the single quote). This should prompt GDB to perform tab-completion, and finish the line like so:
(gdb) break 'BST::add(BST*, BST*)
and which point you can add the terminating
'' and hit Enter to add the breakpoint.
I can get a break point for the void display function
Function return type is not part of its signature and has nothing to do with what's happening.