• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Révision7e1c5a0c7517848f08894b8dcc4e54e8832c7180 (tree)
l'heure2006-09-17 21:26:21
AuteurNick Roberts <nickrob@snap...>
CommiterNick Roberts

Message de Log

Copy code from Apple more carefully and remove redundant code

Change Summary

Modification

--- a/gdb/async-nat-inferior.c
+++ b/gdb/async-nat-inferior.c
@@ -23,61 +23,18 @@
2323 Boston, MA 02111-1307, USA. */
2424
2525 #include "defs.h"
26-#include "top.h"
2726 #include "inferior.h"
28-#include "target.h"
29-#include "symfile.h"
30-#include "symtab.h"
3127 #include "objfiles.h"
32-#include "gdbcmd.h"
33-#include "gdbcore.h"
34-#include "gdbthread.h"
35-#include "regcache.h"
36-#include "environ.h"
3728 #include "event-top.h"
38-#include "inf-loop.h"
39-#include "gdb_stat.h"
40-#include "exceptions.h"
41-
42-#include "bfd.h"
43-
44-#include <sys/ptrace.h>
45-#include <sys/signal.h>
46-#include <setjmp.h>
47-#include <sys/types.h>
48-#include <unistd.h>
49-#include <signal.h>
50-#include <string.h>
51-#include <ctype.h>
52-#include <sys/param.h>
53-#include <sys/sysctl.h>
5429
5530 #include "async-nat-inferior.h"
56-/* classic-inferior-support */
57-//#include "macosx-nat.h"
58-//#include "macosx-nat-inferior-util.h"
59-
60-#ifndef EXC_SOFT_SIGNAL
61-#define EXC_SOFT_SIGNAL 0
62-#endif
63-
64-extern bfd *exec_bfd;
6531
6632 gdb_inferior_status *gdb_status = NULL;
6733
68-int inferior_ptrace_flag = 1;
69-int inferior_ptrace_on_attach_flag = 1;
70-int inferior_bind_exception_port_flag = 1;
71-int inferior_handle_exceptions_flag = 1;
72-int inferior_handle_all_events_flag = 1;
73-
7434 enum gdb_source_type
7535 {
7636 NEXT_SOURCE_NONE = 0x0,
77- NEXT_SOURCE_EXCEPTION = 0x1,
78- NEXT_SOURCE_SIGNAL = 0x2,
79- NEXT_SOURCE_CFM = 0x4,
80- NEXT_SOURCE_ALL = 0x7
37+ NEXT_SOURCE_SIGNAL = 0x1,
8138 };
8239
8340 struct gdb_pending_event
@@ -139,8 +96,6 @@ gdb_handle_signal (gdb_signal_thread_message *msg,
13996
14097 gdb_status->stopped_in_ptrace = 1;
14198
142- //prepare_threads_after_stop (gdb_status);
143-
14499 status->kind = TARGET_WAITKIND_STOPPED;
145100 status->value.sig = target_signal_from_host (WSTOPSIG (msg->status));
146101 }
@@ -292,8 +247,6 @@ gdb_post_pending_event (void)
292247 if (pending_event_chain == NULL)
293248 pending_event_tail = NULL;
294249
295- /*inferior_debug (1,
296- "gdb_post_pending_event: consuming event off queue\n"); */
297250 gdb_queue_event (gdb_pending_event_handler, (void *) event, HEAD);
298251
299252 return 1;
@@ -303,7 +256,6 @@ gdb_post_pending_event (void)
303256 static void
304257 gdb_pending_event_handler (void *data)
305258 {
306- //inferior_debug (1, "Called in gdb_pending_event_handler\n");
307259 async_client_callback (INF_REG_EVENT, data);
308260 }
309261
@@ -312,15 +264,7 @@ gdb_service_event (enum gdb_source_type source,
312264 unsigned char *buf, struct target_waitstatus *status)
313265 {
314266 if (source == NEXT_SOURCE_SIGNAL)
315- {
316- // inferior_debug (1, "gdb_service_events: got signal message\n");
317267 gdb_handle_signal ((gdb_signal_thread_message *) buf, status);
318- // CHECK_FATAL (status->kind != TARGET_WAITKIND_SPURIOUS);
319- if (!inferior_handle_all_events_flag)
320- {
321- return 1;
322- }
323- }
324268 else
325269 {
326270 error ("got message from unknown source: 0x%08x\n", source);
@@ -347,7 +291,7 @@ gdb_process_events (struct gdb_inferior_status *inferior,
347291 // CHECK_FATAL (status->kind == TARGET_WAITKIND_SPURIOUS);
348292
349293 source = gdb_fetch_event (inferior, buf, sizeof (buf),
350- NEXT_SOURCE_ALL, timeout);
294+ NEXT_SOURCE_SIGNAL, timeout);
351295 if (source == NEXT_SOURCE_NONE)
352296 {
353297 return 0;
@@ -365,6 +309,32 @@ gdb_process_events (struct gdb_inferior_status *inferior,
365309 gdb_add_to_pending_events (source, buf);
366310 }
367311
312+ /* FIXME: we want to poll in gdb_fetch_event because otherwise we
313+ arbitrarily wait however long the wait quanta for select is
314+ (seemingly ~.01 sec). However, if we do this we aren't giving
315+ the mach exception thread a chance to run, and see if there are
316+ any more exceptions available. Normally this is okay, because
317+ there really IS only one message, but to be correct we need to
318+ use some thread synchronization. */
319+ for (;;)
320+ {
321+ source = gdb_fetch_event (inferior, buf, sizeof (buf),
322+ NEXT_SOURCE_SIGNAL, 0);
323+ if (source == NEXT_SOURCE_NONE)
324+ {
325+ break;
326+ }
327+ else
328+ {
329+ event_count++;
330+
331+ /* Stuff the remaining events onto the pending_events queue.
332+ These will be dispatched when we run again. */
333+ /* PENDING_EVENTS */
334+ gdb_add_to_pending_events (source, buf);
335+ }
336+ }
337+
368338 return event_count;
369339 }
370340
@@ -378,6 +348,7 @@ gdb_process_pending_event (struct gdb_inferior_status *ns,
378348
379349 //inferior_debug (1, "Processing pending event type: %d\n", event->type);
380350 gdb_service_event (event->type, (unsigned char *) event->buf, status);
351+ // printf ("IN GDB_PROCESS_PENDING_EVENT %s\n", event->buf);
381352
382353 return ptid_build (gdb_status->pid, gdb_status->pid, 0);
383354 }
@@ -385,8 +356,6 @@ gdb_process_pending_event (struct gdb_inferior_status *ns,
385356 void
386357 gdb_create_inferior (struct gdb_inferior_status *inferior, int pid)
387358 {
388- // CHECK_FATAL (inferior != NULL);
389-
390359 gdb_inferior_destroy (inferior);
391360 gdb_inferior_reset (inferior);
392361
--- a/gdb/async-nat-inferior.h
+++ b/gdb/async-nat-inferior.h
@@ -44,8 +44,6 @@ int gdb_post_pending_event (void);
4444 void (*async_client_callback) (enum inferior_event_type event_type,
4545 void *context);
4646
47-void *async_client_context;
48-
4947 void async_terminal_inferior (void);
5048
5149 void async_terminal_ours (void);
--- a/gdb/async-nat-sigthread.c
+++ b/gdb/async-nat-sigthread.c
@@ -28,13 +28,8 @@
2828 #include "inferior.h"
2929
3030 #include "async-nat-sigthread.h"
31-//#include "macosx-nat-inferior.h"
32-//#include "macosx-nat-mutils.h"
3331
34-#include <stdlib.h>
35-#include <stdarg.h>
3632 #include <string.h>
37-
3833 #include <sys/select.h>
3934
4035 static FILE *sigthread_stderr_re = NULL;
@@ -74,7 +69,6 @@ gdb_signal_thread_create (gdb_signal_thread_status *s, int pid)
7469 int ret;
7570
7671 ret = pipe (fd);
77- // CHECK_FATAL (ret == 0);
7872
7973 s->transmit_fd = fd[1];
8074 s->receive_fd = fd[0];
@@ -132,7 +126,6 @@ static void*
132126 gdb_signal_thread (void *arg)
133127 {
134128 gdb_signal_thread_status *s = (gdb_signal_thread_status *) arg;
135- // CHECK_FATAL (s != NULL);
136129
137130 for (;;)
138131 {
@@ -209,6 +202,13 @@ gdb_pthread_kill (pthread_t pthread)
209202 {
210203 warning ("Unable to cancel thread: %s (%d)", strerror (errno), errno);
211204 }
205+
206+ ret = pthread_join (pthread, NULL);
207+ if (ret != 0)
208+ {
209+ warning ("Unable to join to canceled thread: %s (%d)", strerror (errno),
210+ errno);
211+ }
212212 }
213213
214214 pthread_t