1 /* General utility routines for the remote server for GDB.
2 Copyright (C) 1986, 1989, 1993 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
23 /* Generally useful subroutines used throughout the program. */
25 /* Print the system error message for errno, and also mention STRING
26 as the file name for which the error was encountered.
27 Then return to command level. */
30 perror_with_name (string
)
34 extern char *sys_errlist
[];
40 err
= sys_errlist
[errno
];
42 err
= "unknown error";
44 combined
= (char *) alloca (strlen (err
) + strlen (string
) + 3);
45 strcpy (combined
, string
);
46 strcat (combined
, ": ");
47 strcat (combined
, err
);
49 error ("%s.", combined
);
52 /* Print an error message and return to command level.
53 STRING is the error message, used as a fprintf string,
54 and ARG is passed as an argument to it. */
57 error (string
, arg1
, arg2
, arg3
)
61 extern jmp_buf toplevel
;
64 fprintf (stderr
, string
, arg1
, arg2
, arg3
);
65 fprintf (stderr
, "\n");
69 /* Print an error message and exit reporting failure.
70 This is for a error that we cannot continue from.
71 STRING and ARG are passed to fprintf. */
78 fprintf (stderr
, "gdb: ");
79 fprintf (stderr
, string
, arg
);
80 fprintf (stderr
, "\n");
This page took 0.029945 seconds and 4 git commands to generate.