void dump_core_file (int pid, const char *filename) { int tt_status; char buf[64]; tt_status = call_ttrace (TT_PROC_CORE, pid, (TTRACE_ARG_TYPE) filename, 0, 0); if (tt_status == -1) { /* With some versions of HP/UX, specifying the name of the core file is not supported, so this may have been the cause for this failure. Try again without the file name. */ tt_status = call_ttrace (TT_PROC_CORE, pid, 0, 0, 0); if (tt_status != -1) { /* Success, so indeed the filename was the source of the problem. Inform the user that the core file was named differently (if indeed the filename is different from the default core file name!) */ sprintf (buf, "core.%d", pid); if (strcmp (filename, buf) != 0) { warning ("The Operating System does not allow the dump in %s", filename); filename = buf; } } } if (tt_status == -1) perror_with_name ("ttrace:"); else fprintf_filtered (gdb_stdout, "Saved corefile %s\n", filename); }