From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13604 invoked by alias); 12 Apr 2005 15:54:19 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13226 invoked from network); 12 Apr 2005 15:54:00 -0000 Received: from unknown (HELO dmz.algor.co.uk) (62.254.210.145) by sourceware.org with SMTP; 12 Apr 2005 15:54:00 -0000 Received: from alg158.algor.co.uk ([62.254.210.158] helo=olympia.mips.com) by dmz.algor.co.uk with esmtp (Exim 3.35 #1 (Debian)) id 1DLNlB-0006Uz-00 for ; Tue, 12 Apr 2005 16:57:05 +0100 Received: from perivale.mips.com ([192.168.192.200]) by olympia.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1DLNi8-0000l9-00 for ; Tue, 12 Apr 2005 16:53:56 +0100 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 3.36 #1 (Debian)) id 1DLNi7-0003eP-00 for ; Tue, 12 Apr 2005 16:53:55 +0100 Date: Tue, 12 Apr 2005 15:54:00 -0000 From: "Maciej W. Rozycki" To: gdb-patches@sources.redhat.com Subject: Support for "break *ADDRESS thread THREADNO" Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MTUK-Scanner: Found to be clean X-MTUK-SpamCheck: not spam (whitelisted), SpamAssassin (score=-4.645, required 4, AWL, BAYES_00) X-SW-Source: 2005-04/txt/msg00092.txt.bz2 Hello, The current version of gdb does not accept the "thread THREADNO" clause for breakpoints at an address. I'm not sure if that's a bug or feature as the info pages carefully avoid documenting what should happen in this case, referring to source lines instead. Anyway I've found the inability to set up such breakpoints an obstacle, so I've implemented the missing bits for it to work. Here's the result. I've run-time tested the C language bit only (i.e. c-exp.y), but the other .y changes are essentially the same, so they should work as well. Unfortunately I haven't found a way of testing the Ada part which is significantly different; I hope it's OK. 2005-04-12 Maciej W. Rozycki * ada-lex.l: Support the "thread THREADNO" clause with breakpoints at an address. * c-exp.y (yylex): Likewise. * f-exp.y (yylex): Likewise. * jv-exp.y (yylex): Likewise. * m2-exp.y (yylex): Likewise. * objc-exp.y (yylex): Likewise. * p-exp.y (yylex): Likewise. This has been verified for the HEAD version with the test suite for the i386-linux-gnu system natively with no regressions. Please consider. Maciej gdb-6.2.1-20050412-break-addr-thread-0.patch Index: src/gdb/ada-lex.l =================================================================== RCS file: /cvsroot/gcc/src-cvs/src/gdb/ada-lex.l,v retrieving revision 1.2.1000.2 diff -u -p -r1.2.1000.2 ada-lex.l --- src/gdb/ada-lex.l 5 Aug 2004 14:41:08 -0000 1.2.1000.2 +++ src/gdb/ada-lex.l 12 Apr 2005 14:25:15 -0000 @@ -191,8 +191,9 @@ static int find_dot_all (const char *); tempbuf_len += yyleng-4; } -if { - while (*lexptr != 'i' && *lexptr != 'I') +if|thread { + while (*lexptr != 'i' && *lexptr != 'I' + && *lexptr != 't' && *lexptr != 'T') lexptr -= 1; yyrestart(NULL); return 0; Index: src/gdb/c-exp.y =================================================================== RCS file: /cvsroot/gcc/src-cvs/src/gdb/c-exp.y,v retrieving revision 1.23.1000.5 diff -u -p -r1.23.1000.5 c-exp.y --- src/gdb/c-exp.y 26 Aug 2004 16:38:01 -0000 1.23.1000.5 +++ src/gdb/c-exp.y 12 Apr 2005 14:25:15 -0000 @@ -1620,12 +1620,11 @@ yylex () c = tokstart[++namelen]; } - /* The token "if" terminates the expression and is NOT removed from - the input stream. It doesn't count if it appears in the - expansion of a macro. */ - if (namelen == 2 - && tokstart[0] == 'i' - && tokstart[1] == 'f' + /* The tokens "if" and "thread" terminate the expression and are NOT + removed from the input stream. It doesn't count if it appears in + the expansion of a macro. */ + if (((namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + || (namelen == 6 && strncmp (tokstart, "thread", 6) == 0)) && ! scanning_macro_expansion ()) { return 0; Index: src/gdb/f-exp.y =================================================================== RCS file: /cvsroot/gcc/src-cvs/src/gdb/f-exp.y,v retrieving revision 1.13.1000.2 diff -u -p -r1.13.1000.2 f-exp.y --- src/gdb/f-exp.y 5 Aug 2004 14:41:15 -0000 1.13.1000.2 +++ src/gdb/f-exp.y 12 Apr 2005 14:25:15 -0000 @@ -1103,10 +1103,11 @@ yylex () || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); c = tokstart[++namelen]); - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - - if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + /* The tokens "if" and "thread" terminate the expression and are NOT + removed from the input stream. It doesn't count if it appears in + the expansion of a macro. */ + if ((namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + || (namelen == 6 && strncmp (tokstart, "thread", 6) == 0)) return 0; lexptr += namelen; Index: src/gdb/jv-exp.y =================================================================== RCS file: /cvsroot/gcc/src-cvs/src/gdb/jv-exp.y,v retrieving revision 1.16.1000.1 diff -u -p -r1.16.1000.1 jv-exp.y --- src/gdb/jv-exp.y 10 Dec 2003 19:29:42 -0000 1.16.1000.1 +++ src/gdb/jv-exp.y 12 Apr 2005 14:25:15 -0000 @@ -1118,9 +1118,11 @@ yylex () c = tokstart[++namelen]; } - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + /* The tokens "if" and "thread" terminate the expression and are NOT + removed from the input stream. It doesn't count if it appears in + the expansion of a macro. */ + if ((namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + || (namelen == 6 && strncmp (tokstart, "thread", 6) == 0)) { return 0; } Index: src/gdb/m2-exp.y =================================================================== RCS file: /cvsroot/gcc/src-cvs/src/gdb/m2-exp.y,v retrieving revision 1.11.1000.1 diff -u -p -r1.11.1000.1 m2-exp.y --- src/gdb/m2-exp.y 10 Dec 2003 19:29:42 -0000 1.11.1000.1 +++ src/gdb/m2-exp.y 12 Apr 2005 14:25:15 -0000 @@ -981,9 +981,11 @@ yylex () c = tokstart[++namelen]) ; - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + /* The tokens "if" and "thread" terminate the expression and are NOT + removed from the input stream. It doesn't count if it appears in + the expansion of a macro. */ + if ((namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + || (namelen == 6 && strncmp (tokstart, "thread", 6) == 0)) { return 0; } Index: src/gdb/objc-exp.y =================================================================== RCS file: /cvsroot/gcc/src-cvs/src/gdb/objc-exp.y,v retrieving revision 1.14.1000.2 diff -u -p -r1.14.1000.2 objc-exp.y --- src/gdb/objc-exp.y 5 Aug 2004 14:41:19 -0000 1.14.1000.2 +++ src/gdb/objc-exp.y 12 Apr 2005 14:25:15 -0000 @@ -1574,9 +1574,11 @@ yylex () c = tokstart[++namelen]; } - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + /* The tokens "if" and "thread" terminate the expression and are NOT + removed from the input stream. It doesn't count if it appears in + the expansion of a macro. */ + if ((namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + || (namelen == 6 && strncmp (tokstart, "thread", 6) == 0)) { return 0; } Index: src/gdb/p-exp.y =================================================================== RCS file: /cvsroot/gcc/src-cvs/src/gdb/p-exp.y,v retrieving revision 1.25.1000.2 diff -u -p -r1.25.1000.2 p-exp.y --- src/gdb/p-exp.y 5 Aug 2004 14:41:19 -0000 1.25.1000.2 +++ src/gdb/p-exp.y 12 Apr 2005 14:25:15 -0000 @@ -1354,9 +1354,11 @@ yylex () uptokstart = uptok(tokstart,namelen); - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F') + /* The tokens "if" and "thread" terminate the expression and are NOT + removed from the input stream. It doesn't count if it appears in + the expansion of a macro. */ + if ((namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F') + || (namelen == 6 && strncmp (uptokstart, "THREAD", 6) == 0)) { return 0; }