gdb/
* remote.c (remote_xfer_partial): Remove KOD support. * target.h (enum target_object): Remove TARGET_OBJECT_KOD. * MAINTAINERS: Move Kernel Object Display entry to past maintainers. * Makefile.in (SFILES, kod_h, COMMON_OBS, kod.o, kod-cisco.o): Remove KOD support. * mi/mi-cmds.c (mi_cmds): Remove dummy KOD commands. * NEWS: Mention KOD. * kod.h, kod.c, kod-cisco.c: Delete files. gdb/doc/ * doc/gdb.texinfo (KOD): Remove node. (GDB/MI Kod Commands): Remove commented out node.
This commit is contained in:
parent
e8b42ce4f8
commit
2ec3381a43
@ -1,3 +1,14 @@
|
||||
2006-07-05 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* remote.c (remote_xfer_partial): Remove KOD support.
|
||||
* target.h (enum target_object): Remove TARGET_OBJECT_KOD.
|
||||
* MAINTAINERS: Move Kernel Object Display entry to past maintainers.
|
||||
* Makefile.in (SFILES, kod_h, COMMON_OBS, kod.o, kod-cisco.o): Remove KOD
|
||||
support.
|
||||
* mi/mi-cmds.c (mi_cmds): Remove dummy KOD commands.
|
||||
* NEWS: Mention KOD.
|
||||
* kod.h, kod.c, kod-cisco.c: Delete files.
|
||||
|
||||
2006-07-04 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* remote.c (init_remote_state): Use xrealloc instead of xmalloc.
|
||||
|
@ -418,7 +418,6 @@ dwarf readers Elena Zannoni ezannoni@redhat.com
|
||||
elf reader Elena Zannoni ezannoni@redhat.com
|
||||
stabs reader Elena Zannoni ezannoni@redhat.com
|
||||
readline/ Elena Zannoni ezannoni@redhat.com
|
||||
Kernel Object Display Fernando Nasser fnasser@redhat.com
|
||||
NetBSD native & host Jason Thorpe thorpej@netbsd.org
|
||||
Pascal support Pierre Muller muller@sources.redhat.com
|
||||
avr Theodore A. Roth troth@openavr.org
|
||||
@ -568,7 +567,7 @@ J.T. Conklin (dcache, NetBSD, remote, global) jtc at acorntoolworks dot com
|
||||
Frank Ch. Eigler (sim) fche at redhat dot com
|
||||
Per Bothner (Java) per at bothner dot com
|
||||
Anthony Green (Java) green at redhat dot com
|
||||
Fernando Nasser (testsuite/, mi, cli) fnasser at redhat dot com
|
||||
Fernando Nasser (testsuite/, mi, cli, KOD) fnasser at redhat dot com
|
||||
Mark Salter (testsuite/lib+config) msalter at redhat dot com
|
||||
Jim Kingdon (web pages) kingdon at panix dot com
|
||||
Jim Ingham (gdbtk, libgui) jingham at apple dot com
|
||||
|
@ -532,7 +532,6 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c \
|
||||
infcmd.c inflow.c infrun.c \
|
||||
interps.c \
|
||||
jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \
|
||||
kod.c kod-cisco.c \
|
||||
language.c linespec.c \
|
||||
m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c \
|
||||
macrotab.c macroexp.c macrocmd.c macroscope.c main.c maint.c \
|
||||
@ -726,7 +725,6 @@ inf_ptrace_h = inf-ptrace.h
|
||||
inf_ttrace_h = inf-ttrace.h
|
||||
interps_h = interps.h $(exceptions_h)
|
||||
jv_lang_h = jv-lang.h
|
||||
kod_h = kod.h
|
||||
language_h = language.h
|
||||
libunwind_frame_h = libunwind-frame.h $(libunwind_h)
|
||||
linespec_h = linespec.h
|
||||
@ -928,7 +926,6 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
|
||||
memattr.o mem-break.o target.o parse.o language.o buildsym.o \
|
||||
std-regs.o \
|
||||
signals.o \
|
||||
kod.o kod-cisco.o \
|
||||
gdb-events.o \
|
||||
exec.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o \
|
||||
dbxread.o coffread.o coff-pe-read.o elfread.o \
|
||||
@ -2198,9 +2195,6 @@ jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
|
||||
jv-valprint.o: jv-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
|
||||
$(gdbcore_h) $(expression_h) $(value_h) $(demangle_h) $(valprint_h) \
|
||||
$(language_h) $(jv_lang_h) $(c_lang_h) $(annotate_h) $(gdb_string_h)
|
||||
kod.o: kod.c $(defs_h) $(command_h) $(gdbcmd_h) $(target_h) $(gdb_string_h) \
|
||||
$(kod_h)
|
||||
kod-cisco.o: kod-cisco.c $(defs_h) $(gdb_string_h) $(kod_h)
|
||||
language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
|
||||
$(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \
|
||||
$(parser_defs_h) $(jv_lang_h) $(demangle_h)
|
||||
|
3
gdb/NEWS
3
gdb/NEWS
@ -7,6 +7,9 @@
|
||||
|
||||
The ARM Demon monitor support (RDP protocol, "target rdp").
|
||||
|
||||
Kernel Object Display, an embedded debugging feature which only worked with
|
||||
an obsolete version of Cisco IOS.
|
||||
|
||||
* New remote packets
|
||||
|
||||
qSupported:
|
||||
|
@ -1,3 +1,8 @@
|
||||
2006-07-05 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* doc/gdb.texinfo (KOD): Remove node.
|
||||
(GDB/MI Kod Commands): Remove commented out node.
|
||||
|
||||
2006-07-01 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* gdb.texinfo (GDB/MI Output Syntax, GDB/MI Simple Examples)
|
||||
|
@ -11977,7 +11977,6 @@ and @code{show architecture}.
|
||||
* Target Commands:: Commands for managing targets
|
||||
* Byte Order:: Choosing target byte order
|
||||
* Remote:: Remote debugging
|
||||
* KOD:: Kernel Object Display
|
||||
|
||||
@end menu
|
||||
|
||||
@ -12264,52 +12263,6 @@ Send an arbitrary @var{command} string to the remote monitor.
|
||||
@end table
|
||||
|
||||
|
||||
@node KOD
|
||||
@section Kernel Object Display
|
||||
@cindex kernel object display
|
||||
@cindex KOD
|
||||
|
||||
Some targets support kernel object display. Using this facility,
|
||||
@value{GDBN} communicates specially with the underlying operating system
|
||||
and can display information about operating system-level objects such as
|
||||
mutexes and other synchronization objects. Exactly which objects can be
|
||||
displayed is determined on a per-OS basis.
|
||||
|
||||
@kindex set os
|
||||
Use the @code{set os} command to set the operating system. This tells
|
||||
@value{GDBN} which kernel object display module to initialize:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) set os cisco
|
||||
@end smallexample
|
||||
|
||||
@kindex show os
|
||||
The associated command @code{show os} displays the operating system
|
||||
set with the @code{set os} command; if no operating system has been
|
||||
set, @code{show os} will display an empty string @samp{""}.
|
||||
|
||||
If @code{set os} succeeds, @value{GDBN} will display some information
|
||||
about the operating system, and will create a new @code{info} command
|
||||
which can be used to query the target. The @code{info} command is named
|
||||
after the operating system:
|
||||
|
||||
@kindex info cisco
|
||||
@smallexample
|
||||
(@value{GDBP}) info cisco
|
||||
List of Cisco Kernel Objects
|
||||
Object Description
|
||||
any Any and all objects
|
||||
@end smallexample
|
||||
|
||||
Further subcommands can be used to query about particular objects known
|
||||
by the kernel.
|
||||
|
||||
There is currently no way to determine whether a given operating
|
||||
system is supported other than to try setting it with @kbd{set os
|
||||
@var{name}}, where @var{name} is the name of the operating system you
|
||||
want to try.
|
||||
|
||||
|
||||
@node Remote Debugging
|
||||
@chapter Debugging remote programs
|
||||
|
||||
@ -20718,20 +20671,6 @@ The corresponding @value{GDBN} command is @samp{symbol-file}.
|
||||
@end smallexample
|
||||
|
||||
@ignore
|
||||
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
@node GDB/MI Kod Commands
|
||||
@section @sc{gdb/mi} Kod Commands
|
||||
|
||||
The Kod commands are not implemented.
|
||||
|
||||
@c @subheading -kod-info
|
||||
|
||||
@c @subheading -kod-list
|
||||
|
||||
@c @subheading -kod-list-object-types
|
||||
|
||||
@c @subheading -kod-show
|
||||
|
||||
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
@node GDB/MI Memory Overlay Commands
|
||||
@section @sc{gdb/mi} Memory Overlay Commands
|
||||
|
318
gdb/kod-cisco.c
318
gdb/kod-cisco.c
@ -1,318 +0,0 @@
|
||||
/* Kernel Object Display facility for Cisco
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by Tom Tromey <tromey@cygnus.com>.
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "gdb_string.h"
|
||||
#include "kod.h"
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* Define this to turn off communication with target. */
|
||||
/* #define FAKE_PACKET */
|
||||
|
||||
/* Size of buffer used for remote communication. */
|
||||
#define PBUFSIZ 400
|
||||
|
||||
/* Pointers to gdb callbacks. */
|
||||
static void (*gdb_kod_display) (char *);
|
||||
static void (*gdb_kod_query) (char *, char *, int *);
|
||||
|
||||
|
||||
|
||||
/* 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. */
|
||||
char *
|
||||
cisco_kod_open (kod_display_callback_ftype *display_func,
|
||||
kod_query_callback_ftype *query_func)
|
||||
{
|
||||
char buffer[PBUFSIZ];
|
||||
int bufsiz = PBUFSIZ;
|
||||
int i, count;
|
||||
|
||||
gdb_kod_display = display_func;
|
||||
gdb_kod_query = query_func;
|
||||
|
||||
/* Get the OS info, and check the version field. This is the stub
|
||||
version, which we use to see whether we will understand what
|
||||
comes back. This is lame, but the `qKoL' request doesn't
|
||||
actually provide enough configurability.
|
||||
|
||||
Right now the only defined version number is `0.0.0'.
|
||||
This stub supports qKoI and the `a' (any) object requests qKaL
|
||||
and qKaI. Each `a' object is returned as a 4-byte integer ID.
|
||||
An info request on an object returns a pair of 4-byte integers;
|
||||
the first is the object pointer and the second is the thread ID. */
|
||||
|
||||
#ifndef FAKE_PACKET
|
||||
(*gdb_kod_query) ("oI;", buffer, &bufsiz);
|
||||
#else
|
||||
strcpy (buffer, "Cisco IOS/Classic/13.4 0.0.0");
|
||||
#endif
|
||||
|
||||
count = 2;
|
||||
for (i = 0; count && buffer[i] != '\0'; ++i)
|
||||
{
|
||||
if (buffer[i] == ' ')
|
||||
--count;
|
||||
}
|
||||
|
||||
if (buffer[i] == '\0')
|
||||
error (_("Remote returned malformed packet."));
|
||||
if (strcmp (&buffer[i], "0.0.0"))
|
||||
error (_("Remote returned unknown stub version: %s."), &buffer[i]);
|
||||
|
||||
/* Return name, version, and description. I hope we have enough
|
||||
space. */
|
||||
return (xstrdup ("gdbkodcisco v0.0.0 - Cisco Kernel Object Display"));
|
||||
}
|
||||
|
||||
/* Close the connection. */
|
||||
void
|
||||
cisco_kod_close (void)
|
||||
{
|
||||
}
|
||||
|
||||
/* Print a "bad packet" message. */
|
||||
static void
|
||||
bad_packet (void)
|
||||
{
|
||||
(*gdb_kod_display) ("Remote target returned malformed packet.\n");
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
void
|
||||
cisco_kod_request (char *arg, int from_tty)
|
||||
{
|
||||
char buffer[PBUFSIZ], command[PBUFSIZ];
|
||||
int done = 0, i;
|
||||
int fail = 0;
|
||||
|
||||
char **sync_ids = NULL;
|
||||
int sync_len = 0;
|
||||
int sync_next = 0;
|
||||
char *prev_id = NULL;
|
||||
|
||||
if (! arg || strcmp (arg, "any"))
|
||||
{
|
||||
/* "Top-level" command. This is really silly, but it also seems
|
||||
to be how KOD is defined. */
|
||||
/* Even sillier is the fact that this first line must start
|
||||
with the word "List". See kod.tcl. */
|
||||
(*gdb_kod_display) ("List of Cisco Kernel Objects\n");
|
||||
(*gdb_kod_display) ("Object\tDescription\n");
|
||||
(*gdb_kod_display) ("any\tAny and all objects\n");
|
||||
return;
|
||||
}
|
||||
|
||||
while (! done)
|
||||
{
|
||||
int off = 0; /* Where we are in the string. */
|
||||
long count; /* Number of objects in this packet. */
|
||||
int bufsiz = PBUFSIZ;
|
||||
char *s_end;
|
||||
|
||||
strcpy (command, "aL");
|
||||
if (prev_id)
|
||||
{
|
||||
strcat (command, ",");
|
||||
strcat (command, prev_id);
|
||||
}
|
||||
strcat (command, ";");
|
||||
|
||||
#ifndef FAKE_PACKET
|
||||
/* We talk to the target by calling through the query function
|
||||
passed to us when we were initialized. */
|
||||
(*gdb_kod_query) (command, buffer, &bufsiz);
|
||||
#else
|
||||
/* Fake up a multi-part packet. */
|
||||
if (! strncmp (&command[3], "a500005a", 8))
|
||||
strcpy (buffer, "KAL,01,1,f500005f;f500005f;");
|
||||
else
|
||||
strcpy (buffer, "KAL,02,0,a500005a;a500005a;de02869f;");
|
||||
#endif
|
||||
|
||||
/* Empty response is an error. */
|
||||
if (strlen (buffer) == 0)
|
||||
{
|
||||
(*gdb_kod_display) ("Remote target did not recognize kernel object query command.\n");
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we don't get a `K' response then the buffer holds the
|
||||
target's error message. */
|
||||
if (buffer[0] != 'K')
|
||||
{
|
||||
(*gdb_kod_display) (buffer);
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure we get the response we expect. */
|
||||
if (strncmp (buffer, "KAL,", 4))
|
||||
{
|
||||
bad_packet ();
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
off += 4;
|
||||
|
||||
/* Parse out the count. We expect to convert exactly two
|
||||
characters followed by a comma. */
|
||||
count = strtol (&buffer[off], &s_end, 16);
|
||||
if (s_end - &buffer[off] != 2 || buffer[off + 2] != ',')
|
||||
{
|
||||
bad_packet ();
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
off += 3;
|
||||
|
||||
/* Parse out the `done' flag. */
|
||||
if ((buffer[off] != '0' && buffer[off] != '1')
|
||||
|| buffer[off + 1] != ',')
|
||||
{
|
||||
bad_packet ();
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
done = buffer[off] == '1';
|
||||
off += 2;
|
||||
|
||||
/* Id of the last item; we might this to construct the next
|
||||
request. */
|
||||
prev_id = &buffer[off];
|
||||
if (strlen (prev_id) < 8 || buffer[off + 8] != ';')
|
||||
{
|
||||
bad_packet ();
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
buffer[off + 8] = '\0';
|
||||
off += 9;
|
||||
|
||||
sync_len += count;
|
||||
sync_ids = (char **) xrealloc (sync_ids, sync_len * sizeof (char *));
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if (strlen (&buffer[off]) < 8 || buffer[off + 8] != ';')
|
||||
{
|
||||
bad_packet ();
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
buffer[off + 8] = '\0';
|
||||
sync_ids[sync_next++] = xstrdup (&buffer[off]);
|
||||
off += 9;
|
||||
}
|
||||
|
||||
if (buffer[off] != '\0')
|
||||
{
|
||||
bad_packet ();
|
||||
fail = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* We've collected all the sync object IDs. Now query to get the
|
||||
specific information, and arrange to print this info. */
|
||||
if (! fail)
|
||||
{
|
||||
(*gdb_kod_display) ("Object ID\tObject Pointer\tThread ID\n");
|
||||
|
||||
for (i = 0; i < sync_next; ++i)
|
||||
{
|
||||
int off = 0;
|
||||
int bufsiz = PBUFSIZ;
|
||||
|
||||
/* For now assume a query can be accomplished in a single
|
||||
transaction. This is implied in the protocol document.
|
||||
See comments above, and the KOD protocol document, to
|
||||
understand the parsing of the return value. */
|
||||
strcpy (command, "aI,");
|
||||
strcat (command, sync_ids[i]);
|
||||
strcat (command, ";");
|
||||
|
||||
#ifndef FAKE_PACKET
|
||||
(*gdb_kod_query) (command, buffer, &bufsiz);
|
||||
#else
|
||||
strcpy (buffer, "KAI,");
|
||||
strcat (buffer, sync_ids[i]);
|
||||
strcat (buffer, ",ffef00a0,cd00123d;");
|
||||
#endif
|
||||
|
||||
if (strlen (buffer) == 0)
|
||||
{
|
||||
(*gdb_kod_display) ("Remote target did not recognize KOD command.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (strncmp (buffer, "KAI,", 4))
|
||||
{
|
||||
bad_packet ();
|
||||
break;
|
||||
}
|
||||
off += 4;
|
||||
|
||||
if (strncmp (&buffer[off], sync_ids[i], 8)
|
||||
|| buffer[off + 8] != ',')
|
||||
{
|
||||
bad_packet ();
|
||||
break;
|
||||
}
|
||||
off += 9;
|
||||
|
||||
/* Extract thread id and sync object pointer. */
|
||||
if (strlen (&buffer[off]) != 2 * 8 + 2
|
||||
|| buffer[off + 8] != ','
|
||||
|| buffer[off + 17] != ';')
|
||||
{
|
||||
bad_packet ();
|
||||
break;
|
||||
}
|
||||
|
||||
buffer[off + 8] = '\0';
|
||||
buffer[off + 17] = '\0';
|
||||
|
||||
/* Display the result. */
|
||||
(*gdb_kod_display) (sync_ids[i]);
|
||||
(*gdb_kod_display) ("\t");
|
||||
(*gdb_kod_display) (&buffer[off]);
|
||||
(*gdb_kod_display) ("\t");
|
||||
(*gdb_kod_display) (&buffer[off + 9]);
|
||||
(*gdb_kod_display) ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Free memory. */
|
||||
for (i = 0; i < sync_next; ++i)
|
||||
xfree (sync_ids[i]);
|
||||
xfree (sync_ids);
|
||||
}
|
229
gdb/kod.c
229
gdb/kod.c
@ -1,229 +0,0 @@
|
||||
/* Kernel Object Display generic routines and callbacks
|
||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Written by Fernando Nasser <fnasser@cygnus.com> for 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., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "command.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "target.h"
|
||||
#include "gdb_string.h"
|
||||
#include "kod.h"
|
||||
|
||||
/* Prototypes for exported functions. */
|
||||
void _initialize_kod (void);
|
||||
|
||||
/* Prototypes for local functions. */
|
||||
static void info_kod_command (char *, int);
|
||||
static void load_kod_library (char *);
|
||||
|
||||
/* Prototypes for callbacks. These are passed into the KOD modules. */
|
||||
static void gdb_kod_display (char *);
|
||||
static void gdb_kod_query (char *, char *, int *);
|
||||
|
||||
/* These functions are imported from the KOD module.
|
||||
|
||||
gdb_kod_open - initiates the KOD connection to the remote. The
|
||||
first argument is the display function the module should use to
|
||||
communicate with the user. The second argument is the query
|
||||
function the display should use to communicate with the target.
|
||||
This should call error() if there is an error. Otherwise it should
|
||||
return a malloc()d string of the form:
|
||||
|
||||
NAME VERSION - DESCRIPTION
|
||||
|
||||
Neither NAME nor VERSION should contain a hyphen.
|
||||
|
||||
|
||||
gdb_kod_request - This is used when the user enters an "info
|
||||
<module>" request. The remaining arguments are passed as the first
|
||||
argument. The second argument is the standard `from_tty'
|
||||
argument.
|
||||
|
||||
|
||||
gdb_kod_close - This is called when the KOD connection to the
|
||||
remote should be terminated. */
|
||||
|
||||
static char *(*gdb_kod_open) (kod_display_callback_ftype *display,
|
||||
kod_query_callback_ftype *query);
|
||||
static void (*gdb_kod_request) (char *, int);
|
||||
static void (*gdb_kod_close) ();
|
||||
|
||||
|
||||
/* Name of inferior's operating system. */
|
||||
char *operating_system;
|
||||
|
||||
/* We save a copy of the OS so that we can properly reset when
|
||||
switching OS's. */
|
||||
static char *old_operating_system;
|
||||
|
||||
/* Print a line of data generated by the module. */
|
||||
|
||||
static void
|
||||
gdb_kod_display (char *arg)
|
||||
{
|
||||
printf_filtered ("%s", arg);
|
||||
}
|
||||
|
||||
/* Queries the target on behalf of the module. */
|
||||
|
||||
static void
|
||||
gdb_kod_query (char *arg, char *result, int *maxsiz)
|
||||
{
|
||||
LONGEST bufsiz = 0;
|
||||
|
||||
/* Check if current target has remote_query capabilities. If not,
|
||||
it does not have kod either. */
|
||||
bufsiz = target_read_partial (¤t_target, TARGET_OBJECT_KOD,
|
||||
NULL, NULL, 0, 0);
|
||||
if (bufsiz < 0)
|
||||
{
|
||||
strcpy (result,
|
||||
"ERR: Kernel Object Display not supported by current target\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Just get the maximum buffer size. */
|
||||
|
||||
/* Check if *we* were called just for getting the buffer size. */
|
||||
if (*maxsiz == 0)
|
||||
{
|
||||
*maxsiz = bufsiz;
|
||||
strcpy (result, "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if caller can handle a buffer this large, if not, adjust. */
|
||||
if (bufsiz > *maxsiz)
|
||||
bufsiz = *maxsiz;
|
||||
|
||||
/* See if buffer can hold the query (usually it can, as the query is
|
||||
short). */
|
||||
if (strlen (arg) >= bufsiz)
|
||||
error (_("kod: query argument too long"));
|
||||
|
||||
/* Send actual request. */
|
||||
if (target_read_partial (¤t_target, TARGET_OBJECT_KOD,
|
||||
arg, result, 0, bufsiz) < 0)
|
||||
strcpy (result, "ERR: remote query failed");
|
||||
}
|
||||
|
||||
/* Print name of kod command after selecting the appropriate kod
|
||||
formatting library module. As a side effect we create a new "info"
|
||||
subcommand which is what the user actually uses to query the OS. */
|
||||
|
||||
static void
|
||||
kod_set_os (char *arg, int from_tty, struct cmd_list_element *command)
|
||||
{
|
||||
char *p;
|
||||
|
||||
/* If we had already had an open OS, close it. */
|
||||
if (gdb_kod_close)
|
||||
(*gdb_kod_close) ();
|
||||
|
||||
/* Also remove the old OS's command. */
|
||||
if (old_operating_system)
|
||||
{
|
||||
delete_cmd (old_operating_system, &infolist);
|
||||
xfree (old_operating_system);
|
||||
}
|
||||
|
||||
if (! operating_system || ! *operating_system)
|
||||
{
|
||||
/* If user set operating system to empty, we want to forget we
|
||||
had a module open. Setting these variables is just nice for
|
||||
debugging and clarity. */
|
||||
gdb_kod_open = NULL;
|
||||
gdb_kod_request = NULL;
|
||||
gdb_kod_close = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *kodlib;
|
||||
|
||||
old_operating_system = xstrdup (operating_system);
|
||||
|
||||
load_kod_library (operating_system);
|
||||
|
||||
kodlib = (*gdb_kod_open) (gdb_kod_display, gdb_kod_query);
|
||||
|
||||
/* Add kod related info commands to gdb. */
|
||||
add_info (operating_system, info_kod_command,
|
||||
_("Displays information about Kernel Objects."));
|
||||
|
||||
p = strrchr (kodlib, '-');
|
||||
if (p != NULL)
|
||||
p++;
|
||||
else
|
||||
p = "Unknown KOD library";
|
||||
printf_filtered ("%s - %s\n", operating_system, p);
|
||||
|
||||
xfree (kodlib);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print information about currently known kernel objects of the
|
||||
specified type or a list of all known kernel object types if
|
||||
argument is empty. */
|
||||
|
||||
static void
|
||||
info_kod_command (char *arg, int from_tty)
|
||||
{
|
||||
(*gdb_kod_request) (arg, from_tty);
|
||||
}
|
||||
|
||||
/* Print name of kod command after selecting the appropriate kod
|
||||
formatting library module. */
|
||||
|
||||
static void
|
||||
load_kod_library (char *lib)
|
||||
{
|
||||
#if 0
|
||||
/* FIXME: Don't have the eCos code here. */
|
||||
if (! strcmp (lib, "ecos"))
|
||||
{
|
||||
gdb_kod_open = ecos_kod_open;
|
||||
gdb_kod_request = ecos_kod_request;
|
||||
gdb_kod_close = ecos_kod_close;
|
||||
}
|
||||
else
|
||||
#endif /* 0 */
|
||||
if (! strcmp (lib, "cisco"))
|
||||
{
|
||||
gdb_kod_open = cisco_kod_open;
|
||||
gdb_kod_request = cisco_kod_request;
|
||||
gdb_kod_close = cisco_kod_close;
|
||||
}
|
||||
else
|
||||
error (_("Unknown operating system: %s."), operating_system);
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_kod (void)
|
||||
{
|
||||
struct cmd_list_element *c;
|
||||
|
||||
add_setshow_string_cmd ("os", no_class, &operating_system, _("\
|
||||
Set operating system"), _("\
|
||||
Show operating system"), NULL,
|
||||
kod_set_os,
|
||||
NULL, /* FIXME: i18n: */
|
||||
&setlist, &showlist);
|
||||
}
|
62
gdb/kod.h
62
gdb/kod.h
@ -1,62 +0,0 @@
|
||||
/* Kernel Object Display facility for Cisco
|
||||
Copyright (C) 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., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, 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
|
@ -94,10 +94,6 @@ struct mi_cmd mi_cmds[] =
|
||||
{ "inferior-tty-set", { NULL, 0 }, NULL, mi_cmd_inferior_tty_set},
|
||||
{ "inferior-tty-show", { NULL, 0 }, NULL, mi_cmd_inferior_tty_show},
|
||||
{ "interpreter-exec", { NULL, 0 }, 0, mi_cmd_interpreter_exec},
|
||||
{ "kod-info", { NULL, 0 }, NULL, NULL },
|
||||
{ "kod-list", { NULL, 0 }, NULL, NULL },
|
||||
{ "kod-list-object-types", { NULL, 0 }, NULL, NULL },
|
||||
{ "kod-show", { NULL, 0 }, NULL, NULL },
|
||||
{ "overlay-auto", { NULL, 0 }, NULL, NULL },
|
||||
{ "overlay-list-mapping-state", { NULL, 0 }, NULL, NULL },
|
||||
{ "overlay-list-overlays", { NULL, 0 }, NULL, NULL },
|
||||
|
@ -5140,9 +5140,6 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
|
||||
objects!!! Instead specify new query packets. */
|
||||
switch (object)
|
||||
{
|
||||
case TARGET_OBJECT_KOD:
|
||||
query_type = 'K';
|
||||
break;
|
||||
case TARGET_OBJECT_AVR:
|
||||
query_type = 'R';
|
||||
break;
|
||||
|
@ -211,17 +211,10 @@ enum target_signal target_signal_from_name (char *);
|
||||
in the name. The old code's failure to do this lead to much
|
||||
confusion and duplication of effort as each target object attempted
|
||||
to locally take responsibility for something it didn't have to
|
||||
worry about.
|
||||
|
||||
NOTE: cagney/2003-10-17: With a TARGET_OBJECT_KOD object, for
|
||||
backward compatibility with the "target_query" method that this
|
||||
replaced, when OFFSET and LEN are both zero, return the "minimum"
|
||||
buffer size. See "remote.c" for further information. */
|
||||
worry about. */
|
||||
|
||||
enum target_object
|
||||
{
|
||||
/* Kernel Object Display transfer. See "kod.c" and "remote.c". */
|
||||
TARGET_OBJECT_KOD,
|
||||
/* AVR target specific transfer. See "avr-tdep.c" and "remote.c". */
|
||||
TARGET_OBJECT_AVR,
|
||||
/* Transfer up-to LEN bytes of memory starting at OFFSET. */
|
||||
|
Loading…
Reference in New Issue
Block a user