Robotics StackExchange | Archived questions

gdb not working

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]));
        ros::spin();
    }
    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;
}

Asked by dinesh on 2020-07-12 12:06:09 UTC

Comments

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.

Asked by Geoff on 2020-07-12 19:00:22 UTC

Please provide complete, compilable code.

Asked by Geoff on 2020-07-13 18:31:30 UTC

after i deleted the .gdb_history it is working.

Asked by dinesh on 2020-07-14 00:52:30 UTC

Answers