1 // OBSOLETE /* Remote debugging with the XLNT Designs, Inc (XDI) NetROM.
2 // OBSOLETE Copyright 1990, 1991, 1992, 1995, 1998, 1999, 2000
3 // OBSOLETE Free Software Foundation, Inc.
4 // OBSOLETE Contributed by:
5 // OBSOLETE Roger Moyers
6 // OBSOLETE XLNT Designs, Inc.
7 // OBSOLETE 15050 Avenue of Science, Suite 106
8 // OBSOLETE San Diego, CA 92128
9 // OBSOLETE (619)487-9320
10 // OBSOLETE roger@xlnt.com
11 // OBSOLETE Adapted from work done at Cygnus Support in remote-nindy.c,
12 // OBSOLETE later merged in by Stan Shebs at Cygnus.
14 // OBSOLETE This file is part of GDB.
16 // OBSOLETE This program is free software; you can redistribute it and/or modify
17 // OBSOLETE it under the terms of the GNU General Public License as published by
18 // OBSOLETE the Free Software Foundation; either version 2 of the License, or
19 // OBSOLETE (at your option) any later version.
21 // OBSOLETE This program is distributed in the hope that it will be useful,
22 // OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // OBSOLETE GNU General Public License for more details.
26 // OBSOLETE You should have received a copy of the GNU General Public License
27 // OBSOLETE along with this program; if not, write to the Free Software
28 // OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
29 // OBSOLETE Boston, MA 02111-1307, USA. */
31 // OBSOLETE #include "defs.h"
32 // OBSOLETE #include "gdbcmd.h"
33 // OBSOLETE #include "serial.h"
34 // OBSOLETE #include "target.h"
36 // OBSOLETE /* Default ports used to talk with the NetROM. */
38 // OBSOLETE #define DEFAULT_NETROM_LOAD_PORT 1236
39 // OBSOLETE #define DEFAULT_NETROM_CONTROL_PORT 1237
41 // OBSOLETE static void nrom_close (int quitting);
43 // OBSOLETE /* New commands. */
45 // OBSOLETE static void nrom_passthru (char *, int);
47 // OBSOLETE /* We talk to the NetROM over these sockets. */
49 // OBSOLETE static struct serial *load_desc = NULL;
50 // OBSOLETE static struct serial *ctrl_desc = NULL;
52 // OBSOLETE static int load_port = DEFAULT_NETROM_LOAD_PORT;
53 // OBSOLETE static int control_port = DEFAULT_NETROM_CONTROL_PORT;
55 // OBSOLETE static char nrom_hostname[100];
57 // OBSOLETE /* Forward data declaration. */
59 // OBSOLETE extern struct target_ops nrom_ops;
61 // OBSOLETE /* Scan input from the remote system, until STRING is found. Print chars that
62 // OBSOLETE don't match. */
64 // OBSOLETE static int
65 // OBSOLETE expect (char *string)
67 // OBSOLETE char *p = string;
70 // OBSOLETE immediate_quit++;
74 // OBSOLETE c = serial_readchar (ctrl_desc, 5);
76 // OBSOLETE if (c == *p++)
78 // OBSOLETE if (*p == '\0')
80 // OBSOLETE immediate_quit--;
86 // OBSOLETE fputc_unfiltered (c, gdb_stdout);
87 // OBSOLETE p = string;
88 // OBSOLETE if (c == *p)
94 // OBSOLETE static void
95 // OBSOLETE nrom_kill (void)
97 // OBSOLETE nrom_close (0);
100 // OBSOLETE static struct serial *
101 // OBSOLETE open_socket (char *name, int port)
103 // OBSOLETE char sockname[100];
104 // OBSOLETE struct serial *desc;
106 // OBSOLETE sprintf (sockname, "%s:%d", name, port);
107 // OBSOLETE desc = serial_open (sockname);
108 // OBSOLETE if (!desc)
109 // OBSOLETE perror_with_name (sockname);
111 // OBSOLETE return desc;
114 // OBSOLETE static void
115 // OBSOLETE load_cleanup (void)
117 // OBSOLETE serial_close (load_desc);
118 // OBSOLETE load_desc = NULL;
121 // OBSOLETE /* Download a file specified in ARGS to the netROM. */
123 // OBSOLETE static void
124 // OBSOLETE nrom_load (char *args, int fromtty)
126 // OBSOLETE int fd, rd_amt, fsize;
127 // OBSOLETE bfd *pbfd;
128 // OBSOLETE asection *section;
129 // OBSOLETE char *downloadstring = "download 0\n";
130 // OBSOLETE struct cleanup *old_chain;
132 // OBSOLETE /* Tell the netrom to get ready to download. */
133 // OBSOLETE if (serial_write (ctrl_desc, downloadstring, strlen (downloadstring)))
134 // OBSOLETE error ("nrom_load: control_send() of `%s' failed", downloadstring);
136 // OBSOLETE expect ("Waiting for a connection...\n");
138 // OBSOLETE load_desc = open_socket (nrom_hostname, load_port);
140 // OBSOLETE old_chain = make_cleanup (load_cleanup, 0);
142 // OBSOLETE pbfd = bfd_openr (args, 0);
144 // OBSOLETE if (pbfd)
146 // OBSOLETE make_cleanup (bfd_close, pbfd);
148 // OBSOLETE if (!bfd_check_format (pbfd, bfd_object))
149 // OBSOLETE error ("\"%s\": not in executable format: %s",
150 // OBSOLETE args, bfd_errmsg (bfd_get_error ()));
152 // OBSOLETE for (section = pbfd->sections; section; section = section->next)
154 // OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_ALLOC)
156 // OBSOLETE bfd_vma section_address;
157 // OBSOLETE unsigned long section_size;
158 // OBSOLETE const char *section_name;
160 // OBSOLETE section_name = bfd_get_section_name (pbfd, section);
161 // OBSOLETE section_address = bfd_get_section_vma (pbfd, section);
162 // OBSOLETE section_size = bfd_section_size (pbfd, section);
164 // OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_LOAD)
166 // OBSOLETE file_ptr fptr;
168 // OBSOLETE printf_filtered ("[Loading section %s at %x (%d bytes)]\n",
169 // OBSOLETE section_name, section_address,
170 // OBSOLETE section_size);
172 // OBSOLETE fptr = 0;
174 // OBSOLETE while (section_size > 0)
176 // OBSOLETE char buffer[1024];
177 // OBSOLETE int count;
179 // OBSOLETE count = min (section_size, 1024);
181 // OBSOLETE bfd_get_section_contents (pbfd, section, buffer, fptr,
184 // OBSOLETE serial_write (load_desc, buffer, count);
185 // OBSOLETE section_address += count;
186 // OBSOLETE fptr += count;
187 // OBSOLETE section_size -= count;
191 // OBSOLETE /* BSS and such */
193 // OBSOLETE printf_filtered ("[section %s: not loading]\n",
194 // OBSOLETE section_name);
200 // OBSOLETE error ("\"%s\": Could not open", args);
202 // OBSOLETE do_cleanups (old_chain);
205 // OBSOLETE /* Open a connection to the remote NetROM devices. */
207 // OBSOLETE static void
208 // OBSOLETE nrom_open (char *name, int from_tty)
210 // OBSOLETE int errn;
212 // OBSOLETE if (!name || strchr (name, '/') || strchr (name, ':'))
214 // OBSOLETE "To open a NetROM connection, you must specify the hostname\n\
215 // OBSOLETE or IP address of the NetROM device you wish to use.");
217 // OBSOLETE strcpy (nrom_hostname, name);
219 // OBSOLETE target_preopen (from_tty);
221 // OBSOLETE unpush_target (&nrom_ops);
223 // OBSOLETE ctrl_desc = open_socket (nrom_hostname, control_port);
225 // OBSOLETE push_target (&nrom_ops);
227 // OBSOLETE if (from_tty)
228 // OBSOLETE printf_filtered ("Connected to NetROM device \"%s\"\n", nrom_hostname);
231 // OBSOLETE /* Close out all files and local state before this target loses control. */
233 // OBSOLETE static void
234 // OBSOLETE nrom_close (int quitting)
236 // OBSOLETE if (load_desc)
237 // OBSOLETE serial_close (load_desc);
238 // OBSOLETE if (ctrl_desc)
239 // OBSOLETE serial_close (ctrl_desc);
242 // OBSOLETE /* Pass arguments directly to the NetROM. */
244 // OBSOLETE static void
245 // OBSOLETE nrom_passthru (char *args, int fromtty)
247 // OBSOLETE char buf[1024];
249 // OBSOLETE sprintf (buf, "%s\n", args);
250 // OBSOLETE if (serial_write (ctrl_desc, buf, strlen (buf)))
251 // OBSOLETE error ("nrom_reset: control_send() of `%s'failed", args);
254 // OBSOLETE static void
255 // OBSOLETE nrom_mourn (void)
257 // OBSOLETE unpush_target (&nrom_ops);
258 // OBSOLETE generic_mourn_inferior ();
261 // OBSOLETE /* Define the target vector. */
263 // OBSOLETE struct target_ops nrom_ops;
265 // OBSOLETE static void
266 // OBSOLETE init_nrom_ops (void)
268 // OBSOLETE nrom_ops.to_shortname = "nrom";
269 // OBSOLETE nrom_ops.to_longname = "Remote XDI `NetROM' target";
270 // OBSOLETE nrom_ops.to_doc = "Remote debug using a NetROM over Ethernet";
271 // OBSOLETE nrom_ops.to_open = nrom_open;
272 // OBSOLETE nrom_ops.to_close = nrom_close;
273 // OBSOLETE nrom_ops.to_attach = NULL;
274 // OBSOLETE nrom_ops.to_post_attach = NULL;
275 // OBSOLETE nrom_ops.to_require_attach = NULL;
276 // OBSOLETE nrom_ops.to_detach = NULL;
277 // OBSOLETE nrom_ops.to_require_detach = NULL;
278 // OBSOLETE nrom_ops.to_resume = NULL;
279 // OBSOLETE nrom_ops.to_wait = NULL;
280 // OBSOLETE nrom_ops.to_post_wait = NULL;
281 // OBSOLETE nrom_ops.to_fetch_registers = NULL;
282 // OBSOLETE nrom_ops.to_store_registers = NULL;
283 // OBSOLETE nrom_ops.to_prepare_to_store = NULL;
284 // OBSOLETE nrom_ops.to_xfer_memory = NULL;
285 // OBSOLETE nrom_ops.to_files_info = NULL;
286 // OBSOLETE nrom_ops.to_insert_breakpoint = NULL;
287 // OBSOLETE nrom_ops.to_remove_breakpoint = NULL;
288 // OBSOLETE nrom_ops.to_terminal_init = NULL;
289 // OBSOLETE nrom_ops.to_terminal_inferior = NULL;
290 // OBSOLETE nrom_ops.to_terminal_ours_for_output = NULL;
291 // OBSOLETE nrom_ops.to_terminal_ours = NULL;
292 // OBSOLETE nrom_ops.to_terminal_info = NULL;
293 // OBSOLETE nrom_ops.to_kill = nrom_kill;
294 // OBSOLETE nrom_ops.to_load = nrom_load;
295 // OBSOLETE nrom_ops.to_lookup_symbol = NULL;
296 // OBSOLETE nrom_ops.to_create_inferior = NULL;
297 // OBSOLETE nrom_ops.to_post_startup_inferior = NULL;
298 // OBSOLETE nrom_ops.to_acknowledge_created_inferior = NULL;
299 // OBSOLETE nrom_ops.to_clone_and_follow_inferior = NULL;
300 // OBSOLETE nrom_ops.to_post_follow_inferior_by_clone = NULL;
301 // OBSOLETE nrom_ops.to_insert_fork_catchpoint = NULL;
302 // OBSOLETE nrom_ops.to_remove_fork_catchpoint = NULL;
303 // OBSOLETE nrom_ops.to_insert_vfork_catchpoint = NULL;
304 // OBSOLETE nrom_ops.to_remove_vfork_catchpoint = NULL;
305 // OBSOLETE nrom_ops.to_has_forked = NULL;
306 // OBSOLETE nrom_ops.to_has_vforked = NULL;
307 // OBSOLETE nrom_ops.to_can_follow_vfork_prior_to_exec = NULL;
308 // OBSOLETE nrom_ops.to_post_follow_vfork = NULL;
309 // OBSOLETE nrom_ops.to_insert_exec_catchpoint = NULL;
310 // OBSOLETE nrom_ops.to_remove_exec_catchpoint = NULL;
311 // OBSOLETE nrom_ops.to_has_execd = NULL;
312 // OBSOLETE nrom_ops.to_reported_exec_events_per_exec_call = NULL;
313 // OBSOLETE nrom_ops.to_has_exited = NULL;
314 // OBSOLETE nrom_ops.to_mourn_inferior = nrom_mourn;
315 // OBSOLETE nrom_ops.to_can_run = NULL;
316 // OBSOLETE nrom_ops.to_notice_signals = 0;
317 // OBSOLETE nrom_ops.to_thread_alive = 0;
318 // OBSOLETE nrom_ops.to_stop = 0;
319 // OBSOLETE nrom_ops.to_pid_to_exec_file = NULL;
320 // OBSOLETE nrom_ops.to_stratum = download_stratum;
321 // OBSOLETE nrom_ops.DONT_USE = NULL;
322 // OBSOLETE nrom_ops.to_has_all_memory = 1;
323 // OBSOLETE nrom_ops.to_has_memory = 1;
324 // OBSOLETE nrom_ops.to_has_stack = 1;
325 // OBSOLETE nrom_ops.to_has_registers = 1;
326 // OBSOLETE nrom_ops.to_has_execution = 0;
327 // OBSOLETE nrom_ops.to_sections = NULL;
328 // OBSOLETE nrom_ops.to_sections_end = NULL;
329 // OBSOLETE nrom_ops.to_magic = OPS_MAGIC;
333 // OBSOLETE _initialize_remote_nrom (void)
335 // OBSOLETE init_nrom_ops ();
336 // OBSOLETE add_target (&nrom_ops);
338 // OBSOLETE add_show_from_set (
339 // OBSOLETE add_set_cmd ("nrom_load_port", no_class, var_zinteger, (char *) &load_port,
340 // OBSOLETE "Set the port to use for NetROM downloads\n", &setlist),
341 // OBSOLETE &showlist);
343 // OBSOLETE add_show_from_set (
344 // OBSOLETE add_set_cmd ("nrom_control_port", no_class, var_zinteger, (char *) &control_port,
345 // OBSOLETE "Set the port to use for NetROM debugger services\n", &setlist),
346 // OBSOLETE &showlist);
348 // OBSOLETE add_cmd ("nrom", no_class, nrom_passthru,
349 // OBSOLETE "Pass arguments as command to NetROM",
350 // OBSOLETE &cmdlist);
This page took 0.035649 seconds and 4 git commands to generate.