Example #1
0
File: cgdb.c Project: i4fumi/cgdb
/* cleanup: Invoked by the various err_xxx funtions when dying.
 * -------- */
void cleanup()
{
    char *log_file, *tmp_log_file;
    int has_recv_data;

    ibuf_free(current_line);

    /* Cleanly scroll the screen up for a prompt */
    scrl(1);
    move(LINES - 1, 0);
    printf("\n");

    rline_write_history(rline, readline_history_path);

    /* The order of these is important. They each must restore the terminal
     * the way they found it. Thus, the order in which curses/readline is 
     * started, is the reverse order in which they should be shutdown 
     */

    /* Shut down interface */
    if_shutdown();

#if 0
    if (masterfd != -1)
        util_free_tty(&masterfd, &slavefd, tty_name);
#endif

    /* Finally, should display the errors. 
     * TGDB guarentees the logger to be open at this point.
     * So, we can get the filename directly from the logger 
     */
    logger_get_file(logger, &tmp_log_file);
    log_file = strdup(tmp_log_file);
    logger_has_recv_data(logger, &has_recv_data);

    /* Shut down debugger */
    tgdb_shutdown(tgdb);

    if (tty_set_attributes(STDIN_FILENO, &term_attributes) == -1)
        logger_write_pos(logger, __FILE__, __LINE__, "tty_reset error");

    if (has_recv_data)
        fprintf(stderr, "CGDB had unexpected results, see %s for details.\n",
                log_file);

    free(log_file);
    log_file = NULL;
}
Example #2
0
int do_if_shutdown(char *ifname)
{
	return if_shutdown(ifname);
}