From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15623 invoked by alias); 31 Jul 2003 15:05:17 -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 15613 invoked from network); 31 Jul 2003 15:05:15 -0000 Received: from unknown (199.72.38.5) by sources.redhat.com with QMTP; 31 Jul 2003 15:05:15 -0000 Received: (qmail 16691 invoked from network); 31 Jul 2003 15:05:14 -0000 Received: from cpe-24-221-209-215.co.sprintbbd.net (HELO ?192.168.1.101?) (24.221.209.215) by external1.doc.com with SMTP; 31 Jul 2003 15:05:14 -0000 Subject: [RFC]: Better ObjC symbol skipping in decode_line_1 From: Adam Fedor To: "gdb-patches@sources.redhat.com" Content-Type: multipart/mixed; boundary="=-4pS71VzjVWAwiqS4TT6d" Organization: Message-Id: <1059663909.1116.23.camel@localhost.localdomain> Mime-Version: 1.0 Date: Thu, 31 Jul 2003 15:05:00 -0000 X-SW-Source: 2003-07/txt/msg00553.txt.bz2 --=-4pS71VzjVWAwiqS4TT6d Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 379 This patch fixes a problem with ObjC symbols not being properly skipped over during decode_line_1 processing. ObjC symbols can have spaces and parenthesis in them, so they need special handling, otherwise you get odd warnings like: Error in re-setting breakpoint 2: Function "-[NSObject(NEXTSTEP)" not defined. or Error in re-setting breakpoint 2: Function "" not defined. --=-4pS71VzjVWAwiqS4TT6d Content-Disposition: attachment; filename=objcsym.patch Content-Type: text/plain; name=objcsym.patch; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 2315 2003-07-31 Adam Fedor * gdb/linespec.c (is_objc_method_format): New function (decode_line_1, locate_first_half): Use it. Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.49.4.1 diff -u -p -r1.49.4.1 linespec.c --- linespec.c 23 Jul 2003 19:28:35 -0000 1.49.4.1 +++ linespec.c 31 Jul 2003 14:43:47 -0000 @@ -94,6 +94,8 @@ static void build_canonical_line_spec (s static char *find_toplevel_char (char *s, char c); +static int is_objc_method_format (const char *s); + static struct symtabs_and_lines decode_line_2 (struct symbol *[], int, int, char ***); @@ -443,6 +445,25 @@ find_toplevel_char (char *s, char c) return 0; } +/* Determines if the gives string corresponds to an Objective-C method + representation, such as -[Foo bar:] or +[Foo bar]. Objective-C symbols + are allowed to have spaces and parentheses in them. */ + +static int +is_objc_method_format (const char *s) +{ + if (s == NULL || *s == '\0') + return 0; + /* Handle arguments with the format FILENAME:SYMBOL. */ + if ((s[0] == ':') && (strchr ("+-", s[1]) != NULL) + && (s[2] == '[') && strchr(s, ']')) + return 1; + /* Handle arguments that are just SYMBOL. */ + else if ((strchr ("+-", s[0]) != NULL) && (s[1] == '[') && strchr(s, ']')) + return 1; + return 0; +} + /* Given a list of NELTS symbols in SYM_ARR, return a list of lines to operate on (ask user if necessary). If CANONICAL is non-NULL return a corresponding array of mangled names @@ -669,8 +690,7 @@ decode_line_1 (char **argptr, int funfir /* Check if this is an Objective-C method (anything that starts with a '+' or '-' and a '['). */ - if (*p && (p[0] == ':') && (strchr ("+-", p[1]) != NULL) - && (p[2] == '[')) + if (is_objc_method_format (p)) { is_objc_method = 1; paren_pointer = NULL; /* Just a category name. Ignore it. */ @@ -972,8 +992,7 @@ locate_first_half (char **argptr, int *i } /* Check for a colon and a plus or minus and a [ (which indicates an Objective-C method) */ - if (*p && (p[0] == ':') && (strchr ("+-", p[1]) != NULL) - && (p[2] == '[')) + if (is_objc_method_format (p)) { break; } --=-4pS71VzjVWAwiqS4TT6d--