diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-05-14 23:19:48 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-02 13:53:11 +0100 |
commit | f6eee2d098049afd18f90b8f4bb6a5d1a49d900c (patch) | |
tree | 50d744e8e9bb6fa77425b8d51e13ae8968b01c7e /gdb | |
parent | 0a50df5dabfe12c8bf20f4f724622ff38ef7828b (diff) | |
download | gdb-f6eee2d098049afd18f90b8f4bb6a5d1a49d900c.zip gdb-f6eee2d098049afd18f90b8f4bb6a5d1a49d900c.tar.gz gdb-f6eee2d098049afd18f90b8f4bb6a5d1a49d900c.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 30 | ||||
-rw-r--r-- | gdb/ada-lang.c | 1 | ||||
-rw-r--r-- | gdb/c-lang.c | 12 | ||||
-rw-r--r-- | gdb/d-lang.c | 1 | ||||
-rw-r--r-- | gdb/f-lang.c | 1 | ||||
-rw-r--r-- | gdb/go-lang.c | 1 | ||||
-rw-r--r-- | gdb/language.c | 18 | ||||
-rw-r--r-- | gdb/language.h | 15 | ||||
-rw-r--r-- | gdb/m2-lang.c | 1 | ||||
-rw-r--r-- | gdb/objc-lang.c | 66 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 1 | ||||
-rw-r--r-- | gdb/p-lang.c | 1 | ||||
-rw-r--r-- | gdb/rust-lang.c | 1 |
13 files changed, 84 insertions, 65 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1390be1..3936517 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,35 @@ 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. (ada_language::demangle): New member function. * c-lang.c (c_language_data): Delete la_demangle initializer. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 42e5709..b1c689b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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. */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index de7a1bd..364a672 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -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 */ diff --git a/gdb/d-lang.c b/gdb/d-lang.c index fb56e1e..81e3aac 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -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, diff --git a/gdb/f-lang.c b/gdb/f-lang.c index bd5f78c..90a794e 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -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 */ diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 6bd87aa..3975dfc 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -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, diff --git a/gdb/language.c b/gdb/language.c index c447eab..ba4d96c 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -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 */ diff --git a/gdb/language.h b/gdb/language.h index c456189..05ad132 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -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]; }; diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index a83cf14..f174ad5 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -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 */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 1e3d1fd..ff028fc 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -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. */ diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index d98b228..eaf61c3 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -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 */ diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 50b913e..777f1ff 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -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 */ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 8848e97..0929daf 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -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 */ |