| Petr Machata | 94078ec | 2012-01-05 18:07:02 +0100 | [diff] [blame] | 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 | |
| Michael K. Edwards | ef4428a | 2011-03-06 20:39:18 +0000 | [diff] [blame] | 23 | #ifndef COMMON_H |
| 24 | #define COMMON_H |
| 25 | |
| Petr Machata | a06eb81 | 2011-07-08 19:23:25 +0200 | [diff] [blame] | 26 | #include <config.h> |
| Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 27 | |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 28 | #include <sys/types.h> |
| 29 | #include <sys/time.h> |
| 30 | #include <stdio.h> |
| 31 | |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 32 | #include "ltrace.h" |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 33 | #include "defs.h" |
| 34 | #include "dict.h" |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 35 | #include "sysdep.h" |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 36 | #include "debug.h" |
| Marc Kleine-Budde | 747c73d | 2010-02-03 20:23:20 +0100 | [diff] [blame] | 37 | #include "ltrace-elf.h" |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 38 | #include "read_config_file.h" |
| Petr Machata | 2b46cfc | 2012-02-18 11:17:29 +0100 | [diff] [blame] | 39 | #include "proc.h" |
| Petr Machata | 000e311 | 2012-01-03 17:03:39 +0100 | [diff] [blame] | 40 | #include "forward.h" |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 41 | |
| Petr Machata | cdd17b8 | 2012-06-01 19:35:24 +0200 | [diff] [blame] | 42 | #if defined HAVE_LIBSUPC__ || defined HAVE_LIBSTDC__ |
| 43 | # define USE_CXA_DEMANGLE |
| 44 | #endif |
| 45 | #if defined HAVE_LIBIBERTY || defined USE_CXA_DEMANGLE |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 46 | # define USE_DEMANGLE |
| 47 | #endif |
| 48 | |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 49 | extern char * command; |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 50 | |
| 51 | extern int exiting; /* =1 if we have to exit ASAP */ |
| 52 | |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 53 | typedef struct Function Function; |
| 54 | struct Function { |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 55 | const char * name; |
| Petr Machata | 865303f | 2012-01-06 18:40:38 +0100 | [diff] [blame] | 56 | struct param *params; |
| Petr Machata | 000e311 | 2012-01-03 17:03:39 +0100 | [diff] [blame] | 57 | struct arg_type_info *return_info; |
| Petr Machata | 3a9bf6d | 2012-01-06 21:44:10 +0100 | [diff] [blame] | 58 | int own_return_info; |
| Petr Machata | 865303f | 2012-01-06 18:40:38 +0100 | [diff] [blame] | 59 | size_t num_params; |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 60 | Function * next; |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 61 | }; |
| 62 | |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 63 | extern Function * list_of_functions; |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 64 | extern char *PLTs_initialized_by_here; |
| 65 | |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 66 | struct opt_c_struct { |
| 67 | int count; |
| 68 | struct timeval tv; |
| 69 | }; |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 70 | |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 71 | #include "options.h" |
| 72 | #include "output.h" |
| 73 | #ifdef USE_DEMANGLE |
| 74 | #include "demangle.h" |
| 75 | #endif |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 76 | |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 77 | extern Dict * dict_opt_c; |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 78 | |
| Petr Machata | 69a03e6 | 2011-07-09 11:29:12 +0200 | [diff] [blame] | 79 | /* Events */ |
| Petr Machata | 69a03e6 | 2011-07-09 11:29:12 +0200 | [diff] [blame] | 80 | extern Event * next_event(void); |
| Juan Cespedes | 8d1b92b | 2009-07-03 10:39:34 +0200 | [diff] [blame] | 81 | extern void handle_event(Event * event); |
| Petr Machata | 4007d74 | 2011-07-09 11:29:42 +0200 | [diff] [blame] | 82 | |
| Petr Machata | 1b17dbf | 2011-07-08 19:22:52 +0200 | [diff] [blame] | 83 | extern pid_t execute_program(const char * command, char ** argv); |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 84 | |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 85 | extern void show_summary(void); |
| Juan Cespedes | 3df476b | 2009-05-28 19:17:17 +0200 | [diff] [blame] | 86 | |
| Petr Machata | 9294d82 | 2012-02-07 12:35:58 +0100 | [diff] [blame] | 87 | struct breakpoint; |
| Petr Machata | 2b46cfc | 2012-02-18 11:17:29 +0100 | [diff] [blame] | 88 | struct library_symbol; |
| Petr Machata | 9294d82 | 2012-02-07 12:35:58 +0100 | [diff] [blame] | 89 | |
| Petr Machata | 94078ec | 2012-01-05 18:07:02 +0100 | [diff] [blame] | 90 | /* 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. */ |
| 94 | int format_argument(FILE *stream, struct value *value, |
| 95 | struct value_dict *arguments); |
| 96 | |
| Michael K. Edwards | ef4428a | 2011-03-06 20:39:18 +0000 | [diff] [blame] | 97 | #endif |