diff options
author | Jason Molenda <jsm@bugshack.cygnus.com> | 1999-09-22 03:25:04 +0000 |
---|---|---|
committer | Jason Molenda <jsm@bugshack.cygnus.com> | 1999-09-22 03:25:04 +0000 |
commit | ff49b98273f2bad8ff6ec338eee32c6d90113d05 (patch) | |
tree | 4b61ba3e441b5a5ed21bf7c943435bd60da1edca | |
parent | 5fba8157a720bc48cf3fbc7aff41fb41a5fa7a97 (diff) | |
download | gdb-ff49b98273f2bad8ff6ec338eee32c6d90113d05.tar.gz |
Initial revision
-rw-r--r-- | gdb/event-top.h | 104 | ||||
-rw-r--r-- | gdb/kod.h | 61 | ||||
-rw-r--r-- | gdb/remote.h | 60 | ||||
-rw-r--r-- | gdb/ser-unix.h | 48 | ||||
-rw-r--r-- | gdb/source.h | 34 |
5 files changed, 307 insertions, 0 deletions
diff --git a/gdb/event-top.h b/gdb/event-top.h new file mode 100644 index 00000000000..24184a49d68 --- /dev/null +++ b/gdb/event-top.h @@ -0,0 +1,104 @@ +/* Definitions used by GDB event-top.c. + Copyright 1999 Free Software Foundation, Inc. + Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Stack for prompts. Each prompt is composed as a prefix, a prompt + and a suffix. The prompt to be displayed at any given time is the + one on top of the stack. A stack is necessary because of cases in + which the execution of a gdb command requires further input from + the user, like for instance 'commands' for breakpoints and + 'actions' for tracepoints. In these cases, the prompt is '>' and + gdb should process input using the asynchronous readline interface + and the event loop. In order to achieve this, we need to save + somewhere the state of GDB, i.e. that it is processing user input + as part of a command and not as part of the top level command loop. + The prompt stack represents part of the saved state. Another part + would be the function that readline would invoke after a whole line + of input has ben entered. This second piece would be something + like, for instance, where to return within the code for the actions + commands after a line has been read. This latter portion has not + beeen implemented yet. The need for a 3-part prompt arises from + the annotation level. When this is set to 2, the prompt is actually + composed of a prefix, the prompt itself and a suffix. */ + +/* At any particular time there will be always at least one prompt on + the stack, the one being currently displayed by gdb. If gdb is + using annotation level equal 2, there will be 2 prompts on the + stack: the usual one, w/o prefix and suffix (at top - 1), and the + 'composite' one with prefix and suffix added (at top). At this + time, this is the only use of the prompt stack. Resetting annotate + to 0 or 1, pops the top of the stack, resetting its size to one + element. The MAXPROMPTS limit is safe, for now. Once other cases + are dealt with (like the different prompts used for 'commands' or + 'actions') this array implementation of the prompt stack may have + to change. */ + +#define MAXPROMPTS 10 +struct prompts + { + struct + { + char *prefix; + char *prompt; + char *suffix; + } + prompt_stack[MAXPROMPTS]; + int top; + }; + +#define PROMPT(X) the_prompts.prompt_stack[the_prompts.top + X].prompt +#define PREFIX(X) the_prompts.prompt_stack[the_prompts.top + X].prefix +#define SUFFIX(X) the_prompts.prompt_stack[the_prompts.top + X].suffix + +/* Exported functions from event-top.c. + FIXME: these should really go into top.h. */ + +extern void display_gdb_prompt (char *new_prompt); +extern void async_init_signals (void); +extern void set_async_editing_command (char *args, int from_tty, struct cmd_list_element *c); +extern void set_async_annotation_level (char *args, int from_tty, struct cmd_list_element *c); +extern void set_async_prompt (char *args, int from_tty, struct cmd_list_element *c); + +/* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */ +#ifndef STOP_SIGNAL +#ifdef SIGTSTP +#define STOP_SIGNAL SIGTSTP +extern void handle_stop_sig (int sig); +#endif +#endif +extern void handle_sigint (int sig); +extern void pop_prompt (void); +extern void push_prompt (char *prefix, char *prompt, char *suffix); +extern void gdb_readline2 (gdb_client_data client_data); +extern void mark_async_signal_handler_wrapper (PTR token); +extern void async_request_quit (gdb_client_data arg); +extern void stdin_event_handler (int error, int fd, gdb_client_data client_data); + +/* Exported variables from event-top.c. + FIXME: these should really go into top.h. */ + +extern int async_command_editing_p; +extern int exec_done_display_p; +extern char *async_annotation_suffix; +extern char *new_async_prompt; +extern struct prompts the_prompts; +extern void (*call_readline) (gdb_client_data); +extern void (*input_handler) (char *); +extern int input_fd; diff --git a/gdb/kod.h b/gdb/kod.h new file mode 100644 index 00000000000..6c4d03a3c7b --- /dev/null +++ b/gdb/kod.h @@ -0,0 +1,61 @@ +/* Kernel Object Display facility for Cisco + Copyright 1999 Free Software Foundation, Inc. + +This file is part of GDB. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef KOD_H +#define KOD_H + +typedef void kod_display_callback_ftype (char *); +typedef void kod_query_callback_ftype (char *, char *, int *); + +/* ???/???: Functions imported from the library for all supported + OSes. FIXME: we really should do something better, such as + dynamically loading the KOD modules. */ + +/* FIXME: cagney/1999-09-20: The kod-cisco.c et.al. kernel modules + should register themselve with kod.c during the _initialization*() + phase. With that implemented the extern declarations below would + be replaced with the KOD register function that the various kernel + modules should call. An example of this mechanism can be seen in + gdbarch.c:register_gdbarch_init(). */ + +#if 0 +/* Don't have ecos code yet. */ +extern char *ecos_kod_open (kod_display_callback_ftype *display_func, + kod_query_callback_ftype *query_func); +extern void ecos_kod_request (char *, int); +extern void ecos_kod_close (void); +#endif + +/* Initialize and return library name and version. The gdb side of + KOD, kod.c, passes us two functions: one for displaying output + (presumably to the user) and the other for querying the target. */ + +extern char *cisco_kod_open (kod_display_callback_ftype *display_func, + kod_query_callback_ftype *query_func); + +/* Print information about currently known kernel objects. We + currently ignore the argument. There is only one mode of querying + the Cisco kernel: we ask for a dump of everything, and it returns + it. */ + +extern void cisco_kod_request (char *arg, int from_tty); + +extern void cisco_kod_close (void); + +#endif diff --git a/gdb/remote.h b/gdb/remote.h new file mode 100644 index 00000000000..d67f7a5173f --- /dev/null +++ b/gdb/remote.h @@ -0,0 +1,60 @@ +/* Remote target communications for serial-line targets in custom GDB protocol + Copyright 1999, Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef REMOTE_H +#define REMOTE_H + +/* FIXME?: move this interface down to tgt vector) */ + +/* Read a packet from the remote machine, with error checking, and + store it in BUF. BUF is expected to be of size PBUFSIZ. If + FOREVER, wait forever rather than timing out; this is used while + the target is executing user code. */ + +extern void getpkt (char *buf, int forever); + +/* Send a packet to the remote machine, with error checking. The data + of the packet is in BUF. The string in BUF can be at most PBUFSIZ + - 5 to account for the $, # and checksum, and for a possible /0 if + we are debugging (remote_debug) and want to print the sent packet + as a string */ + +extern int putpkt (char *buf); + +/* Send HEX encoded string to the target console. (gdb_stdtarg) */ + +extern void remote_console_output PARAMS ((char *)); + + +/* FIXME: cagney/1999-09-20: This function is going to be replaced + with a more generic (non remote specific) mechanism. */ + +extern void cleanup_sigint_signal_handler (void); + +/* FIXME: cagney/1999-09-20: The remote cisco stuff in remote.c needs + to be broken out into a separate file (remote-cisco.[hc]?). Before + that can happen, a remote protocol stack framework needs to be + implemented. */ + +extern void remote_cisco_objfile_relocate (bfd_signed_vma text_off, + bfd_signed_vma data_off, + bfd_signed_vma bss_off); + +#endif diff --git a/gdb/ser-unix.h b/gdb/ser-unix.h new file mode 100644 index 00000000000..83656ea070d --- /dev/null +++ b/gdb/ser-unix.h @@ -0,0 +1,48 @@ +/* Serial interface for UN*X file-descriptor based connection. + Copyright 1999 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef SER_UNIX_H +#define SER_UNIX_H + +#undef XMALLOC +#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) + +/* Generic UNIX/FD functions */ + +extern int ser_unix_nop_flush_output (serial_t scb); +extern int ser_unix_nop_flush_input (serial_t scb); +extern int ser_unix_nop_send_break (serial_t scb); +extern void ser_unix_nop_raw (serial_t scb); +extern serial_ttystate ser_unix_nop_get_tty_state (serial_t scb); +extern int ser_unix_nop_set_tty_state (serial_t scb, serial_ttystate ttystate); +extern void ser_unix_nop_print_tty_state (serial_t scb, serial_ttystate ttystate, struct gdb_file *stream); +extern int ser_unix_nop_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate); +extern int ser_unix_nop_setbaudrate (serial_t scb, int rate); +extern int ser_unix_nop_setstopbits (serial_t scb, int rate); +extern int ser_unix_nop_drain_output (serial_t scb); + +extern int ser_unix_wait_for (serial_t scb, int timeout); +extern int ser_unix_readchar (serial_t scb, int timeout); + +extern int ser_unix_write (serial_t scb, const char *str, int len); + +extern void ser_unix_async (serial_t scb, int async_p); + +#endif diff --git a/gdb/source.h b/gdb/source.h new file mode 100644 index 00000000000..8dbf8517056 --- /dev/null +++ b/gdb/source.h @@ -0,0 +1,34 @@ +/* List lines of source files for GDB, the GNU debugger. + Copyright 1999 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef SOURCE_H +#define SOURCE_H + +/* Open a source file given a symtab S. Returns a file descriptor or + negative number for error. */ +extern int open_source_file (struct symtab *s); + +/* Create and initialize the table S->line_charpos that records the + positions of the lines in the source file, which is assumed to be + open on descriptor DESC. All set S->nlines to the number of such + lines. */ +extern void find_source_lines (struct symtab *s, int desc); + +#endif |