Skip to content

C family language

Breakpoint for member functions

stackoverflow breakpoint for member functions

class BST
{
    BST()
    ...
    private:
    int add((BST * root, BST *src);
}

A

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.

Show all members of a class

如何在gdb中,展示一个class的所有的member?可以使用如下命令:

ptype

参见

struct

使用如下命令:

ptype /o

sizeof

gdb是能够理解sizeof的,所以通过此可以获知一个struct的size,下面是例子:

(gdb) p sizeof(CHSInsRspInfoField)
$1 = 264
(gdb)