From: Matt Rice <ratmice@gmail.com>
To: gdb-patches@sourceware.org
Subject: Re: gdb.objc/objcdecode.exp test error..
Date: Sun, 08 Mar 2009 14:16:00 -0000 [thread overview]
Message-ID: <8ba6bed40903080716k3fbeb56t5605aef1864b26a3@mail.gmail.com> (raw)
In-Reply-To: <8ba6bed40903070407q3e91f0ffs6fc67b2b9c329081@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]
On Sat, Mar 7, 2009 at 4:07 AM, Matt Rice <ratmice@gmail.com> wrote:
> I went ahead and tried to do some new tests
sorry for replying to myself, after trying to fix the bug,
i found the tests still had failures because of some bad regular
expressions in the test.
attached are new tests, and patches for the bug,
the patches are mutually exclusive they both do the same thing pretty much.
what Daniel said to try here.
http://sourceware.org/ml/gdb-patches/2008-03/msg00306.html
after fixing these bugs it fixes the testcases in question, but.... a
number of other testcases though either cause random passes of
previous failures or failures of previous passes on my machine
i have tested that decode_objc only quotes symbols which match
objective-c methods,
so I don't see how this affects non-objc tests
I think these are related to some issues i've been seeing while trying
to debug gdb with gdb.
After running the inferior in the bottom gdb, the top gdb (the one
running the debugger) gets
warning: Unexpected waitpid result 00117f when waiting for vfork-done
linux-nat.c:1999: internal-error: unknown ptrace event 5
A problem internal to GDB has been detected,
further debugging may prove unreliable.
this is an intermittent error with an unpatched gdb, i can work around
it by doing the same stuff (setting breakpoints running the inferior
in different orders), anyhow I would be grateful if someone could run
these through the testsuite on a system which works.
cheers
[-- Attachment #2: decode_line_2.diff --]
[-- Type: application/octet-stream, Size: 3841 bytes --]
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 6579d42..b43d249 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -105,7 +105,7 @@ 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 ***);
+ int, int, char ***, int);
static struct symtab *symtab_from_filename (char **argptr,
char *p, int is_quote_enclosed,
@@ -477,11 +477,13 @@ is_objc_method_format (const char *s)
/* 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
- as canonical line specs there. */
+ as canonical line specs there. If should_quote_canonical is non-zero
+ it will wrap the canonical in single quotes.
+*/
static struct symtabs_and_lines
decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
- char ***canonical)
+ char ***canonical, int should_quote_canonical)
{
struct symtabs_and_lines values, return_values;
char *args, *arg1;
@@ -587,6 +589,16 @@ See set/show multiple-symbol."));
if (canonical_arr[i] == NULL)
{
symname = SYMBOL_LINKAGE_NAME (sym_arr[i]);
+
+ if (should_quote_canonical)
+ {
+ char *qsymname;
+ qsymname = alloca(strlen(symname) + sizeof("''\0"));
+ strcpy(qsymname, "'");
+ strcat(qsymname, symname);
+ strcat(qsymname, "'");
+ symname = qsymname;
+ }
canonical_arr[i] = savestring (symname, strlen (symname));
}
}
@@ -609,9 +621,27 @@ See set/show multiple-symbol."));
{
if (canonical_arr)
{
+ char *the_symname;
+
symname = SYMBOL_LINKAGE_NAME (sym_arr[num]);
+
+ if (should_quote_canonical)
+ {
+ char *qsymname;
+
+ qsymname = alloca(strlen(symname) + sizeof("''\0"));
+ strcpy(qsymname, "'");
+ strcat(qsymname, symname);
+ strcat(qsymname, "'");
+ the_symname = qsymname;
+ }
+ else
+ the_symname = symname;
+
+ // why cleanup? SYMBOL_LINKAGE_NAME doesn't allocate
+ // anything, so this appears to free one of our args?
make_cleanup (xfree, symname);
- canonical_arr[i] = savestring (symname, strlen (symname));
+ canonical_arr[i] = savestring (the_symname, strlen (the_symname));
}
return_values.sals[i++] = values.sals[num];
values.sals[num].pc = 0;
@@ -740,14 +770,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
}
/* Check if the symbol could be an Objective-C selector. */
-
- {
- struct symtabs_and_lines values;
- values = decode_objc (argptr, funfirstline, NULL,
+ if (!is_quoted)
+ {
+ struct symtabs_and_lines values;
+ values = decode_objc (argptr, funfirstline, NULL,
canonical, saved_arg);
- if (values.sals != NULL)
- return values;
- }
+ if (values.sals != NULL)
+ return values;
+ }
/* Does it look like there actually were two parts? */
@@ -1182,7 +1212,7 @@ decode_objc (char **argptr, int funfirstline, struct symtab *file_symtab,
if (i1 > 1)
{
/* More than one match. The user must choose one or more. */
- return decode_line_2 (sym_arr, i2, funfirstline, canonical);
+ return decode_line_2 (sym_arr, i2, funfirstline, canonical, 1);
}
return values;
@@ -1467,7 +1497,7 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
{
/* There is more than one field with that name
(overloaded). Ask the user which one to use. */
- return decode_line_2 (sym_arr, i1, funfirstline, canonical);
+ return decode_line_2 (sym_arr, i1, funfirstline, canonical, 0);
}
else
{
[-- Attachment #3: decode_objc.diff --]
[-- Type: application/octet-stream, Size: 1504 bytes --]
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 6579d42..2fa030e 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -740,14 +740,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
}
/* Check if the symbol could be an Objective-C selector. */
-
- {
- struct symtabs_and_lines values;
- values = decode_objc (argptr, funfirstline, NULL,
- canonical, saved_arg);
- if (values.sals != NULL)
- return values;
- }
+ if (!is_quoted)
+ {
+ struct symtabs_and_lines values;
+ values = decode_objc (argptr, funfirstline, NULL,
+ canonical, saved_arg);
+ if (values.sals != NULL)
+ return values;
+ }
/* Does it look like there actually were two parts? */
@@ -1181,8 +1181,24 @@ decode_objc (char **argptr, int funfirstline, struct symtab *file_symtab,
if (i1 > 1)
{
+ int i;
+
/* More than one match. The user must choose one or more. */
- return decode_line_2 (sym_arr, i2, funfirstline, canonical);
+ values = decode_line_2 (sym_arr, i2, funfirstline, canonical);
+
+ if (!canonical)
+ return values;
+
+ for (i = 0; i < values.nelts; i++)
+ {
+ char **canonical_arr = *canonical;
+ char *canonical_name = canonical_arr[i];
+ char *fq_name = xmalloc(strlen(canonical_name) + sizeof("''\0"));
+
+ sprintf(fq_name, "'%s'", canonical_name);
+ canonical_arr[i] = fq_name;
+ xfree(canonical_name);
+ }
}
return values;
[-- Attachment #4: tests.diff --]
[-- Type: application/octet-stream, Size: 3106 bytes --]
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 50e61ce..4617c4d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-05 Matt Rice <ratmice@gmail.com>
+
+ * gdb.objc/objcdecode.exp: Set the multiple symbols found behaviour
+ to ask for the original test. Add tests for the multiple symbols
+ found behaviour of all.
+
2009-03-05 Paul Pluzhnikov <ppluzhnikov@google.com>
* solib-display.exp: New file.
diff --git a/gdb/testsuite/gdb.objc/objcdecode.exp b/gdb/testsuite/gdb.objc/objcdecode.exp
index b751fb9..b2a2d97 100644
--- a/gdb/testsuite/gdb.objc/objcdecode.exp
+++ b/gdb/testsuite/gdb.objc/objcdecode.exp
@@ -59,7 +59,8 @@ do_objc_tests
#
# Break on multiply defined method (PR objc/1236)
#
-set name "break on multiply defined method"
+set name "break on multiply defined method using multiple-symbols ask"
+gdb_test "set multiple-symbols ask" ""
gdb_test_multiple "break multipleDef" $name \
{
-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] -.Decode multipleDef. at .*\r\n\\\[3\\\] multipleDef at .*\r\n> $" {
@@ -70,7 +71,7 @@ gdb_test_multiple "break multipleDef" $name \
-re ".*$gdb_prompt $" { kfail "gdb/1236" $name }
}
-set name "continue after break on multiply defined symbol"
+set name "run after setting breakpoints on multiply defined symbol"
gdb_run_cmd
gdb_test_multiple "" $name \
{
@@ -84,3 +85,54 @@ gdb_test_multiple "" $name \
# It would be difficult to do any more tests after this.
}
}
+
+do_objc_tests
+if ![runto_main] { fail "Can't run to main" }
+
+set name "break on multiply defined symbol with multiple-symbols all after main"
+gdb_test "set multiple-symbols all after main" ""
+gdb_test_multiple "break multipleDef" $name \
+{
+ -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\n$gdb_prompt $" { pass $name }
+ -re ".*$gdb_prompt $" { fail $name }
+}
+
+set name "can hit multiply defined breakpoint on function after main"
+gdb_continue_to_breakpoint "function multipleDef"
+
+set name "can hit multiply defined breakpoint on objc method after main"
+gdb_continue_to_breakpoint "method multipleDef"
+gdb_exit
+
+do_objc_tests
+
+set name "break on multiply defined symbol with multiple-symbols all before main"
+gdb_test_multiple "break multipleDef" $name \
+{
+ -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\n$gdb_prompt $" { pass $name }
+ -re ".*$gdb_prompt $" { kfail $name }
+}
+
+set name "can hit multiply defined breakpoint on function before main"
+gdb_run_cmd
+gdb_test_multiple "" $name \
+{
+ -re "Breakpoint \[0-9\]+, multipleDef \\\(\\\) at .*\r\n$gdb_prompt $" {
+ pass $name
+ }
+ -re ".*$gdb_prompt $" { fail $name }
+}
+
+set name "can hit multiply defined breakpoint on method before main"
+gdb_test_multiple "continue" $name \
+{
+ -re "Breakpoint \[0-9\]+, -\\\[Decode multipleDef\\\] \\\(.*\\\) at .*\r\n$gdb_prompt $" {
+ pass $name
+ }
+ -re ".*$gdb_prompt $" { fail $name }
+}
+
+
+gdb_exit
+return 0
+
next prev parent reply other threads:[~2009-03-08 14:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 1:31 Matt Rice
2009-03-06 17:33 ` Joel Brobecker
2009-03-06 19:13 ` Pedro Alves
2009-03-07 12:07 ` Matt Rice
2009-03-08 14:16 ` Matt Rice [this message]
2009-03-09 2:10 ` Matt Rice
2009-09-11 11:43 ` Matt Rice
2009-09-24 0:53 ` Joel Brobecker
2009-09-24 8:24 ` Matt Rice
2009-09-24 18:28 ` Tom Tromey
2009-09-24 22:07 ` Matt Rice
2009-09-24 22:29 ` Matt Rice
2009-09-24 22:51 ` Matt Rice
2009-09-25 4:03 ` Matt Rice
2009-10-13 0:44 ` Tom Tromey
2009-10-14 1:59 ` Joel Brobecker
2009-09-23 23:13 ` Joel Brobecker
2009-09-24 6:48 ` Matt Rice
2009-09-24 16:41 ` Joel Brobecker
2009-09-24 17:31 ` Joel Brobecker
2009-09-24 17:41 ` Joel Brobecker
2009-09-24 16:52 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ba6bed40903080716k3fbeb56t5605aef1864b26a3@mail.gmail.com \
--to=ratmice@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox