[01/11] eval.c: reverse minsym and sym

Message ID 20180309211612.12941-2-palves@redhat.com
State New
Headers show
Series
  • Fixing GNU ifunc support
Related show

Commit Message

Pedro Alves March 9, 2018, 9:16 p.m.
I noticed that in evaluate_funcall, where we handle
OP_VAR_MSYM_VALUE/OP_VAR_VALUE to figure out the symbol's name gets
the minimal_symbol/symbol backwards.  Happens to be harmless in
practice because the symbol name is recorded in the common initial
sequence (in the general_symbol_info field).

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

	* eval.c (evaluate_funcall): Swap OP_VAR_MSYM_VALUE/OP_VAR_VALUE
	if then/else bodies in var_func_name extraction.
---
 gdb/eval.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.14.3

Comments

Joel Brobecker March 11, 2018, 2:24 p.m. | #1
> I noticed that in evaluate_funcall, where we handle

> OP_VAR_MSYM_VALUE/OP_VAR_VALUE to figure out the symbol's name gets

> the minimal_symbol/symbol backwards.  Happens to be harmless in

> practice because the symbol name is recorded in the common initial

> sequence (in the general_symbol_info field).

> 

> gdb/ChangeLog:

> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

> 

> 	* eval.c (evaluate_funcall): Swap OP_VAR_MSYM_VALUE/OP_VAR_VALUE

> 	if then/else bodies in var_func_name extraction.


Hah! Looks obvious and can be pushed independently of the series...

> ---

>  gdb/eval.c | 8 ++++----

>  1 file changed, 4 insertions(+), 4 deletions(-)

> 

> diff --git a/gdb/eval.c b/gdb/eval.c

> index 4899011a58f..a50299cbfdb 100644

> --- a/gdb/eval.c

> +++ b/gdb/eval.c

> @@ -1046,13 +1046,13 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,

>  	{

>  	  if (op == OP_VAR_MSYM_VALUE)

>  	    {

> -	      symbol *sym = exp->elts[*pos + 2].symbol;

> -	      var_func_name = SYMBOL_PRINT_NAME (sym);

> +	      minimal_symbol *msym = exp->elts[*pos + 2].msymbol;

> +	      var_func_name = MSYMBOL_PRINT_NAME (msym);

>  	    }

>  	  else if (op == OP_VAR_VALUE)

>  	    {

> -	      minimal_symbol *msym = exp->elts[*pos + 2].msymbol;

> -	      var_func_name = MSYMBOL_PRINT_NAME (msym);

> +	      symbol *sym = exp->elts[*pos + 2].symbol;

> +	      var_func_name = SYMBOL_PRINT_NAME (sym);

>  	    }

>  

>  	  argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside);

> -- 

> 2.14.3


-- 
Joel

Patch

diff --git a/gdb/eval.c b/gdb/eval.c
index 4899011a58f..a50299cbfdb 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1046,13 +1046,13 @@  evaluate_funcall (type *expect_type, expression *exp, int *pos,
 	{
 	  if (op == OP_VAR_MSYM_VALUE)
 	    {
-	      symbol *sym = exp->elts[*pos + 2].symbol;
-	      var_func_name = SYMBOL_PRINT_NAME (sym);
+	      minimal_symbol *msym = exp->elts[*pos + 2].msymbol;
+	      var_func_name = MSYMBOL_PRINT_NAME (msym);
 	    }
 	  else if (op == OP_VAR_VALUE)
 	    {
-	      minimal_symbol *msym = exp->elts[*pos + 2].msymbol;
-	      var_func_name = MSYMBOL_PRINT_NAME (msym);
+	      symbol *sym = exp->elts[*pos + 2].symbol;
+	      var_func_name = SYMBOL_PRINT_NAME (sym);
 	    }
 
 	  argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside);