1 /* General utility routines for the remote server for GDB.
2 Copyright (C) 1986, 1989, 1993, 1995, 1996, 1997, 1999, 2000, 2002, 2003,
4 Free Software Foundation, Inc.
6 This file is part of GDB.
7 It has been modified to integrate it in valgrind
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */
25 /* Generally useful subroutines used throughout the program. */
27 /* Print the system error message for sr.
28 Then print the rest of the args. */
29 void sr_perror (SysRes sr
, const char *string
,...)
33 VG_(umsg
) ("error %lu %s\n", sr_Err(sr
), VG_(strerror
) (sr_Err(sr
)));
35 VG_(umsg
) ("sr_perror called with no error!!!\n");
36 va_start (args
, string
);
37 VG_(vmessage
) ( Vg_UserMsg
, string
, args
);
41 /* Print an error message and return to command level.
42 STRING is the error message, used as a fprintf string,
43 and ARG is passed as an argument to it. */
45 void error (const char *string
,...)
48 va_start (args
, string
);
49 VG_(vmessage
) ( Vg_UserMsg
, string
, args
);
51 VG_MINIMAL_LONGJMP(toplevel
);
54 /* Print an error message and exit reporting failure.
55 This is for a error that we cannot continue from.
56 STRING and ARG are passed to fprintf. */
59 void fatal (const char *string
,...)
62 va_start (args
, string
);
63 VG_(vmessage
) ( Vg_UserMsg
, string
, args
);
69 void warning (const char *string
,...)
72 va_start (args
, string
);
73 VG_(vmessage
) ( Vg_UserMsg
, string
, args
);
82 struct vki_timeval dbgtv
;
84 res
= VG_(do_syscall2
)(__NR_gettimeofday
, (UWord
)&dbgtv
, (UWord
)NULL
);
85 // gettimeofday(&dbgtv, NULL);
86 dlog(0, "%ld.%6ld ", dbgtv
.tv_sec
, dbgtv
.tv_usec
);