From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19788 invoked by alias); 20 Mar 2012 00:17:13 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 19709 invoked by uid 9674); 20 Mar 2012 00:17:08 -0000 Date: Tue, 20 Mar 2012 00:17:00 -0000 Message-ID: <20120320001708.19691.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-autoload: Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal X-Git-Refname: refs/heads/archer-jankratochvil-autoload X-Git-Reftype: branch X-Git-Oldrev: fe4236cb1e811443bf11f862a1a4ad8a5da0439f X-Git-Newrev: 0a287816462ac6b27bb8a6d0d7a5ae5d6455932c X-SW-Source: 2012-q1/txt/msg00075.txt.bz2 List-Id: The branch, archer-jankratochvil-autoload has been updated via 0a287816462ac6b27bb8a6d0d7a5ae5d6455932c (commit) via 9a53ca220541ef2f69ad7126ae36c03faba26a86 (commit) via 2cfb45d4b864dfcc4af97014d7866634f0777630 (commit) via 321c08a34ce080063e212583953af0526fd07ab3 (commit) via 42660c695e33e37071d335af53a7bb6f9912a1c1 (commit) via a9de0e28d528fd139a7c03ee1b290a044947627e (commit) via bd6cffaf447d1b2d0c45b3259952dd7ecf68a1af (commit) via a37aeece2522c0fd960c3966360eaa6f5c366969 (commit) via dcc21d52d2c7765095d0b063d77ba8552a0eccdd (commit) via 04d87e4adf7d45b73618b2245341ea19d5e4599f (commit) via a2b0fa540d5b89571a47c543de726686d7f9a98a (commit) via 50be3db303ea87c48061ae8744045bb50ba360e4 (commit) via 3c38337a788e561173eb3b3ee61707b57ab2b0cd (commit) via 6c82884560a93eee038060280d925fbe2564d3a1 (commit) via 715abeaedde4625238944c7f94bbc2648b4ed6fb (commit) via f52a654d20d82c3cb528b63aacbfd11434a2da10 (commit) via b1a1e3bc7937cbcc502ec11c8b942867a16a862f (commit) via 517805593efad7d7f8c8e72ad68069c9157a381b (commit) via 3190055e0f41b9a8377ddf8d0f8bc4f6c3a32782 (commit) via 4f6fc94bad5664cd04fc462162325128c8570dc8 (commit) via 8992e810d033e65c77c3e728bee8531b2df4939f (commit) via 421e79e10b2f2c2f3dc53363decced9eb543709a (commit) via 5b133bd527b0dfdef9a6bd8e0c4cca54f201c431 (commit) via 195652c20487c2508d21a76435db69b9562cd6bf (commit) via e7790fb2b118aa0d8e1e07cd6807e2044f249fd2 (commit) via a92991f85d1aded8ab50ed3f7db9d7e26f52f567 (commit) via 0940281b0acf91d2dff2b3e8bdd3cbc1fc5ce6ed (commit) via 06d3bc0d3aed553e9b72ec0c5d769210bd2fb7e6 (commit) via 61db129da84871fb6aaff7d84d7cfc2606f140bd (commit) via c44fcf813d108cd1e63c067117f72f6cc130ad53 (commit) from fe4236cb1e811443bf11f862a1a4ad8a5da0439f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 0a287816462ac6b27bb8a6d0d7a5ae5d6455932c Merge: a9de0e2 9a53ca2 Author: Jan Kratochvil Date: Tue Mar 20 01:16:43 2012 +0100 Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal commit 9a53ca220541ef2f69ad7126ae36c03faba26a86 Merge: bd6cffa 2cfb45d Author: Jan Kratochvil Date: Tue Mar 20 01:16:43 2012 +0100 Merge branch 'secmove-misc2-warn-safepath' into secmove-misc2-warn-safepath-debug commit 2cfb45d4b864dfcc4af97014d7866634f0777630 Merge: dcc21d5 321c08a Author: Jan Kratochvil Date: Tue Mar 20 01:16:40 2012 +0100 Merge branch 'secmove-misc2-warn' into secmove-misc2-warn-safepath Conflicts: gdb/auto-load.c commit 321c08a34ce080063e212583953af0526fd07ab3 Merge: a2b0fa5 42660c6 Author: Jan Kratochvil Date: Tue Mar 20 01:16:25 2012 +0100 Merge branch 'secmove-misc2' into secmove-misc2-warn commit 42660c695e33e37071d335af53a7bb6f9912a1c1 Author: Jan Kratochvil Date: Tue Mar 20 01:16:23 2012 +0100 . commit a9de0e28d528fd139a7c03ee1b290a044947627e Merge: 50be3db bd6cffa Author: Jan Kratochvil Date: Tue Mar 20 00:50:51 2012 +0100 Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal commit bd6cffaf447d1b2d0c45b3259952dd7ecf68a1af Author: Jan Kratochvil Date: Tue Mar 20 00:50:42 2012 +0100 . commit a37aeece2522c0fd960c3966360eaa6f5c366969 Merge: 3c38337 dcc21d5 Author: Jan Kratochvil Date: Tue Mar 20 00:32:59 2012 +0100 Merge branch 'secmove-misc2-warn-safepath' into secmove-misc2-warn-safepath-debug commit dcc21d52d2c7765095d0b063d77ba8552a0eccdd Author: Jan Kratochvil Date: Tue Mar 20 00:32:54 2012 +0100 . commit 04d87e4adf7d45b73618b2245341ea19d5e4599f Merge: 6c82884 a2b0fa5 Author: Jan Kratochvil Date: Tue Mar 20 00:03:52 2012 +0100 Merge branch 'secmove-misc2-warn' into secmove-misc2-warn-safepath commit a2b0fa540d5b89571a47c543de726686d7f9a98a Author: Jan Kratochvil Date: Tue Mar 20 00:03:46 2012 +0100 . commit 50be3db303ea87c48061ae8744045bb50ba360e4 Merge: 195652c 3c38337 Author: Jan Kratochvil Date: Mon Mar 19 23:43:29 2012 +0100 Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal Conflicts: gdb/auto-load.c commit 3c38337a788e561173eb3b3ee61707b57ab2b0cd Merge: e7790fb 6c82884 Author: Jan Kratochvil Date: Mon Mar 19 23:43:08 2012 +0100 Merge branch 'secmove-misc2-warn-safepath' into secmove-misc2-warn-safepath-debug Conflicts: gdb/NEWS commit 6c82884560a93eee038060280d925fbe2564d3a1 Merge: a92991f 715abea Author: Jan Kratochvil Date: Mon Mar 19 23:42:48 2012 +0100 Merge branch 'secmove-misc2-warn' into secmove-misc2-warn-safepath Conflicts: gdb/NEWS commit 715abeaedde4625238944c7f94bbc2648b4ed6fb Merge: b1a1e3b f52a654 Author: Jan Kratochvil Date: Mon Mar 19 23:42:21 2012 +0100 . commit f52a654d20d82c3cb528b63aacbfd11434a2da10 Author: Jan Kratochvil Date: Mon Mar 19 23:39:55 2012 +0100 . commit b1a1e3bc7937cbcc502ec11c8b942867a16a862f Merge: 3190055 5178055 Author: Jan Kratochvil Date: Mon Mar 19 23:39:07 2012 +0100 Merge branch 'secmove-misc2' into secmove-misc2-warn commit 517805593efad7d7f8c8e72ad68069c9157a381b Author: Jan Kratochvil Date: Mon Mar 19 23:39:04 2012 +0100 . commit 3190055e0f41b9a8377ddf8d0f8bc4f6c3a32782 Author: Jan Kratochvil Date: Mon Mar 19 23:38:25 2012 +0100 . commit 4f6fc94bad5664cd04fc462162325128c8570dc8 Merge: 421e79e 8992e81 Author: Jan Kratochvil Date: Mon Mar 19 23:37:30 2012 +0100 Merge branch 'secmove-misc2' into secmove-misc2-warn commit 8992e810d033e65c77c3e728bee8531b2df4939f Author: Jan Kratochvil Date: Mon Mar 19 23:37:28 2012 +0100 . commit 421e79e10b2f2c2f3dc53363decced9eb543709a Merge: 0940281 5b133bd Author: Jan Kratochvil Date: Mon Mar 19 23:36:30 2012 +0100 Merge branch 'secmove-misc2' into secmove-misc2-warn Conflicts: gdb/NEWS commit 5b133bd527b0dfdef9a6bd8e0c4cca54f201c431 Author: Jan Kratochvil Date: Mon Mar 19 23:35:43 2012 +0100 . commit 195652c20487c2508d21a76435db69b9562cd6bf Merge: fe4236c e7790fb Author: Jan Kratochvil Date: Mon Mar 19 22:31:02 2012 +0100 Merge branch 'secmove-misc2-warn-safepath-debug' into secmove-misc2-warn-safepath-debug-warnlocal commit e7790fb2b118aa0d8e1e07cd6807e2044f249fd2 Merge: a3613cf a92991f Author: Jan Kratochvil Date: Mon Mar 19 22:31:01 2012 +0100 Merge branch 'secmove-misc2-warn-safepath' into secmove-misc2-warn-safepath-debug commit a92991f85d1aded8ab50ed3f7db9d7e26f52f567 Merge: 15a5243 0940281 Author: Jan Kratochvil Date: Mon Mar 19 22:31:01 2012 +0100 Merge branch 'secmove-misc2-warn' into secmove-misc2-warn-safepath commit 0940281b0acf91d2dff2b3e8bdd3cbc1fc5ce6ed Merge: 90ffcbd 06d3bc0 Author: Jan Kratochvil Date: Mon Mar 19 22:31:01 2012 +0100 Merge branch 'secmove-misc2' into secmove-misc2-warn commit 06d3bc0d3aed553e9b72ec0c5d769210bd2fb7e6 Merge: f86f6c7 61db129 Author: Jan Kratochvil Date: Mon Mar 19 22:31:01 2012 +0100 Merge branch 'secmove' into secmove-misc2 commit 61db129da84871fb6aaff7d84d7cfc2606f140bd Merge: b14ef7c c44fcf8 Author: Jan Kratochvil Date: Mon Mar 19 22:31:01 2012 +0100 Merge remote-tracking branch 'gdb/master' into secmove commit c44fcf813d108cd1e63c067117f72f6cc130ad53 Author: Jan Kratochvil Date: Mon Mar 19 19:59:15 2012 +0000 gdb/ Code cleanupp: Use cu_offset and sect_offset compile time type checking. * dwarf2expr.c (add_piece, dwarf_get_base_type, execute_stack_op) (ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2expr.h (cu_offset, sect_offset): New types. (struct dwarf_expr_context_funcs) (struct dwarf_expr_context_funcs) : Use cu_offset and sect_offset. (struct dwarf_expr_context) : Improve the comment. (struct dwarf_expr_piece, ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and sect_offset. * dwarf2loc.c (per_cu_dwarf_call, dwarf_expr_dwarf_call) (dwarf_expr_get_base_type, needs_frame_dwarf_call) (dwarf2_compile_expr_to_ax, disassemble_dwarf_expression): Likewise. * dwarf2loc.h: Include dwarf2expr.h. (dwarf2_fetch_die_location_block, dwarf2_get_die_type): Use cu_offset and sect_offset. * dwarf2read.c (struct dwarf2_per_objfile) : Improve the comment. (struct comp_unit_head, struct dwarf2_cu, struct dwarf2_per_cu_data) (struct signatured_type, struct line_header, struct partial_die_info) (struct die_info, find_partial_die, dwarf2_get_ref_die_offset) (lookup_signatured_type_at_offset, dwarf2_find_containing_comp_unit) (get_die_type_at_offset, create_cus_from_index) (create_signatured_type_table_from_index, dw2_get_file_names) (offset_in_cu_p, read_comp_unit_head, error_check_comp_unit_head) (read_and_check_comp_unit_head, read_and_check_type_unit_head) (create_debug_types_hash_table, process_psymtab_comp_unit) (load_partial_comp_unit, create_all_comp_units) (partial_die_parent_scope, partial_die_full_name, skip_one_die) (load_full_comp_unit, dwarf2_physname, read_import_statement) (inherit_abstract_dies, read_func_scope, read_call_site_scope) (dwarf2_add_member_fn, process_enumeration_scope, read_module_type) (read_typedef, die_hash, die_eq, read_full_die, dwarf2_read_abbrevs) (load_partial_dies, read_partial_die, find_partial_die_in_comp_unit) (find_partial_die, read_attribute_value, lookup_die_type) (dump_die_shallow, store_in_ref_table): Use cu_offset and sect_offset. (is_ref_attr): New function comment. (dwarf2_get_ref_die_offset): New function comment, new variable retval. Use cu_offset and sect_offset. (follow_die_offset, follow_die_ref, dwarf2_fetch_die_location_block) (dwarf2_get_die_type, follow_die_sig, lookup_signatured_type_at_offset) (load_full_type_unit, read_signatured_type, per_cu_header_read_in) (dwarf2_find_containing_comp_unit, struct dwarf2_offset_and_type) (offset_and_type_hash, offset_and_type_eq, set_die_type) (get_die_type_at_offset, partial_die_hash, partial_die_eq) (write_one_signatured_type, write_psymtabs_to_index): Use cu_offset and sect_offset. ----------------------------------------------------------------------- Summary of changes: gdb/ChangeLog | 51 +++++++ gdb/NEWS | 16 ++- gdb/auto-load.c | 47 +++++-- gdb/auto-load.h | 8 +- gdb/doc/gdb.texinfo | 163 ++++++++++++++++++++++-- gdb/dwarf2expr.c | 52 +++++--- gdb/dwarf2expr.h | 25 +++- gdb/dwarf2loc.c | 45 ++++--- gdb/dwarf2loc.h | 6 +- gdb/dwarf2read.c | 365 ++++++++++++++++++++++++++++----------------------- gdb/main.c | 6 +- 11 files changed, 540 insertions(+), 244 deletions(-) First 500 lines of diff: diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3059d69..aad141b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,56 @@ 2012-03-19 Jan Kratochvil + Code cleanupp: Use cu_offset and sect_offset compile time type checking. + * dwarf2expr.c (add_piece, dwarf_get_base_type, execute_stack_op) + (ctx_no_dwarf_call, ctx_no_get_base_type): Use cu_offset and + sect_offset. + * dwarf2expr.h (cu_offset, sect_offset): New types. + (struct dwarf_expr_context_funcs) + (struct dwarf_expr_context_funcs) : Use cu_offset and + sect_offset. + (struct dwarf_expr_context) : Improve the comment. + (struct dwarf_expr_piece, ctx_no_dwarf_call, ctx_no_get_base_type): Use + cu_offset and sect_offset. + * dwarf2loc.c (per_cu_dwarf_call, dwarf_expr_dwarf_call) + (dwarf_expr_get_base_type, needs_frame_dwarf_call) + (dwarf2_compile_expr_to_ax, disassemble_dwarf_expression): Likewise. + * dwarf2loc.h: Include dwarf2expr.h. + (dwarf2_fetch_die_location_block, dwarf2_get_die_type): Use cu_offset + and sect_offset. + * dwarf2read.c (struct dwarf2_per_objfile) : + Improve the comment. + (struct comp_unit_head, struct dwarf2_cu, struct dwarf2_per_cu_data) + (struct signatured_type, struct line_header, struct partial_die_info) + (struct die_info, find_partial_die, dwarf2_get_ref_die_offset) + (lookup_signatured_type_at_offset, dwarf2_find_containing_comp_unit) + (get_die_type_at_offset, create_cus_from_index) + (create_signatured_type_table_from_index, dw2_get_file_names) + (offset_in_cu_p, read_comp_unit_head, error_check_comp_unit_head) + (read_and_check_comp_unit_head, read_and_check_type_unit_head) + (create_debug_types_hash_table, process_psymtab_comp_unit) + (load_partial_comp_unit, create_all_comp_units) + (partial_die_parent_scope, partial_die_full_name, skip_one_die) + (load_full_comp_unit, dwarf2_physname, read_import_statement) + (inherit_abstract_dies, read_func_scope, read_call_site_scope) + (dwarf2_add_member_fn, process_enumeration_scope, read_module_type) + (read_typedef, die_hash, die_eq, read_full_die, dwarf2_read_abbrevs) + (load_partial_dies, read_partial_die, find_partial_die_in_comp_unit) + (find_partial_die, read_attribute_value, lookup_die_type) + (dump_die_shallow, store_in_ref_table): Use cu_offset and sect_offset. + (is_ref_attr): New function comment. + (dwarf2_get_ref_die_offset): New function comment, new variable retval. + Use cu_offset and sect_offset. + (follow_die_offset, follow_die_ref, dwarf2_fetch_die_location_block) + (dwarf2_get_die_type, follow_die_sig, lookup_signatured_type_at_offset) + (load_full_type_unit, read_signatured_type, per_cu_header_read_in) + (dwarf2_find_containing_comp_unit, struct dwarf2_offset_and_type) + (offset_and_type_hash, offset_and_type_eq, set_die_type) + (get_die_type_at_offset, partial_die_hash, partial_die_eq) + (write_one_signatured_type, write_psymtabs_to_index): Use cu_offset and + sect_offset. + +2012-03-19 Jan Kratochvil + Code cleanup. * python/py-auto-load.c (source_section_scripts): New variable back_to. Turn fclose and xfree calls into make_cleanup_fclose and make_cleanup diff --git a/gdb/NEWS b/gdb/NEWS index 890c761..d864720 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -84,7 +84,11 @@ ** "info vtbl" can be used to show the virtual method tables for C++ and Java objects. - ** "info auto-load" shows the status of all kinds of auto-loaded scripts. + ** "info auto-load" shows the status of all kinds of auto-loaded scripts, + "info auto-load gdb-scripts", "info auto-load python-scripts", + "info auto-load local-gdbinit" and "info auto-load libthread-db" show + status of the specific kinds of auto-loaded scripts associated with + inferior. ** "info auto-load-scripts", "set auto-load-scripts on|off" and "show auto-load-scripts" commands have been deprecated, use their @@ -114,17 +118,17 @@ show breakpoint condition-evaluation show auto-load set auto-load gdb-scripts on|off show auto-load gdb-scripts -set auto-load libthread-db on|off -show auto-load libthread-db -set auto-load local-gdbinit on|off|warn-and-on|warn-and-off -show auto-load local-gdbinit set auto-load python-scripts on|off show auto-load python-scripts +set auto-load local-gdbinit on|off|warn-and-on|warn-and-off +show auto-load local-gdbinit +set auto-load libthread-db on|off +show auto-load libthread-db set auto-load safe-path [:...] show auto-load safe-path set debug auto-load on|off show debug auto-load - Controls auto-loading of various kinds of scripts. + Controls auto-loading of various kinds of scripts associated with inferior. * New remote packets diff --git a/gdb/auto-load.c b/gdb/auto-load.c index f10d901..0348b44 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -30,6 +30,8 @@ #include "exceptions.h" #include "cli/cli-script.h" #include "gdbcmd.h" +#include "cli/cli-decode.h" +#include "cli/cli-setshow.h" #include "gdb_vecs.h" /* The suffix of per-objfile scripts to auto-load as non-Python command files. @@ -84,30 +86,30 @@ show_auto_load_gdb_scripts (struct ui_file *file, int from_tty, int global_auto_load = 1; /* Load current directory .gdbinit file automatically. */ -const char auto_load_local_gdbinit_on[] = "on"; +const char auto_load_local_gdbinit_yes[] = "yes"; /* Never load current directory .gdbinit file. */ -const char auto_load_local_gdbinit_off[] = "off"; +const char auto_load_local_gdbinit_no[] = "no"; /* Give deprecation warning and load current directory .gdbinit file automatically. */ -const char auto_load_local_gdbinit_warn_and_on[] = "warn-and-on"; +const char auto_load_local_gdbinit_warn_and_yes[] = "warn-and-yes"; /* Give deprecation warning and do not load current directory .gdbinit file. */ -const char auto_load_local_gdbinit_warn_and_off[] = "warn-and-off"; +const char auto_load_local_gdbinit_warn_and_no[] = "warn-and-no"; /* Options for auto_load_local_gdbinit. */ static const char *const auto_load_local_gdbinit_enum[] = { - auto_load_local_gdbinit_on, - auto_load_local_gdbinit_off, - auto_load_local_gdbinit_warn_and_on, - auto_load_local_gdbinit_warn_and_off, + auto_load_local_gdbinit_yes, + auto_load_local_gdbinit_no, + auto_load_local_gdbinit_warn_and_yes, + auto_load_local_gdbinit_warn_and_no, NULL }; /* Auto-load .gdbinit file from the current directory? */ -const char *auto_load_local_gdbinit = auto_load_local_gdbinit_warn_and_on; +const char *auto_load_local_gdbinit = auto_load_local_gdbinit_warn_and_yes; /* "show" command for the auto_load_local_gdbinit configuration variable. */ @@ -781,11 +783,34 @@ script_not_found_warning_print (struct auto_load_pspace_info *pspace_info) return retval; } -/* Command "set auto-load" does nothing. */ +/* The only valid "set auto-load" argument is off|0|no|disable. */ static void set_auto_load_cmd (char *args, int from_tty) { + struct cmd_list_element *list; + size_t length; + + /* See parse_binary_operation in use by the sub-commands. */ + + length = args ? strlen (args) : 0; + + while (length > 0 && (args[length - 1] == ' ' || args[length - 1] == '\t')) + length--; + + if (length == 0 || (strncmp (args, "off", length) != 0 + && strncmp (args, "0", length) != 0 + && strncmp (args, "no", length) != 0 + && strncmp (args, "disable", length) != 0)) + error (_("Valid is only global 'set auto-load no'; " + "otherwise check the auto-load sub-commands.")); + + for (list = *auto_load_set_cmdlist_get (); list != NULL; list = list->next) + if (list->var_type == var_boolean) + { + gdb_assert (list->type == set_cmd); + do_setshow_command (args, from_tty, list); + } } /* Initialize "set auto-load " commands prefix and return it. */ @@ -801,7 +826,7 @@ Auto-loading specific settings\n\ Configure various auto-load-specific variables such as\n\ automatic loading of Python scripts"), &retval, "set auto-load ", - 0/*allow-unknown*/, &setlist); + 1/*allow-unknown*/, &setlist); return &retval; } diff --git a/gdb/auto-load.h b/gdb/auto-load.h index cf2a035..1ec9a1d 100644 --- a/gdb/auto-load.h +++ b/gdb/auto-load.h @@ -32,10 +32,10 @@ struct script_language extern int global_auto_load; -extern const char auto_load_local_gdbinit_on[]; -extern const char auto_load_local_gdbinit_off[]; -extern const char auto_load_local_gdbinit_warn_and_on[]; -extern const char auto_load_local_gdbinit_warn_and_off[]; +extern const char auto_load_local_gdbinit_yes[]; +extern const char auto_load_local_gdbinit_no[]; +extern const char auto_load_local_gdbinit_warn_and_yes[]; +extern const char auto_load_local_gdbinit_warn_and_no[]; extern const char *auto_load_local_gdbinit; extern struct auto_load_pspace_info * diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 86b2493..e8dd125 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -1280,14 +1280,44 @@ that file. @item Processes command line options and operands. +@anchor{local-gdbinit} @item Reads and executes the commands from init file (if any) in the current -working directory. This is only done if the current directory is -different from your home directory. Thus, you can have more than one +working directory as long as @samp{set auto-load local-gdbinit} is set to +@samp{yes} or @samp{warn-and-yes}. This is only done if the current directory +is different from your home directory. Thus, you can have more than one init file, one generic in your home directory, and another, specific to the program you are debugging, in the directory where you invoke @value{GDBN}. +This feature is deprecated, please use @ref{objfile-gdb.rc file} instead. + +You can control execution of this file: + +@table @code +@kindex set auto-load local-gdbinit +@item set auto-load local-gdbinit [yes|no|warn-and-yes|warn-and-no] +Enable or disable the auto-loading of +@xref{Sequences, Canned Sequences of Commands}, found in init file in the +current directory. The options @samp{warn-and-X} give warning before loading +(@samp{warn-and-yes}) or when declining to load (@samp{warn-and-no}) the file +as the @samp{local-gdbinit} feature is deprecated in the favor +of @xref{objfile-gdb.rc file}. + +@kindex show auto-load local-gdbinit +@item show auto-load local-gdbinit +Show whether auto-loading of canned sequences of commands from init file in the +current directory is enabled or disabled and whether warnings are printed +during its load. + +@kindex info auto-load local-gdbinit +@cindex print commands from current directory init file have been auto-loaded +@item info auto-load local-gdbinit +Print whether canned sequences of commands from init file in the +current directory have been auto-loaded. +@end table + +@anchor{-iex} @item If the command line specified a program to debug, or a process to attach to, or a core file, @value{GDBN} loads any auto-loaded @@ -24640,13 +24670,17 @@ writable. When a new object file is read (for example, due to the @code{file} command, or because the inferior has loaded a shared library), -@value{GDBN} will look for Python support scripts in several ways: -@file{@var{objfile}-gdb.py} and @code{.debug_gdb_scripts} section. +@value{GDBN} will look for support scripts in several ways: +@file{@var{objfile}-gdb.py} file, @file{@var{objfile}-gdb.rc} file +and @code{.debug_gdb_scripts} section. @menu * objfile-gdb.py file:: The @file{@var{objfile}-gdb.py} file +* objfile-gdb.rc file:: The @file{@var{objfile}-gdb.rc} file * .debug_gdb_scripts section:: The @code{.debug_gdb_scripts} section * Which flavor to choose?:: +* auto-load safe-path:: Security restriction for auto-loading +* auto-load verbose mode:: Displaying files tried for auto-load @end menu The auto-loading feature is useful for supplying application-specific @@ -24656,20 +24690,41 @@ Auto-loading can be enabled or disabled, and the list of auto-loaded scripts can be printed. @table @code +@kindex set auto-load no +@item set auto-load no +Global disable of any auto-loading sub-commands of @value{GDBN}. You may want +to use this command with the @samp{-iex} option @pxref{-iex, -init-eval-command}. + @kindex set auto-load python-scripts @item set auto-load python-scripts [yes|no] -Enable or disable the auto-loading of Python scripts. +Enable or disable the auto-loading of Python scripts, either specified as the +@file{@var{objfile}-gdb.py} file or in the @code{.debug_gdb_scripts} section. + +@kindex set auto-load gdb-scripts +@item set auto-load gdb-scripts [yes|no] +Similar to the previous item but +for @xref{Sequences, Canned Sequences of Commands}. @kindex show auto-load python-scripts @item show auto-load python-scripts Show whether auto-loading of Python scripts is enabled or disabled. +@kindex show auto-load gdb-scripts +@item show auto-load gdb-scripts +Similar to the previous item but for canned sequences of commands. + @kindex info auto-load python-scripts @cindex print list of auto-loaded Python scripts @item info auto-load python-scripts [@var{regexp}] -Print the list of all scripts that @value{GDBN} auto-loaded. +Print the list of all Python scripts that @value{GDBN} auto-loaded. -Also printed is the list of scripts that were mentioned in +@kindex info auto-load gdb-scripts +@cindex print list of auto-loaded canned sequences of commands scripts. +@item info auto-load gdb-scripts [@var{regexp}] +Similar to the previous item but for canned sequences of commands. + +@samp{info auto-load python-scripts} also prints +the list of Python scripts that were mentioned in the @code{.debug_gdb_scripts} section and were not found (@pxref{.debug_gdb_scripts section}). This is useful because their names are not printed when @value{GDBN} @@ -24700,7 +24755,8 @@ registering objfile-specific pretty-printers. @cindex @file{@var{objfile}-gdb.py} When a new object file is read, @value{GDBN} looks for -a file named @file{@var{objfile}-gdb.py}, +a file named @file{@var{objfile}-gdb.py} as long +as @samp{set auto-load python-scripts} is set to @samp{yes}, where @var{objfile} is the object file's real name, formed by ensuring that the file name is absolute, following all symlinks, and resolving @code{.} and @code{..} components. If this file exists and is @@ -24723,6 +24779,15 @@ is the object file's real name, as described above. So your @file{-gdb.py} file should be careful to avoid errors if it is evaluated more than once. +@node objfile-gdb.rc file +@subsubsection The @file{@var{objfile}-gdb.rc} file +@cindex @file{@var{objfile}-gdb.rc} + +Similar to the @ref{objfile-gdb.py file} file @value{GDBN} also tries to load +an @file{@var{objfile}-gdb.rc} file containing +@xref{Sequences, Canned Sequences of Commands}, as long as +@samp{set auto-load gdb-scripts} is set to @samp{yes}. + @node .debug_gdb_scripts section @subsubsection The @code{.debug_gdb_scripts} section @cindex @code{.debug_gdb_scripts} section @@ -24732,6 +24797,7 @@ when @value{GDBN} loads a new object file it will look for a special section named @samp{.debug_gdb_scripts}. If this section exists, its contents is a list of names of scripts to load. +As long as @samp{set auto-load python-scripts} is set to @samp{yes}, @value{GDBN} will look for each specified script file first in the current directory and then along the source search path (@pxref{Source Path, ,Specifying Source Directories}), @@ -24767,7 +24833,7 @@ using this header will get a reference to the specified script. @node Which flavor to choose? @subsubsection Which flavor to choose? -Given the multiple ways of auto-loading Python scripts, it might not always +Given the multiple ways of auto-loading scripts, it might not always be clear which one to choose. This section provides some guidance. Benefits of the @file{-gdb.py} way: @@ -24788,6 +24854,14 @@ isn't a source directory in which to find the script. Doesn't require source code additions. @end itemize +Benefits of the @file{-gdb.rc} way: + +@itemize @bullet +@item +Canned sequences of commands scripting can be used on systems where Python is +not available for the build of @value{GDBN} itself. +@end itemize + Benefits of the @code{.debug_gdb_scripts} way: @itemize @bullet @@ -24816,6 +24890,77 @@ cumbersome. It may be easier to specify the scripts in the top of the source tree to the source search path. @end itemize +@node auto-load safe-path +@subsubsection Security restriction for auto-loading +@cindex auto-load safe-path + +As the files of inferior can come from untrusted source (such as submitted by +an application user) @value{GDBN} does not always load any files automatically. + +This setting should contain so called canonical filenames, after any symbolic +links, current and parent directories have been resolved. Both the +@samp{auto-load safe-path} setting and the scripts being verified are +canonicalized first for their matching. + +@table @code +@kindex set auto-load safe-path +@item set auto-load safe-path @var{directories} +Set the list of directories (and their subdirectories) trusted for automatic +loading and execution of scripts. The list of directories uses directory +separator as its delimiter. You can also enter a specific trusted file. + +@kindex show auto-load safe-path +@item show auto-load safe-path +Show the list of directories (and their subdirectories) trusted for automatic +loading and execution of scripts. +@end table + +Setting this variable to an empty string disables this security protection. +This variable is supposed to be set to the system directories writable by the +system superuser only. Users can add their source directories in home +directories. See also the deprecated option @xref{local-gdbinit}. + +Be aware even downloaded source packages may contain exploit code which may get +executed by @value{GDBN} without explicitly running any program therein. + +@node auto-load verbose mode +@subsubsection Displaying files tried for auto-load +@cindex debug auto-load + +For better visibility of all the file locations where you can place scripts to +be auto-loaded with inferior --- or to protect yourself against accidental +execution of untrusted scripts --- @value{GDBN} provides a feature for printing +all the files attempted to be loaded. Both existing and non-existing files may +be printed. + +For example @ref{auto-load safe-path} applies to canonicalized filenames which +may not be too obvious while setting it up. + +@smallexample +(gdb) set debug auto-load ues +(gdb) file /home/user/gdb/gdb +Reading symbols from /home/user/gdb/gdb...done. +auto-load: Loading canned sequences of commands script + "/home/user/gdb/gdb-gdb.rc" for objfile "/home/user/gdb/gdb". +auto-load: Resolved file "/home/user/gdb/gdb-gdb.rc" + as "/home/user/gdb/gdb-gdb.rc". +auto-load: Updating directories of "/usr/local". +auto-load: Resolved directory "/usr/local". +warning: File "/home/user/gdb/gdb-gdb.rc" auto-loading has been declined + by your `auto-load safe-path' set to "/usr/local". +@end smallexample + +@table @code +@kindex set debug auto-load path +@item set debug auto-load [yes|no] +Set whether printing of the filenames attempted to be auto-loaded is turned on. + +@kindex show debug auto-load +@item show debug auto-load +Show whether printing of the filenames attempted to be auto-loaded is turned +on. +@end table + @node Python modules @subsection Python modules @cindex python modules diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 6757204..700d8cc 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -342,7 +342,7 @@ add_piece (struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset) } else if (p->location == DWARF_VALUE_IMPLICIT_POINTER) { - p->v.ptr.die = ctx->len; + p->v.ptr.die.cu_off = ctx->len; p->v.ptr.offset = value_as_long (dwarf_expr_fetch (ctx, 0)); } else if (p->location == DWARF_VALUE_REGISTER) @@ -464,7 +464,7 @@ base_types_equal_p (struct type *t1, struct type *t2) size. */ static struct type * -dwarf_get_base_type (struct dwarf_expr_context *ctx, ULONGEST die, int size) +dwarf_get_base_type (struct dwarf_expr_context *ctx, cu_offset die, int size) { struct type *result; @@ -869,7 +869,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, error (_("DWARF-2 expression error: DW_OP_GNU_implicit_pointer " "is not allowed in frame context")); - /* The referred-to DIE. */ + /* The referred-to DIE of cu_offset kind. */ ctx->len = extract_unsigned_integer (op_ptr, ctx->ref_addr_size, byte_order); hooks/post-receive -- Repository for Project Archer.