gdb not working

asked 2020-07-12 12:06:09 -0500

dinesh gravatar image

updated 2020-07-13 18:17:06 -0500

Geoff gravatar image

when i run the ros node with gdb with command rosrun --prefix gdb my_node my_node and than add break point in main function with break main than running the program it shows given error, it was not comming beofer in same program:

  __libc_start_main (main=0x58c770 <main>, argc=1, argv=0x7fffffffd368, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd358) at ../csu/libc-start.c:344

main function is as follows:

int main(int argc, char** argv)
    ros::init(argc, argv, "image_converter");
    ros::NodeHandle nh;

    if(argc<3) {
        ROS_ERROR("Enter 0 for rgb, 1 for rgbd and 2 for d images and radious of interest point finder!");
        return 0;
    std::cout<<"arg passed = "<<atoi(argv[1])<<std::endl;
    if(atoi(argv[1]) == 0) {
        ImageConverter ic(atoi(argv[2]));
    else if (atoi(argv[1]) == 1) {
        ros::Subscriber sub = nh.subscribe ("rgbd", 1, cloud_cb);
        ros::spin ();
    else if (atoi(argv[1]) == 2) {
        ros::Subscriber sub = nh.subscribe ("point_cloud", 1, cloud_cb);
        ros::spin ();
    return 0;
edit retag flag offensive close merge delete


Please provide some complete source code that demonstrates the problem, and describe exactly where you put the breakpoint and how you stepped through the program. A screen capture could be useful.

Geoff gravatar image Geoff  ( 2020-07-12 19:00:22 -0500 )edit

Please provide complete, compilable code.

Geoff gravatar image Geoff  ( 2020-07-13 18:31:30 -0500 )edit

after i deleted the .gdb_history it is working.

dinesh gravatar image dinesh  ( 2020-07-14 00:52:30 -0500 )edit