X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fremote-nrom.c;h=86a0718c6748bdb1566d6a725ff44fe515fc7520;hb=e30839fee3fa2b2ae067e6d85fa9ba41be09fc22;hp=d67791b67bb57184a95094fafbaee9fc5b15fedd;hpb=82569cc199791891f71ca2de3538accb51b2eb55;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/remote-nrom.c b/gdb/remote-nrom.c index d67791b67b..86a0718c67 100644 --- a/gdb/remote-nrom.c +++ b/gdb/remote-nrom.c @@ -1,30 +1,31 @@ /* Remote debugging with the XLNT Designs, Inc (XDI) NetROM. Copyright 1990, 1991, 1992, 1995 Free Software Foundation, Inc. Contributed by: - Roger Moyers - XLNT Designs, Inc. - 15050 Avenue of Science, Suite 106 - San Diego, CA 92128 - (619)487-9320 - roger@xlnt.com + Roger Moyers + XLNT Designs, Inc. + 15050 Avenue of Science, Suite 106 + San Diego, CA 92128 + (619)487-9320 + roger@xlnt.com Adapted from work done at Cygnus Support in remote-nindy.c, later merged in by Stan Shebs at Cygnus. -This file is part of GDB. + 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 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. + 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. */ + 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. */ #include "defs.h" #include "gdbcmd.h" @@ -36,11 +37,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define DEFAULT_NETROM_LOAD_PORT 1236 #define DEFAULT_NETROM_CONTROL_PORT 1237 -static void nrom_close PARAMS ((int quitting)); +static void nrom_close (int quitting); /* New commands. */ -static void nrom_passthru PARAMS ((char *, int)); +static void nrom_passthru (char *, int); /* We talk to the NetROM over these sockets. */ @@ -60,13 +61,12 @@ extern struct target_ops nrom_ops; don't match. */ static int -expect (string) - char *string; +expect (char *string) { char *p = string; int c; - immediate_quit = 1; + immediate_quit++; while (1) { @@ -76,8 +76,7 @@ expect (string) { if (*p == '\0') { - immediate_quit = 0; - + immediate_quit--; return 0; } } @@ -92,15 +91,13 @@ expect (string) } static void -nrom_kill () +nrom_kill (void) { nrom_close (0); } static serial_t -open_socket (name, port) - char *name; - int port; +open_socket (char *name, int port) { char sockname[100]; serial_t desc; @@ -114,7 +111,7 @@ open_socket (name, port) } static void -load_cleanup () +load_cleanup (void) { SERIAL_CLOSE (load_desc); load_desc = NULL; @@ -123,9 +120,7 @@ load_cleanup () /* Download a file specified in ARGS to the netROM. */ static void -nrom_load (args, fromtty) - char *args; - int fromtty; +nrom_load (char *args, int fromtty) { int fd, rd_amt, fsize; bfd *pbfd; @@ -149,11 +144,11 @@ nrom_load (args, fromtty) { make_cleanup (bfd_close, pbfd); - if (!bfd_check_format (pbfd, bfd_object)) + if (!bfd_check_format (pbfd, bfd_object)) error ("\"%s\": not in executable format: %s", args, bfd_errmsg (bfd_get_error ())); - for (section = pbfd->sections; section; section = section->next) + for (section = pbfd->sections; section; section = section->next) { if (bfd_get_section_flags (pbfd, section) & SEC_ALLOC) { @@ -179,7 +174,7 @@ nrom_load (args, fromtty) { char buffer[1024]; int count; - + count = min (section_size, 1024); bfd_get_section_contents (pbfd, section, buffer, fptr, @@ -191,7 +186,8 @@ nrom_load (args, fromtty) section_size -= count; } } - else /* BSS and such */ + else + /* BSS and such */ { printf_filtered ("[section %s: not loading]\n", section_name); @@ -208,15 +204,13 @@ nrom_load (args, fromtty) /* Open a connection to the remote NetROM devices. */ static void -nrom_open (name, from_tty) - char *name; - int from_tty; +nrom_open (char *name, int from_tty) { int errn; if (!name || strchr (name, '/') || strchr (name, ':')) error ( -"To open a NetROM connection, you must specify the hostname\n\ + "To open a NetROM connection, you must specify the hostname\n\ or IP address of the NetROM device you wish to use."); strcpy (nrom_hostname, name); @@ -236,8 +230,7 @@ or IP address of the NetROM device you wish to use."); /* Close out all files and local state before this target loses control. */ static void -nrom_close (quitting) - int quitting; +nrom_close (int quitting) { if (load_desc) SERIAL_CLOSE (load_desc); @@ -248,9 +241,7 @@ nrom_close (quitting) /* Pass arguments directly to the NetROM. */ static void -nrom_passthru (args, fromtty) - char *args; - int fromtty; +nrom_passthru (char *args, int fromtty) { char buf[1024]; @@ -260,71 +251,99 @@ nrom_passthru (args, fromtty) } static void -nrom_mourn() -{ +nrom_mourn (void) +{ unpush_target (&nrom_ops); generic_mourn_inferior (); } /* Define the target vector. */ -struct target_ops nrom_ops = { - "nrom", /* to_shortname */ - "Remote XDI `NetROM' target", /* to_longname */ - "Remote debug using a NetROM over Ethernet", /* to_doc */ - nrom_open, /* to_open */ - nrom_close, /* to_close */ - NULL, /* to_attach */ - NULL, /* to_detach */ - NULL, /* to_resume */ - NULL, /* to_wait */ - NULL, /* to_fetch_registers */ - NULL, /* to_store_registers */ - NULL, /* to_prepare_to_store */ - NULL, /* to_xfer_memory */ - NULL, /* to_files_info */ - NULL, /* to_insert_breakpoint */ - NULL, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ - NULL, /* to_terminal_inferior */ - NULL, /* to_terminal_ours_for_output */ - NULL, /* to_terminal_ours */ - NULL, /* to_terminal_info */ - nrom_kill, /* to_kill */ - nrom_load, /* to_load */ - NULL, /* to_lookup_symbol */ - NULL, /* to_create_inferior */ - nrom_mourn, /* to_mourn_inferior */ - NULL, /* to_can_run */ - 0, /* to_notice_signals */ - 0, /* to_thread_alive */ - 0, /* to_stop */ - download_stratum, /* to_stratum */ - NULL, /* to_next */ - 1, /* to_has_all_memory */ - 1, /* to_has_memory */ - 1, /* to_has_stack */ - 1, /* to_has_registers */ - 0, /* to_has_execution */ - NULL, /* sections */ - NULL, /* sections_end */ - OPS_MAGIC /* to_magic */ +struct target_ops nrom_ops; + +static void +init_nrom_ops (void) +{ + nrom_ops.to_shortname = "nrom"; + nrom_ops.to_longname = "Remote XDI `NetROM' target"; + nrom_ops.to_doc = "Remote debug using a NetROM over Ethernet"; + nrom_ops.to_open = nrom_open; + nrom_ops.to_close = nrom_close; + nrom_ops.to_attach = NULL; + nrom_ops.to_post_attach = NULL; + nrom_ops.to_require_attach = NULL; + nrom_ops.to_detach = NULL; + nrom_ops.to_require_detach = NULL; + nrom_ops.to_resume = NULL; + nrom_ops.to_wait = NULL; + nrom_ops.to_post_wait = NULL; + nrom_ops.to_fetch_registers = NULL; + nrom_ops.to_store_registers = NULL; + nrom_ops.to_prepare_to_store = NULL; + nrom_ops.to_xfer_memory = NULL; + nrom_ops.to_files_info = NULL; + nrom_ops.to_insert_breakpoint = NULL; + nrom_ops.to_remove_breakpoint = NULL; + nrom_ops.to_terminal_init = NULL; + nrom_ops.to_terminal_inferior = NULL; + nrom_ops.to_terminal_ours_for_output = NULL; + nrom_ops.to_terminal_ours = NULL; + nrom_ops.to_terminal_info = NULL; + nrom_ops.to_kill = nrom_kill; + nrom_ops.to_load = nrom_load; + nrom_ops.to_lookup_symbol = NULL; + nrom_ops.to_create_inferior = NULL; + nrom_ops.to_post_startup_inferior = NULL; + nrom_ops.to_acknowledge_created_inferior = NULL; + nrom_ops.to_clone_and_follow_inferior = NULL; + nrom_ops.to_post_follow_inferior_by_clone = NULL; + nrom_ops.to_insert_fork_catchpoint = NULL; + nrom_ops.to_remove_fork_catchpoint = NULL; + nrom_ops.to_insert_vfork_catchpoint = NULL; + nrom_ops.to_remove_vfork_catchpoint = NULL; + nrom_ops.to_has_forked = NULL; + nrom_ops.to_has_vforked = NULL; + nrom_ops.to_can_follow_vfork_prior_to_exec = NULL; + nrom_ops.to_post_follow_vfork = NULL; + nrom_ops.to_insert_exec_catchpoint = NULL; + nrom_ops.to_remove_exec_catchpoint = NULL; + nrom_ops.to_has_execd = NULL; + nrom_ops.to_reported_exec_events_per_exec_call = NULL; + nrom_ops.to_has_exited = NULL; + nrom_ops.to_mourn_inferior = nrom_mourn; + nrom_ops.to_can_run = NULL; + nrom_ops.to_notice_signals = 0; + nrom_ops.to_thread_alive = 0; + nrom_ops.to_stop = 0; + nrom_ops.to_pid_to_exec_file = NULL; + nrom_ops.to_core_file_to_sym_file = NULL; + nrom_ops.to_stratum = download_stratum; + nrom_ops.DONT_USE = NULL; + nrom_ops.to_has_all_memory = 1; + nrom_ops.to_has_memory = 1; + nrom_ops.to_has_stack = 1; + nrom_ops.to_has_registers = 1; + nrom_ops.to_has_execution = 0; + nrom_ops.to_sections = NULL; + nrom_ops.to_sections_end = NULL; + nrom_ops.to_magic = OPS_MAGIC; }; void -_initialize_remote_nrom () +_initialize_remote_nrom (void) { + init_nrom_ops (); add_target (&nrom_ops); add_show_from_set ( - add_set_cmd ("nrom_load_port", no_class, var_zinteger, (char *)&load_port, - "Set the port to use for NetROM downloads\n", &setlist), - &showlist); + add_set_cmd ("nrom_load_port", no_class, var_zinteger, (char *) &load_port, + "Set the port to use for NetROM downloads\n", &setlist), + &showlist); add_show_from_set ( - add_set_cmd ("nrom_control_port", no_class, var_zinteger, (char *)&control_port, - "Set the port to use for NetROM debugger services\n", &setlist), - &showlist); + add_set_cmd ("nrom_control_port", no_class, var_zinteger, (char *) &control_port, + "Set the port to use for NetROM debugger services\n", &setlist), + &showlist); add_cmd ("nrom", no_class, nrom_passthru, "Pass arguments as command to NetROM",