blob: f333f3fe7464688693951346817d4271da8688b7 [file] [log] [blame]
Petr Machata94078ec2012-01-05 18:07:02 +01001/*
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
Michael K. Edwardsef4428a2011-03-06 20:39:18 +000023#ifndef COMMON_H
24#define COMMON_H
25
Petr Machataa06eb812011-07-08 19:23:25 +020026#include <config.h>
Joe Damatoab3b72c2010-10-31 00:21:53 -070027
Juan Cespedes3df476b2009-05-28 19:17:17 +020028#include <sys/types.h>
29#include <sys/time.h>
30#include <stdio.h>
31
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020032#include "ltrace.h"
Juan Cespedes3df476b2009-05-28 19:17:17 +020033#include "defs.h"
34#include "dict.h"
Juan Cespedes3df476b2009-05-28 19:17:17 +020035#include "sysdep.h"
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020036#include "debug.h"
Marc Kleine-Budde747c73d2010-02-03 20:23:20 +010037#include "ltrace-elf.h"
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020038#include "read_config_file.h"
Petr Machata2b46cfc2012-02-18 11:17:29 +010039#include "proc.h"
Petr Machata000e3112012-01-03 17:03:39 +010040#include "forward.h"
Juan Cespedes3df476b2009-05-28 19:17:17 +020041
Petr Machatacdd17b82012-06-01 19:35:24 +020042#if defined HAVE_LIBSUPC__ || defined HAVE_LIBSTDC__
43# define USE_CXA_DEMANGLE
44#endif
45#if defined HAVE_LIBIBERTY || defined USE_CXA_DEMANGLE
Juan Cespedes3df476b2009-05-28 19:17:17 +020046# define USE_DEMANGLE
47#endif
48
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020049extern char * command;
Juan Cespedes3df476b2009-05-28 19:17:17 +020050
51extern int exiting; /* =1 if we have to exit ASAP */
52
Juan Cespedes3df476b2009-05-28 19:17:17 +020053typedef struct Function Function;
54struct Function {
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020055 const char * name;
Petr Machata865303f2012-01-06 18:40:38 +010056 struct param *params;
Petr Machata000e3112012-01-03 17:03:39 +010057 struct arg_type_info *return_info;
Petr Machata3a9bf6d2012-01-06 21:44:10 +010058 int own_return_info;
Petr Machata865303f2012-01-06 18:40:38 +010059 size_t num_params;
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020060 Function * next;
Juan Cespedes3df476b2009-05-28 19:17:17 +020061};
62
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020063extern Function * list_of_functions;
Juan Cespedes3df476b2009-05-28 19:17:17 +020064extern char *PLTs_initialized_by_here;
65
Juan Cespedes3df476b2009-05-28 19:17:17 +020066struct opt_c_struct {
67 int count;
68 struct timeval tv;
69};
Juan Cespedes3df476b2009-05-28 19:17:17 +020070
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020071#include "options.h"
72#include "output.h"
73#ifdef USE_DEMANGLE
74#include "demangle.h"
75#endif
Juan Cespedes3df476b2009-05-28 19:17:17 +020076
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020077extern Dict * dict_opt_c;
Juan Cespedes3df476b2009-05-28 19:17:17 +020078
Petr Machata69a03e62011-07-09 11:29:12 +020079/* Events */
Petr Machata69a03e62011-07-09 11:29:12 +020080extern Event * next_event(void);
Juan Cespedes8d1b92b2009-07-03 10:39:34 +020081extern void handle_event(Event * event);
Petr Machata4007d742011-07-09 11:29:42 +020082
Petr Machata1b17dbf2011-07-08 19:22:52 +020083extern pid_t execute_program(const char * command, char ** argv);
Juan Cespedes3df476b2009-05-28 19:17:17 +020084
Juan Cespedes3df476b2009-05-28 19:17:17 +020085extern void show_summary(void);
Juan Cespedes3df476b2009-05-28 19:17:17 +020086
Petr Machata9294d822012-02-07 12:35:58 +010087struct breakpoint;
Petr Machata2b46cfc2012-02-18 11:17:29 +010088struct library_symbol;
Petr Machata9294d822012-02-07 12:35:58 +010089
Petr Machata94078ec2012-01-05 18:07:02 +010090/* Format VALUE into STREAM. The dictionary of all arguments is given
91 * for purposes of evaluating array lengths and other dynamic
92 * expressions. Returns number of characters outputted, -1 in case of
93 * failure. */
94int format_argument(FILE *stream, struct value *value,
95 struct value_dict *arguments);
96
Michael K. Edwardsef4428a2011-03-06 20:39:18 +000097#endif