gdb: Convert language skip_trampoline field to a method

This commit changes the language_data::skip_trampoline function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data): Delete skip_trampoline
	initializer.
	* c-lang.c (c_language_data): Likewise.
	(cplus_language_data): Likewise.
	(cplus_language::skip_trampoline): New member function.
	(asm_language_data): Delete skip_trampoline initializer.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* f-lang.c (f_language_data): Likewise.
	* go-lang.c (go_language_data): Likewise.
	* language.c (unk_lang_trampoline): Delete function.
	(skip_language_trampoline): Update.
	(unknown_language_data): Delete skip_trampoline initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete skip_trampoline field.
	(language_defn::skip_trampoline): New function.
	* m2-lang.c (m2_language_data): Delete skip_trampoline
	initializer.
	* objc-lang.c (objc_skip_trampoline): Delete function, move
	implementation to objc_language::skip_trampoline.
	(objc_language_data): Delete skip_trampoline initializer.
	(objc_language::skip_trampoline): New member function with
	implementation from objc_skip_trampoline.
	* opencl-lang.c (opencl_language_data): Delete skip_trampoline
	initializer.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
This commit is contained in:
Andrew Burgess 2020-05-14 23:19:48 +01:00
parent 0a50df5dab
commit f6eee2d098
13 changed files with 84 additions and 65 deletions

View File

@ -1,3 +1,33 @@
2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data): Delete skip_trampoline
initializer.
* c-lang.c (c_language_data): Likewise.
(cplus_language_data): Likewise.
(cplus_language::skip_trampoline): New member function.
(asm_language_data): Delete skip_trampoline initializer.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (unk_lang_trampoline): Delete function.
(skip_language_trampoline): Update.
(unknown_language_data): Delete skip_trampoline initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete skip_trampoline field.
(language_defn::skip_trampoline): New function.
* m2-lang.c (m2_language_data): Delete skip_trampoline
initializer.
* objc-lang.c (objc_skip_trampoline): Delete function, move
implementation to objc_language::skip_trampoline.
(objc_language_data): Delete skip_trampoline initializer.
(objc_language::skip_trampoline): New member function with
implementation from objc_skip_trampoline.
* opencl-lang.c (opencl_language_data): Delete skip_trampoline
initializer.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.
2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_language_data): Delete la_demangle initializer.

View File

@ -13922,7 +13922,6 @@ extern const struct language_data ada_language_data =
ada_print_typedef, /* Print a typedef using appropriate syntax */
ada_value_print_inner, /* la_value_print_inner */
ada_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
ada_lookup_symbol_nonlocal, /* Looking up non-local symbols. */

View File

@ -908,7 +908,6 @@ extern const struct language_data c_language_data =
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
@ -1017,7 +1016,6 @@ extern const struct language_data cplus_language_data =
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
cplus_skip_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
@ -1157,6 +1155,14 @@ public:
{
c_print_type (type, varstring, stream, show, level, flags);
}
/* See language.h. */
CORE_ADDR skip_trampoline (struct frame_info *fi,
CORE_ADDR pc) const override
{
return cplus_skip_trampoline (fi, pc);
}
};
/* The single instance of the C++ language class. */
@ -1189,7 +1195,6 @@ extern const struct language_data asm_language_data =
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
@ -1263,7 +1268,6 @@ extern const struct language_data minimal_language_data =
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */

View File

@ -151,7 +151,6 @@ extern const struct language_data d_language_data =
syntax. */
d_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
NULL, /* Language specific skip_trampoline. */
"this",
false, /* la_store_sym_names_in_linkage_form_p */
d_lookup_symbol_nonlocal,

View File

@ -611,7 +611,6 @@ extern const struct language_data f_language_data =
f_print_typedef, /* Print a typedef using appropriate syntax */
f_value_print_innner, /* la_value_print_inner */
c_value_print, /* FIXME */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */

View File

@ -536,7 +536,6 @@ extern const struct language_data go_language_data =
syntax. */
go_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
NULL, /* Language specific skip_trampoline. */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal,

View File

@ -60,8 +60,6 @@ static void unk_lang_printchar (int c, struct type *type,
static void unk_lang_value_print (struct value *, struct ui_file *,
const struct value_print_options *);
static CORE_ADDR unk_lang_trampoline (struct frame_info *, CORE_ADDR pc);
/* The current (default at startup) state of type and range checking.
(If the modes are set to "auto", though, these are changed based
on the default language at startup, and then again based on the
@ -567,13 +565,10 @@ skip_language_trampoline (struct frame_info *frame, CORE_ADDR pc)
{
for (const auto &lang : language_defn::languages)
{
if (lang->skip_trampoline != NULL)
{
CORE_ADDR real_pc = lang->skip_trampoline (frame, pc);
CORE_ADDR real_pc = lang->skip_trampoline (frame, pc);
if (real_pc)
return real_pc;
}
if (real_pc != 0)
return real_pc;
}
return 0;
@ -744,11 +739,6 @@ unk_lang_value_print (struct value *val, struct ui_file *stream,
"function unk_lang_value_print called."));
}
static CORE_ADDR unk_lang_trampoline (struct frame_info *frame, CORE_ADDR pc)
{
return 0;
}
static char *unk_lang_class_name (const char *mangled)
{
return NULL;
@ -790,7 +780,6 @@ extern const struct language_data unknown_language_data =
default_print_typedef, /* Print a typedef using appropriate syntax */
unk_lang_value_print_inner, /* la_value_print_inner */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
true, /* store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
@ -868,7 +857,6 @@ extern const struct language_data auto_language_data =
default_print_typedef, /* Print a typedef using appropriate syntax */
unk_lang_value_print_inner, /* la_value_print_inner */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */

View File

@ -267,12 +267,6 @@ struct language_data
void (*la_value_print) (struct value *, struct ui_file *,
const struct value_print_options *);
/* PC is possibly an unknown languages trampoline.
If that PC falls in a trampoline belonging to this language,
return the address of the first pc in the real function, or 0
if it isn't a language tramp for this language. */
CORE_ADDR (*skip_trampoline) (struct frame_info *, CORE_ADDR);
/* Now come some hooks for lookup_symbol. */
/* If this is non-NULL, specifies the name that of the implicit
@ -520,6 +514,15 @@ struct language_defn : language_data
virtual void print_type (struct type *, const char *, struct ui_file *, int,
int, const struct type_print_options *) const = 0;
/* PC is possibly an unknown languages trampoline.
If that PC falls in a trampoline belonging to this language, return
the address of the first pc in the real function, or 0 if it isn't a
language tramp for this language. */
virtual CORE_ADDR skip_trampoline (struct frame_info *fi, CORE_ADDR pc) const
{
return (CORE_ADDR) 0;
}
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};

View File

@ -370,7 +370,6 @@ extern const struct language_data m2_language_data =
m2_print_typedef, /* Print a typedef using appropriate syntax */
m2_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */

View File

@ -281,37 +281,6 @@ objc_demangle (const char *mangled, int options)
return NULL; /* Not an objc mangled name. */
}
/* Determine if we are currently in the Objective-C dispatch function.
If so, get the address of the method function that the dispatcher
would call and use that as the function to step into instead. Also
skip over the trampoline for the function (if any). This is better
for the user since they are only interested in stepping into the
method function anyway. */
static CORE_ADDR
objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
CORE_ADDR real_stop_pc;
CORE_ADDR method_stop_pc;
real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
if (real_stop_pc != 0)
find_objc_msgcall (real_stop_pc, &method_stop_pc);
else
find_objc_msgcall (stop_pc, &method_stop_pc);
if (method_stop_pc)
{
real_stop_pc = gdbarch_skip_trampoline_code
(gdbarch, frame, method_stop_pc);
if (real_stop_pc == 0)
real_stop_pc = method_stop_pc;
}
return real_stop_pc;
}
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
@ -376,7 +345,6 @@ extern const struct language_data objc_language_data =
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
objc_skip_trampoline, /* Language specific skip_trampoline */
"self", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
@ -434,6 +402,40 @@ public:
{
c_print_type (type, varstring, stream, show, level, flags);
}
/* See language.h. */
CORE_ADDR skip_trampoline (struct frame_info *frame,
CORE_ADDR stop_pc) const override
{
struct gdbarch *gdbarch = get_frame_arch (frame);
CORE_ADDR real_stop_pc;
CORE_ADDR method_stop_pc;
/* Determine if we are currently in the Objective-C dispatch function.
If so, get the address of the method function that the dispatcher
would call and use that as the function to step into instead. Also
skip over the trampoline for the function (if any). This is better
for the user since they are only interested in stepping into the
method function anyway. */
real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
if (real_stop_pc != 0)
find_objc_msgcall (real_stop_pc, &method_stop_pc);
else
find_objc_msgcall (stop_pc, &method_stop_pc);
if (method_stop_pc)
{
real_stop_pc = gdbarch_skip_trampoline_code
(gdbarch, frame, method_stop_pc);
if (real_stop_pc == 0)
real_stop_pc = method_stop_pc;
}
return real_stop_pc;
}
};
/* Single instance of the class representing the Objective-C language. */

View File

@ -1024,7 +1024,6 @@ extern const struct language_data opencl_language_data =
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */

View File

@ -401,7 +401,6 @@ extern const struct language_data pascal_language_data =
pascal_print_typedef, /* Print a typedef using appropriate syntax */
pascal_value_print_inner, /* la_value_print_inner */
pascal_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */

View File

@ -2056,7 +2056,6 @@ extern const struct language_data rust_language_data =
rust_print_typedef, /* Print a typedef using appropriate syntax */
rust_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
rust_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */