* [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp
@ 2014-11-26 4:20 Doug Evans
2014-11-26 9:00 ` Yao Qi
2014-12-04 11:48 ` Andreas Arnez
0 siblings, 2 replies; 5+ messages in thread
From: Doug Evans @ 2014-11-26 4:20 UTC (permalink / raw)
To: gdb-patches
Hi.
This patch fixes pr 17602, the arguments to symbol_name_cmp are
reversed, as explained in the comment in this patch.
Regression tested on amd64-linux.
2014-11-25 Doug Evans <dje@google.com>
PR symtab/17602
* linespec.c (iterate_name_matcher): Fix arguments to symbol_name_cmp.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 5325702..35b0205 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -982,7 +982,12 @@ iterate_name_matcher (const char *name, void *d)
{
const struct symbol_matcher_data *data = d;
- if (data->symbol_name_cmp (name, data->lookup_name) == 0)
+ /* The order of arguments we pass to symbol_name_cmp is important as
+ strcmp_iw, a typical value for symbol_name_cmp, only performs special
+ processing of '(' to remove overload info on the first argument and not
+ the second. The first argument is what the user provided, the second
+ argument is what came from partial syms / .gdb_index. */
+ if (data->symbol_name_cmp (data->lookup_name, name) == 0)
return 1; /* Expand this symbol's symbol table. */
return 0; /* Skip this symbol. */
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp
2014-11-26 4:20 [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp Doug Evans
@ 2014-11-26 9:00 ` Yao Qi
2014-12-04 16:02 ` Doug Evans
2014-12-04 11:48 ` Andreas Arnez
1 sibling, 1 reply; 5+ messages in thread
From: Yao Qi @ 2014-11-26 9:00 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Doug Evans <dje@google.com> writes:
> - if (data->symbol_name_cmp (name, data->lookup_name) == 0)
> + /* The order of arguments we pass to symbol_name_cmp is important as
> + strcmp_iw, a typical value for symbol_name_cmp, only performs special
> + processing of '(' to remove overload info on the first argument and not
> + the second. The first argument is what the user provided, the second
> + argument is what came from partial syms / .gdb_index. */
> + if (data->symbol_name_cmp (data->lookup_name, name) == 0)
> return 1; /* Expand this symbol's symbol table. */
> return 0; /* Skip this symbol. */
Such odd feature is documented in the comments to strcmp_iw:
As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
This "feature" is useful when searching for matching C++ function names
(such as if the user types 'break FOO', where FOO is a mangled C++
function).
A question not related to this patch too much, do you consider to move
such c++ specific hack into c++ specific routine la_get_symbol_name_cmp?
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp
2014-11-26 4:20 [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp Doug Evans
2014-11-26 9:00 ` Yao Qi
@ 2014-12-04 11:48 ` Andreas Arnez
2014-12-04 15:57 ` Doug Evans
1 sibling, 1 reply; 5+ messages in thread
From: Andreas Arnez @ 2014-12-04 11:48 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches, Joel Brobecker
On Wed, Nov 26 2014, Doug Evans wrote:
> diff --git a/gdb/linespec.c b/gdb/linespec.c
> index 5325702..35b0205 100644
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -982,7 +982,12 @@ iterate_name_matcher (const char *name, void *d)
> {
> const struct symbol_matcher_data *data = d;
>
> - if (data->symbol_name_cmp (name, data->lookup_name) == 0)
> + /* The order of arguments we pass to symbol_name_cmp is important as
> + strcmp_iw, a typical value for symbol_name_cmp, only performs special
> + processing of '(' to remove overload info on the first argument and not
> + the second. The first argument is what the user provided, the second
> + argument is what came from partial syms / .gdb_index. */
> + if (data->symbol_name_cmp (data->lookup_name, name) == 0)
> return 1; /* Expand this symbol's symbol table. */
> return 0; /* Skip this symbol. */
> }
This seems to cause a regression for the Ada testcase "operator_bp.exp":
> [...]
> FAIL: gdb.ada/operator_bp.exp: break "+" (got interactive prompt)
> FAIL: gdb.ada/operator_bp.exp: break "-" (got interactive prompt)
> FAIL: gdb.ada/operator_bp.exp: break "*" (got interactive prompt)
> FAIL: gdb.ada/operator_bp.exp: break "/" (got interactive prompt)
> FAIL: gdb.ada/operator_bp.exp: break "mod" (got interactive prompt)
> FAIL: gdb.ada/operator_bp.exp: break "rem" (got interactive prompt)
> FAIL: gdb.ada/operator_bp.exp: break "**" (got interactive prompt)
> [...]
See https://sourceware.org/ml/gdb-testers/2014-q4/msg00126.html
The problem occurs like this:
(gdb) break "+"
Function ""+"" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) FAIL: gdb.ada/operator_bp.exp: break "+" (got interactive prompt)
When reverting the patch, the test succeeds again.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp
2014-12-04 11:48 ` Andreas Arnez
@ 2014-12-04 15:57 ` Doug Evans
0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2014-12-04 15:57 UTC (permalink / raw)
To: Andreas Arnez; +Cc: gdb-patches, Joel Brobecker
On Thu, Dec 4, 2014 at 3:48 AM, Andreas Arnez <arnez@linux.vnet.ibm.com> wrote:
> On Wed, Nov 26 2014, Doug Evans wrote:
>
>> diff --git a/gdb/linespec.c b/gdb/linespec.c
>> index 5325702..35b0205 100644
>> --- a/gdb/linespec.c
>> +++ b/gdb/linespec.c
>> @@ -982,7 +982,12 @@ iterate_name_matcher (const char *name, void *d)
>> {
>> const struct symbol_matcher_data *data = d;
>>
>> - if (data->symbol_name_cmp (name, data->lookup_name) == 0)
>> + /* The order of arguments we pass to symbol_name_cmp is important as
>> + strcmp_iw, a typical value for symbol_name_cmp, only performs special
>> + processing of '(' to remove overload info on the first argument and not
>> + the second. The first argument is what the user provided, the second
>> + argument is what came from partial syms / .gdb_index. */
>> + if (data->symbol_name_cmp (data->lookup_name, name) == 0)
>> return 1; /* Expand this symbol's symbol table. */
>> return 0; /* Skip this symbol. */
>> }
>
> This seems to cause a regression for the Ada testcase "operator_bp.exp":
>
>> [...]
>> FAIL: gdb.ada/operator_bp.exp: break "+" (got interactive prompt)
>> FAIL: gdb.ada/operator_bp.exp: break "-" (got interactive prompt)
>> FAIL: gdb.ada/operator_bp.exp: break "*" (got interactive prompt)
>> FAIL: gdb.ada/operator_bp.exp: break "/" (got interactive prompt)
>> FAIL: gdb.ada/operator_bp.exp: break "mod" (got interactive prompt)
>> FAIL: gdb.ada/operator_bp.exp: break "rem" (got interactive prompt)
>> FAIL: gdb.ada/operator_bp.exp: break "**" (got interactive prompt)
>> [...]
>
> See https://sourceware.org/ml/gdb-testers/2014-q4/msg00126.html
>
> The problem occurs like this:
>
> (gdb) break "+"
> Function ""+"" not defined.
> Make breakpoint pending on future shared library load? (y or [n]) n
> (gdb) FAIL: gdb.ada/operator_bp.exp: break "+" (got interactive prompt)
>
> When reverting the patch, the test succeeds again.
Yeah, found that last night.
The problem is ada-lang.c:wild_match takes arguments in the opposite
order of strcmp_iw.
Working on a patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp
2014-11-26 9:00 ` Yao Qi
@ 2014-12-04 16:02 ` Doug Evans
0 siblings, 0 replies; 5+ messages in thread
From: Doug Evans @ 2014-12-04 16:02 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On Wed, Nov 26, 2014 at 1:00 AM, Yao Qi <yao@codesourcery.com> wrote:
> A question not related to this patch too much, do you consider to move
> such c++ specific hack into c++ specific routine la_get_symbol_name_cmp?
I hadn't planned on it, at least not soon.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-12-04 16:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 4:20 [PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp Doug Evans
2014-11-26 9:00 ` Yao Qi
2014-12-04 16:02 ` Doug Evans
2014-12-04 11:48 ` Andreas Arnez
2014-12-04 15:57 ` Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox