common.h revision 3d083b6326ab15015979c97c884a6104c1fa65f5
1/*
2 * This file is part of ltrace.
3 * Copyright (C) 2011,2012 Petr Machata, Red Hat Inc.
4 * Copyright (C) 2010 Joe Damato
5 * Copyright (C) 2009 Juan Cespedes
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef COMMON_H
24#define COMMON_H
25
26#include <config.h>
27
28#include <sys/types.h>
29#include <sys/time.h>
30#include <stdio.h>
31
32#include "ltrace.h"
33#include "defs.h"
34#include "dict.h"
35#include "sysdep.h"
36#include "debug.h"
37#include "ltrace-elf.h"
38#include "read_config_file.h"
39#include "proc.h"
40#include "forward.h"
41
42#if defined HAVE_LIBSUPC__ || defined HAVE_LIBSTDC__
43# define USE_CXA_DEMANGLE
44#endif
45#if defined HAVE_LIBIBERTY || defined USE_CXA_DEMANGLE
46# define USE_DEMANGLE
47#endif
48
49extern char * command;
50
51extern int exiting;  /* =1 if we have to exit ASAP */
52
53struct prototype {
54	const char *name;
55	struct param *params;
56	struct arg_type_info *return_info;
57	int own_return_info;
58	size_t num_params;
59	struct prototype *next;
60};
61
62extern struct prototype *list_of_functions;
63extern char *PLTs_initialized_by_here;
64
65struct opt_c_struct {
66	int count;
67	struct timeval tv;
68};
69
70#include "options.h"
71#include "output.h"
72#ifdef USE_DEMANGLE
73#include "demangle.h"
74#endif
75
76extern struct dict *dict_opt_c;
77
78/* Events  */
79extern Event * next_event(void);
80extern void handle_event(Event * event);
81
82extern pid_t execute_program(const char * command, char ** argv);
83
84extern void show_summary(void);
85
86struct breakpoint;
87struct library_symbol;
88
89/* Format VALUE into STREAM.  The dictionary of all arguments is given
90 * for purposes of evaluating array lengths and other dynamic
91 * expressions.  Returns number of characters outputted, -1 in case of
92 * failure.  */
93int format_argument(FILE *stream, struct value *value,
94		    struct value_dict *arguments);
95
96#endif
97