From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26775 invoked by alias); 25 Jan 2013 18:06:55 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 26713 invoked by uid 9674); 25 Jan 2013 18:06:52 -0000 Date: Fri, 25 Jan 2013 18:06:00 -0000 Message-ID: <20130125180652.26698.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-absdir: Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal-macrorel X-Git-Refname: refs/heads/archer-jankratochvil-absdir X-Git-Reftype: branch X-Git-Oldrev: 792e21ccc3eed823bd1fb3e93201b1348236b4c7 X-Git-Newrev: 66404891ed57a7c2c143184abb8857dd49d8700a X-SW-Source: 2013-q1/txt/msg00029.txt.bz2 List-Id: The branch, archer-jankratochvil-absdir has been updated via 66404891ed57a7c2c143184abb8857dd49d8700a (commit) via 33a1bcf0d1496b659a56b2e5333e6b73091408d1 (commit) via 04177ea379a2c3ec48a0d726ed65944c52ab8163 (commit) via 9b37dd402a7348cf7f705b3c3759e5df8e707a42 (commit) via e427139516bae26159bce2017eb34ed541f61e85 (commit) via 20635587dc58cfe9dfa0c83b34a4c92f34749aeb (commit) via 9647d22489286afd6fa0b38c9a9a76acc1d25c5d (commit) via ba06d0ffb54e337e47f46ff6774dadeb1112ccb1 (commit) via e803707997cc6f1bb87f251efc22eb19eb61a46b (commit) via d39625f6e5b44fa87c2d0919bca43a0f8bbee170 (commit) via 76d10fd5c5599f6f31199c8fa908fe41ac32d9e9 (commit) via 8463bd8ec9236783c2d64ff13830a4844d9f9be3 (commit) via bcfeeca6a6fdebb89d47f332f7f4db1cb25763c9 (commit) via 58a49b4e8a6fa7915b3f394ea4c20257d9bf9937 (commit) via 50ebe2328e7447a9a7eaf0333c89774027967ab1 (commit) via 86e893c7ddf69e484a63cdcf9495ad063c2a0f54 (commit) via 2d5311f5c73da623a2c9c24da2516fb28ba1bd45 (commit) via 5c3b9d458f3751b0139644dafcdf46bdc41d8292 (commit) via b04ec52e0436ba30d2caaf80cba9f03536faa880 (commit) via 1c9d4709ba96a66a6ae9af5b4828d2b51d732580 (commit) via b6c63ac19ae0ad4f83218d862d77a6c701109e8d (commit) via 079e9efdbb3d2ef592bc5daa1e4c1a0b04a16a8d (commit) via 1693afc3efbcf376b866d2db8f83923a180e0dea (commit) via ede33d50ecd9a4ba3f9a2e9b8f26adc42e31f0d1 (commit) via db6f136ef9c6dba7ce143046f7918719a6d70085 (commit) via fb5e48c5990d7d6ef7e9921a075df50ad21950a5 (commit) via d56b2cf44bd855912cda7020ed442b6b8cbf1116 (commit) via b4a6dc73b967a147cdb7eafe9dd24f94c4d0fda8 (commit) via 3a4a143f453a0ef692e6fa60747c8dc973a42f37 (commit) from 792e21ccc3eed823bd1fb3e93201b1348236b4c7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 66404891ed57a7c2c143184abb8857dd49d8700a Merge: bcfeeca 33a1bcf Author: Jan Kratochvil Date: Fri Jan 25 19:05:58 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal-macrorel commit 33a1bcf0d1496b659a56b2e5333e6b73091408d1 Merge: 8463bd8 04177ea Author: Jan Kratochvil Date: Fri Jan 25 19:05:58 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal commit 04177ea379a2c3ec48a0d726ed65944c52ab8163 Merge: 58a49b4 9b37dd4 Author: Jan Kratochvil Date: Fri Jan 25 19:05:58 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab commit 9b37dd402a7348cf7f705b3c3759e5df8e707a42 Merge: 86e893c e427139 Author: Jan Kratochvil Date: Fri Jan 25 19:05:58 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui commit e427139516bae26159bce2017eb34ed541f61e85 Merge: 2d5311f 2063558 Author: Jan Kratochvil Date: Fri Jan 25 19:05:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2 commit 20635587dc58cfe9dfa0c83b34a4c92f34749aeb Merge: 5c3b9d4 9647d22 Author: Jan Kratochvil Date: Fri Jan 25 19:05:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config commit 9647d22489286afd6fa0b38c9a9a76acc1d25c5d Merge: b04ec52 ba06d0f Author: Jan Kratochvil Date: Fri Jan 25 19:05:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname' into xfullpath-locsymtab-isabs-expandfullname-tuifullname commit ba06d0ffb54e337e47f46ff6774dadeb1112ccb1 Merge: 1c9d470 e803707 Author: Jan Kratochvil Date: Fri Jan 25 19:05:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs' into xfullpath-locsymtab-isabs-expandfullname commit e803707997cc6f1bb87f251efc22eb19eb61a46b Merge: b6c63ac d39625f Author: Jan Kratochvil Date: Fri Jan 25 19:05:56 2013 +0100 Merge branch 'xfullpath-locsymtab' into xfullpath-locsymtab-isabs commit d39625f6e5b44fa87c2d0919bca43a0f8bbee170 Merge: 079e9ef 76d10fd Author: Jan Kratochvil Date: Fri Jan 25 19:05:56 2013 +0100 Merge branch 'xfullpath' into xfullpath-locsymtab commit 76d10fd5c5599f6f31199c8fa908fe41ac32d9e9 Merge: db6f136 fb5e48c Author: Jan Kratochvil Date: Fri Jan 25 19:05:56 2013 +0100 Merge remote-tracking branch 'gdb/master' into xfullpath commit 8463bd8ec9236783c2d64ff13830a4844d9f9be3 Author: Jan Kratochvil Date: Fri Jan 25 19:03:20 2013 +0100 . commit bcfeeca6a6fdebb89d47f332f7f4db1cb25763c9 Merge: 792e21c 50ebe23 Author: Jan Kratochvil Date: Fri Jan 25 18:51:58 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal-macrorel commit 58a49b4e8a6fa7915b3f394ea4c20257d9bf9937 Merge: a56cb09 86e893c Author: Jan Kratochvil Date: Fri Jan 25 18:51:58 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab commit 50ebe2328e7447a9a7eaf0333c89774027967ab1 Merge: ede33d5 58a49b4 Author: Jan Kratochvil Date: Fri Jan 25 18:51:58 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui-psymtab-dw2fullreal commit 86e893c7ddf69e484a63cdcf9495ad063c2a0f54 Merge: 0c95a7a 2d5311f Author: Jan Kratochvil Date: Fri Jan 25 18:51:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2-tui commit 2d5311f5c73da623a2c9c24da2516fb28ba1bd45 Merge: 1693afc 5c3b9d4 Author: Jan Kratochvil Date: Fri Jan 25 18:51:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname-config' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config-simple2 commit 5c3b9d458f3751b0139644dafcdf46bdc41d8292 Merge: f6fc7d5 b04ec52 Author: Jan Kratochvil Date: Fri Jan 25 18:51:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname-tuifullname' into xfullpath-locsymtab-isabs-expandfullname-tuifullname-config commit b04ec52e0436ba30d2caaf80cba9f03536faa880 Merge: 3067c9d 1c9d470 Author: Jan Kratochvil Date: Fri Jan 25 18:51:57 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs-expandfullname' into xfullpath-locsymtab-isabs-expandfullname-tuifullname commit 1c9d4709ba96a66a6ae9af5b4828d2b51d732580 Merge: 038a517 b6c63ac Author: Jan Kratochvil Date: Fri Jan 25 18:51:56 2013 +0100 Merge branch 'xfullpath-locsymtab-isabs' into xfullpath-locsymtab-isabs-expandfullname commit b6c63ac19ae0ad4f83218d862d77a6c701109e8d Merge: 29f9a2b 079e9ef Author: Jan Kratochvil Date: Fri Jan 25 18:51:56 2013 +0100 Merge branch 'xfullpath-locsymtab' into xfullpath-locsymtab-isabs commit 079e9efdbb3d2ef592bc5daa1e4c1a0b04a16a8d Merge: 3791216 db6f136 Author: Jan Kratochvil Date: Fri Jan 25 18:51:56 2013 +0100 Merge branch 'xfullpath' into xfullpath-locsymtab commit 1693afc3efbcf376b866d2db8f83923a180e0dea Author: Jan Kratochvil Date: Fri Jan 25 18:51:50 2013 +0100 . commit ede33d50ecd9a4ba3f9a2e9b8f26adc42e31f0d1 Author: Jan Kratochvil Date: Fri Jan 25 18:51:42 2013 +0100 . commit db6f136ef9c6dba7ce143046f7918719a6d70085 Author: Jan Kratochvil Date: Fri Jan 25 18:11:23 2013 +0100 . commit fb5e48c5990d7d6ef7e9921a075df50ad21950a5 Author: Nick Clifton Date: Fri Jan 25 14:22:07 2013 +0000 * elf32-h8300.c (elf32_h8_relax_section): When checking for a second reloc, make sure that the reloc potentially exists first. commit d56b2cf44bd855912cda7020ed442b6b8cbf1116 Author: qiyao Date: Fri Jan 25 14:16:57 2013 +0000 gdb/ * event-loop.c: Include "queue.h". (gdb_event_p): New typedef. (DECLARE_QUEUE_P): Use. (DEFINE_QUEUE_P): Use. (async_queue_event): Remove. (gdb_event_xfree): New. (initialize_event_loop): New. (process_event): Use QUEUE macros. (event_queue): Remove. (gdb_wait_for_event): Caller update. (check_async_event_handlers): Likewise. (poll_timers): Likewise. * event-loop.h (initialize_event_loop): Declare. * event-loop.c (gdb_event_xfree): New. * top.c (gdb_init): Call initialize_event_loop. commit b4a6dc73b967a147cdb7eafe9dd24f94c4d0fda8 Author: qiyao Date: Fri Jan 25 14:14:12 2013 +0000 gdb/ * event-loop.c (async_queue_event): Remove one parameter 'position'. Remove code handling 'position' == TAIL. (gdb_wait_for_event): Caller update. (check_async_event_handlers): Caller update. (poll_timers): Caller update. * event-loop.h (enum queue_position): Remove. commit 3a4a143f453a0ef692e6fa60747c8dc973a42f37 Author: qiyao Date: Fri Jan 25 14:12:02 2013 +0000 gdb/gdbserver * event-loop.c: Include "queue.h". (gdb_event_p): New typedef. (struct gdb_event) : Remove. (event_queue): Change to QUEUE(gdb_event_p). (async_queue_event): Remove. (gdb_event_xfree): New. (initialize_event_loop): New. (process_event): Use API from QUEUE. (wait_for_event): Likewise. * server.c (main): Call initialize_event_loop. * server.h (initialize_event_loop): Declare. ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 5 + bfd/elf32-h8300.c | 2 +- gdb/ChangeLog | 27 ++++++ gdb/dwarf2read.c | 15 ++- gdb/event-loop.c | 135 ++++++++-------------------- gdb/event-loop.h | 13 +--- gdb/gdbserver/ChangeLog | 14 +++ gdb/gdbserver/event-loop.c | 110 ++++++----------------- gdb/gdbserver/server.c | 1 + gdb/gdbserver/server.h | 1 + gdb/symtab.c | 16 +++- gdb/testsuite/gdb.base/realname-expand.exp | 6 ++ gdb/top.c | 1 + 13 files changed, 146 insertions(+), 200 deletions(-) First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6dfcb64..e36a37c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2013-01-25 Michael Schewe + + * elf32-h8300.c (elf32_h8_relax_section): When checking for a + second reloc, make sure that the reloc potentially exists first. + 2013-01-24 Nick Clifton * archures.c: Add bfd_mach_v850e3v5. diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 388d220..43ac16e 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -1239,7 +1239,7 @@ elf32_h8_relax_section (bfd *abfd, asection *sec, second_reloc = 1; } } - if (irel < irelend) + if (irel + 1 < irelend) { Elf_Internal_Rela *next_reloc = irel + 1; arelent bfd_reloc; diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 596b5a0..23f6f07 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,30 @@ +2013-01-25 Yao Qi + + * event-loop.c: Include "queue.h". + (gdb_event_p): New typedef. + (DECLARE_QUEUE_P): Use. + (DEFINE_QUEUE_P): Use. + (async_queue_event): Remove. + (gdb_event_xfree): New. + (initialize_event_loop): New. + (process_event): Use QUEUE macros. + (event_queue): Remove. + (gdb_wait_for_event): Caller update. + (check_async_event_handlers): Likewise. + (poll_timers): Likewise. + * event-loop.h (initialize_event_loop): Declare. + * event-loop.c (gdb_event_xfree): New. + * top.c (gdb_init): Call initialize_event_loop. + +2013-01-25 Yao Qi + + * event-loop.c (async_queue_event): Remove one parameter + 'position'. Remove code handling 'position' == TAIL. + (gdb_wait_for_event): Caller update. + (check_async_event_handlers): Caller update. + (poll_timers): Caller update. + * event-loop.h (enum queue_position): Remove. + 2013-01-25 Maxim Kuvyrkov * MAINTAINERS: Update my email. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index fc7d2a1..1957f9d 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3072,11 +3072,11 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name, for (j = 0; j < file_data->num_file_names; ++j) { const char *this_name = file_data->file_names[j]; + const char *this_real_name; if (compare_filenames_for_search (this_name, name)) { - if (dw2_map_expand_apply (objfile, per_cu, - name, real_path, + if (dw2_map_expand_apply (objfile, per_cu, name, real_path, callback, data)) return 1; } @@ -3087,11 +3087,16 @@ dw2_map_symtabs_matching_filename (struct objfile *objfile, const char *name, && FILENAME_CMP (lbasename (this_name), name_basename) != 0) continue; - if (real_path != NULL) + this_real_name = dw2_get_real_path (objfile, file_data, j); + if (compare_filenames_for_search (this_real_name, name)) { - const char *this_real_name = dw2_get_real_path (objfile, - file_data, j); + if (dw2_map_expand_apply (objfile, per_cu, name, real_path, + callback, data)) + return 1; + } + if (real_path != NULL) + { gdb_assert (IS_ABSOLUTE_PATH (real_path)); gdb_assert (IS_ABSOLUTE_PATH (name)); if (this_real_name != NULL diff --git a/gdb/event-loop.c b/gdb/event-loop.c index be485c9..f34f153 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -20,6 +20,7 @@ #include "defs.h" #include "event-loop.h" #include "event-top.h" +#include "queue.h" #ifdef HAVE_POLL #if defined (HAVE_POLL_H) @@ -68,17 +69,14 @@ typedef void (event_handler_func) (event_data); case of async signal handlers, it is invoke_async_signal_handler. */ -struct gdb_event +typedef struct gdb_event { /* Procedure to call to service this event. */ event_handler_func *proc; /* Data to pass to the event handler. */ event_data data; - - /* Next in list of events or NULL. */ - struct gdb_event *next_event; - }; + } *gdb_event_p; /* Information about each file descriptor we register with the event loop. */ @@ -140,26 +138,9 @@ typedef struct async_event_handler } async_event_handler; - -/* Event queue: - - the first event in the queue is the head of the queue. - It will be the next to be serviced. - - the last event in the queue - - Events can be inserted at the front of the queue or at the end of - the queue. Events will be extracted from the queue for processing - starting from the head. Therefore, events inserted at the head of - the queue will be processed in a last in first out fashion, while - those inserted at the tail of the queue will be processed in a first - in first out manner. All the fields are NULL if the queue is - empty. */ - -static struct - { - gdb_event *first_event; /* First pending event. */ - gdb_event *last_event; /* Last pending event. */ - } -event_queue; +DECLARE_QUEUE_P(gdb_event_p); +DEFINE_QUEUE_P(gdb_event_p); +static QUEUE(gdb_event_p) *event_queue = NULL; /* Gdb_notifier is just a list of file descriptors gdb is interested in. These are the input file descriptor, and the target file @@ -274,41 +255,6 @@ static int gdb_wait_for_event (int); static void poll_timers (void); -/* Insert an event object into the gdb event queue at - the specified position. - POSITION can be head or tail, with values TAIL, HEAD. - EVENT_PTR points to the event to be inserted into the queue. - The caller must allocate memory for the event. It is freed - after the event has ben handled. - Events in the queue will be processed head to tail, therefore, - events inserted at the head of the queue will be processed - as last in first out. Event appended at the tail of the queue - will be processed first in first out. */ -static void -async_queue_event (gdb_event * event_ptr, queue_position position) -{ - if (position == TAIL) - { - /* The event will become the new last_event. */ - - event_ptr->next_event = NULL; - if (event_queue.first_event == NULL) - event_queue.first_event = event_ptr; - else - event_queue.last_event->next_event = event_ptr; - event_queue.last_event = event_ptr; - } - else if (position == HEAD) - { - /* The event becomes the new first_event. */ - - event_ptr->next_event = event_queue.first_event; - if (event_queue.first_event == NULL) - event_queue.last_event = event_ptr; - event_queue.first_event = event_ptr; - } -} - /* Create a generic event, to be enqueued in the event queue for processing. PROC is the procedure associated to the event. DATA is passed to PROC upon PROC invocation. */ @@ -338,6 +284,23 @@ create_file_event (int fd) return create_event (handle_file_event, data); } + +/* Free EVENT. */ + +static void +gdb_event_xfree (struct gdb_event *event) +{ + xfree (event); +} + +/* Initialize the event queue. */ + +void +initialize_event_loop (void) +{ + event_queue = QUEUE_alloc (gdb_event_p, gdb_event_xfree); +} + /* Process one event. The event can be the next one to be serviced in the event queue, or an asynchronous event handler can be invoked in response to @@ -350,10 +313,6 @@ create_file_event (int fd) static int process_event (void) { - gdb_event *event_ptr, *prev_ptr; - event_handler_func *proc; - event_data data; - /* First let's see if there are any asynchronous event handlers that are ready. These would be the result of invoking any of the signal handlers. */ @@ -364,38 +323,20 @@ process_event (void) /* Look in the event queue to find an event that is ready to be processed. */ - for (event_ptr = event_queue.first_event; event_ptr != NULL; - event_ptr = event_ptr->next_event) + if (!QUEUE_is_empty (gdb_event_p, event_queue)) { - /* Call the handler for the event. */ - - proc = event_ptr->proc; - data = event_ptr->data; - /* Let's get rid of the event from the event queue. We need to - do this now because while processing the event, the proc - function could end up calling 'error' and therefore jump out - to the caller of this function, gdb_do_one_event. In that - case, we would have on the event queue an event wich has been - processed, but not deleted. */ - - if (event_queue.first_event == event_ptr) - { - event_queue.first_event = event_ptr->next_event; - if (event_ptr->next_event == NULL) - event_queue.last_event = NULL; - } - else - { - prev_ptr = event_queue.first_event; - while (prev_ptr->next_event != event_ptr) - prev_ptr = prev_ptr->next_event; + do this now because while processing the event, the proc + function could end up calling 'error' and therefore jump out + to the caller of this function, gdb_do_one_event. In that + case, we would have on the event queue an event wich has been + processed, but not deleted. */ + gdb_event *event_ptr = QUEUE_deque (gdb_event_p, event_queue); + /* Call the handler for the event. */ + event_handler_func *proc = event_ptr->proc; + event_data data = event_ptr->data; - prev_ptr->next_event = event_ptr->next_event; - if (event_ptr->next_event == NULL) - event_queue.last_event = prev_ptr; - } - xfree (event_ptr); + gdb_event_xfree (event_ptr); /* Now call the procedure associated with the event. */ (*proc) (data); @@ -936,7 +877,7 @@ gdb_wait_for_event (int block) if (file_ptr->ready_mask == 0) { file_event_ptr = create_file_event (file_ptr->fd); - async_queue_event (file_event_ptr, TAIL); + QUEUE_enque (gdb_event_p, event_queue, file_event_ptr); } file_ptr->ready_mask = (gdb_notifier.poll_fds + i)->revents; } @@ -972,7 +913,7 @@ gdb_wait_for_event (int block) if (file_ptr->ready_mask == 0) { file_event_ptr = create_file_event (file_ptr->fd); - async_queue_event (file_event_ptr, TAIL); + QUEUE_enque (gdb_event_p, event_queue, file_event_ptr); } file_ptr->ready_mask = mask; } @@ -1158,7 +1099,7 @@ check_async_event_handlers (void) data.ptr = hdata; event_ptr = create_event (invoke_async_event_handler, data); - async_queue_event (event_ptr, TAIL); + QUEUE_enque (gdb_event_p, event_queue, event_ptr); } } } @@ -1365,7 +1306,7 @@ poll_timers (void) event_ptr = (gdb_event *) xmalloc (sizeof (gdb_event)); event_ptr->proc = handle_timer_event; event_ptr->data.integer = timer_list.first_timer->timer_id; - async_queue_event (event_ptr, TAIL); + QUEUE_enque (gdb_event_p, event_queue, event_ptr); } /* Now we need to update the timeout for select/ poll, because diff --git a/gdb/event-loop.h b/gdb/event-loop.h index 16c2286..e994fc1 100644 --- a/gdb/event-loop.h +++ b/gdb/event-loop.h @@ -75,20 +75,9 @@ typedef void (sig_handler_func) (gdb_client_data); typedef void (async_event_handler_func) (gdb_client_data); typedef void (timer_handler_func) (gdb_client_data); -/* Where to add an event onto the event queue, by queue_event. */ -typedef enum - { - /* Add at tail of queue. It will be processed in first in first - out order. */ - TAIL, - /* Add at head of queue. It will be processed in last in first - out order. */ - HEAD - } -queue_position; - /* Exported functions from event-loop.c */ +extern void initialize_event_loop (void); extern void start_event_loop (void); extern int gdb_do_one_event (void); extern void delete_file_handler (int fd); diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 5b41f7a..a9ef720 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,17 @@ +2013-01-25 Yao Qi + + * event-loop.c: Include "queue.h". + (gdb_event_p): New typedef. + (struct gdb_event) : Remove. + (event_queue): Change to QUEUE(gdb_event_p). + (async_queue_event): Remove. + (gdb_event_xfree): New. + (initialize_event_loop): New. + (process_event): Use API from QUEUE. + (wait_for_event): Likewise. + * server.c (main): Call initialize_event_loop. + * server.h (initialize_event_loop): Declare. + 2013-01-18 Yao Qi * ax.h (struct eval_agent_expr_context): New. diff --git a/gdb/gdbserver/event-loop.c b/gdb/gdbserver/event-loop.c index 87487e0..9e172a9 100644 --- a/gdb/gdbserver/event-loop.c +++ b/gdb/gdbserver/event-loop.c @@ -19,6 +19,7 @@ /* Based on src/gdb/event-loop.c. */ #include "server.h" +#include "queue.h" #include #include @@ -46,7 +47,8 @@ typedef int (event_handler_func) (gdb_fildes_t); #define GDB_WRITABLE (1<<2) #define GDB_EXCEPTION (1<<3) -/* Events are queued by calling async_queue_event and serviced later +/* Events are queued by calling 'QUEUE_enque (gdb_event_p, event_queue, + file_event_ptr)' and serviced later on by do_one_event. An event can be, for instance, a file descriptor becoming ready to be read. Servicing an event simply means that the procedure PROC will be called. We have 2 queues, @@ -57,17 +59,14 @@ typedef int (event_handler_func) (gdb_fildes_t); descriptor whose state change generated the event, plus doing other cleanups and such. */ -struct gdb_event +typedef struct gdb_event { /* Procedure to call to service this event. */ event_handler_func *proc; /* File descriptor that is ready. */ gdb_fildes_t fd; - - /* Next in list of events or NULL. */ - struct gdb_event *next_event; - }; + } *gdb_event_p; /* Information about each file descriptor we register with the event loop. */ @@ -97,25 +96,9 @@ typedef struct file_handler } file_handler; -/* Event queue: - - Events can be inserted at the front of the queue or at the end of - the queue. Events will be extracted from the queue for processing - starting from the head. Therefore, events inserted at the head of - the queue will be processed in a last in first out fashion, while - those inserted at the tail of the queue will be processed in a - first in first out manner. All the fields are NULL if the queue is - empty. */ - -static struct - { - /* The first pending event. */ - gdb_event *first_event; - - /* The last pending event. */ - gdb_event *last_event; - } -event_queue; +DECLARE_QUEUE_P(gdb_event_p); +static QUEUE(gdb_event_p) *event_queue = NULL; +DEFINE_QUEUE_P(gdb_event_p); /* Gdb_notifier is just a list of file descriptors gdb is interested in. These are the input file descriptor, and the target file @@ -170,25 +153,18 @@ static struct } callback_list; -/* Insert an event object into the gdb event queue. - - EVENT_PTR points to the event to be inserted into the queue. The - caller must allocate memory for the event. It is freed after the - event has ben handled. Events in the queue will be processed head - to tail, therefore, events will be processed first in first - out. */ +/* Free EVENT. */ static void -async_queue_event (gdb_event *event_ptr) +gdb_event_xfree (struct gdb_event *event) { - /* The event will become the new last_event. */ + xfree (event); +} - event_ptr->next_event = NULL; - if (event_queue.first_event == NULL) - event_queue.first_event = event_ptr; - else - event_queue.last_event->next_event = event_ptr; - event_queue.last_event = event_ptr; +void +initialize_event_loop (void) +{ + event_queue = QUEUE_alloc (gdb_event_p, gdb_event_xfree); } /* Process one event. If an event was processed, 1 is returned @@ -199,46 +175,18 @@ async_queue_event (gdb_event *event_ptr) static int process_event (void) { - gdb_event *event_ptr, *prev_ptr; - event_handler_func *proc; - gdb_fildes_t fd; - - /* Look in the event queue to find an event that is ready - to be processed. */ - - for (event_ptr = event_queue.first_event; - event_ptr != NULL; - event_ptr = event_ptr->next_event) + /* Let's get rid of the event from the event queue. We need to + do this now because while processing the event, since the + proc function could end up jumping out to the caller of this + function. In that case, we would have on the event queue an + event which has been processed, but not deleted. */ + if (!QUEUE_is_empty (gdb_event_p, event_queue)) { - /* Call the handler for the event. */ - hooks/post-receive -- Repository for Project Archer.