aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2018-02-20Fix make 3.81 build errorsAlan Hayward2-13/+18
gdbserver/ * Makefile.in: Switch order of make rules.
2018-02-19gdb/doc: Additional information about 'info line'Andrew Burgess2-6/+18
Extend the documentation of 'info line' command to: 1. Make 'info line' with no argument more obvious, and make it clearer what this does. 2. Cover what happens when a secod 'info line' with no argument is issued. 3. Extend the example output for 'info line ...' to include symbolic addresses. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Additional information about "info line" command.
2018-02-19Add common/ dir in build directoriesAlan Hayward9-101/+81
gdb/ * Makefile.in: (COMMON_SFILES): Add common/*.c files. (SFILES): Remove common/*.c files. (COMMON_OBS): Remove some *.o files built from common/*.c files. * common/common.host: Add common reference. * configure.ac: Likewise. * configure: Regenerate. gdbserver/ * Makefile.in: Add common directory in build. * configure.ac: Add common reference. * configure: Regenerate.
2018-02-16New class allocate_on_obstackYao Qi5-24/+50
This patch adds a new class allocate_on_obstack, and let dwarf2_per_objfile inherit it, so that dwarf2_per_objfile is automatically allocated on obstack, and "delete dwarf2_per_objfile" doesn't de-allocate any space. gdb: 2018-02-16 Yao Qi <yao.qi@linaro.org> * block.c (block_namespace_info): Inherit allocate_on_obstack. (block_initialize_namespace): Use new. * dwarf2read.c (dwarf2_per_objfile): Inherit allocate_on_obstack. (dwarf2_free_objfile): Use delete. * gdbtypes.c (type_pair): Inherit allocate_on_obstack. (copy_type_recursive): Use new. * gdb_obstack.h (allocate_on_obstack): New.
2018-02-15Reset inferior::control on inferior exitYao Qi2-0/+7
When we kill an inferior, the inferior is not deleted. What is more, it is reused when the new process is created, so we need to reset inferior's state when it exits. gdb: 2018-02-15 Yao Qi <yao.qi@linaro.org> PR gdb/22849 * inferior.c (exit_inferior_1): Reset inf->control.
2018-02-14delete ada-lang.c::ada_to_fixed_value_create advance declarationJoel Brobecker2-3/+5
This advance declaration really isn't necesary, since the implementation of this function comes before the first reference to it. gdb/ChangeLog: * ada-lang.c (ada_to_fixed_value_create): Delete advance declaration. Tested by rebuilding GDB.
2018-02-14Fix GDB crash after Quit thrown from unwinder snifferPedro Alves4-1/+25
I ran into a GDB crash in gdb.base/bp-cmds-continue-ctrl-c.exp in my multi-target branch, which turns out exposed a bug that exists in master too. That testcase has a breakpoint with a "continue" command associated. Then the breakpoint is constantly being hit. At the same time, the testcase is continualy interrupting the program with Ctrl-C, and re-resuming it, in a loop. Running that testcase manually under Valgrind, after a few sequences of 'Ctrl-C' + 'continue', I got: Breakpoint 1, Quit (gdb) ==21270== Invalid read of size 8 ==21270== at 0x4D8185: pyuw_this_id(frame_info*, void**, frame_id*) (py-unwind.c:461) ==21270== by 0x6D426A: compute_frame_id(frame_info*) (frame.c:505) ==21270== by 0x6D43B7: get_frame_id(frame_info*) (frame.c:537) ==21270== by 0x84F3B8: scoped_restore_current_thread::scoped_restore_current_thread() (thread.c:1678) ==21270== by 0x718E3D: fetch_inferior_event(void*) (infrun.c:4076) ==21270== by 0x7067C9: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43) ==21270== by 0x45BEF9: handle_target_event(int, void*) (linux-nat.c:4419) ==21270== by 0x6C4255: handle_file_event(file_handler*, int) (event-loop.c:733) ==21270== by 0x6C47F8: gdb_wait_for_event(int) (event-loop.c:859) ==21270== by 0x6C3666: gdb_do_one_event() (event-loop.c:322) ==21270== by 0x6C3712: start_event_loop() (event-loop.c:371) ==21270== by 0x746801: captured_command_loop() (main.c:329) ==21270== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==21270== ==21270== ==21270== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==21270== Access not within mapped region at address 0x0 ==21270== at 0x4D8185: pyuw_this_id(frame_info*, void**, frame_id*) (py-unwind.c:461) ==21270== by 0x6D426A: compute_frame_id(frame_info*) (frame.c:505) ==21270== by 0x6D43B7: get_frame_id(frame_info*) (frame.c:537) ==21270== by 0x84F3B8: scoped_restore_current_thread::scoped_restore_current_thread() (thread.c:1678) ==21270== by 0x718E3D: fetch_inferior_event(void*) (infrun.c:4076) ==21270== by 0x7067C9: inferior_event_handler(inferior_event_type, void*) (inf-loop.c:43) ==21270== by 0x45BEF9: handle_target_event(int, void*) (linux-nat.c:4419) ==21270== by 0x6C4255: handle_file_event(file_handler*, int) (event-loop.c:733) ==21270== by 0x6C47F8: gdb_wait_for_event(int) (event-loop.c:859) ==21270== by 0x6C3666: gdb_do_one_event() (event-loop.c:322) ==21270== by 0x6C3712: start_event_loop() (event-loop.c:371) ==21270== by 0x746801: captured_command_loop() (main.c:329) ==21270== If you believe this happened as a result of a stack ==21270== overflow in your program's main thread (unlikely but ==21270== possible), you can try to increase the size of the ==21270== main thread stack using the --main-stacksize= flag. ==21270== The main thread stack size used in this run was 8388608. ==21270== Above, when we get to compute_frame_id, fi->unwind is non-NULL, meaning, we found an unwinder, in this case the Python unwinder, but somehow, fi->prologue_cache is left NULL. pyuw_this_id then crashes because it assumes fi->prologue_cache is non-NULL: static void pyuw_this_id (struct frame_info *this_frame, void **cache_ptr, struct frame_id *this_id) { *this_id = ((cached_frame_info *) *cache_ptr)->frame_id; ^^^^^^^^^^ '*cache_ptr' here is 'fi->prologue_cache'. There's a quit() call in pyuw_sniffer that I believe is the one that sometimes triggers the crash above. The crash can be reproduced easily with this hack to force a quit out of the python unwinder: --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -497,6 +497,8 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, struct gdbarch *gdbarch = (struct gdbarch *) (self->unwind_data); cached_frame_info *cached_frame; + quit (); + gdbpy_enter enter_py (gdbarch, current_language); TRACE_PY_UNWIND (3, "%s (SP=%s, PC=%s)\n", __FUNCTION__, After that quit is thrown, any subsequent operation that involves unwinding results in GDB crashing with SIGSEGV like above. The problem is that this commit: commit 30a9c02feff56bd58a276c2a7262f364baa558ac CommitDate: Sun Oct 8 23:16:42 2017 -0600 Subject: Remove cleanup from frame_prepare_for_sniffer missed that we need to call frame_cleanup_after_sniffer before rethrowing the exception too. Without the fix, the "bt" added to gdb.base/bp-cmds-continue-ctrl-c.exp in this commit makes GDB crash: Running src/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp ... ERROR: Process no longer exists gdb/ChangeLog: 2018-02-14 Pedro Alves <palves@redhat.com> * frame-unwind.c (frame_unwind_try_unwinder): Always call frame_cleanup_after_sniffer on exception. gdb/testsuite/ChangeLog: 2018-02-14 Pedro Alves <palves@redhat.com> * gdb.base/bp-cmds-continue-ctrl-c.exp (do_test): Test "bt" after getting a "Quit".
2018-02-14Constify target_so_ops::bfd_openTom Tromey6-9/+20
This constifies the bfd_open method of struct target_so_ops. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * solist.h (struct target_so_ops) <bfd_open>: Make pathname const. (solib_bfd_open): Make pathname const. * solib.c (solib_bfd_open): Make pathname const. * solib-spu.c (spu_bfd_fopen): Make name const. (spu_bfd_open): Make pathname const. * solib-darwin.c (darwin_bfd_open): Make pathname const. * solib-aix.c (solib_aix_bfd_open): Make pathname const.
2018-02-14Change openp et al to use a unique_xmalloc_ptrTom Tromey12-90/+98
This changes openp, source_full_path_of, and find_and_open_source to take a unique_xmalloc_ptr, rather than a char*, as an outgoing argument type. This simplifies the API, ownership-wise, and allows for the removal of some cleanups. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * symfile.c (symfile_bfd_open): Update. * source.h (openp, source_full_path_of, find_and_open_source): Change argument type to unique_xmalloc_ptr. * source.c (openp): Take a unique_xmalloc_ptr. (source_full_path_of, find_and_open_source): Likewise. (open_source_file, symtab_to_fullname): Update. * solist.h (struct target_so_ops) <find_and_open_solib>: Take a unique_xmalloc_ptr. * solib.c (solib_find_1): Use unique_xmalloc_ptr. (exec_file_find): Update. * psymtab.c (psymtab_to_fullname): Update. * nto-tdep.h (nto_find_and_open_solib): Update. * nto-tdep.c (nto_find_and_open_solib): Change temp_path to a unique_xmalloc_ptr. * exec.c (exec_file_attach): Update. * dwarf2read.c (try_open_dwop_file): Use unique_xmalloc_ptr. * cli/cli-cmds.c (find_and_open_script): Use unique_xmalloc_ptr.
2018-02-14Move some declarations to source.hTom Tromey8-27/+44
I noticed a few declarations in defs.h that really could be put into source.h. I think it's generally preferable to something out of defs.h unless it is needed by most of the files in gdb. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * solib.c: Include source.h. * nto-tdep.c: Include source.h. * mi/mi-cmd-env.c: Include source.h. * infcmd.c: Include source.h. * exec.c: Include source.h. * defs.h (enum openp_flag, openp, source_full_path_of, mod_path) (add_path, directory_switch, source_path, init_source_path): Move declarations... * source.h (enum openp_flag, openp, source_full_path_of, mod_path) (add_path, directory_switch, source_path, init_source_path): ...here.
2018-02-14Return unique_xmalloc_ptr from some solib.c functionsTom Tromey7-51/+56
This changes a couple of solib.c functions -- exec_file_find and solib_find -- to return a unique_xmalloc_ptr, and then fixes up the users. This allows the removal of some cleanups. This also changes solib_bfd_open to not take ownership of its argument. I think this change is somewhat cleaner. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * solist.h (exec_file_find, solib_find): Return unique_xmalloc_ptr. (solib_bfd_fopen): Take a const char *. * solib.c (solib_find_1): Return unique_xmalloc_ptr. (exec_file_find, solib_find): Likewise. (solib_bfd_fopen): Do not take ownership of "pathname". (solib_bfd_open): Use unique_xmalloc_ptr. * solib-darwin.c (darwin_bfd_open): Use unique_xmalloc_ptr. * solib-aix.c (solib_aix_bfd_open): Use unique_xmalloc_ptr. * infrun.c (follow_exec): Use unique_xmalloc_ptr. * exec.c (exec_file_locate_attach): Use unique_xmalloc_ptr.
2018-02-14Remove references to ada_name_for_lookup (deleted)Joel Brobecker3-3/+7
This function was deleted on 2017-11-08, but its declaration and a reference to it in a comment was left behind. This patch just removes those. gdb/ChangeLog: * ada-lang.c (name_match_type_from_name): Remove reference to ada_name_for_lookup in function's documentation. * ada-lang.h (ada_name_for_lookup): Delete declaration. Tested by rebuilding GDB.
2018-02-13Use enum flags for flags passed to openpSimon Marchi5-8/+25
gdb/ChangeLog: * defs.h (enum openp_flags): New enum. (OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH): Move to enum openp_flags. (openp_flags): New enum flags. (openp): Change parameter type to openp_flags. * source.c (openp): Change parameter type to openp_flags. * cli/cli-cmds.c (find_and_open_script): Use openp_flags. * dwarf2read.c (try_open_dwop_file): Use openp_flags.
2018-02-13Fix prefix of maint set/show per-commandSimon Marchi2-2/+7
I noticed this: (gdb) apropos per-command maintenance set per-command -- Per-command statistics settings set per-command space -- Set whether to display per-command space usage set per-command symtab -- Set whether to display per-command symtab statistics set per-command time -- Set whether to display per-command execution time maintenance show per-command -- Show per-command statistics settings show per-command space -- Show whether to display per-command space usage show per-command symtab -- Show whether to display per-command symtab statistics show per-command time -- Show whether to display per-command execution time The subcommands of "maintenance set per-command" are missing the maintenance keyword. This is because that command is registered with the wrong prefix. This patch fixes that. gdb/ChangeLog: * maint.c (_initialize_maint_cmds): Fix prefix of maint set/show per-command.
2018-02-12gdb: Remove cleanup from dw2_do_instantiate_symtabAndrew Burgess2-35/+49
When running the test gdb.dwarf2/dw2-bad-parameter-type.exp under valgrind, I see the following issue reported (on x86-64 Fedora): (gdb) ptype f ==5203== Invalid read of size 1 ==5203== at 0x6931FE: process_die_scope::~process_die_scope() (dwarf2read.c:10642) ==5203== by 0x66818F: process_die(die_info*, dwarf2_cu*) (dwarf2read.c:10664) ==5203== by 0x66A01F: read_file_scope(die_info*, dwarf2_cu*) (dwarf2read.c:11650) ==5203== by 0x667F2D: process_die(die_info*, dwarf2_cu*) (dwarf2read.c:10672) ==5203== by 0x6677B6: process_full_comp_unit(dwarf2_per_cu_data*, language) (dwarf2read.c:10445) ==5203== by 0x66657A: process_queue(dwarf2_per_objfile*) (dwarf2read.c:9945) ==5203== by 0x6559B4: dw2_do_instantiate_symtab(dwarf2_per_cu_data*) (dwarf2read.c:3163) ==5203== by 0x66683D: psymtab_to_symtab_1(partial_symtab*) (dwarf2read.c:10034) ==5203== by 0x66622A: dwarf2_read_symtab(partial_symtab*, objfile*) (dwarf2read.c:9811) ==5203== by 0x787984: psymtab_to_symtab(objfile*, partial_symtab*) (psymtab.c:792) ==5203== by 0x786E3E: psym_lookup_symbol(objfile*, int, char const*, domain_enum_tag) (psymtab.c:522) ==5203== by 0x804BD0: lookup_symbol_via_quick_fns(objfile*, int, char const*, domain_enum_tag) (symtab.c:2383) ==5203== Address 0x147ed063 is 291 bytes inside a block of size 4,064 free'd ==5203== at 0x4C2CD5A: free (vg_replace_malloc.c:530) ==5203== by 0x444415: void xfree<void>(void*) (common-utils.h:60) ==5203== by 0x9DA8C2: call_freefun (obstack.c:103) ==5203== by 0x9DAD35: _obstack_free (obstack.c:280) ==5203== by 0x44464C: auto_obstack::~auto_obstack() (gdb_obstack.h:73) ==5203== by 0x68AFB0: dwarf2_cu::~dwarf2_cu() (dwarf2read.c:25080) ==5203== by 0x68B204: free_one_cached_comp_unit(dwarf2_per_cu_data*) (dwarf2read.c:25174) ==5203== by 0x66668C: dwarf2_release_queue(void*) (dwarf2read.c:9982) ==5203== by 0x563A4C: do_my_cleanups(cleanup**, cleanup*) (cleanups.c:154) ==5203== by 0x563AA7: do_cleanups(cleanup*) (cleanups.c:176) ==5203== by 0x5646CE: throw_exception_cxx(gdb_exception) (common-exceptions.c:289) ==5203== by 0x5647B7: throw_exception(gdb_exception) (common-exceptions.c:317) ==5203== Block was alloc'd at ==5203== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==5203== by 0x564BE8: xmalloc (common-utils.c:44) ==5203== by 0x9DA872: call_chunkfun (obstack.c:94) ==5203== by 0x9DA935: _obstack_begin_worker (obstack.c:141) ==5203== by 0x9DAA3C: _obstack_begin (obstack.c:164) ==5203== by 0x4445E0: auto_obstack::auto_obstack() (gdb_obstack.h:70) ==5203== by 0x68AE07: dwarf2_cu::dwarf2_cu(dwarf2_per_cu_data*) (dwarf2read.c:25073) ==5203== by 0x661A8A: init_cutu_and_read_dies(dwarf2_per_cu_data*, abbrev_table*, int, int, void (*)(die_reader_specs const*, unsigned char const*, die_info*, int, void*), void*) (dwarf2read.c:7869) ==5203== by 0x666A29: load_full_comp_unit(dwarf2_per_cu_data*, language) (dwarf2read.c:10108) ==5203== by 0x655847: load_cu(dwarf2_per_cu_data*) (dwarf2read.c:3120) ==5203== by 0x655928: dw2_do_instantiate_symtab(dwarf2_per_cu_data*) (dwarf2read.c:3148) ==5203== by 0x66683D: psymtab_to_symtab_1(partial_symtab*) (dwarf2read.c:10034) There's actually a series of three issues reported, but it turns out they're all related, so we can consider on the first one. The invalid read is triggered from a destructor which is being invoked as part of a stack unwind after throwing an error. At the time the error is thrown, the stack looks like this: #0 0x00000000009f4ecd in __cxa_throw () #1 0x0000000000564761 in throw_exception_cxx (exception=...) at ../../src/gdb/common/common-exceptions.c:303 #2 0x00000000005647b8 in throw_exception (exception=...) at ../../src/gdb/common/common-exceptions.c:317 #3 0x00000000005648ff in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR, error=GENERIC_ERROR, fmt=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]", ap=0x7fff387f2d68) at ../../src/gdb/common/common-exceptions.c:373 #4 0x0000000000564929 in throw_verror (error=GENERIC_ERROR, fmt=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]", ap=0x7fff387f2d68) at ../../src/gdb/common/common-exceptions.c:379 #5 0x0000000000867be4 in verror (string=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]", args=0x7fff387f2d68) at ../../src/gdb/utils.c:251 #6 0x000000000056879d in error (fmt=0xb33020 "Dwarf Error: Cannot find DIE at 0x%x referenced from DIE at 0x%x [in module %s]") at ../../src/gdb/common/errors.c:43 #7 0x0000000000686875 in follow_die_ref (src_die=0x30bc8a0, attr=0x30bc8c8, ref_cu=0x7fff387f2ed0) at ../../src/gdb/dwarf2read.c:22969 #8 0x00000000006844cd in lookup_die_type (die=0x30bc8a0, attr=0x30bc8c8, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:21976 #9 0x0000000000683f27 in die_type (die=0x30bc8a0, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:21832 #10 0x0000000000679b39 in read_subroutine_type (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:17343 #11 0x00000000006845fb in read_type_die_1 (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:22035 #12 0x0000000000684576 in read_type_die (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:22010 #13 0x000000000067003f in read_func_scope (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:13822 #14 0x0000000000667f5e in process_die (die=0x30bc830, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:10679 #15 0x000000000066a020 in read_file_scope (die=0x30bc720, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:11650 #16 0x0000000000667f2e in process_die (die=0x30bc720, cu=0x30bc5d0) at ../../src/gdb/dwarf2read.c:10672 #17 0x00000000006677b7 in process_full_comp_unit (per_cu=0x3089b80, pretend_language=language_minimal) at ../../src/gdb/dwarf2read.c:10445 #18 0x000000000066657b in process_queue (dwarf2_per_objfile=0x30897d0) at ../../src/gdb/dwarf2read.c:9945 #19 0x00000000006559b5 in dw2_do_instantiate_symtab (per_cu=0x3089b80) at ../../src/gdb/dwarf2read.c:3163 #20 0x000000000066683e in psymtab_to_symtab_1 (pst=0x3089bd0) at ../../src/gdb/dwarf2read.c:10034 #21 0x000000000066622b in dwarf2_read_symtab (self=0x3089bd0, objfile=0x3073f40) at ../../src/gdb/dwarf2read.c:9811 #22 0x0000000000787985 in psymtab_to_symtab (objfile=0x3073f40, pst=0x3089bd0) at ../../src/gdb/psymtab.c:792 #23 0x0000000000786e3f in psym_lookup_symbol (objfile=0x3073f40, block_index=1, name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/psymtab.c:522 #24 0x0000000000804bd1 in lookup_symbol_via_quick_fns (objfile=0x3073f40, block_index=1, name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/symtab.c:2383 #25 0x0000000000804fe4 in lookup_symbol_in_objfile (objfile=0x3073f40, block_index=1, name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/symtab.c:2558 #26 0x0000000000805125 in lookup_static_symbol (name=0x30b2e30 "f", domain=VAR_DOMAIN) at ../../src/gdb/symtab.c:2595 #27 0x0000000000804357 in lookup_symbol_aux (name=0x30b2e30 "f", match_type=symbol_name_match_type::FULL, block=0x0, domain=VAR_DOMAIN, language=language_c, is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:2105 #28 0x0000000000803ad9 in lookup_symbol_in_language (name=0x30b2e30 "f", block=0x0, domain=VAR_DOMAIN, lang=language_c, is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:1887 #29 0x0000000000803b53 in lookup_symbol (name=0x30b2e30 "f", block=0x0, domain=VAR_DOMAIN, is_a_field_of_this=0x0) at ../../src/gdb/symtab.c:1899 #30 0x000000000053b246 in classify_name (par_state=0x7fff387f6090, block=0x0, is_quoted_name=false, is_after_structop=false) at ../../src/gdb/c-exp.y:2879 #31 0x000000000053b7e9 in c_yylex () at ../../src/gdb/c-exp.y:3083 #32 0x000000000053414a in c_yyparse () at c-exp.c:1903 #33 0x000000000053c2e7 in c_parse (par_state=0x7fff387f6090) at ../../src/gdb/c-exp.y:3255 #34 0x0000000000774a02 in parse_exp_in_context_1 (stringptr=0x7fff387f61c0, pc=0, block=0x0, comma=0, void_context_p=0, out_subexp=0x0) at ../../src/gdb/parse.c:1213 #35 0x000000000077476a in parse_exp_in_context (stringptr=0x7fff387f61c0, pc=0, block=0x0, comma=0, void_context_p=0, out_subexp=0x0) at ../../src/gdb/parse.c:1115 #36 0x0000000000774714 in parse_exp_1 (stringptr=0x7fff387f61c0, pc=0, block=0x0, comma=0) at ../../src/gdb/parse.c:1106 #37 0x0000000000774c53 in parse_expression (string=0x27ff996 "f") at ../../src/gdb/parse.c:1253 #38 0x0000000000861dc4 in whatis_exp (exp=0x27ff996 "f", show=1) at ../../src/gdb/typeprint.c:472 #39 0x00000000008620d8 in ptype_command (type_name=0x27ff996 "f", from_tty=1) at ../../src/gdb/typeprint.c:561 #40 0x000000000047430b in do_const_cfunc (c=0x3012010, args=0x27ff996 "f", from_tty=1) at ../../src/gdb/cli/cli-decode.c:106 #41 0x000000000047715e in cmd_func (cmd=0x3012010, args=0x27ff996 "f", from_tty=1) at ../../src/gdb/cli/cli-decode.c:1886 #42 0x00000000008431bb in execute_command (p=0x27ff996 "f", from_tty=1) at ../../src/gdb/top.c:630 #43 0x00000000006bf946 in command_handler (command=0x27ff990 "ptype f") at ../../src/gdb/event-top.c:583 #44 0x00000000006bfd12 in command_line_handler (rl=0x30bb3a0 "\240\305\v\003") at ../../src/gdb/event-top.c:774 The problem is that in `process_die` (frames 14 and 16) we create a `process_die_scope` object, that takes a copy of the `struct dwarf2_cu *` passed into the frame. The destructor of the `process_die_scope` dereferences the stored pointer. This wouldn't be an issue, except... ... in dw2_do_instantiate_symtab (frame 19) a clean up was registered that clears the dwarf2_queue in case of an error. Part of this clean up involves deleting the `struct dwarf2_cu`s referenced from the queue.. The problem then, is that cleanups are processed at the site of the throw, while, class destructors are invoked as we unwind their frame. The result is that we process the frame 19 cleanup (and delete the struct dwarf2_cu) before we process the destructors in frames 14 and 16. When we do get back to frames 14 and 16 the objects being references have already been deleted. The solution is to remove the cleanup from dw2_do_instantiate_symtab, and instead use a destructor to release the dwarf2_queue instead. With this patch in place, the valgrind errors are now resolved. gdb/ChangeLog: * dwarf2read.c (dwarf2_release_queue): Delete function, move body into... (class dwarf2_queue_guard): ...the destructor of this new class. (dw2_do_instantiate_symtab): Create instance of the new class dwarf2_queue_guard, remove cleanup.
2018-02-09Don't reference past the end of the vectorTom Tromey2-1/+6
An earlier change made find_source_lines read: end = &data[size]; However, since 'size' is the size of the vector, this seems fishy. More obviously ok is to compute the end of the data directly: end = data.data () + size; 2018-02-09 Tom Tromey <tom@tromey.com> * source.c (find_source_lines): Don't reference past the end of the vector.
2018-02-09btrace: reword error messagesMarkus Metzger5-7/+21
Reword some btrace error messages to align with the format discussed in https://sourceware.org/ml/gdb-patches/2018-02/msg00135.html. gdb/ * remote.c (remote_btrace_maybe_reopen): Change error message. * btrace.c (btrace_enable): Likewise. (parse_xml_btrace): Likewise. (parse_xml_btrace_conf): Likewise. testsuite/ * lib/gdb.exp (skip_btrace_pt_tests): Update expected error message. Fix test name.
2018-02-09btrace: check perf_event_paranoidMarkus Metzger2-2/+36
One recurring error on Debian systems is that the default perf_event_paranoid setting disables the perf_event interface for user-space. Check the current level and point the user to the file. gdb/ * nat/linux-btrace.c (diagnose_perf_event_open_fail): New. (linux_enable_pt, linux_enable_bts): Call diagnose_perf_event_open_fail.
2018-02-09btrace: improve enable error messagesMarkus Metzger2-40/+38
Improve the error message when GDB fails to start recording branch trace. This patch also removes a zero buffer size check for PT to align with BTS. The buffer size can not be configured to be zero. gdb/ * nat/linux-btrace.c (perf_event_pt_event_type): Improve error message. Remove parameter and change return type. Update callers. Move it. (linux_enable_bts, linux_enable_pt): Improve error message. (linux_enable_pt): Remove zero buffer size check. (linux_enable_btrace): Improve error messages. Remove NULL return check.
2018-02-09btrace, gdbserver: remove the to_supports_btrace target methodMarkus Metzger16-373/+51
Remove the to_supports_btrace target method and instead rely on detecting errors when trying to enable recording. This will also provide a suitable error message explaining why recording is not possible. For remote debugging, gdbserver will now always advertise branch tracing related packets. When talking to an older GDB, this will cause GDB to try to enable branch tracing and gdbserver to report a suitable error message every time. An older gdbserver will not advertise branch tracing related packets if the one-time check failed, so a newer GDB with this patch will fail to enable branch tracing at remote_enable_btrace() rather than at btrace_enable(). The error message is the same in both cases so there should be no user-visible change. gdb/ * btrace.c (btrace_enable): Remove target_supports_btrace call. * nat/linux-btrace.c (perf_event_pt_event_type): Move. (kernel_supports_bts, kernel_supports_pt, linux_supports_bts) (linux_supports_pt, linux_supports_btrace): Remove. (linux_enable_bts): Call cpu_supports_bts. * nat/linux-btrace.h (linux_supports_btrace): Remove. * remote.c (remote_supports_btrace): Remove. (init_remote_ops): Remove remote_supports_btrace. * target-delegates.c: Regenerated. * target.c (target_supports_btrace): Remove. * target.h (target_ops) <to_supports_btrace>: Remove (target_supports_btrace): Remove. * x86-linux-nat.c (x86_linux_create_target): Remove linux_supports_btrace. gdbserver/ * linux-low.c (linux_target_ops): Remove linux_supports_btrace. * nto-low.c (nto_target_ops): Remove NULL for supports_btrace. * spu-low.c (spu_target_ops): Likewise. * win32-low.c (win32_target_ops): Likewise. * server.c (supported_btrace_packets): Report packets unconditionally. * target.h (target_ops) <supports_btrace>: Remove. (target_supports_btrace): Remove.
2018-02-09btrace, gdbserver: use exceptions to convey btrace enable/disable errorsMarkus Metzger5-39/+53
Change error reporting to use exceptions and be prepared to catch them in gdbserver. We use the exception message in our error reply to GDB. This may remove some detail from the error message in the native case since errno is no longer printed. Later patches will improve that. We're still using error strings on the RSP level. This patch does not affect the interoperability of older/newer GDB/gdbserver. gdbserver/ * server.c (handle_btrace_enable_bts, handle_btrace_enable_pt) (handle_btrace_disable): Change return type to void. Use exceptions to report errors. (handle_btrace_general_set): Catch exception and copy message to return message. gdb/ * nat/linux-btrace.c (linux_enable_btrace): Throw exception if enabling btrace failed. * x86-linux-nat.c (x86_linux_enable_btrace): Catch btrace enabling exception and use message in own exception.
2018-02-09btrace: prepare for throwing exceptions when enabling btraceMarkus Metzger2-67/+58
We indicate success or failure for enabling branch tracing via the pointer return value. Depending on the type of error, errno may provide additional information. Prepare for using exceptions with more descriptive error messages by using smart pointers and objects with automatic destruction to hold intermediate results. gdb/ * nat/linux-btrace.c: Include scoped_fd.h and scoped_mmap.h. (perf_event_pt_event_type): Use gdb_file_up. (linux_enable_bts, linux_enable_pt): Use gdb::unique_xmalloc_ptr, scoped_fd, and scoped_mmap.
2018-02-09common: add scoped_mmapMarkus Metzger4-0/+176
Add a simple helper to automatically unmap a memory mapping. gdb/ * common/scoped_mmap.h: New. * unittests/scoped_mmap-selftest.c: New. * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/scoped_mmap-selftest.c.
2018-02-09common: add scoped_fdMarkus Metzger4-0/+158
Add a simple helper to automatically close a file descriptor. gdb/ * common/scoped_fd.h: New. * unittests/scoped_fd-selftest.c: New. * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/scoped_fd-selftest.c.
2018-02-09Use gdb::unique_xmalloc_ptr in auto_load_section_scriptsTom Tromey2-4/+7
This changes auto_load_section_scripts to use gdb::unique_xmalloc_ptr, allowing the removal of a cleanup. 2018-02-09 Tom Tromey <tom@tromey.com> * auto-load.c (auto_load_section_scripts): Use gdb::unique_xmalloc_ptr.
2018-02-09Use std::string in execute_script_contentsTom Tromey2-12/+9
This changes execute_script_contents to use a std::string, allowing the removal of a cleanup. 2018-02-09 Tom Tromey <tom@tromey.com> * auto-load.c (execute_script_contents): Use std::string.
2018-02-09gdb/NEWS: Clarify the news entry for "rbreak" in GDB 8.1Joel Brobecker2-3/+8
gdb/ChangeLog: * NEWS <Changes in GDB 8.1>: Clarify that "rbreak" is a new Python function, rather than a new command.
2018-02-08Remove cleanups from solib.cTom Tromey2-8/+11
This removes a couple of cleanups from solib.c, replacing one with std::string and another with unique_xmalloc_ptr. 2018-02-08 Tom Tromey <tom@tromey.com> * solib.c (solib_find_1): Use std::string. (solib_bfd_fopen): Use unique_xmalloc_ptr.
2018-02-08Use unique_xmalloc_ptr in build_id_to_debug_bfdTom Tromey2-6/+7
This changes build_id_to_debug_bfd to use a unique_xmalloc_ptr, removing a cleanup. 2018-02-08 Tom Tromey <tom@tromey.com> * build-id.c (build_id_to_debug_bfd): Use unique_xmalloc_ptr.
2018-02-08Use gdb::def_vector in find_source_linesTom Tromey2-12/+12
This replaces an explicit malloc and a cleanup with a gdb::def_vector. 2018-02-08 Tom Tromey <tom@tromey.com> * source.c (find_source_lines): Use gdb::def_vector.
2018-02-08Remove cleanups from macro_define_commandTom Tromey2-21/+28
This removes cleanups from macro_define_command, by introducing a new struct temporary_macro_definition that cleans up after itself. 2018-02-08 Tom Tromey <tom@tromey.com> * macrocmd.c (struct temporary_macro_definition): New. (macro_define_command): Use temporary_macro_definition. Remove cleanups. (free_macro_definition_ptr): Remove.
2018-02-08Use std::string in maybe_expandTom Tromey2-14/+10
This patch changes maybe_expand to use std::string rather than an explicit malloc and a cleanup. 2018-02-08 Tom Tromey <tom@tromey.com> * macroexp.c (maybe_expand): Use std::string.
2018-02-08Class-ify macro_bufferTom Tromey2-240/+185
This patch changes macro_buffer to be a bit more of a C++ class, adding constructors, a destructor, and some members. Then this is used to remove various cleanups in macroexp.c. 2018-02-08 Tom Tromey <tom@tromey.com> * macroexp.c (struct macro_buffer): Add initializers for some members. (init_buffer, init_shared_buffer, free_buffer) (free_buffer_return_text): Remove. (macro_buffer): New constructors. (~macro_buffer): New destructor. (macro_buffer::set_shared): New method. (macro_buffer::resize_buffer, macro_buffer::appendc) (macro_buffer::appendmem): Now methods, not free functions. (set_token, append_tokens_without_splicing, stringify) (macro_stringify): Update. (gather_arguments): Change return type. Remove argc_p argument, add args_ptr argument. Use std::vector. (substitute_args): Remove argc argument. Accept std::vector. (expand): Update. Use std::vector. (scan, macro_expand, macro_expand_next): Update.
2018-02-08Return unique_xmalloc_ptr from macro scope functionsTom Tromey9-75/+65
This changes the macro scope functions (sal_macro_scope, user_macro_scope, and default_macro_scope) to return a unique_xmalloc_ptr, then fixes up the users. This allowed for the removal of several cleanups. 2018-02-08 Tom Tromey <tom@tromey.com> * symtab.c (default_collect_symbol_completion_matches_break_on): Use unique_xmalloc_ptr. * macroscope.h: (sal_macro_scope, user_macro_scope) (default_macro_scope): Return unique_xmalloc_ptr. * macroscope.c (sal_macro_scope, user_macro_scope) (default_macro_scope): Return unique_xmalloc_ptr. * macroexp.h (macro_expand, macro_expand_once): Return unique_xmalloc_ptr. * macroexp.c (macro_expand, macro_expand_once): Return unique_xmalloc_ptr. * macrocmd.c (macro_expand_command, macro_expand_once_command) (info_macro_command, info_macros_command): Use unique_xmalloc_ptr. * compile/compile-c-support.c (write_macro_definitions): Use unique_xmalloc_ptr. * c-exp.y (c_parse): Use unique_xmalloc_ptr.
2018-02-08Remove make_cleanup_restore_current_thread from gdbserverTom Tromey4-18/+12
This removes make_cleanup_restore_current_thread from gdbserver, replacing it with a use of scoped_restore. 2018-02-08 Tom Tromey <tom@tromey.com> * linux-low.c (install_software_single_step_breakpoints): Use make_scoped_restore. * inferiors.c (make_cleanup_restore_current_thread): Remove. (do_restore_current_thread_cleanup): Remove. * gdbthread.h (make_cleanup_restore_current_thread): Don't declare.
2018-02-08Remove a cleanup from gdbserverTom Tromey2-5/+11
This removes a cleanup from gdbserver's set_raw_breakpoint_at, replacing it with unique_xmalloc_ptr. 2018-02-08 Tom Tromey <tom@tromey.com> * mem-break.c (set_raw_breakpoint_at): Use gdb::unique_xmalloc_ptr.
2018-02-07Fix type of values representing optimized out static membersSimon Marchi4-5/+15
As reported here: https://sourceware.org/ml/gdb/2018-02/msg00019.html the type of values representing static members that are optimized out is wrong. It currently assigns the type of the containing class rather than the type of the field. This patch fixes that. I found a place in m-static.exp already dealing with optimized out static members, so I just added some gdb_test there. gdb/ChangeLog: * value.c (value_static_field): Assign field type instead of containing type when returning an optimized out value. gdb/testsuite/ChangeLog: * gdb.cp/m-static.exp: Check type of optimized out static member.
2018-02-06Remove some $ARCH_read_pc and $ARCH_write_pcYao Qi7-85/+18
Nowadays, gdbarch_read_pc is called in this way, if (gdbarch_read_pc_p (gdbarch)) pc_val = gdbarch_read_pc (gdbarch, regcache); /* Else use per-frame method on get_current_frame. */ else if (gdbarch_pc_regnum (gdbarch) >= 0) { ULONGEST raw_val; if (regcache_cooked_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch), &raw_val) == REG_UNAVAILABLE) some ports don't have to define its own gdbarch read_pc method if the pc value is simply a unsigned value from "pc" register. The same rule applies to regcache_write_pc. This patch removes these $ARCH_read_pc and $ARCH_write_pc functions. gdb: 2018-02-06 Yao Qi <yao.qi@linaro.org> * ft32-tdep.c (ft32_read_pc): Remove. (ft32_write_pc): Remove. (ft32_gdbarch_init): Update. * m32r-tdep.c (m32r_read_pc): Remove. (m32r_gdbarch_init): Update. * mep-tdep.c (mep_read_pc): Remove. (mep_gdbarch_init): Update. * microblaze-tdep.c (microblaze_write_pc): Remove. (microblaze_gdbarch_init): Update. * mn10300-tdep.c (mn10300_read_pc): Remove. (mn10300_write_pc): Remove. (mn10300_gdbarch_init): Update. * moxie-tdep.c (moxie_read_pc): Remove. (moxie_write_pc): Remove. (moxie_gdbarch_init): Update.
2018-02-06Treat OP_F77_UNDETERMINED_ARGLIST as OP_FUNCALLYao Qi2-1/+8
When I debug some fortran expression parsing, I got (gdb) set debug expression 1 (gdb) p intvla(5,5,5) Dump of expression @ 0x205fa80, before conversion to prefix form: Language fortran, 19 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_VAR_VALUE 40 (............... 1 <unknown 31863232> 31863232 .1.............. .... 14 BINOP_REM 5 ................ 15 OP_LONG 38 &............... 16 OP_F77_UNDETERMINED_ARGLIST 48 0............... 17 BINOP_MUL 3 ................ 18 OP_F77_UNDETERMINED_ARGLIST 48 0............... Dump of expression @ 0x205fa80, after conversion to prefix form: Expression: `Invalid expression ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This patch fixes this problem by handling OP_F77_UNDETERMINED_ARGLIST in the same way as handling OP_FUNCALL. With this patch applied, the output looks better, (gdb) p intvla (5,5,5) Dump of expression @ 0x2d75590, before conversion to prefix form: Language fortran, 19 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_VAR_VALUE 40 (............... .... 16 OP_F77_UNDETERMINED_ARGLIST 48 0............... 17 BINOP_MUL 3 ................ 18 OP_F77_UNDETERMINED_ARGLIST 48 0............... Dump of expression @ 0x2d75590, after conversion to prefix form: Expression: `vla_primitives::intvla (5, 5, 5)' Language fortran, 19 elements, 16 bytes each. 0 OP_F77_UNDETERMINED_ARGLIST Number of args: 3 3 OP_VAR_VALUE Block @0x297e1c0, symbol @0x297cd50 (intvla) 7 OP_LONG Type @0x2976900 (int), value 5 (0x5) 11 OP_LONG Type @0x2976900 (int), value 5 (0x5) 15 OP_LONG Type @0x2976900 (int), value 5 (0x5) gdb: 2018-02-06 Yao Qi <yao.qi@linaro.org> * expprint.c (print_subexp_standard): Handle OP_F77_UNDETERMINED_ARGLIST. (dump_subexp_body_standard): Likewise.
2018-02-06Fix up one ChangeLog entry dateYao Qi1-2/+3
The patch was committed on 5th Feb, and the first line of ChangeLog entry is too long. The max line length is 74. https://sourceware.org/gdb/wiki/ContributionChecklist#Properly_Formatted_GNU_ChangeLog
2018-02-05ppc64: Fix stwux encodingJan Kratochvil1-1/+1
With gcc-8.0.1-0.9.fc28.x86_64 I get: ../../gdb/rs6000-tdep.c: In function 'CORE_ADDR skip_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, rs6000_framedata*)': ../../gdb/rs6000-tdep.c:1911:34: error: bitwise comparison always evaluates to false [-Werror=tautological-compare] else if ((op & 0xfc1f016a) == 0x7c01016e) ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/com.ibm.aix.alangref/idalangref_stwux_stux_instrs.htm says bit 21 - 30 = 183 Those are bits 1..10 in normal bit order: 183<<1 = 0x16e gdb/ChangeLog 2018-02-04 Jan Kratochvil <jan.kratochvil@redhat.com> * rs6000-tdep.c (skip_prologue): Fix stwux encoding.
2018-02-05Remove myself as a write-after-approval GDB maintainer.Antoine Tremblay1-1/+0
Since I'll be leaving Ericsson. gdb/ * MAINTAINERS (Write After Approval): Remove Antoine Tremblay.
2018-02-05Use visitors for make_gdb_typeAlan Hayward2-224/+272
Remove the make_gdb_type functions from the tdesc_type_ classes. Replace with a static make_gdb_type function that uses a element visitor called gdb_type_creator. gdb/ * target-descriptions.c (tdesc_element_visitor) Add empty implementations. (tdesc_type): Move make_gdb_type from here. (tdesc_type_builtin): Likewise. (tdesc_type_vector): Likewise. (tdesc_type_with_fields): Move make_gdb_type_ functions from here. (make_gdb_type_struct): Move from tdesc_type_with_fields. (make_gdb_type_union): Likewise. (make_gdb_type_flags): Likewise. (make_gdb_type_enum): Likewise. (make_gdb_type): New function. (tdesc_register_type): Use static make_gdb_type.
2018-02-05Align natural-format register values to the same columnRuslan Kabatsayev2-10/+36
Currently, commands such as "info reg", "info all-reg", as well as register window in the TUI print badly aligned columns, like here: eax 0x1 1 ecx 0xffffd3e0 -11296 edx 0xffffd404 -11260 ebx 0xf7fa5ff4 -134586380 esp 0xffffd390 0xffffd390 ebp 0xffffd3c8 0xffffd3c8 esi 0x0 0 edi 0x0 0 eip 0x8048b60 0x8048b60 <main+16> eflags 0x286 [ PF SF IF ] cs 0x23 35 ss 0x2b 43 ds 0x2b 43 es 0x2b 43 fs 0x0 0 gs 0x63 99 After this patch, these commands print the third column values consistently aligned one under another, provided the second column is not too long. Originally, the third column was (attempted to be) aligned using a simple tab character. This patch changes the alignment to spaces only. The tests checking the output and expecting the single tab have been fixed in a previous patch, so this change doesn't break any. gdb/ChangeLog: * infcmd.c (default_print_one_register_info): Align natural-format column values consistently one under another. (pad_to_column): New function.
2018-02-04Move comment in gdb/dwarf2read.c::dwarf2_physnameJoel Brobecker2-8/+12
This commit just moves a comment right next to where it is actually relevant. No actual code change. gdb/ChangeLog: * dwarf2read.c (dwarf2_physname): Move commment. Tested by rebuilding GDB.
2018-02-03gdb/testsuite: Remove use of dejagnu cleanup procAndrew Burgess3-3/+5
The 'cleanup' proc has been removed from dejagnu (Feb 15 2016). The proc has not done anything useful since at least 2001 so removing these calls should be harmless. gdb/testsuite/ChangeLog: * config/sid.exp (gdb_target_sid): Remove use of cleanup. * config/sim.exp (gdb_target_sim): Remove use of cleanup.
2018-02-02MI: Allow non-raw varobj evaluationLeszek Swirski via gdb-patches7-2/+70
Make the MI variable object expression evaluation, with the -var-evaluate-expression command, recursively call pretty printers, to match the output of normal expression printing. Consider the following code: struct Foo { int val; }; struct Wrapper { Foo foo; }; int main() { Wrapper w; w.foo.val = 23; } and this pretty printer file: import gdb.printing class FooPrinter: def __init__(self, val): self.val = val def to_string(self): return "Foo" + str(self.val["val"]) class WrapperPrinter: def __init__(self, val): self.val = val def to_string(self): return self.val["foo"] test_printer = gdb.printing.RegexpCollectionPrettyPrinter("test") test_printer.add_printer('Foo', '^Foo$', FooPrinter) test_printer.add_printer('Wrapper', '^Wrapper$', WrapperPrinter) gdb.printing.register_pretty_printer(None, test_printer) Setting a breakpoint at the end of the function, we call the following commands: -enable-pretty-printing ^done -var-create var_w @ w ^done,name="var_w",numchild="0",value="{val = 23}",type="Wrapper",dynamic="1",has_more="0" -var-create var_w_foo @ w.foo ^done,name="var_w_foo",numchild="0",value="Foo23",type="Foo",dynamic="1",has_more="0" -var-evaluate-expression var_w ^done,value="{val = 23}" -var-evaluate-expression var_w_foo ^done,value="Foo23" -data-evaluate-expression w ^done,value="Foo23" -data-evaluate-expression w.foo ^done,value="Foo23" So, in the -var-evaluate-expression var_w case, we print the "raw" value of w.foo, while in the -data-evaluate-expression w case, we print the pretty printed w.foo value. After this patch, all of the above print "Foo23". gdb/ChangeLog: * varobj.c (varobj_formatted_print_options): Allow recursive pretty printing if pretty printing is enabled. gdb/testsuite/ChangeLog: * gdb.python/py-prettyprint.c (struct to_string_returns_value_inner, struct to_string_returns_value_wrapper): New. (main): Add tsrvw variable. * gdb.python/py-prettyprint.py (ToStringReturnsValueInner, ToStringReturnsValueWrapper): New classes. (register_pretty_printers): Register new pretty-printers. * gdb.python/py-prettyprint.exp (run_lang_tests): Test printing recursive pretty printer. * gdb.python/py-mi.exp: Likewise.
2018-02-01Do not classify C struct members as a filenameLeszek Swirski5-24/+74
There is existing logic in C/C++ expression parsing to avoid classifying names as a filename when they are a field on the this object. This change extends this logic to also avoid classifying names after a struct-op (-> or .) as a filename, which otherwise causes a syntax error. Thus, it is now possible in the file #include <map> struct D { void map(); } D d; to call (gdb) print d.map() where previously this would have been a syntax error. Tested on gdb.cp/*.exp gdb/ChangeLog: * c-exp.y (lex_one_token, classify_name, yylex): Don't classify names after a structop as a filename gdb/testsuite/ChangeLog: * gdb.cp/filename.cc, gdb.cp/filename.exp: Test that member functions with the same name as an include file are parsed correctly.
2018-02-01Rewrite arm_record_coproc_data_proc and arm_record_data_proc_misc_ld_strYao Qi2-172/+334
When I triage some reverse debugging test fails on arm-linux, I find arm_record_coproc_data_proc and arm_record_data_proc_misc_ld_str is not friendly to instruction encoding on ARM ARM. This patch rewrites them, in a way match more closely to the manual. gdb: 2018-02-01 Yao Qi <yao.qi@linaro.org> * arm-tdep.c (arm_record_data_proc_misc_ld_str): Rewrite it. (arm_record_coproc_data_proc): Likewise.
2018-02-01set ret signed in arm_record_extension_spaceYao Qi2-1/+5
Variable 'ret' should be int rather than unsigned, as it can be -1. gdb: 2018-02-01 Yao Qi <yao.qi@linaro.org> * arm-tdep.c (arm_record_extension_space): Change ret to signed.