Adapt ASLR to ltrace
[platform/upstream/ltrace.git] / output.h
1 /*
2  * This file is part of ltrace.
3  * Copyright (C) 2011, 2012, 2013 Petr Machata, Red Hat Inc.
4  * Copyright (C) 2009 Juan Cespedes
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
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., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21
22 #ifndef OUTPUT_H
23 #define OUTPUT_H
24
25 #include "fetch.h"
26 #include "forward.h"
27
28 void output_line(struct process *proc, const char *fmt, ...);
29 void output_left(enum tof type, struct process *proc,
30                  struct library_symbol *libsym);
31 void output_right(enum tof type, struct process *proc,
32                   struct library_symbol *libsym,
33                   struct timedelta *spent);
34
35 /* This function is for emitting lists of comma-separated strings.
36  *
37  * STREAM is where the output should be eventually sent.
38  *
39  * WRITER is the function to do the output.  It returns number of
40  * characters written, or a negative value if there were errors (like
41  * what fprintf does).  If WRITER returns 0, it means nothing was
42  * written, and separator shouldn't therefore be emitted either.
43  *
44  * NEED_DELIMP serves for keeping state between calls.  It should
45  * point to a variable that is initialized to 0.  DATA is passed
46  * verbatim to the WRITER.
47  *
48  * Returns number of characters written to STREAM (including any
49  * separators), or a negative value if there were errors.  */
50 int delim_output(FILE *stream, int *need_delimp,
51                  int (*writer)(FILE *stream, void *data), void *data);
52
53 /* If C is positive, add it to *COUNTP.  Returns C.  */
54 int account_output(int *countp, int c);
55
56 void report_error(char const *file, unsigned line_no, const char *fmt, ...);
57 void report_warning(char const *file, unsigned line_no, const char *fmt, ...);
58 void report_global_error(const char *fmt, ...);
59
60 #endif /* OUTPUT_H */