From 5b7f31a409c4cf665493580e9087f293298255dc Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 28 Jul 2001 19:48:15 +0000 Subject: [PATCH] Move libgdb library functions to gdb.h (new file). Update everything related to this. --- gdb/ChangeLog | 13 ++++++++++ gdb/Makefile.in | 11 ++++---- gdb/breakpoint.c | 1 + gdb/defs.h | 41 ----------------------------- gdb/gdb.h | 60 +++++++++++++++++++++++++++++++++++++++++++ gdb/mi/ChangeLog | 5 ++++ gdb/mi/mi-cmd-break.c | 1 + gdb/mi/mi-main.c | 1 + gdb/thread.c | 1 + 9 files changed, 88 insertions(+), 46 deletions(-) create mode 100644 gdb/gdb.h diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f0b6473bce4..1025a1c601e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2001-07-26 Andrew Cagney + + * thread.c, breakpoint.c: Include "gdb.h". + * Makefile.in (gdb_h): Define. + (HFILES_NO_SRCDIR): Add gdb.h. + (mi-cmd-break.o, mi-main.o, thread.o) + (breakpoint.o): Add dependency on $(gdb_h). + + * defs.h (enum gdb_rc, gdb_breakpoint_query) + (gdb_breakpoint, gdb_thread_select) + (gdb_list_thread_ids): Move declaration from here ... + * gdb.h: To here. New file. + 2001-07-28 Stephane Carrez * Makefile.in (SUBDIR_TUI_OBS): Add tui-out.o, tui-hooks.o. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 7c7e5841e8a..80b8e9e1cb9 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -597,6 +597,7 @@ xm_h = @xm_h@ tm_h = @tm_h@ nm_h = @nm_h@ defs_h = defs.h $(xm_h) $(tm_h) $(nm_h) config.status config.h gdbarch.h ui-file.h +gdb_h = gdb.h top_h = top.h inferior_h = inferior.h $(breakpoint_h) @@ -630,7 +631,7 @@ cp_abi_h = cp-abi.h # right, it is probably easiest just to list .h files here directly. HFILES_NO_SRCDIR = bcache.h buildsym.h call-cmds.h coff-solib.h defs.h \ - dst.h environ.h $(gdbcmd_h) gdbcore.h \ + dst.h environ.h $(gdbcmd_h) gdb.h gdbcore.h \ gdb-stabs.h hpread.h $(inferior_h) language.h minimon.h monitor.h \ objfiles.h parser-defs.h partial-stab.h serial.h solib.h \ symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \ @@ -1226,7 +1227,7 @@ blockframe.o: blockframe.c $(defs_h) $(gdbcore_h) $(inferior_h) \ breakpoint.o: breakpoint.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) language.h target.h gdbthread.h $(gdb_string_h) \ - gdb-events.h linespec.h $(ui_out_h) $(completer_h) + gdb-events.h linespec.h $(ui_out_h) $(completer_h) $(gdb_h) buildsym.o: buildsym.c $(bfd_h) buildsym.h complaints.h $(defs_h) \ objfiles.h symfile.h $(symtab_h) $(gdb_string_h) @@ -2044,7 +2045,7 @@ target.o: target.c $(bfd_h) $(defs_h) $(gdbcmd_h) $(inferior_h) \ objfiles.h symfile.h target.h $(gdb_string_h) $(regcache_h) thread.o: thread.c $(defs_h) gdbthread.h $(gdbcmd_h) target.h \ - $(regcache_h) $(ui_out_h) + $(regcache_h) $(ui_out_h) $(gdb_h) completer.o: completer.c $(completer_h) $(gdbtypes_h) $(symtab_h) \ $(defs_h) $(gdbcmd_h) $(expression_h) $(readline_headers) @@ -2200,14 +2201,14 @@ mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(top_h) $(mi_cmds_h) \ $(ui_out_h) $(frame_h) $(value_h) $(target_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \ - $(ui_out_h) $(mi_getopt_h) + $(ui_out_h) $(mi_getopt_h) $(gdb_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(mi_cmds_h) \ $(ui_out_h) $(value_h) $(target_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(top_h) $(mi_cmds_h) $(ui_out_h) \ $(mi_console_h) $(mi_getopt_h) $(event_loop_h) $(event_top_h) \ - $(mi_getopt_h) $(regcache_h) + $(mi_getopt_h) $(regcache_h) $(gdb_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-main.c mi-out.o: $(srcdir)/mi/mi-out.c $(defs_h) $(mi_out_h) $(ui_out_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-out.c diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 77e96067df2..db330ccfe92 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -41,6 +41,7 @@ #include "objfiles.h" #include "linespec.h" #include "completer.h" +#include "gdb.h" #ifdef UI_OUT #include "ui-out.h" #endif diff --git a/gdb/defs.h b/gdb/defs.h index b54a6166343..d535b7c015c 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1437,45 +1437,4 @@ extern int use_windows; #define ISATTY(FP) (isatty (fileno (FP))) #endif - -/* FIXME: cagney/1999-12-13: The following will be moved to gdb.h / - libgdb.h or gdblib.h. */ - -/* Return-code (RC) from a gdb library call. (The abreviation RC is - taken from the sim/common directory.) */ - -enum gdb_rc { - /* The operation failed. The failure message can be fetched by - calling ``char *error_last_message(void)''. The value is - determined by the catch_errors() interface. */ - /* NOTE: Since ``defs.h:catch_errors()'' does not return an error / - internal / quit indication it is not possible to return that - here. */ - GDB_RC_FAIL = 0, - /* No error occured but nothing happened. Due to the catch_errors() - interface, this must be non-zero. */ - GDB_RC_NONE = 1, - /* The operation was successful. Due to the catch_errors() - interface, this must be non-zero. */ - GDB_RC_OK = 2 -}; - - -/* Print the specified breakpoint on GDB_STDOUT. (Eventually this - function will ``print'' the object on ``output''). */ -enum gdb_rc gdb_breakpoint_query (/* struct {ui,gdb}_out *output, */ int bnum); - -/* Create a breakpoint at ADDRESS (a GDB source and line). */ -enum gdb_rc gdb_breakpoint (char *address, char *condition, - int hardwareflag, int tempflag, - int thread, int ignore_count); -enum gdb_rc gdb_thread_select (/* output object */ char *tidstr); - -#ifdef UI_OUT -/* Print a list of known thread ids. */ -enum gdb_rc gdb_list_thread_ids (/* output object */); - -/* Switch thread and print notification. */ -#endif - #endif /* #ifndef DEFS_H */ diff --git a/gdb/gdb.h b/gdb/gdb.h new file mode 100644 index 00000000000..aa75612a6c6 --- /dev/null +++ b/gdb/gdb.h @@ -0,0 +1,60 @@ +/* Library interface into GDB. + Copyright 1999, 2001 + 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 GDB_H +#define GDB_H + +/* Return-code (RC) from a gdb library call. (The abreviation RC is + taken from the sim/common directory.) */ + +enum gdb_rc { + /* The operation failed. The failure message can be fetched by + calling ``char *error_last_message(void)''. The value is + determined by the catch_errors() interface. */ + /* NOTE: Since ``defs.h:catch_errors()'' does not return an error / + internal / quit indication it is not possible to return that + here. */ + GDB_RC_FAIL = 0, + /* No error occured but nothing happened. Due to the catch_errors() + interface, this must be non-zero. */ + GDB_RC_NONE = 1, + /* The operation was successful. Due to the catch_errors() + interface, this must be non-zero. */ + GDB_RC_OK = 2 +}; + + +/* Print the specified breakpoint on GDB_STDOUT. (Eventually this + function will ``print'' the object on ``output''). */ +enum gdb_rc gdb_breakpoint_query (/* struct {ui,gdb}_out *output, */ int bnum); + +/* Create a breakpoint at ADDRESS (a GDB source and line). */ +enum gdb_rc gdb_breakpoint (char *address, char *condition, + int hardwareflag, int tempflag, + int thread, int ignore_count); + +/* Switch thread and print notification. */ +enum gdb_rc gdb_thread_select (/* output object */ char *tidstr); + +/* Print a list of known thread ids. */ +enum gdb_rc gdb_list_thread_ids (/* output object */); + +#endif diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 31e62190e85..f28f340a51b 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,8 @@ +2001-07-26 Andrew Cagney + + * mi-main.c: Include "gdb.h". + * mi-cmd-break.c: Include "gdb.h". + 2001-07-12 Andrew Cagney * mi-main.c (mi_execute_command): Flush output after ``(gdb)'' diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index dc2eb3722f2..916acfa51b0 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -27,6 +27,7 @@ #include "gdb_string.h" #include "mi-getopt.h" #include "gdb-events.h" +#include "gdb.h" /* Convenience macro for allocting typesafe memory. */ diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 1ce765f6d9f..464e5bc8f36 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -38,6 +38,7 @@ #include "gdbcore.h" /* for write_memory() */ #include "value.h" /* for write_register_bytes() */ #include "regcache.h" +#include "gdb.h" #include #include diff --git a/gdb/thread.c b/gdb/thread.c index 210b9461bfc..668fccafcb5 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -33,6 +33,7 @@ #include "command.h" #include "gdbcmd.h" #include "regcache.h" +#include "gdb.h" #include #include -- 2.30.2