After setting a breakpoint in Qt, gdb says: “Error accessing memory address”

前端 未结 4 931
遥遥无期
遥遥无期 2020-12-11 06:01

I wrote a very simple Qt program here:

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    QTableView table(&frame         


        
4条回答
  •  一个人的身影
    2020-12-11 06:37

    Don't use the gdb command symbol-file to load external symbols. The breakpoint addresses will be wrong since they're not relocated.

    Instead, put a breakpoint in main, run the program, and then set your breakpoint:

    gdb ./program
    GNU gdb 6.8-debian blah blah blah
    (gdb) br main
    Breakpoint 1 at 0x80489c1
    (gdb) run
    Starting program: ./program
    Breakpoint 1, 0x080489c1 in main ()
    (gdb) br 'QAbstractItemView::clicked(QModelIndex const&)'
    Breakpoint 2 at 0xb7d24664
    (gdb) continue
    Continuing.
    

    Then make your breakpoint happen.

    Make sure to specify the parameter list in the function you want to set a breakpoint in, without the names of those parameters, just their types.

提交回复
热议问题