From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16385 invoked by alias); 25 Nov 2009 08:06:33 -0000 Received: (qmail 16376 invoked by uid 22791); 25 Nov 2009 08:06:32 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-px0-f175.google.com (HELO mail-px0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Nov 2009 08:06:25 +0000 Received: by pxi5 with SMTP id 5so5261897pxi.12 for ; Wed, 25 Nov 2009 00:06:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.143.21.36 with SMTP id y36mr863704wfi.211.1259136384164; Wed, 25 Nov 2009 00:06:24 -0800 (PST) From: Hui Zhu Date: Wed, 25 Nov 2009 08:06:00 -0000 Message-ID: Subject: [RFA/RFC] Prec multi-thread support [3/4] thread.c To: gdb-patches ml Cc: Michael Snyder Content-Type: multipart/mixed; boundary=00504502cdebe6e30504792d88bb X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00544.txt.bz2 --00504502cdebe6e30504792d88bb Content-Type: text/plain; charset=ISO-8859-1 Content-length: 1673 1. Move thread_state to gdbthread.h because record target need get the status of each thread. Sometime, GDB will not remove the thread entry when it exit. 2. record_is_waiting is to flag that mean this thread is still running. I will introduce in next mail. 2009-11-25 Hui Zhu gdbthread.h (thread_state): New enum. (thread_info): Add record_is_waiting. thread.c (thread_state): Deleted. --- gdbthread.h | 11 +++++++++++ thread.c | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) --- a/gdbthread.h +++ b/gdbthread.h @@ -29,6 +29,15 @@ struct symtab; #include "ui-out.h" #include "inferior.h" +/* Frontend view of the thread state. Possible extensions: stepping, + finishing, until(ling),... */ +enum thread_state +{ + THREAD_STOPPED, + THREAD_RUNNING, + THREAD_EXITED, +}; + struct thread_info { struct thread_info *next; @@ -37,6 +46,8 @@ struct thread_info kernel thread id, etc. */ int num; /* Convenient handle (GDB thread id) */ + int record_is_waiting; + /* Non-zero means the thread is executing. Note: this is different from saying that there is an active target and we are stopped at a breakpoint, for instance. This is a real indicator whether the --- a/thread.c +++ b/thread.c @@ -63,15 +63,6 @@ static void thread_apply_command (char * static void restore_current_thread (ptid_t); static void prune_threads (void); -/* Frontend view of the thread state. Possible extensions: stepping, - finishing, until(ling),... */ -enum thread_state -{ - THREAD_STOPPED, - THREAD_RUNNING, - THREAD_EXITED, -}; - struct thread_info* inferior_thread (void) { --00504502cdebe6e30504792d88bb Content-Type: text/plain; charset=US-ASCII; name="prec-thread-c.txt" Content-Disposition: attachment; filename="prec-thread-c.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g2ftgpyj0 Content-length: 1708 LS0tCiBnZGJ0aHJlYWQuaCB8ICAgMTEgKysrKysrKysrKysKIHRocmVhZC5j ICAgIHwgICAgOSAtLS0tLS0tLS0KIDIgZmlsZXMgY2hhbmdlZCwgMTEgaW5z ZXJ0aW9ucygrKSwgOSBkZWxldGlvbnMoLSkKCi0tLSBhL2dkYnRocmVhZC5o CisrKyBiL2dkYnRocmVhZC5oCkBAIC0yOSw2ICsyOSwxNSBAQCBzdHJ1Y3Qg c3ltdGFiOwogI2luY2x1ZGUgInVpLW91dC5oIgogI2luY2x1ZGUgImluZmVy aW9yLmgiCiAKKy8qIEZyb250ZW5kIHZpZXcgb2YgdGhlIHRocmVhZCBzdGF0 ZS4gIFBvc3NpYmxlIGV4dGVuc2lvbnM6IHN0ZXBwaW5nLAorICAgZmluaXNo aW5nLCB1bnRpbChsaW5nKSwuLi4gICovCitlbnVtIHRocmVhZF9zdGF0ZQor eworICBUSFJFQURfU1RPUFBFRCwKKyAgVEhSRUFEX1JVTk5JTkcsCisgIFRI UkVBRF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