146283Sdfr/* Data structures associated with tracepoints in GDB.
298944Sobrien   Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
346283Sdfr
498944Sobrien   This file is part of GDB.
546283Sdfr
698944Sobrien   This program is free software; you can redistribute it and/or modify
798944Sobrien   it under the terms of the GNU General Public License as published by
898944Sobrien   the Free Software Foundation; either version 2 of the License, or
998944Sobrien   (at your option) any later version.
1046283Sdfr
1198944Sobrien   This program is distributed in the hope that it will be useful,
1298944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1398944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1498944Sobrien   GNU General Public License for more details.
1546283Sdfr
1698944Sobrien   You should have received a copy of the GNU General Public License
1798944Sobrien   along with this program; if not, write to the Free Software
1898944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
1998944Sobrien   Boston, MA 02111-1307, USA.  */
2046283Sdfr
2146283Sdfr#if !defined (TRACEPOINT_H)
2246283Sdfr#define TRACEPOINT_H 1
2346283Sdfr
2446283Sdfr/* The data structure for an action: */
2598944Sobrienstruct action_line
2698944Sobrien  {
2798944Sobrien    struct action_line *next;
2898944Sobrien    char *action;
2998944Sobrien  };
3046283Sdfr
3146283Sdfr/* The data structure for a tracepoint: */
3246283Sdfr
3346283Sdfrstruct tracepoint
3498944Sobrien  {
3598944Sobrien    struct tracepoint *next;
3646283Sdfr
3798944Sobrien    int enabled_p;
3846283Sdfr
3946283Sdfr#if 0
4098944Sobrien    /* Type of tracepoint (MVS FIXME: needed?). */
4198944Sobrien    enum tptype type;
4246283Sdfr
4398944Sobrien    /* What to do with this tracepoint after we hit it MVS FIXME: needed?). */
4498944Sobrien    enum tpdisp disposition;
4546283Sdfr#endif
4698944Sobrien    /* Number assigned to distinguish tracepoints.  */
4798944Sobrien    int number;
4846283Sdfr
4998944Sobrien    /* Address to trace at, or NULL if not an instruction tracepoint (MVS ?). */
5098944Sobrien    CORE_ADDR address;
5146283Sdfr
5298944Sobrien    /* Line number of this address.  Only matters if address is non-NULL.  */
5398944Sobrien    int line_number;
5446283Sdfr
5598944Sobrien    /* Source file name of this address.  Only matters if address is non-NULL. */
5698944Sobrien    char *source_file;
5746283Sdfr
5898944Sobrien    /* Number of times this tracepoint should single-step
5998944Sobrien       and collect additional data */
6098944Sobrien    long step_count;
6146283Sdfr
6298944Sobrien    /* Number of times this tracepoint should be hit before disabling/ending. */
6398944Sobrien    int pass_count;
6446283Sdfr
6598944Sobrien    /* Chain of action lines to execute when this tracepoint is hit. */
6698944Sobrien    struct action_line *actions;
6746283Sdfr
6898944Sobrien    /* Conditional (MVS ?).  */
6998944Sobrien    struct expression *cond;
7046283Sdfr
7198944Sobrien    /* String we used to set the tracepoint (malloc'd).  Only matters if
7298944Sobrien       address is non-NULL.  */
7398944Sobrien    char *addr_string;
7446283Sdfr
7598944Sobrien    /* Language we used to set the tracepoint.  */
7698944Sobrien    enum language language;
7746283Sdfr
7898944Sobrien    /* Input radix we used to set the tracepoint.  */
7998944Sobrien    int input_radix;
8046283Sdfr
8198944Sobrien    /* Count of the number of times this tracepoint was taken, dumped
8298944Sobrien       with the info, but not used for anything else.  Useful for
8398944Sobrien       seeing how many times you hit a tracepoint prior to the program
8498944Sobrien       aborting, so you can back up to just before the abort.  */
8598944Sobrien    int hit_count;
8646283Sdfr
8798944Sobrien    /* Thread number for thread-specific tracepoint, or -1 if don't care */
8898944Sobrien    int thread;
8946283Sdfr
9098944Sobrien    /* BFD section, in case of overlays:
9198944Sobrien       no, I don't know if tracepoints are really gonna work with overlays.  */
9298944Sobrien    asection *section;
9398944Sobrien  };
9498944Sobrien
9546283Sdfrenum actionline_type
9698944Sobrien  {
9798944Sobrien    BADLINE = -1,
9898944Sobrien    GENERIC = 0,
9998944Sobrien    END = 1,
10098944Sobrien    STEPPING = 2
10198944Sobrien  };
10246283Sdfr
10346283Sdfr
10498944Sobrien/* The tracepoint chain of all tracepoints */
10546283Sdfr
10646283Sdfrextern struct tracepoint *tracepoint_chain;
10746283Sdfr
10846283Sdfrextern unsigned long trace_running_p;
10946283Sdfr
11046283Sdfr/* A hook used to notify the UI of tracepoint operations */
11146283Sdfr
11298944Sobrienvoid (*create_tracepoint_hook) (struct tracepoint *);
11398944Sobrienvoid (*delete_tracepoint_hook) (struct tracepoint *);
11498944Sobrienvoid (*modify_tracepoint_hook) (struct tracepoint *);
11598944Sobrienvoid (*trace_find_hook) (char *arg, int from_tty);
11698944Sobrienvoid (*trace_start_stop_hook) (int start, int from_tty);
11746283Sdfr
11898944Sobrienstruct tracepoint *get_tracepoint_by_number (char **, int, int);
11998944Sobrienint get_traceframe_number (void);
12098944Sobrienvoid free_actions (struct tracepoint *);
12198944Sobrienenum actionline_type validate_actionline (char **, struct tracepoint *);
12246283Sdfr
12346283Sdfr
12446283Sdfr/* Walk the following statement or block through all tracepoints.
12546283Sdfr   ALL_TRACEPOINTS_SAFE does so even if the statment deletes the current
12646283Sdfr   breakpoint.  */
12746283Sdfr
12846283Sdfr#define ALL_TRACEPOINTS(t)  for (t = tracepoint_chain; t; t = t->next)
12946283Sdfr
13046283Sdfr#define ALL_TRACEPOINTS_SAFE(t,tmp)	\
13146283Sdfr	for (t = tracepoint_chain;	\
13246283Sdfr	     t ? (tmp = t->next, 1) : 0;\
13346283Sdfr	     t = tmp)
13446283Sdfr#endif /* TRACEPOINT_H */
135