aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-05-29Make display_gdb_prompt CLI-only.Pedro Alves12-73/+92
Enabling target-async by default will require implementing sync execution on top of an async target, much like foreground command are implemented on the CLI in async mode. In order to do that, we will need better control of when to print the MI prompt. Currently the interp->display_prompt_p hook is all we have, and MI just always returns false, meaning, make display_gdb_prompt a no-op. We'll need to be able to know to print the MI prompt in some of the conditions that display_gdb_prompt is called from the core, but not all. This is all a litte twisted currently. As we can see, display_gdb_prompt is really CLI specific, so make the console interpreters (console/tui) themselves call it. To be able to do that, and add a few different observers that the interpreters can use to distinguish when or why the the prompt is being printed: #1 - one called whenever a command is cancelled due to an error. #2 - another for when a foreground command just finished. In both cases, CLI wants to print the prompt, while MI doesn't. MI will want to print the prompt in the second case when in a special MI mode. The display_gdb_prompt call in interp_set made me pause. The comment there reads: /* Finally, put up the new prompt to show that we are indeed here. Also, display_gdb_prompt for the console does some readline magic which is needed for the console interpreter, at least... */ But, that looks very much like a no-op to me currently: - the MI interpreter always return false in the prompt hook, meaning actually display no prompt. - the interpreter used at that point is still quiet. And the console/tui interpreters return false in the prompt hook if they're quiet, meaning actually display no prompt. The only remaining possible use would then be the readline magic. But whatever that might have been, it's not reacheable today either, because display_gdb_prompt returns early, before touching readline if the interpreter returns false in the display_prompt_p hook. Tested on x86_64 Fedora 20, sync and async modes. gdb/ 2014-05-29 Pedro Alves <palves@redhat.com> * cli/cli-interp.c (cli_interpreter_display_prompt_p): Delete. (_initialize_cli_interp): Adjust. * event-loop.c: Include "observer.h". (start_event_loop): Notify 'command_error' observers instead of calling display_gdb_prompt. Remove FIXME comment. * event-top.c (display_gdb_prompt): Remove call into the interpreters. * inf-loop.c: Include "observer.h". (inferior_event_handler): Notify 'command_error' observers instead of calling display_gdb_prompt. * infrun.c (fetch_inferior_event): Notify 'sync_execution_done' observers instead of calling display_gdb_prompt. * interps.c (interp_set): Don't call display_gdb_prompt. (current_interp_display_prompt_p): Delete. * interps.h (interp_prompt_p): Delete declaration. (interp_prompt_p_ftype): Delete. (struct interp_procs) <prompt_proc_p>: Delete field. (current_interp_display_prompt_p): Delete declaration. * mi-interp.c (mi_interpreter_prompt_p): Delete. (_initialize_mi_interp): Adjust. * tui-interp.c (tui_init): Install 'sync_execution_done' and 'command_error' observers. (tui_on_sync_execution_done, tui_on_command_error): New functions. (tui_display_prompt_p): Delete. (_initialize_tui_interp): Adjust. gdb/doc/ 2014-05-29 Pedro Alves <palves@redhat.com> * observer.texi (sync_execution_done, command_error): New subjects.
2014-05-29PR gdb/13860 - Make MI sync vs async output (closer to) the same.Pedro Alves11-103/+408
Ignoring expected and desired differences like whether the prompt is output after *stoppped records, GDB MI output is still different in sync and async modes. In sync mode, when a CLI execution command is entered, the "reason" field is missing in the *stopped async record. And in async mode, for some events, like program exits, the corresponding CLI output is missing in the CLI channel. Vis, diff between sync vs async modes: run ^running *running,thread-id="1" (gdb) ... - ~"[Inferior 1 (process 15882) exited normally]\n" =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1",exit-code="0" - *stopped + *stopped,reason="exited-normally" si ... (gdb) ~"0x000000000045e033\t29\t memset (&args, 0, sizeof args);\n" - *stopped,frame=...,thread-id="1",stopped-threads="all",core="0" + *stopped,reason="end-stepping-range",frame=...,thread-id="1",stopped-threads="all",core="0" (gdb) In addition, in both cases, when a MI execution command is entered, and a breakpoint triggers, the event is sent to the console too. But some events like program exits have the CLI output missing in the CLI channel: -exec-run ^running *running,thread-id="1" (gdb) ... =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1",exit-code="0" - *stopped + *stopped,reason="exited-normally" We'll want to make background commands always possible by default. IOW, make target-async be the default. But, in order to do that, we'll need to emulate MI sync on top of an async target. That means we'll have yet another combination to care for in the testsuite. Rather than making the testsuite cope with all these differences, I thought it better to just fix GDB to always have the complete output, no matter whether it's in sync or async mode. This is all related to interpreter-exec, and the corresponding uiout switching. (Typing a CLI command directly in MI is shorthand for running it through -interpreter-exec console.) In sync mode, when a CLI command is active, normal_stop is called when the current interpreter and uiout are CLI's. So print_XXX_reason prints the stop reason to CLI uiout (only), and we don't show it in MI. In async mode the stop event is processed when we're back in the MI interpreter, so the stop reason is printed directly to the MI uiout. Fix this by making run control event printing roughly independent of whatever is the current interpreter or uiout. That is, move these prints to interpreter observers, that know whether to print or be quiet, and if printing, which uiout to print to. In the case of the console/tui interpreters, only print if the top interpreter. For MI, always print. Breakpoint hits / normal stops are already handled similarly -- MI has a normal_stop observer that prints the event to both MI and the CLI, though that could be cleaned up further in the direction of this patch. This also makes all of: (gdb) foo and (gdb) interpreter-exec MI "-exec-foo" and (gdb) -exec-foo and (gdb) -interpreter-exec console "foo" print as expected. Tested on x86_64 Fedora 20, sync and async modes. gdb/ 2014-05-29 Pedro Alves <palves@redhat.com> PR gdb/13860 * cli/cli-interp.c: Include infrun.h and observer.h. (cli_uiout, cli_interp): New globals. (cli_on_signal_received, cli_on_end_stepping_range) (cli_on_signal_exited, cli_on_exited, cli_on_no_history): New functions. (cli_interpreter_init): Install them as 'end_stepping_range', 'signal_received' 'signal_exited', 'exited' and 'no_history' observers. (_initialize_cli_interp): Remove cli_interp local. * infrun.c (handle_inferior_event): Call the several stop reason observers instead of printing the stop reason directly. (end_stepping_range): New function. (print_end_stepping_range_reason, print_signal_exited_reason) (print_exited_reason, print_signal_received_reason) (print_no_history_reason): Make static, and add an uiout parameter. Print to that instead of to CURRENT_UIOUT. * infrun.h (print_end_stepping_range_reason) (print_signal_exited_reason, print_exited_reason) (print_signal_received_reason print_no_history_reason): New declarations. * mi/mi-common.h (struct mi_interp): Rename 'uiout' field to 'mi_uiout'. <cli_uiout>: New field. * mi/mi-interp.c (mi_interpreter_init): Adjust. Create the new uiout for CLI output. Install 'signal_received', 'end_stepping_range', 'signal_exited', 'exited' and 'no_history' observers. (find_mi_interpreter, mi_interp_data, mi_on_signal_received) (mi_on_end_stepping_range, mi_on_signal_exited, mi_on_exited) (mi_on_no_history): New functions. (ui_out_free_cleanup): Delete function. (mi_on_normal_stop): Don't allocate a new uiout for CLI output, instead use the one already stored in the MI interpreter data. (mi_ui_out): Adjust. * tui/tui-interp.c: Include infrun.h and observer.h. (tui_interp): New global. (tui_on_signal_received, tui_on_end_stepping_range) (tui_on_signal_exited, tui_on_exited) (tui_on_no_history): New functions. (tui_init): Install them as 'end_stepping_range', 'signal_received' 'signal_exited', 'exited' and 'no_history' observers. (_initialize_tui_interp): Delete tui_interp local. gdb/doc/ 2014-05-29 Pedro Alves <palves@redhat.com> PR gdb/13860 * observer.texi (signal_received, end_stepping_range) (signal_exited, exited, no_history): New observer subjects. gdb/testsuite/ 2014-05-29 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdb.mi/mi-cli.exp: Always expect "end-stepping-range" stop reason, even in sync mode.
2014-05-29PR gdb/15713 - errors from i386_linux_resume lead to lock-upPedro Alves2-23/+35
linux_nat_resume is not considering that linux_ops->to_resume may throw: /* Mark LWP as not stopped to prevent it from being continued by linux_nat_resume_callback. */ lp->stopped = 0; if (resume_many) iterate_over_lwps (ptid, linux_nat_resume_callback, NULL); If something within linux_nat_resume_callback throws, GDB leaves the lwp_info as if the inferior was resumed, while it actually wasn't. A couple examples, there are possibly others: - i386_linux_resume calls target_read which calls QUIT. - if the actual ptrace resumption fails in inf_ptrace_resume, perror_with_name is called. If the user tries to kill the inferior at this point (or quit, which offers to kill), GDB locks up trying to stop the lwp -- if it is already stopped no new waitpid event gets generated for it. Fix this by setting the stopped flag earlier, as soon as we collect a stop event with waitpid, and clearing it always only after resuming the lwp successfully. Tested on x86_64 Fedora 20. Confirmed the lock-up disappears using a local hack that forces an error in inf_ptrace_resume. Also fixes a little "set debug lin-lwp" annoyance. Currently we always see: Continuing. LLR: Preparing to resume process 6802, 0, inferior_ptid Thread 0x7ffff7fc7740 (LWP 6802) ^^^^^^^^ RC: Resuming sibling Thread 0x7ffff77c5700 (LWP 6807), 0, resume RC: Resuming sibling Thread 0x7ffff7fc6700 (LWP 6806), 0, resume RC: Not resuming sibling Thread 0x7ffff7fc7740 (LWP 6802) (not stopped) ^^^^^^^^^^^^^^^^^^^^^^^ LLR: PTRACE_CONT process 6802, 0 (resume event thread) This patch gets rid of the "Not resuming sibling" line. 2014-05-29 Pedro Alves <palves@redhat.com> PR gdb/15713 * linux-nat.c (linux_nat_resume_callback): Rename the second parameter to 'except'. Skip LP if it points to EXCEPT. (linux_nat_resume): Don't mark the event lwp as not stopped before resuming sibling lwps. Instead ask linux_nat_resume_callback to skip the event lwp. Mark it as not stopped after actually resuming it. (linux_handle_syscall_trap): Mark the lwp as not stopped after resuming it. (wait_lwp): Mark the lwp as stopped here. (stop_wait_callback): Mark the lwp as not stopped right after resuming it. Don't mark lwps as stopped here. (linux_nat_filter_event): Mark the lwp as stopped earlier. (linux_nat_wait_1): Don't mark dead lwps as stopped here.
2014-05-29PR15693 - Fix spurious *running events, thread state, dprintf-style callPedro Alves8-12/+291
If one sets a breakpoint with a condition that involves calling a function in the inferior, and then the condition evaluates false, GDB outputs one *running event for each time the program hits the breakpoint. E.g., $ gdb return-false -i=mi (gdb) start ... (gdb) b 14 if return_false () &"b 14 if return_false ()\n" ~"Breakpoint 2 at 0x4004eb: file return-false.c, line 14.\n" ... ^done (gdb) c &"c\n" ~"Continuing.\n" ^running *running,thread-id=(...) (gdb) *running,thread-id=(...) *running,thread-id=(...) *running,thread-id=(...) *running,thread-id=(...) *running,thread-id=(...) ... repeat forever ... An easy way a user can trip on this is with a dprintf with "set dprintf-style call". In that case, a dprintf is just a breakpoint that when hit GDB calls the printf function in the inferior, and then resumes it, just like the case above. If the breakpoint/dprintf is set in a loop, then these spurious events can potentially slow down a frontend much, if it decides to refresh its GUI whenever it sees this event (Eclipse is one such case). When we run an infcall, we pretend we don't actually run the inferior. This is already handled for the usual case of calling a function directly from the CLI: (gdb) p return_false () &"p return_false ()\n" ~"$1 = 0" ~"\n" ^done (gdb) Note no *running, nor *stopped events. That's handled by: static void mi_on_resume (ptid_t ptid) { ... /* Suppress output while calling an inferior function. */ if (tp->control.in_infcall) return; and equivalent code on normal_stop. However, in the cases of the PR, after finishing the infcall there's one more resume, and mi_on_resume doesn't know that it should suppress output then too, somehow. The "running/stopped" state is a high level user/frontend state. Internal stops are invisible to the frontend. If follows from that that we should be setting the thread to running at a higher level where we still know the set of threads the user _intends_ to resume. Currently we mark a thread as running from within target_resume, a low level target operation. As consequence, today, if we resume a multi-threaded program while stopped at a breakpoint, we see this: -exec-continue ^running *running,thread-id="1" (gdb) *running,thread-id="all" The first *running was GDB stepping over the breakpoint, and the second is GDB finally resuming everything. Between those two *running's, threads other than "1" still have their state set to stopped. That's bogus -- in async mode, this opens a tiny window between both resumes where the user might try to run another execution command to threads other than thread 1, and very much confuse GDB. That is, the "step" below should fail the "step", complaining that the thread is running: (gdb) c -a & (gdb) thread 2 (gdb) step IOW, threads that GDB happens to not resume immediately (say, because it needs to step over a breakpoint) shall still be marked as running. Then, if we move marking threads as running to a higher layer, decoupled from target_resume, plus skip marking threads as running when running an infcall, the spurious *running events disappear, because there will be no state transitions at all. I think we might end up adding a new thread state -- THREAD_INFCALL or some such, however since infcalls are always synchronous today, I didn't find a need. There's no way to execute a CLI/MI command directly from the prompt if some thread is running an infcall. Tested on x86_64 Fedora 20. gdb/ 2014-05-29 Pedro Alves <palves@redhat.com> PR PR15693 * infrun.c (resume): Determine how much to resume depending on whether the caller wanted a step, not whether we can hardware step the target. Mark all threads that we intend to run as running, unless we're calling an inferior function. (normal_stop): If the thread is running an infcall, don't finish thread state. * target.c (target_resume): Don't mark threads as running here. gdb/testsuite/ 2014-05-29 Pedro Alves <palves@redhat.com> Hui Zhu <hui@codesourcery.com> PR PR15693 * gdb.mi/mi-condbreak-call-thr-state-mt.c: New file. * gdb.mi/mi-condbreak-call-thr-state-st.c: New file. * gdb.mi/mi-condbreak-call-thr-state.c: New file. * gdb.mi/mi-condbreak-call-thr-state.exp: New file.
2014-05-29daily updateAlan Modra1-1/+1
2014-05-28Fix demangler testsuite crashes with CP_DEMANGLE_DEBUG definedPedro Alves2-0/+11
Running the demangler's testsuite with CP_DEMANGLE_DEBUG defined crashes, with: Program received signal SIGSEGV, Segmentation fault. 0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567 567 switch (dc->type) (gdb) bt 3 #0 0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567 #1 0x000000000040ae47 in d_dump (dc=0x7fffffffd098, indent=10) at ../../src/libiberty/cp-demangle.c:787 #2 0x000000000040ae47 in d_dump (dc=0x7fffffffd0c8, indent=8) at ../../src/libiberty/cp-demangle.c:787 Note dc=0x1, which is obviously a bogus pointer. This is the end of d_dump recursing for a component type that that doesn't actually have subtrees: 787 d_dump (d_left (dc), indent + 2); 788 d_dump (d_right (dc), indent + 2); This fixes the two cases the testsuite currently trips on. libiberty/ 2014-05-28 Pedro Alves <palves@redhat.com> * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM and DEMANGLE_COMPONENT_NUMBER.
2014-05-28Fix test in libiberty/testsuite/demangle-expected.Thomas Schwinge2-0/+5
libiberty/ * testsuite/demangle-expected: Fix last commit. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210803 138bc75d-0d04-0410-961f-82ee72b054a4
2014-05-28cplus-demangler, free resource after a failed call to gnu_special.Andrew Burgess3-0/+18
libiberty/ 2014-05-14 Andrew Burgess <aburgess@broadcom.com> * cplus-dmem.c (internal_cplus_demangle): Free any resources allocated by possible previous call to gnu_special. (squangle_mop_up): Reset pointers to NULL after calling free. * testsuite/demangle-expected: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210425 138bc75d-0d04-0410-961f-82ee72b054a4
2014-05-28Remove "set/show remotebaud" (deprecated) commands.Joel Brobecker5-29/+16
This patch removes support for the "set/show remotebaud" command, which were deprecated in GDB 7.7, and should be now be removed ahead of cutting the GDB 7.8 branch. gdb/ChangeLog: * serial.c (_initialize_serial): Remove support for the "set remotebaud" and "show remotebaud" commands. * NEWS: Add entry documenting the removal of that command. gdb/testsuite/ChangeLog: * config/monitor.exp (gdb_target_monitor): Replace use of "set remotebaud" by "set serial baud".
2014-05-28ld: Split GENSCRIPTS rule from dependencies to fix tdir_'s.Hans-Peter Nilsson3-666/+699
* Makefile.am: Change all rules with ${GENSCRIPTS} invocations to be just dependencies. ($(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)) (run-genscripts): New rules. * Makefile.in: Regenerate.
2014-05-28Add objcopy stage between assembly and linking for run_dump_testmfortune2-0/+42
ld/testsuite/ * lib/ld-lib.exp: Add objcopy_objects command to run_dump_test. This allows each input object to be optionally run through objcopy before linking.
2014-05-28Fix rx "set but not used" warningsAlan Modra2-16/+16
* elf32-rx.c (rx_table_map): Delete set but not used variables.
2014-05-28addr2line: fix missing inlined frames.Tristan Gingold2-9/+25
2014-05-28 Tristan Gingold <gingold@adacore.com> * dwarf2.c (lookup_address_in_function_table): Add best_fit_len to keep the length of the best fit range. (lookup_symbol_in_function_table, info_hash_lookup_funcinfo): Likewise.
2014-05-28Fix typo in commentsYao Qi2-1/+5
"unsed" -> "used" gdb: 2014-05-28 Yao Qi <yao@codesourcery.com> * charset.c: Fix typo in comments.
2014-05-28daily updateAlan Modra1-1/+1
2014-05-27Fix typo.DJ Delorie1-1/+1
2014-05-27Add new link-map-text hook and RX auto-vector support.DJ Delorie23-14/+507
* bfd/elf32-rx.c (get_symbol_value_maybe): New. (rx_elf_relocate_section): If we find a reloc against $tableentry$default$<name>, redirect it to the appropriate $tableentry$<n>$. (RX_Table_Info): New. (rx_table_find): New. Check all tables and SEC_KEEP all sections with table parts in them. (rx_check_directives): New. (rx_table_map_2): New. (rx_table_map): New. (rx_additional_link_map_text): New. Called to dump tables to the map file. * bfd/elf32-rx.h: New. * ld/ldemul.h (extra_map_file_text): New field. (ldemul_extra_map_file_text): Declare. * ld/ldemul.c (ldemul_extra_map_file_text): Define. * ld/ldlang.c (lang_map): Call it. * ld/emultempl/rxelf.em: Add extra_map_file_text hook. * ld/emultempl/aix.em: Add NULL extra_map_file_text hook. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/vanilla.em: Likewise.
2014-05-27Properly handle 64-bit GOT relocationsH.J. Lu2-2/+11
This patch fixes 2 issues: 1. Since the GOT offset is always negative, we need to use signed int to support 64-bit GOT relocations. 2. R_X86_64_PLTOFF64 uses the address of GLOBAL_OFFSET_TABLE, which is the address of the .got.plt section, not the .got section.
2014-05-27Prompt the user to file bug reports for internal errors and warnings.Gary Benson2-0/+10
2014-05-27 Gary Benson <gbenson@redhat.com> * utils.c (internal_vproblem): Prompt for a bug report.
2014-05-26remove unnecessary smob mark/free functionsAndy Wingo14-204/+21
* guile/scm-arch.c (arscm_mark_arch_smob): * guile/scm-block.c (bkscm_mark_block_smob) (bkscm_mark_block_syms_progress_smob): * guile/scm-breakpoint.c (bpscm_mark_breakpoint_smob): * guile/scm-exception.c (exscm_mark_exception_smob): * guile/scm-frame.c (frscm_mark_frame_smob): * guile/scm-iterator.c (itscm_mark_iterator_smob): * guile/scm-lazy-string.c (lsscm_mark_lazy_string_smob): * guile/scm-objfile.c (ofscm_mark_objfile_smob): * guile/scm-pretty-print.c (ppscm_mark_pretty_printer_smob) (ppscm_mark_pretty_printer_worker_smob): * guile/scm-symbol.c (syscm_mark_symbol_smob): * guile/scm-symtab.c (stscm_mark_symtab_smob, stscm_mark_sal_smob): * guile/scm-type.c (tyscm_mark_type_smob, tyscm_mark_field_smob): * guile/scm-value.c (vlscm_mark_value_smob): Remove unnecessary mark functions. * guile/scm-symtab.c (stscm_free_sal_smob): Remove unnecessary free function.
2014-05-26gdb smob cleanupsAndy Wingo22-344/+102
* guile/guile-internal.h (GDB_SMOB_HEAD): Replace properties with empty_base_class. All uses updated. (gdbscm_mark_gsmob, gdbscm_mark_chained_gsmob) (gdbscm_mark_eqable_gsmob): Remove these now-unneeded functions. Adapt all callers. * guile/scm-gsmob.c (gdbscm_mark_gsmob) (gdbscm_mark_chained_gsmob, gdbscm_mark_eqable_gsmob): Remove. (gdbscm_gsmob_property, gdbscm_set_gsmob_property_x) (gdbscm_gsmob_has_property_p, add_property_name) (gdbscm_gsmob_properties): Remove, and remove them from gsmob_functions. * guile/lib/gdb.scm (gdb-object-property, set-gdb-object-property) (gdb-object-has-property?, gdb-object-properties): Remove. (gdb-object-kind): Renamed from gsmob-kind. doc/ * guile.texi (GDB Scheme Data Types): Remove documentation for removed interfaces. Update spelling of gdb-object-kind. testsuite/ * gdb.guile/scm-breakpoint.exp: * gdb.guile/scm-gsmob.exp: Update to use plain old object properties instead of gdb-object-properties.
2014-05-27daily updateAlan Modra1-1/+1
2014-05-26guile.texi (Basic Guile): Fix some typos.Andy Wingo2-2/+6
2014-05-26Fix excess parentheses in use-modules forms.Andy Wingo2-5/+10
2014-05-26Add configure support for building with guile 2.2.Andy Wingo3-2/+7
* configure.ac (try_guile_versions): Allow building with guile 2.2. * configure: Regenerate.
2014-05-26fix 80 cols overrun in earlier entryDoug Evans1-1/+1
2014-05-26Specify source file explicitly when setting a breakpointYao Qi2-1/+6
When I run no-thread-db.exp, the breakpoint is set on line 26. However, the breakpoint is set to line 26 of dl-start.S rather than no-thread-db.c, which is not intended. (gdb) monitor set libthread-db-search-path /foo/bar^M libthread-db-search-path set to `/foo/bar'^M (gdb) PASS: gdb.server/no-thread-db.exp: libthread-db is now unresolvable break 26^M Breakpoint 1 at 0x48018078: file ../sysdeps/powerpc/powerpc32/dl-start.S, line 26.^M (gdb) continue^M Continuing. This patch is to change the breakpoint setting with source file specified, then it is correct now. gdb/testsuite: 2014-05-26 Yao Qi <yao@codesourcery.com> * gdb.server/no-thread-db.exp: Specify source file name explicitly when setting a breakpoint.
2014-05-26daily updateAlan Modra1-1/+1
2014-05-25daily updateAlan Modra1-1/+1
2014-05-25Localize varible to avoid warningAlan Modra4-3/+8
* ldlang.c (base): Move variable to.. * mri.c: ..here, and make static. * ldlang.h (base): Delete declaration.
2014-05-24Don't use @var at the beginning of a sentence in GDB documentation.Eli Zaretskii4-208/+239
gdb/doc/guile.texi (Types In Guile, Basic Guile, Frames In Guile) (Breakpoints In Guile, Guile Printing Module) (Guile Exception Handling, Values From Inferior In Guile) (Objfiles In Guile, Breakpoints In Guile, Memory Ports in Guile): Don't use @var at the beginning of a sentence. gdb/doc/gdb.texinfo (Frame Filter Management, Trace Files) (C Operators, Ada Tasks, Calling, Bootstrapping, ARM) (PowerPC Embedded, Define, Annotations for Running) (IPA Protocol Commands, Packets, General Query Packets) (Tracepoint Packets, Notification Packets, Environment) (Inferiors and Programs, Set Breaks, Set Catchpoints) (Continuing and Stepping, Signals, Thread-Specific Breakpoints) (Frames, Backtrace, Selection, Expressions, Registers) (Trace State Variables, Built-In Func/Proc, Signaling, Files) (Numbers, GDB/MI Async Records, GDB/MI Data Manipulation) (Source Annotations, Using JIT Debug Info Readers, Packets) (Stop Reply Packets, Host I/O Packets) (Target Description Format): Don't use @var at the beginning of a sentence. gdb/doc/python.texi (Basic Python, Types In Python) (Commands In Python, Frames In Python, Line Tables In Python) (Breakpoints In Python, gdb.printing, gdb.types) (Type Printing API): Don't use @var at the beginning of a sentence.
2014-05-24daily updateAlan Modra1-1/+1
2014-05-23Include asm/ptrace.h for linux-aarch64-low.cRamana Radhakrishnan2-0/+5
A recent change to glibc removed asm/ptrace.h from user.h for AArch64. This meant that cross-native builds of gdbserver using trunk glibc broke because linux-aarch64-low.c because user_hwdebug_state couldn't be found. This is like commit #036cd38182bde32d8297b630cd5c861d53b8949e 2014-05-23 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> * linux-aarch64-low.c (asm/ptrace.h): Include.
2014-05-23btrace, vdso: add vdso target sectionsMarkus Metzger5-0/+110
When loading symbols for the vdso, also add its sections to target_sections. This fixes an issue with record btrace where vdso instructions could not be disassembled during replay. * symfile-mem.c (symbol_file_add_from_memory): Add BFD sections. testsuite/ * gdb.btrace/vdso.c: New. * gdb.btrace/vdso.exp: New.
2014-05-23test, gcore: move capture_command_output into lib/gdb.expMarkus Metzger3-13/+19
Allow gcore's capture_command_output function to be used by other tests. testsuite/ * gdb.base/gcore.exp (capture_command_output): Move ... * lib/gdb.exp (capture_command_output): ... here.
2014-05-23btrace: control memory access during replayMarkus Metzger7-12/+135
The btrace record target does not trace data. We therefore do not allow accessing read-write memory during replay. In some cases, this might be useful to advanced users, though, who we assume to know what they are doing. Add a set|show command pair to turn this memory access restriction off. * record-btrace.c (record_btrace_allow_memory_access): Remove. (replay_memory_access_read_only, replay_memory_access_read_write) (replay_memory_access_types, replay_memory_access) (set_record_btrace_cmdlist, show_record_btrace_cmdlist) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_show_replay_memory_access): New. (record_btrace_xfer_partial, record_btrace_insert_breakpoint) (record_btrace_remove_breakpoint): Replace record_btrace_allow_memory_access with replay_memory_access. (_initialize_record_btrace): Add commands. * NEWS: Announce it. testsuite/ * gdb.btrace/data.exp: Test it. doc/ * gdb.texinfo (Process Record and Replay): Document it.
2014-05-23daily updateAlan Modra1-1/+1
2014-05-22Add comment for mi_run_cmd_fullSimon Marchi2-0/+16
It should clear up confusion about the args parameter to mi_run_cmd_full. Thanks to Joel for clear formulation. I also added a comment about the impact of use_gdb_stub. gdb/testsuite/ChangeLog: 2014-05-22 Simon Marchi <simon.marchi@ericsson.com> * lib/mi-support.exp (mi_run_cmd_full): Add comments.
2014-05-22Include asm/ptrace.h in aarch64-linux-nat.cRamana Radhakrishnan2-0/+5
A recent change to glibc removed asm/ptrace.h from user.h for AArch64. This meant that cross-native builds of gdb using trunk glibc broke because aarch64-linux-nat.c because user_hwdebug_state couldn't be found. Fixed by including asm/ptrace.h like other ports. 2014-05-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> * aarch64-linux-nat.c (asm/ptrace.h): Include.
2014-05-22Reinstate self to Write After ApprovalRamana Radhakrishnan2-1/+6
2014-05-22 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> * MAINTAINERS (Write After Approval): Move self back from paper trail.
2014-05-22Add new infrun.h header.Pedro Alves44-136/+267
Move infrun.c declarations out of inferior.h to a new infrun.h file. Tested by building on: i686-w64-mingw32, enable-targets=all x86_64-linux, enable-targets=all i586-pc-msdosdjgpp And also grepped the whole tree for each symbol moved to find where infrun.h might be necessary. gdb/ 2014-05-22 Pedro Alves <palves@redhat.com> * inferior.h (debug_infrun, debug_displaced, stop_on_solib_events) (sync_execution, sched_multi, step_stop_if_no_debug, non_stop) (disable_randomization, enum exec_direction_kind) (execution_direction, stop_registers, start_remote) (clear_proceed_status, proceed, resume, user_visible_resume_ptid) (wait_for_inferior, normal_stop, get_last_target_status) (prepare_for_detach, fetch_inferior_event, init_wait_for_inferior) (insert_step_resume_breakpoint_at_sal) (follow_inferior_reset_breakpoints, stepping_past_instruction_at) (set_step_info, print_stop_event, signal_stop_state) (signal_print_state, signal_pass_state, signal_stop_update) (signal_print_update, signal_pass_update) (update_signals_program_target, clear_exit_convenience_vars) (displaced_step_dump_bytes, update_observer_mode) (signal_catch_update, gdb_signal_from_command): Move declarations ... * infrun.h: ... to this new file. * amd64-tdep.c: Include infrun.h. * annotate.c: Include infrun.h. * arch-utils.c: Include infrun.h. * arm-linux-tdep.c: Include infrun.h. * arm-tdep.c: Include infrun.h. * break-catch-sig.c: Include infrun.h. * breakpoint.c: Include infrun.h. * common/agent.c: Include infrun.h instead of inferior.h. * corelow.c: Include infrun.h. * event-top.c: Include infrun.h. * go32-nat.c: Include infrun.h. * i386-tdep.c: Include infrun.h. * inf-loop.c: Include infrun.h. * infcall.c: Include infrun.h. * infcmd.c: Include infrun.h. * infrun.c: Include infrun.h. * linux-fork.c: Include infrun.h. * linux-nat.c: Include infrun.h. * linux-thread-db.c: Include infrun.h. * monitor.c: Include infrun.h. * nto-tdep.c: Include infrun.h. * procfs.c: Include infrun.h. * record-btrace.c: Include infrun.h. * record-full.c: Include infrun.h. * remote-m32r-sdi.c: Include infrun.h. * remote-mips.c: Include infrun.h. * remote-notif.c: Include infrun.h. * remote-sim.c: Include infrun.h. * remote.c: Include infrun.h. * reverse.c: Include infrun.h. * rs6000-tdep.c: Include infrun.h. * s390-linux-tdep.c: Include infrun.h. * solib-irix.c: Include infrun.h. * solib-osf.c: Include infrun.h. * solib-svr4.c: Include infrun.h. * target.c: Include infrun.h. * top.c: Include infrun.h. * windows-nat.c: Include infrun.h. * mi/mi-interp.c: Include infrun.h. * mi/mi-main.c: Include infrun.h. * python/py-threadevent.c: Include infrun.h.
2014-05-22Don't store the inferior's exit code for --return-child-result in a print ↵Pedro Alves2-2/+9
routine. A small cleanup - so we can call the print routine without affecting --return-child-result. gdb/ 2014-05-22 Pedro Alves <palves@redhat.com> * infrun.c (handle_inferior_event): Store the exit code for --return-child-result here, instead of ... (print_exited_reason): ... here.
2014-05-22Fix whitespace in gas listing errors and warningsAlan Modra16-128/+149
gas/ * listing.c (listing_warning, listing_error): Add space after colon. * messages.c (as_warn_internal, as_bad_internal): Use the same string as above. gas/testsuite/ * gas/d30v/bittest.l: Update for changed whitespace. * gas/d30v/serial.l: Likewise. * gas/d30v/serial2.l: Likewise. * gas/d30v/serial2O.l: Likewise. * gas/d30v/warn_oddreg.l: Likewise. * gas/i386/inval-equ-2.l: Likewise. * gas/i386/mpx-inval-1.l: Likewise. * gas/i386/sse-check-error.l: Likewise. * gas/i386/x86-64-mpx-inval-1.l: Likewise. * gas/i386/x86-64-mpx-inval-2.l: Likewise. * gas/i386/x86-64-size-inval-1.l: Likewise. * gas/i386/x86-64-sse-check-error.l: Likewise.
2014-05-22daily updateAlan Modra1-1/+1
2014-05-21PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s ↵Pedro Alves11-9/+262
output in async mode. The other part of PR gdb/13860 is about console execution commands in MI getting their output half lost. E.g., take the finish command, executed on a frontend's GDB console: sync: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) ~"0x00000000004004d7 in foo () at stepinf.c:6\n" ~"6\t usleep (10);\n" ~"Value returned is $1 = 0\n" *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1" async: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0" Note how all the "Value returned" etc. output is missing in async mode. The same happens with e.g., catchpoints: =breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"} ~"\nCatchpoint " ~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n" ~"131\t pid = ARCH_FORK ();\n" *stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0" where all those ~ lines are missing in async mode, or just the "step" current line indication: s &"s\n" ^running *running,thread-id="all" (gdb) ~"13\t foo ();\n" *stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3" (gdb) Or in the case of the PRs example, the "Stopped due to shared library event" note: start &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="21990" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3" (gdb) IMO, if you're typing execution commands in a frontend's console, you expect to see their output. Indeed it's what you get in sync mode. I think async mode should do the same. Deciding what to mirror to the console wrt to breakpoints and random stops gets messy real fast. E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the event to the console in this case. But what about more complicated cases like "s&; thread n; s&", and one of those steps spawning a new thread, and that thread hitting a breakpoint? It's impossible in general to track whether the thread had any relation to the commands that had been executed. So I think we should just simplify and always mirror breakpoints and random events to the console. Notes: - mi->out is the same as gdb_stdout when MI is the current interpreter. I think that referring to that directly is cleaner. An earlier revision of this patch made the changes that are now done in mi_on_normal_stop directly in infrun.c:normal_stop, and so not having an obvious place to put the new uiout by then, and not wanting to abuse CLI's uiout, I made a temporary uiout when necessary. - Hopefuly the rest of the patch is more or less obvious given the comments added. Tested on x86_64 Fedora 20, no regressions. 2014-05-21 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdbthread.h (struct thread_control_state): New field `command_interp'. * infrun.c (follow_fork): Copy the new thread control field to the child fork thread. (clear_proceed_status_thread): Clear the new thread control field. (proceed): Set the new thread control field. * interps.h (command_interp): Declare. * interps.c (command_interpreter): New global. (command_interp): New function. (interp_exec): Set `command_interpreter' while here. * cli-out.c (cli_uiout_dtor): New function. (cli_ui_out_impl): Install it. * mi/mi-interp.c: Include cli-out.h. (mi_cmd_interpreter_exec): Add comment. (restore_current_uiout_cleanup): New function. (ui_out_free_cleanup): New function. (mi_on_normal_stop): If finishing an execution command started by a CLI command, or any kind of breakpoint-like event triggered, print the stop event to the output (CLI) stream. * mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler. 2014-05-21 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdb.mi/mi-cli.exp (line_callee4_next_step): New global. (top level): Test that output related to execution commands is sent to the console with CLI commands, but not with MI commands. Test that breakpoint events are always mirrored to the console. Also expect the new source line to be output after a "next" in async mode too. Make it a pass/fail test. * gdb.mi/mi-solib.exp: Test that the CLI solib event note is output. * lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
2014-05-21PR gdb/13860: make -interpreter-exec console "list" behave more like "list".Pedro Alves11-23/+197
I noticed that "list" behaves differently in CLI vs MI. Particularly: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done. (gdb) start Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62. Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62 62 callee1 (2, "A string argument.", 3.5); (gdb) list 57 { 58 } 59 60 main () 61 { 62 callee1 (2, "A string argument.", 3.5); 63 callee1 (2, "A string argument.", 3.5); 64 65 do_nothing (); /* Hello, World! */ 66 (gdb) Note the list started at line 57. IOW, the program stopped at line 62, and GDB centered the list on that. compare with: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..." ~"done.\n" (gdb) start &"start\n" ... ~"\nTemporary breakpoint " ~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n" ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0" =breakpoint-deleted,id="1" (gdb) -interpreter-exec console list ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" ~"63\t callee1 (2, \"A string argument.\", 3.5);\n" ~"64\t\n" ~"65\t do_nothing (); /* Hello, World! */\n" ~"66\t\n" ~"67\t callme (1);\n" ~"68\t callme (2);\n" ~"69\t\n" ~"70\t return 0;\n" ~"71\t}\n" ^done (gdb) Here the list starts at line 62, where the program was stopped. This happens because print_stack_frame, called from both normal_stop and mi_on_normal_stop, is the function responsible for setting the current sal from the selected frame, overrides the PRINT_WHAT argument, and only after that does it decide whether to center the current sal line or not, based on the overridden value, and it will always decide false. (The print_stack_frame call in mi_on_normal_stop is a little different from the call in normal_stop, in that it is an unconditional SRC_AND_LOC call. A future patch will make those uniform.) A previous version of this patch made MI uniform with CLI here, by making print_stack_frame also center when MI is active. That changed the output of a "list" command in mi-cli.exp, to expect line 57 instead of 62, as per the example above. However, looking deeper, that list in question is the first "list" after the program stops, and right after the stop, before the "list", the test did "set listsize 1". Let's try the same thing with the CLI: (gdb) start 62 callee1 (2, "A string argument.", 3.5); (gdb) set listsize 1 (gdb) list 57 { Huh, that's unexpected. Why the 57? It's because print_stack_frame, called in reaction to the breakpoint stop, expecting the next "list" to show 10 lines (the listsize at the time) around line 62, sets the lines listed range to 57-67 (62 +/- 5). If the user changes the listsize before "list", why would we still show that range? Looks bogus to me. So the fix for this whole issue should be delay trying to center the listing to until actually listing, so that the correct listsize can be taken into account. This makes MI and CLI uniform too, as it deletes the center code from print_stack_frame. A series of tests are added to list.exp to cover this. mi-cli.exp was after all correct all along, but it now gains an additional test that lists lines with listsize 10, to ensure the centering is consistent with CLI's. One related Python test changed related output -- it's a test that prints the line number after stopping for a breakpoint, similar to the new list.exp tests. Previously we'd print the stop line minus 5 (due to the premature centering), now we print the stop line. I think that's a good change. Tested on x86_64 Fedora 20. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Handle the first "list" after the current source line having changed. * frame.h (set_current_sal_from_frame): Remove 'center' parameter. * infrun.c (normal_stop): Adjust call to set_current_sal_from_frame. * source.c (clear_lines_listed_range): New function. (set_current_source_symtab_and_line, identify_source_line): Clear the lines listed range. (line_info): Handle the first "info line" after the current source line having changed. * stack.c (print_stack_frame): Remove center handling. (set_current_sal_from_frame): Remove 'center' parameter. Don't center sal.line. gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.base/list.exp (build_pattern, test_list): New procedures. Use them to test variations of "list" after reaching a breakpoint. * gdb.mi/mi-cli.exp (line_main_callme_2): New global. Test "list" with listsize 10 after reaching a breakpoint. * gdb.python/python.exp (decode_line current location line number): Adjust expected line number.
2014-05-21fix file names in earlier checkinDoug Evans1-4/+4
2014-05-21Revert "Fix argument passing in mi_run_cmd_full"Simon Marchi2-12/+6
This reverts commit 8c217a4b684386aa5ce6a078dffbe63265a524e6. Following this https://sourceware.org/ml/gdb-patches/2014-05/msg00462.html I suggest reverting my previous commit. I will follow with another patch to add comments, to clarify some things as stated in the mail thread. I ran make check with on gdb.mi, and the test that the commit broke passes again. gdb/testsuite/ChangeLog: 2014-05-21 Simon Marchi <simon.marchi@ericsson.com> * lib/mi-support.exp (mi_run_cmd_full): Revert to original behavior for $args, pass it directly to "run".
2014-05-21Native targets: Add inf-child.c:inf_child_mourn_inferior and use it.Pedro Alves9-13/+29
Most ports do the same thing in the tail of their mourn routine - call generic_mourn_inferior+inf_child_maybe_unpush_target. This factors that out to a convenience function. More could be done, but this converts only the really obvious ones. Tested by building GDB on x86_64 Fedora 20, mingw32 and djgpp. The rest is untested, but I think a patch can't get more obvious. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * inf-child.c (inf_child_mourn_inferior): New function. * inf-child.h (inf_child_mourn_inferior): New declaration. * darwin-nat.c (darwin_mourn_inferior): Use inf_child_mourn_inferior. * gnu-nat.c (gnu_mourn_inferior): Likewise. * inf-ptrace.c (inf_ptrace_mourn_inferior): Likewise. * inf-ttrace.c (inf_ttrace_mourn_inferior): Likewise. * nto-procfs.c (procfs_mourn_inferior): Likewise. * windows-nat.c (windows_mourn_inferior): Likewise.
2014-05-21gdb/testsuite: Bump up `match_max'Maciej W. Rozycki2-2/+8
This fixes: PASS: gdb.base/info-macros.exp: info macro -a -- FOO ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros 2 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros 3 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros 4 FAIL: gdb.base/info-macros.exp: info macros *$pc ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: next FAIL: gdb.base/info-macros.exp: info macros ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: next FAIL: gdb.base/info-macros.exp: info macros 6 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: next FAIL: gdb.base/info-macros.exp: info macros 7 ERROR: internal buffer is full. UNRESOLVED: gdb.base/info-macros.exp: info macros info-macros.c:42 (PRMS gdb/NNNN) with the arm-eabi target tested on the i686-mingw32 host where GCC defines enough macros to exhaust expect's 30000 characters of buffer space. * lib/gdb.exp (default_gdb_init): Bump `match_max' up from 30000 to 65536.