Fix calling ifunc functions when resolver has debug info and different name
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index 8f0aa00f5296c3d7d9be0031e698494ed5ad41e4..e2ea07cd792836f1b3b08ba6b5b3391e863e1633 100644 (file)
@@ -1081,7 +1081,9 @@ variable: name_not_typename
                                 is important for example for "p
                                 *__errno_location()".  */
                              symbol *alias_target
-                               = find_function_alias_target (msymbol);
+                               = (msymbol.minsym->type != mst_text_gnu_ifunc
+                                  ? find_function_alias_target (msymbol)
+                                  : NULL);
                              if (alias_target != NULL)
                                {
                                  write_exp_elt_opcode (pstate, OP_VAR_VALUE);
@@ -3220,26 +3222,24 @@ c_parse (struct parser_state *par_state)
   gdb_assert (par_state != NULL);
   pstate = par_state;
 
-  /* Note that parsing (within yyparse) freely installs cleanups
-     assuming they'll be run here (below).  */
-
-  back_to = make_cleanup (free_current_contents, &expression_macro_scope);
-
-  /* Set up the scope for macro expansion.  */
-  expression_macro_scope = NULL;
+  gdb::unique_xmalloc_ptr<struct macro_scope> macro_scope;
 
   if (expression_context_block)
-    expression_macro_scope
-      = sal_macro_scope (find_pc_line (expression_context_pc, 0));
+    macro_scope = sal_macro_scope (find_pc_line (expression_context_pc, 0));
   else
-    expression_macro_scope = default_macro_scope ();
-  if (! expression_macro_scope)
-    expression_macro_scope = user_macro_scope ();
+    macro_scope = default_macro_scope ();
+  if (! macro_scope)
+    macro_scope = user_macro_scope ();
+
+  scoped_restore restore_macro_scope
+    = make_scoped_restore (&expression_macro_scope, macro_scope.get ());
 
   /* Initialize macro expansion code.  */
   obstack_init (&expansion_obstack);
   gdb_assert (! macro_original_text);
-  make_cleanup (scan_macro_cleanup, 0);
+  /* Note that parsing (within yyparse) freely installs cleanups
+     assuming they'll be run here (below).  */
+  back_to = make_cleanup (scan_macro_cleanup, 0);
 
   scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
                                                        parser_debug);
This page took 0.023552 seconds and 4 git commands to generate.