diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-10-05 19:20:52 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-10-05 19:20:52 +0000 |
commit | 0b83947edd8774f1b1b8e0ea0441e1ab62d7daab (patch) | |
tree | d0b1639a0e13fcce552ab897c95599631a7e3e7b /gdb | |
parent | a9c70046ea557d899c90ebef0c30bdbe67fa155d (diff) | |
download | gdb-0b83947edd8774f1b1b8e0ea0441e1ab62d7daab.zip gdb-0b83947edd8774f1b1b8e0ea0441e1ab62d7daab.tar.gz gdb-0b83947edd8774f1b1b8e0ea0441e1ab62d7daab.tar.bz2 |
* remote.c (get_remote_state_raw): Renamed from get_remote_state.
(get_remote_state): New function.
(init_remote_state, _initialize_remote): Use get_remote_state_raw.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/remote.c | 21 |
2 files changed, 24 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7f0a0dc..b431592 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2006-10-05 Daniel Jacobowitz <dan@codesourcery.com> + + * remote.c (get_remote_state_raw): Renamed from get_remote_state. + (get_remote_state): New function. + (init_remote_state, _initialize_remote): Use get_remote_state_raw. + 2006-10-04 Fred Fish <fnf@specifix.com> * vec.c: Include defs.h first. This pulls in config.h which can diff --git a/gdb/remote.c b/gdb/remote.c index 409aa83..9a9e94d 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -244,7 +244,7 @@ struct remote_state static struct remote_state remote_state; static struct remote_state * -get_remote_state (void) +get_remote_state_raw (void) { return &remote_state; } @@ -294,11 +294,26 @@ get_remote_arch_state (void) return gdbarch_data (current_gdbarch, remote_gdbarch_data_handle); } +/* Fetch the global remote target state. */ + +static struct remote_state * +get_remote_state (void) +{ + /* Make sure that the remote architecture state has been + initialized, because doing so might reallocate rs->buf. Any + function which calls getpkt also needs to be mindful of changes + to rs->buf, but this call limits the number of places which run + into trouble. */ + get_remote_arch_state (); + + return get_remote_state_raw (); +} + static void * init_remote_state (struct gdbarch *gdbarch) { int regnum; - struct remote_state *rs = get_remote_state (); + struct remote_state *rs = get_remote_state_raw (); struct remote_arch_state *rsa; rsa = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct remote_arch_state); @@ -6141,7 +6156,7 @@ _initialize_remote (void) of these, not one per target. Only one target is active at a time. The default buffer size is unimportant; it will be expanded whenever a larger buffer is needed. */ - rs = get_remote_state (); + rs = get_remote_state_raw (); rs->buf_size = 400; rs->buf = xmalloc (rs->buf_size); |