Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: gdb/serial.h

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/ser-pipe.c ('k') | gdb/serial.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Remote serial support interface definitions for GDB, the GNU Debugger. 1 /* Remote serial support interface definitions for GDB, the GNU Debugger.
2 Copyright (C) 1992-1996, 1998-2001, 2004-2012 Free Software 2 Copyright (C) 1992-1996, 1998-2001, 2004-2012 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
(...skipping 19 matching lines...) Expand all
30 /* For most routines, if a failure is indicated, then errno should be 30 /* For most routines, if a failure is indicated, then errno should be
31 examined. */ 31 examined. */
32 32
33 /* Terminal state pointer. This is specific to each type of 33 /* Terminal state pointer. This is specific to each type of
34 interface. */ 34 interface. */
35 35
36 typedef void *serial_ttystate; 36 typedef void *serial_ttystate;
37 struct serial; 37 struct serial;
38 38
39 /* Try to open NAME. Returns a new `struct serial *' on success, NULL 39 /* Try to open NAME. Returns a new `struct serial *' on success, NULL
40 on failure. Note that some open calls can block and, if possible, 40 on failure. The new serial object has a reference count of 1.
41 should be written to be non-blocking, with calls to ui_look_hook 41 Note that some open calls can block and, if possible, should be
42 so they can be cancelled. An async interface for open could be 42 written to be non-blocking, with calls to ui_look_hook so they can
43 added to GDB if necessary. */ 43 be cancelled. An async interface for open could be added to GDB if
44 necessary. */
44 45
45 extern struct serial *serial_open (const char *name); 46 extern struct serial *serial_open (const char *name);
46 47
48 /* Returns true if SCB is open. */
49
50 extern int serial_is_open (struct serial *scb);
51
47 /* Find an already opened serial stream using a file handle. */ 52 /* Find an already opened serial stream using a file handle. */
48 53
49 extern struct serial *serial_for_fd (int fd); 54 extern struct serial *serial_for_fd (int fd);
50 55
51 /* Open a new serial stream using a file handle. */ 56 /* Open a new serial stream using a file handle. */
52 57
53 extern struct serial *serial_fdopen (const int fd); 58 extern struct serial *serial_fdopen (const int fd);
54 59
55 /* Push out all buffers, close the device and destroy SCB. */ 60 /* Push out all buffers, close the device and unref SCB. */
56 61
57 extern void serial_close (struct serial *scb); 62 extern void serial_close (struct serial *scb);
58 63
64 /* Increment reference count of SCB. */
65
66 extern void serial_ref (struct serial *scb);
67
68 /* Decrement reference count of SCB. */
69
70 extern void serial_unref (struct serial *scb);
71
59 /* Create a pipe, and put the read end in files[0], and the write end 72 /* Create a pipe, and put the read end in files[0], and the write end
60 in filde[1]. Returns 0 for success, negative value for error (in 73 in filde[1]. Returns 0 for success, negative value for error (in
61 which case errno contains the error). */ 74 which case errno contains the error). */
62 75
63 extern int gdb_pipe (int fildes[2]); 76 extern int gdb_pipe (int fildes[2]);
64 77
65 /* Create a pipe with each end wrapped in a `struct serial' interface. 78 /* Create a pipe with each end wrapped in a `struct serial' interface.
66 Put the read end in scbs[0], and the write end in scbs[1]. Returns 79 Put the read end in scbs[0], and the write end in scbs[1]. Returns
67 0 for success, negative value for error (in which case errno 80 0 for success, negative value for error (in which case errno
68 contains the error). */ 81 contains the error). */
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 219
207 extern void serial_debug (struct serial *scb, int debug_p); 220 extern void serial_debug (struct serial *scb, int debug_p);
208 221
209 extern int serial_debug_p (struct serial *scb); 222 extern int serial_debug_p (struct serial *scb);
210 223
211 224
212 /* Details of an instance of a serial object. */ 225 /* Details of an instance of a serial object. */
213 226
214 struct serial 227 struct serial
215 { 228 {
229 /* serial objects are ref counted (but not the underlying
230 connection, just the object's lifetime in memory). */
231 int refcnt;
232
216 int fd; /* File descriptor */ 233 int fd; /* File descriptor */
217 /* File descriptor for a separate error stream that should be 234 /* File descriptor for a separate error stream that should be
218 immediately forwarded to gdb_stderr. This may be -1. 235 immediately forwarded to gdb_stderr. This may be -1.
219 If != -1, this descriptor should be non-blocking or 236 If != -1, this descriptor should be non-blocking or
220 ops->avail should be non-NULL. */ 237 ops->avail should be non-NULL. */
221 int error_fd; 238 int error_fd;
222 struct serial_ops *ops; /* Function vector */ 239 struct serial_ops *ops; /* Function vector */
223 void *state; /* Local context info for open FD */ 240 void *state; /* Local context info for open FD */
224 serial_ttystate ttystate; /* Not used (yet) */ 241 serial_ttystate ttystate; /* Not used (yet) */
225 int bufcnt; /* Amount of data remaining in receive 242 int bufcnt; /* Amount of data remaining in receive
226 buffer. -ve for sticky errors. */ 243 buffer. -ve for sticky errors. */
227 unsigned char *bufp; /* Current byte */ 244 unsigned char *bufp; /* Current byte */
228 unsigned char buf[BUFSIZ]; /* Da buffer itself */ 245 unsigned char buf[BUFSIZ]; /* Da buffer itself */
229 int current_timeout; /* (ser-unix.c termio{,s} only), last 246 int current_timeout; /* (ser-unix.c termio{,s} only), last
230 value of VTIME */ 247 value of VTIME */
231 int timeout_remaining; /* (ser-unix.c termio{,s} only), we 248 int timeout_remaining; /* (ser-unix.c termio{,s} only), we
232 still need to wait for this many 249 still need to wait for this many
233 more seconds. */ 250 more seconds. */
234 char *name; /* The name of the device or host */ 251 char *name; /* The name of the device or host */
235 struct serial *next; /* Pointer to the next `struct serial *' */ 252 struct serial *next; /* Pointer to the next `struct serial *' */
236 int refcnt; /* Number of pointers to this block */
237 int debug_p; /* Trace this serial devices operation. */ 253 int debug_p; /* Trace this serial devices operation. */
238 int async_state; /* Async internal state. */ 254 int async_state; /* Async internal state. */
239 void *async_context; /* Async event thread's context */ 255 void *async_context; /* Async event thread's context */
240 serial_event_ftype *async_handler;/* Async event handler */ 256 serial_event_ftype *async_handler;/* Async event handler */
241 }; 257 };
242 258
243 struct serial_ops 259 struct serial_ops
244 { 260 {
245 char *name; 261 char *name;
246 struct serial_ops *next; 262 struct serial_ops *next;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 /* Windows-only: find or create handles that we can wait on for this 320 /* Windows-only: find or create handles that we can wait on for this
305 serial device. */ 321 serial device. */
306 extern void serial_wait_handle (struct serial *, HANDLE *, HANDLE *); 322 extern void serial_wait_handle (struct serial *, HANDLE *, HANDLE *);
307 323
308 /* Windows-only: signal that we are done with the wait handles. */ 324 /* Windows-only: signal that we are done with the wait handles. */
309 extern void serial_done_wait_handle (struct serial *); 325 extern void serial_done_wait_handle (struct serial *);
310 326
311 #endif /* USE_WIN32API */ 327 #endif /* USE_WIN32API */
312 328
313 #endif /* SERIAL_H */ 329 #endif /* SERIAL_H */
OLDNEW
« no previous file with comments | « gdb/ser-pipe.c ('k') | gdb/serial.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698