1. make_cleanup (VEC_cleanup (cmdarg_s), &cmdarg_vec)
  2. interpreter_p = xstrdup (context->interpreter_p)
  3. gdb_init (argv[0])
    1. if (pre_init_ui_hook)
      1. pre_init_ui_hook ()
    2. init_cmd_lists
    3. initialize_targets ()
      1. init_dummy_target
      2. push_target (&dummy_target)
        1. update_current_target
  4. if (set_args)
    1. symarg = argv[optind]
    2. execarg = argv[optind]
    3. set_inferior_args_vector (argc - optind, &argv[optind])
  5. else
    1. symarg = argv[optind]
    2. execarg = argv[optind]
  6. get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit)
  7. interp = interp_lookup (interpreter_p)
  8. if (system_gdbinit && !inhibit_gdbinit)
    1. catch_command_errors (source_script, system_gdbinit, 0, RETURN_MASK_ALL)
  9. if (hoem_gdbinit && !inhibit_gdbinit)
    1. catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL)
  10. for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++)
    1. case CMDARG_INIT_FILE
      1. catch_command_errors (source_script, cmdarg_p->string, !batch_flag, RETURN_MASK_ALL)
    2. case CMDARG_INIT_COMMAND
      1. catch_command_errors (execute_command, cmdarg_p->string, !batch_flag, RETURN_MASK_ALL)
  11. if (cdarg != NULL)
    1. catch_command_errors (cd_command, cdarg, 0, RETURN_MASK_ALL)
  12. for (i = 0; i < ndir; i++)
    1. catch_command_errors (directory_switch, dirarg[i], 0, RETURN_MASK_ALL)
  13. save_auto_load = global_auto_load
  14. global_auto_load = 0
  15. if (execarg != NULL && symarg != NULL && strcmp (execarg, symarg) == 0)
    1. if (catch_command_errors (exec_file_attach, execarg, !batch_flag, RETURN_MASK_ALL)
      1. catch_command_errors (symbol_file_add_main, symarg, !batch_flag, RETURN_MASK_ALL)
  16. else
    1. if (execarg != NULL)
      1. catch_command_errors (exec_file_attach, execarg, !batch_flag, RETURN_MASK_ALL)
    2. if (symarg != NULL)
      1. catch_command_errors (symbol_file_add_main, symarg, !batch_flag, RETURN_MASK_ALL)
  17. if (corearg != NULL)
    1. catch_command_errors (core_file_command, corearg, !batch_flag, RETURN_MASK_ALL)
  18. else if (pidarg != NULL)
    1. catch_command_errors (attach_command, pidarg, !batch_flag, RETURN_MASK_ALL)
  19. else if (pid_or_core_arg)
  20. if (ttyarg != NULL)
    1. set_inferior_io_terminal (ttyarg)
  21. if (local_gdbinit)
    1. auto_load_local_gdbinit_pathname =gdb_realpath (local_gdbinit)
    2. if (...)
      1. catch_command_errors = (source_script, local_gdbinit, 0, RETURN_MASK_ALL)
  22. for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++)
    1. case CMDARG_FILE
      1. catch_command_errors (source_script, cmdarg_p->string, !batch_flag, RETURN_MASK_ALL)
    2. case CMDARG_COMMAND
      1. catch_command_errors (execute_command, cmdarg_p->string, !batch_flag, RETURN_MASK_ALL)
  23. init_history ()
  24. if (batch_flag)
    1. quit_force (NULL, 0)
  25. do_cleanups (pre_stat_chain)
  26. while (1)
    1. catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL)