From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3446 invoked by alias); 2 Aug 2013 18:34:33 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 3428 invoked by uid 306); 2 Aug 2013 18:34:33 -0000 Date: Fri, 02 Aug 2013 18:34:00 -0000 Message-ID: <20130802183433.3325.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] tromey/always-async: enable target-async X-Git-Refname: refs/heads/tromey/always-async X-Git-Reftype: branch X-Git-Oldrev: 7888e8b09d4b4c1e746c1d82e00dcb555ac76d45 X-Git-Newrev: e661149db1db5d426ea9b9c257b694d9c54293a4 X-SW-Source: 2013-q3/txt/msg00018.txt.bz2 List-Id: The branch, tromey/always-async has been updated discards 7888e8b09d4b4c1e746c1d82e00dcb555ac76d45 (commit) discards d45b5606f6db5ab35f02ac977651d73823f8694a (commit) discards 262870ca15ddfeda3b65da97b9fdcd12357d30f3 (commit) discards ff151c706279c3f1b637b52bb58ecef1cf94fbf2 (commit) discards fcdad5ed9365533ddee3ef4dfb2cf4b8204512b7 (commit) discards 029969c02352d7be222bc799b7f6a597a9bd4dce (commit) discards 3f4e17be3ed3ef2eeb45cdd5feb01e749a138e66 (commit) discards 719746031c2cbb0a9f6c4d5118ff1297062540fa (commit) discards e01dcfc09f68077efce58475486cf80a1ae4fff5 (commit) discards 0ba707dcf38b2602eb1b90d40e98498d47e3625a (commit) via e661149db1db5d426ea9b9c257b694d9c54293a4 (commit) via 285ca28b05b09b50708a1d6a058d5517bac2bdca (commit) via bbdff0bfa4d0e503cb996ab3ff316edc5c446045 (commit) via 2877f9998b7eb932033050a55d17f811ddf172e2 (commit) via a2bbddf105ebdeab5044757de1ae40210d752539 (commit) via 13ea390d0768caa9777b96aa6059ab3234eb9b97 (commit) via fd963a4bf4136df0648be597e86467871807f9d4 (commit) via e5833629099527896ace6151e47cb8ba76195171 (commit) via c4f717e32f7cfdad7472dc8ed2f47105875f23cc (commit) via 17182bb5487760d28ed38f35d438df86cea2a0de (commit) via f481f474696ffbf874d1f9c97371e7bfcb6a47b3 (commit) via cb81ffd4f1c415b1f7f6ebce3a11d2b6777a02f2 (commit) via 6ae209793c817f943940a4a0f0da1c4d4ba15003 (commit) via 9581d55eeddac9d2d965c62c345991e138f27ccb (commit) via cbb25189b69e501ddca64917d810b54bb1466c93 (commit) via 7f350588e9fa12457cc33814ec32f79e33f193bb (commit) via a82b41ab61a641afe650cdde1a70c8834fe6c8ff (commit) via 735c540f6b8b8a77af01e7c324c0fb267005ffb8 (commit) via 20906da825104f6638a8452eb79ff9be60162e32 (commit) via c90923c3d3bb0c723e7060888c5034f24c8cd139 (commit) via 57cff626eb477c651122001df4f7f626e0c90568 (commit) via 93be37415c8e18dd27cfc6a601ebc8c2f9622586 (commit) via c05949d07b2011170e72443c5b21ae43f35e99d4 (commit) via 9e845f3a1ecdb854b114bcf26ab64c24c10a9f2e (commit) via 679592fa11267d1e95e52ad0a4761b0bd8fa66dd (commit) via d18d79ffd1a573842d30cf062ba1fc6ed544644e (commit) via a1269d2a9a983622bbfcaa31206b78d165f18b18 (commit) via 5339a63aa3d9196b38789e8094dca5697967d81e (commit) via edaf879a2211e21ffc722b29ae85d1bd7cf51711 (commit) via 6e5c95e6cf1e3c37bd3a822ca9e6721caab97a85 (commit) via dd7ddfa96a2afe14e3144d3a869ef0d30c4311fb (commit) via 3e802ea78f3efbd04ef273ed75a4f24a9aeca23a (commit) via b777aa6cb360fa6ea341954bd070e59be27f7357 (commit) via 71e62cdb4bd587906a4b949a14fd6c73c865c6cb (commit) via cc734a965e0b979c2386dcb07b9c330e12dd168e (commit) via a6eb4d5106bff31cfde208f0d2eb919038c6e0e4 (commit) via 23633161a39d81e9dc3249d393034b9cbd393acd (commit) via 45bee3e492b91db8ab00e333f7a00c12aabe0c50 (commit) via aaef7abe463aa2f70b5a001d8a9753740c656e50 (commit) via 860f76d89149da5b24df88fb822be50824114885 (commit) via fe870957318b688c9f8788863a3447a88262f3d5 (commit) via 19dbd794eaea44916da1de106ae42a5d1e4523e0 (commit) via 52f87c6e3e23b032c4c50f251e5347089164f438 (commit) via 292fb5e98d0f74e4bd9e7374155e27fe438080a1 (commit) via 27e287614ca92a26d3873f90d4b8296fb6448b47 (commit) via 75cec15187a953fc66ba491774dbb872fa3910d1 (commit) via 81011583e35c192b1aabbc66495dbba622910dfd (commit) via 0b2b5f7374a6cf5d113379ee91c418df18f15308 (commit) via dad15ffb0ef559eb8b4368dec1cd232d2537ef75 (commit) via abc98afe7bd6df63f0de02867a06669b21c93efb (commit) via 8c570d909765a5fdf9dd60b222ca962944e886e8 (commit) from 7888e8b09d4b4c1e746c1d82e00dcb555ac76d45 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit e661149db1db5d426ea9b9c257b694d9c54293a4 Author: Tom Tromey Date: Wed Jul 3 10:11:58 2013 -0600 enable target-async This enables target-async by default. Unlike the CLI, MI chose to treat target-async specially -- setting it changes the default behavior of commands. So, we can't get rid of the option. Instead we have to make it MI-only. The hardest part of this patch, to my surprise, was getting the MI prompt to work properly. It was reasonably easy, and clean, to get close to what the test suite expects; but to fix the last remaining failure (mi-async.exp), I had to resort to a hack. It seems to me that the MI grammar was never updated to account for changes implied by async. Perhaps some future MI can dispense with the prompt entirely. Built and regtested on x86-64 Fedora 18. * infrun.c (set_observer_mode): Don't set target_async_permitted. * linux-nat.c (linux_nat_is_async_p): Always return 1. (linux_nat_can_async_p): Likewise. * mi/mi-interp.c (mi_interpreter_prompt_p): Maybe print the MI prompt. (mi_cmd_interpreter_exec): Set mi_last_was_cli. (mi_execute_command_input_handler): Conditionally print prompt. (mi_on_resume): Check sync_execution before printing prompt. * mi/mi-main.h (mi_last_was_cli): Declare. * mi/mi-main.c (mi_last_was_cli): New global. (mi_target_can_async_p): New function. (exec_continue): Maybe call async_disable_stdin. (run_one_inferior, mi_cmd_exec_run, mi_cmd_list_target_features): Use mi_target_can_async_p. (captured_mi_execute_command): Clear mi_last_was_cli. (mi_execute_async_cli_command): Use mi_target_can_async_p. * remote.c (remote_open_1, remote_terminal_inferior) (remote_terminal_ours, remote_can_async_p, remote_is_async_p): Don't check target_async_permitted. * gdb.texinfo (Non-Stop Mode): Remove "set target-async 1" from example. (Background Execution): Move target-async docs... (Asynchronous and non-stop modes): ... here. Rewrite to MI form. * gdb.mi/mi-cli.exp: Don't check "$async". commit 285ca28b05b09b50708a1d6a058d5517bac2bdca Author: Tom Tromey Date: Mon Jul 8 10:23:33 2013 -0600 fix py-finish-breakpoint.exp with always-async With target async enabled, py-finish-breakpoint.exp will trigger an assertion failure. The failure occurs because execute_command re-enters the event loop in some circumstances, and in this case resets the sync_execution flag. Then later gdb reaches this assertion in normal_stop: gdb_assert (sync_execution || !target_can_async_p ()); execute_command has a comment explaining why it dispatches events: /* If the interpreter is in sync mode (we're running a user command's list, running command hooks or similars), and we just ran a synchronous command that started the target, wait for that command to end. */ However, the code did not follow this comment -- it didn't check to see if the command started the target, just whether the target was executing a sync command at this point. This patch fixes the problem by noting whether the target was executing in sync_execution mode before running the command, and then augmenting the condition to test this as well. Built and regtested on x86-64 Fedora 18. * top.c (execute_command): Only dispatch events if command started target. commit bbdff0bfa4d0e503cb996ab3ff316edc5c446045 Author: Tom Tromey Date: Mon Jul 8 09:41:57 2013 -0600 make dprintf.exp pass in always-async mode When target-async is enabled, dprintf.exp fails. This happens because run_inferior_call causes gdb to forget that it is running in sync_execution mode, so something like a breakpoint condition that makes an inferior call causes gdb to enter fully async mode. This patch fixes the problem by noticing when gdb was in sync_execution mode in run_inferior_call, and taking care to restore this state afterward. Built and regtested on x86-64 Fedora 18. PR cli/15718: * infcall.c: Include event-top.h. (run_inferior_call): Call async_disable_stdin if needed. commit 2877f9998b7eb932033050a55d17f811ddf172e2 Author: Pedro Alves Date: Wed May 9 14:07:04 2012 +0100 PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s 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. That's what this patch does. 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 I added. Tested on x86_64 Fedora 16, no regressions. 2012-05-09 Pedro Alves 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): In async mode, 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. gdb/testsuite/ * gdb.mi/mi-cli.exp: Also expect the new source line to be output after a "next", in async mode. Make it a pass/fail test. * gdb.mi/mi-solib.exp: Test that the CLI solib event note is output. commit a2bbddf105ebdeab5044757de1ae40210d752539 Author: Pedro Alves Date: Wed May 9 14:10:30 2012 +0100 PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output. Part of PR gdb/13860 is about the mi-solib.exp test's output being different in sync vs async modes. sync: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) &"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="17724" =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",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3" (gdb) async: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async on" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) 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="17729" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" =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" (gdb) *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1" For now, let's focus only on the *stopped event. We see that the async output is missing frame info. And this causes a test failure in async mode, as "mi_expect_stop solib-event" wants to see the frame info. However, if we compare the event output when a real MI execution command is used, compared to a CLI command (e.g., run vs -exec-run, next vs -exec-next, etc.), we see: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) r &"r\n" ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="17751" =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",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3" (gdb) -exec-run =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1" =library-unloaded,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",thread-group="i1" =thread-group-started,id="i1",pid="17754" =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,reason="solib-event",thread-id="1",stopped-threads="all",core="1" =thread-selected,id="1" (gdb) As seen above, with MI commands, the *stopped event _doesn't_ have frame info. This is because normal_stop, as commanded by the result of bpstat_print, skips printing frame info in this case (it's an "event", not a "breakpoint"), and when the interpreter is MI, mi_on_normal_stop skips calling print_stack_frame, as the normal_stop call was already done with the MI uiout. This explains why the async output is different even with a CLI command. Its because in async mode, the mi_on_normal_stop path is always taken; it is always reached with the MI uiout, because the stop is handled from the event loop, instead of from within `proceed -> wait_for_inferior -> normal_stop' with the interpreter overridden, as in sync mode. This patch fixes the issue by making all cases output the same *stopped event, by factoring out the print code from normal_stop, and using it from mi_on_normal_stop as well. I chose the *stopped output without a frame, mainly because that is what you already get if you use MI execution commands, the commands frontends are supposed to use (except when implementing a console). This patch makes it simpler to tweak the MI output differently if desired, as we only have to change the centralized print_stop_event (taking into account whether the uiout is MI-like), and all different modes will change accordingly. Tested on x86_64 Fedora 16, no regressions. The mi-solib.exp test no longer fails in async mode with this patch, so the patch removes the kfail. 2012-05-09 Pedro Alves PR gdb/13860 gdb/ * inferior.h (print_stop_event): Declare. * infrun.c (print_stop_event): New, factored out from ... (normal_stop): ... this. * mi/mi-interp.c (mi_on_normal_stop): Use print_stop_event instead of bpstat_print/print_stack_frame. gdb/testsuite/ * gdb.mi/mi-solib.exp: Remove gdb/13860 kfail. * lib/mi-support.exp (mi_expect_stop): Add special handling for solib-event. commit 13ea390d0768caa9777b96aa6059ab3234eb9b97 Author: Pedro Alves Date: Wed May 9 17:28:12 2012 +0100 PR gdb/13860: make -interpreter-exec console "list" behave more like "list". Patch 3 in this series made me notice 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" ~"Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x000000000040054d",func="main",file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli \n" =thread-group-started,id="i1",pid="14221" =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" =library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name="/lib64/libm.so.6",symbols-loaded="0",thread-group="i1" =library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="/lib64/libc.so.6",symbols-loaded="0",thread-group="i1" =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x000000000040054d",func="main",file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62",times="1",original-location="main"} ~"\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 overriden 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. The next patch will make those uniform.) Tested on x86_64 Fedora 16, no regressions. gdb/ 2012-05-09 Pedro Alves * stack.c (print_stack_frame): Compute CENTER before overriding PRINT_WHAT. gdb/testsuite/ 2012-05-09 Pedro Alves * gdb.mi/mi-cli.exp: Adjust expected output of "list". commit fd963a4bf4136df0648be597e86467871807f9d4 Author: Tom Tromey Date: Tue Jul 30 10:36:07 2013 -0600 add "this" pointers to more target APIs commit e5833629099527896ace6151e47cb8ba76195171 Author: Tom Tromey Date: Fri Jul 12 13:00:34 2013 -0600 add target method delegation This patch replaces some code in the record targets with target method delegation. Right now there are two latent problems in the record target. First, record-full.c stores pointers to many target methods when the record target is pushed. Then it later delegates some calls via these. This is wrong because it violates the target stack contract. In particular it is ok to unpush a target at any stratum, but record-full does not keep track of this, so it could potentially call into an unpushed target. Second, RECORD_IS_USED and some other spots look at current_target.to_stratum to determine whether a record target is in use. This is bad because arch_stratum is greater than record_stratum. To fix the first problem, this patch introduces a handful of target_delegate_* functions, which forward calls further down the target stack. To fix the second problem, this patch adds find_target_at to determine whether a target appears at a given stratum. This may seem like overkill somehow, but I have a subsequent patch series (see archer.git tromey/multi-target) that uses it more heavily. * record-full.c (record_full_beneath_to_resume_ops) (record_full_beneath_to_resume, record_full_beneath_to_wait_ops) (record_full_beneath_to_wait) (record_full_beneath_to_store_registers_ops) (record_full_beneath_to_store_registers) (record_full_beneath_to_xfer_partial_ops) (record_full_beneath_to_xfer_partial) (record_full_beneath_to_insert_breakpoint) (record_full_beneath_to_remove_breakpoint) (record_full_beneath_to_stopped_by_watchpoint) (record_full_beneath_to_stopped_data_address) (record_full_beneath_to_async, tmp_to_resume_ops, tmp_to_resume) (tmp_to_wait_ops, tmp_to_wait, tmp_to_store_registers_ops) (tmp_to_store_registers, tmp_to_xfer_partial_ops) (tmp_to_xfer_partial, tmp_to_insert_breakpoint) (tmp_to_remove_breakpoint, tmp_to_stopped_by_watchpoint) (tmp_to_stopped_data_address, tmp_to_async): Remove. (record_full_open_1, record_full_open): Update. Use RECORD_IS_USED. (record_full_resume, record_full_wait_1) (record_full_stopped_by_watchpoint, record_full_stopped_data_address) (record_full_store_registers, record_full_xfer_partial) (record_full_insert_breakpoint, record_full_remove_breakpoint) (record_full_async, record_full_can_async_p, record_full_is_async_p) (record_full_core_xfer_partial): Use target delegation. * record.c (find_record_target): Use find_target_at. * record.h (RECORD_IS_USED): Use find_target_at. * target.c (update_current_target): Use target_delegate_xfer_partial. (target_delegate_xfer_partial): Now public. Renamed from... (current_xfer_partial): ...this. Remove. (target_delegate_async, target_delegate_is_async_p) (target_delegate_can_async_p, target_delegate_insert_breakpoint) (target_delegate_remove_breakpoint, target_delegate_wait) (target_delegate_resume, find_target_at) (target_delegate_store_registers) (target_delegate_stopped_by_watchpoint) (target_delegate_stopped_data_address): New functions. * target.h (target_delegate_async, target_delegate_is_async_p) (target_delegate_can_async_p, target_delegate_insert_breakpoint) (target_delegate_remove_breakpoint, target_delegate_wait) (target_delegate_resume, find_target_at) (target_delegate_store_registers) (target_delegate_stopped_by_watchpoint) (target_delegate_stopped_data_address) (target_delegate_xfer_partial): Declare. commit c4f717e32f7cfdad7472dc8ed2f47105875f23cc Author: Tom Tromey Date: Tue Jul 9 09:48:09 2013 -0600 fix latent bugs in ui-out.c The destructor code in ui-out.c has a latent bug, which is hidden by the fact that nothing uses this right now. This patch fixes the problem. The bug is that we don't always clear a pointer in the ui-out object, leading to bad a free. * ui-out.c (clear_table, ui_out_new): Clear uiout->table.id. commit 17182bb5487760d28ed38f35d438df86cea2a0de Author: Tom Tromey Date: Tue Jul 30 09:22:07 2013 -0600 add README.archer commit f481f474696ffbf874d1f9c97371e7bfcb6a47b3 Author: Tom Tromey Date: Fri Aug 2 16:41:07 2013 +0000 fix PR symtab/15719 This patch fixes PR symtab/15719. The bug is that "watch -location" crashes on a certain expression. The problem is that fetch_subexp_value is catching an exception. For ordinary watchpoints this is ok; but for location watchpoints, it is better for the exception to propagate. Built and regtested on x86-64 Fedora 18. New test case included. PR symtab/15719: * breakpoint.c (update_watchpoint, watchpoint_check) (watch_command_1): Update. * eval.c (fetch_subexp_value): Add "preserve_errors" parameter. * ppc-linux-nat.c (check_condition): Update. * value.h (fetch_subexp_value): Update. * gdb.base/watchpoint.c (struct foo5): New. (nullptr): New global. * gdb.base/watchpoint.exp (test_watch_location): Add test. ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 6 + bfd/elf32-arm.c | 15 +- bfd/version.h | 2 +- gdb/ChangeLog | 163 + gdb/breakpoint.c | 6 +- gdb/cli/cli-interp.c | 1 - gdb/cli/cli-script.c | 3 - gdb/dwarf2read.c | 256 +- gdb/eval.c | 18 +- gdb/exceptions.c | 22 - gdb/exceptions.h | 5 - gdb/linespec.c | 61 +- gdb/main.c | 6 +- gdb/mi/mi-cmd-stack.c | 79 +- gdb/mi/mi-interp.c | 18 +- gdb/mi/mi-main.c | 2 + gdb/monitor.c | 2 +- gdb/nto-procfs.c | 2 +- gdb/ppc-linux-nat.c | 4 +- gdb/remote-fileio.c | 2 +- gdb/remote-mips.c | 20 +- gdb/remote.c | 4 +- gdb/symtab.c | 196 +- gdb/symtab.h | 8 +- gdb/target.c | 2 +- gdb/testsuite/ChangeLog | 60 + gdb/testsuite/gdb.base/func-ptr.c | 30 + gdb/testsuite/gdb.base/func-ptr.exp | 30 + gdb/testsuite/gdb.base/setshow.exp | 31 +- gdb/testsuite/gdb.base/watchpoint.c | 7 + gdb/testsuite/gdb.base/watchpoint.exp | 3 + gdb/testsuite/gdb.dwarf2/fission-mix.c | 33 + gdb/testsuite/gdb.dwarf2/fission-mix.exp | 46 + gdb/testsuite/gdb.dwarf2/fission-mix.h | 23 + gdb/testsuite/gdb.dwarf2/fission-mix2.c | 27 + gdb/testsuite/gdb.dwarf2/pieces-optimized-out.S | 548 ++++ gdb/testsuite/gdb.dwarf2/pieces-optimized-out.c | 47 + gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp | 50 + gdb/testsuite/gdb.python/py-sync-interp.c | 46 + gdb/testsuite/gdb.python/py-sync-interp.exp | 59 + gdb/testsuite/gdb.trace/backtrace.exp | 92 +- gdb/top.c | 19 +- gdb/tracepoint.c | 6 + gdb/utils.c | 10 +- gdb/utils.h | 8 - gdb/valops.c | 4 +- gdb/value.c | 10 +- gdb/value.h | 3 +- include/opcode/ChangeLog | 32 + include/opcode/mips.h | 193 +- opcodes/ChangeLog | 73 + opcodes/micromips-opc.c | 1455 +++++----- opcodes/mips-dis.c | 16 +- opcodes/mips-opc.c | 3408 ++++++++++----------- opcodes/mips16-opc.c | 381 ++-- opcodes/ppc-dis.c | 39 +- 56 files changed, 4515 insertions(+), 3177 deletions(-) create mode 100644 gdb/testsuite/gdb.base/func-ptr.c create mode 100644 gdb/testsuite/gdb.base/func-ptr.exp create mode 100644 gdb/testsuite/gdb.dwarf2/fission-mix.c create mode 100644 gdb/testsuite/gdb.dwarf2/fission-mix.exp create mode 100644 gdb/testsuite/gdb.dwarf2/fission-mix.h create mode 100644 gdb/testsuite/gdb.dwarf2/fission-mix2.c create mode 100644 gdb/testsuite/gdb.dwarf2/pieces-optimized-out.S create mode 100644 gdb/testsuite/gdb.dwarf2/pieces-optimized-out.c create mode 100644 gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp create mode 100644 gdb/testsuite/gdb.python/py-sync-interp.c create mode 100644 gdb/testsuite/gdb.python/py-sync-interp.exp First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 62cb270..3df9e8e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2013-07-31 John Tytgat + + PR ld/15787 + * elf32-arm.c (elf32_arm_final_link_relocate): Base SB on the + output section VMA. + 2013-07-28 Maciej W. Rozycki * elf64-hppa.c (elf64_hppa_finish_dynamic_sections) diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 8f88839..4616ae9 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -9852,10 +9852,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_vma insn = bfd_get_32 (input_bfd, hit_data); bfd_vma pc = input_section->output_section->vma + input_section->output_offset + rel->r_offset; - /* sb should be the origin of the *segment* containing the symbol. - It is not clear how to obtain this OS-dependent value, so we - make an arbitrary choice of zero. */ - bfd_vma sb = 0; + /* sb is the origin of the *segment* containing the symbol. */ + bfd_vma sb = sym_sec->output_section->vma; bfd_vma residual; bfd_vma g_n; bfd_signed_vma signed_value; @@ -9988,7 +9986,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_vma insn = bfd_get_32 (input_bfd, hit_data); bfd_vma pc = input_section->output_section->vma + input_section->output_offset + rel->r_offset; - bfd_vma sb = 0; /* See note above. */ + /* sb is the origin of the *segment* containing the symbol. */ + bfd_vma sb = sym_sec->output_section->vma; bfd_vma residual; bfd_signed_vma signed_value; int group = 0; @@ -10071,7 +10070,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_vma insn = bfd_get_32 (input_bfd, hit_data); bfd_vma pc = input_section->output_section->vma + input_section->output_offset + rel->r_offset; - bfd_vma sb = 0; /* See note above. */ + /* sb is the origin of the *segment* containing the symbol. */ + bfd_vma sb = sym_sec->output_section->vma; bfd_vma residual; bfd_signed_vma signed_value; int group = 0; @@ -10154,7 +10154,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_vma insn = bfd_get_32 (input_bfd, hit_data); bfd_vma pc = input_section->output_section->vma + input_section->output_offset + rel->r_offset; - bfd_vma sb = 0; /* See note above. */ + /* sb is the origin of the *segment* containing the symbol. */ + bfd_vma sb = sym_sec->output_section->vma; bfd_vma residual; bfd_signed_vma signed_value; int group = 0; diff --git a/bfd/version.h b/bfd/version.h index 3740357..2cabd26 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20130729 +#define BFD_VERSION_DATE 20130802 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 519e488..af34dec 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,166 @@ +2013-08-02 Tom Tromey + + PR symtab/15719: + * breakpoint.c (update_watchpoint, watchpoint_check) + (watch_command_1): Update. + * eval.c (fetch_subexp_value): Add "preserve_errors" + parameter. + * ppc-linux-nat.c (check_condition): Update. + * value.h (fetch_subexp_value): Update. + +2013-08-02 Andrew Burgess + + * mi/mi-interp.c (mi_interpreter_resume): Remove call to + add_file_handler. + +2013-08-01 Doug Evans + + PR symtab/15691 + * dwarf2read.c (struct dwarf2_per_cu_data): New member tu_read. + (fill_in_sig_entry_from_dwo_entry): Reorganize asserts. + Add assert of sig_entry->dwo_unit == NULL. + (lookup_dwo_signatured_type): Don't assign TU to a DWO if the TU + had already been read. + (read_signatured_type): Set per_cu.tu_read. + + PR symtab/15695 + * valops.c (value_struct_elt): Add missing call to check_typedef. + (value_find_oload_method_list): Ditto. + + * symtab.c (do_free_search_symbols_cleanup): Change arg to, + effectively, struct symbol_search **. + (make_cleanup_free_search_symbols): Change arg to struct + symbol_search **. All callers updated. + (compare_search_syms): Compare symtab file name and block as well. + (search_symbols_equal): New function. + (sort_search_symbols_remove_dups): Renamed from sort_search_symbols. + New args new_head, new_tail. Result is now void. Remove dups after + sorting the symbols. + (search_symbols): Sort all found symbols once, after all have been + found, and remove duplicates. Simplify cleanup tracking of result. + * symtab.h (make_cleanup_free_search_symbols): Update prototype. + + Further workarounds for binutils/15021. + * dwarf2read.c (recursively_compute_inclusions): Change type of result + parameter to VEC (symtab_ptr) **. New parameter all_type_symtabs. + Watch for duplicate symtabs coming from type units. + (compute_symtab_includes): Update call to + recursively_compute_inclusions. Build vector of included symtabs + instead of per_cus. + * symtab.h (symtab_ptr): New typedef. + (DEF_VEC_P (symtab_ptr)): New VEC type. + * linespec.c (symtab_p): Delete. All uses updated to use symtab_ptr + instead. + +2013-08-01 Andrew Burgess + + * cli/cli-script.c (script_from_file): Remove use of + error_pre_print. + * main.c (captured_main): Remove use of error_pre_print and + quit_pre_print. + * utils.c (error_pre_print, quit_pre_print): Remove. + * utils.h (error_pre_print, quit_pre_print): Likewise. + +2013-08-01 Yao Qi + + * mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Parse argv + with mi_getopt. + (mi_cmd_stack_list_variables): Likewise. + +2013-07-31 Andrew Burgess + + * exceptions.c (deprecated_throw_reason): Remove. + * exceptions.h (deprecated_throw_reason): Remove. + +2013-07-31 Andrew Burgess + + * remote-mips.c (mips_error): Replace use of + deprecated_throw_reason with throw_verror. Use the error message + passed to mips_error as the error message for throw_verror. + +2013-07-31 Andrew Burgess + + * monitor.c (monitor_interrupt_query): Replace use of + deprecated_throw_reason with quit. + * nto-procfs.c (interrupt_query): Likewise. + * remote-fileio.c (remote_fileio_sig_exit): Likewise. + * remote-mips.c (mips_kill): Likewise. + * remote.c (interrupt_query): Likewise. + +2013-07-31 Andrew Burgess + + * utils.c (internal_verror): Replace use of deprecated_throw_reason + with call to fatal. + +2013-07-31 Pedro Alves + Yao Qi + + * tracepoint.c (trace_dump_command): Select the current frame. + +2013-07-30 Doug Evans + + * dwarf2read.c (process_queue): Add type signature to debug output. + +2013-07-30 Andrew Burgess + + * value.c (value_fetch_lazy): Mark optimized out values as such + rather than raising an error. + +2013-07-30 Andrew Burgess + + * value.c (value_fetch_lazy): Ensure parent value is not lazy + before checking which bits of the parent, not the child, value are + valid. + +2013-07-30 Muhammad Bilal + + PR gdb/15715 + * top.c: Include "filenames.h". + (set_history_filename): New function. + (init_main): Install it as set hook of the "set history filename" + command. + +2013-07-30 Sanimir Agovic + + * dwarf2read.c (dwarf2_get_ref_die_offset): Constify struct + attribute parameter. + (dwarf2_const_value_data): Constify struct attribute parameter. + (dwarf2_const_value): Constify struct attribute parameter. + (dwarf2_const_value_attr): Constify struct attribute parameter. + (lookup_die_type): Constify struct attribute parameter. + (dwarf2_get_attr_constant_value): Constify struct attribute parameter. + (follow_die_ref_or_sig): Constify struct attribute parameter. + (follow_die_ref): Constify struct attribute parameter. + (follow_die_sig): Constify struct attribute parameter. + (get_DW_AT_signature_type): Constify struct attribute parameter. + (get_type_unit_group): Constify struct attribute parameter. + (fill_in_loclist_baton): Constify struct attribute parameter. + (dwarf2_symbol_mark_computed): Constify struct attribute parameter. + (type_unit_group): Constify struct attribute parameter. + +2013-07-30 Sanimir Agovic + + * dwarf2read.c (attr_form_is_block): Make argument const. + (attr_form_is_section_offset): Make argument const. + (attr_form_is_constant): Make argument const. + (attr_form_is_ref): Make argument const. + +2013-07-30 Sanimir Agovic + + * dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref. + All uses updated. + (attr_form_is_ref): Moved below attr_form_is_constant. + +2013-07-29 Doug Evans + + * main.c (captured_command_loop): Tweak comment. + + * target.c (target_async_permitted_1): Fix comment. + + * symtab.c (iterate_over_some_symtabs): Add comment. + + * symtab.c (iterate_over_some_symtabs): Fix indentation. + 2013-07-27 Yao Qi * NEWS: Mention that GDBserver now supports hardware diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 1e89407..eec7b7c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1807,7 +1807,7 @@ update_watchpoint (struct watchpoint *b, int reparse) struct value *val_chain, *v, *result, *next; struct program_space *frame_pspace; - fetch_subexp_value (b->exp, &pc, &v, &result, &val_chain); + fetch_subexp_value (b->exp, &pc, &v, &result, &val_chain, 0); /* Avoid setting b->val if it's already set. The meaning of b->val is 'the last value' user saw, and we should update @@ -4822,7 +4822,7 @@ watchpoint_check (void *p) return WP_VALUE_CHANGED; mark = value_mark (); - fetch_subexp_value (b->exp, &pc, &new_val, NULL, NULL); + fetch_subexp_value (b->exp, &pc, &new_val, NULL, NULL, 0); /* We use value_equal_contents instead of value_equal because the latter coerces an array to a pointer, thus comparing just @@ -11010,7 +11010,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty, exp_valid_block = innermost_block; mark = value_mark (); - fetch_subexp_value (exp, &pc, &val, &result, NULL); + fetch_subexp_value (exp, &pc, &val, &result, NULL, just_location); if (just_location) { diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index ef1e65b..1003cc7 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -25,7 +25,6 @@ #include "top.h" /* for "execute_command" */ #include "gdb_string.h" #include "exceptions.h" -#include "target.h" struct ui_out *cli_uiout; diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index d35f42f..6ea3243 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -1636,9 +1636,6 @@ script_from_file (FILE *stream, const char *file) old_cleanups = make_cleanup (source_cleanup_lines, &old_lines); source_line_number = 0; source_file_name = file; - /* This will get set every time we read a line. So it won't stay "" - for long. */ - error_pre_print = ""; { volatile struct gdb_exception e; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 04993c2..cb77386 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -558,6 +558,16 @@ struct dwarf2_per_cu_data attributes in the stub. */ unsigned int reading_dwo_directly : 1; + /* Non-zero if the TU has been read. + This is used to assist the "Stay in DWO Optimization" for Fission: + When reading a DWO, it's faster to read TUs from the DWO instead of + fetching them from random other DWOs (due to comdat folding). + If the TU has already been read, the optimization is unnecessary + (and unwise - we don't want to change where gdb thinks the TU lives + "midflight"). + This flag is only valid if is_debug_types is true. */ + unsigned int tu_read : 1; + /* The section this CU/TU lives in. If the DIE refers to a DWO file, this is always the original die, not the DWO file. */ @@ -1452,10 +1462,10 @@ static struct symbol *new_symbol (struct die_info *, struct type *, static struct symbol *new_symbol_full (struct die_info *, struct type *, struct dwarf2_cu *, struct symbol *); -static void dwarf2_const_value (struct attribute *, struct symbol *, +static void dwarf2_const_value (const struct attribute *, struct symbol *, struct dwarf2_cu *); -static void dwarf2_const_value_attr (struct attribute *attr, +static void dwarf2_const_value_attr (const struct attribute *attr, struct type *type, const char *name, struct obstack *obstack, @@ -1476,7 +1486,7 @@ static void set_descriptive_type (struct type *, struct die_info *, static struct type *die_containing_type (struct die_info *, struct dwarf2_cu *); -static struct type *lookup_die_type (struct die_info *, struct attribute *, +static struct type *lookup_die_type (struct die_info *, const struct attribute *, struct dwarf2_cu *); static struct type *read_type_die (struct die_info *, struct dwarf2_cu *); @@ -1608,29 +1618,27 @@ static void dump_die_1 (struct ui_file *, int level, int max_level, static void store_in_ref_table (struct die_info *, struct dwarf2_cu *); -static int is_ref_attr (struct attribute *); - -static sect_offset dwarf2_get_ref_die_offset (struct attribute *); +static sect_offset dwarf2_get_ref_die_offset (const struct attribute *); -static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int); +static LONGEST dwarf2_get_attr_constant_value (const struct attribute *, int); static struct die_info *follow_die_ref_or_sig (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu **); static struct die_info *follow_die_ref (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu **); static struct die_info *follow_die_sig (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu **); static struct type *get_signatured_type (struct die_info *, ULONGEST, struct dwarf2_cu *); static struct type *get_DW_AT_signature_type (struct die_info *, - struct attribute *, + const struct attribute *, struct dwarf2_cu *); static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu); @@ -1638,7 +1646,7 @@ static void load_full_type_unit (struct dwarf2_per_cu_data *per_cu); static void read_signatured_type (struct signatured_type *); static struct type_unit_group *get_type_unit_group - (struct dwarf2_cu *, struct attribute *); + (struct dwarf2_cu *, const struct attribute *); static void build_type_unit_groups (die_reader_func_ftype *, void *); @@ -1651,17 +1659,19 @@ static struct die_info *dwarf_alloc_die (struct dwarf2_cu *, int); static void dwarf_decode_macros (struct dwarf2_cu *, unsigned int, const char *, int); -static int attr_form_is_block (struct attribute *); +static int attr_form_is_block (const struct attribute *); + +static int attr_form_is_section_offset (const struct attribute *); -static int attr_form_is_section_offset (struct attribute *); +static int attr_form_is_constant (const struct attribute *); -static int attr_form_is_constant (struct attribute *); +static int attr_form_is_ref (const struct attribute *); static void fill_in_loclist_baton (struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, - struct attribute *attr); + const struct attribute *attr); -static void dwarf2_symbol_mark_computed (struct attribute *attr, +static void dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu, int is_block); @@ -4443,11 +4453,7 @@ fill_in_sig_entry_from_dwo_entry (struct objfile *objfile, struct signatured_type *sig_entry, struct dwo_unit *dwo_entry) { - sig_entry->per_cu.section = dwo_entry->section; - sig_entry->per_cu.offset = dwo_entry->offset; - sig_entry->per_cu.length = dwo_entry->length; - sig_entry->per_cu.reading_dwo_directly = 1; - sig_entry->per_cu.objfile = objfile; + /* Make sure we're not clobbering something we don't expect to. */ gdb_assert (! sig_entry->per_cu.queued); gdb_assert (sig_entry->per_cu.cu == NULL); gdb_assert (sig_entry->per_cu.v.quick != NULL); @@ -4455,19 +4461,26 @@ fill_in_sig_entry_from_dwo_entry (struct objfile *objfile, gdb_assert (sig_entry->signature == dwo_entry->signature); gdb_assert (sig_entry->type_offset_in_section.sect_off == 0); gdb_assert (sig_entry->type_unit_group == NULL); + gdb_assert (sig_entry->dwo_unit == NULL); + + sig_entry->per_cu.section = dwo_entry->section; + sig_entry->per_cu.offset = dwo_entry->offset; + sig_entry->per_cu.length = dwo_entry->length; + sig_entry->per_cu.reading_dwo_directly = 1; + sig_entry->per_cu.objfile = objfile; sig_entry->type_offset_in_tu = dwo_entry->type_offset_in_tu; sig_entry->dwo_unit = dwo_entry; } /* Subroutine of lookup_signatured_type. - Create the signatured_type data structure for a TU to be read in - directly from a DWO file, bypassing the stub. - We do this for the case where there is no DWP file and we're using - .gdb_index: When reading a CU we want to stay in the DWO file containing - that CU. Otherwise we could end up reading several other DWO files (due - to comdat folding) to process the transitive closure of all the mentioned - TUs, and that can be slow. The current DWO file will have every type - signature that it needs. + If we haven't read the TU yet, create the signatured_type data structure + for a TU to be read in directly from a DWO file, bypassing the stub. + This is the "Stay in DWO Optimization": When there is no DWP file and we're + using .gdb_index, then when reading a CU we want to stay in the DWO file + containing that CU. Otherwise we could end up reading several other DWO + files (due to comdat folding) to process the transitive closure of all the + mentioned TUs, and that can be slow. The current DWO file will have every + type signature that it needs. We only do this for .gdb_index because in the psymtab case we already have to read all the DWOs to build the type unit groups. */ @@ -4496,8 +4509,13 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) sig_entry = htab_find (dwarf2_per_objfile->signatured_types, &find_sig_entry); if (sig_entry == NULL) return NULL; + + /* We can get here with the TU already read, *or* in the process of being + read. Don't reassign it if that's the case. Also note that if the TU is + already being read, it may not have come from a DWO, the program may be + a mix of Fission-compiled code and non-Fission-compiled code. */ /* Have we already tried to read this TU? */ - if (sig_entry->dwo_unit != NULL) + if (sig_entry->per_cu.tu_read) return sig_entry; /* Ok, this is the first time we're reading this TU. */ @@ -5414,7 +5432,7 @@ create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct) STMT_LIST is a DW_AT_stmt_list attribute. */ static struct type_unit_group * -get_type_unit_group (struct dwarf2_cu *cu, struct attribute *stmt_list) +get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list) { struct tu_stats *tu_stats = &dwarf2_per_objfile->tu_stats; struct type_unit_group *tu_group; @@ -7028,14 +7046,21 @@ process_queue (void) : (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin)) { struct dwarf2_per_cu_data *per_cu = item->per_cu; + char buf[100]; - if (dwarf2_read_debug) + if (per_cu->is_debug_types) { - fprintf_unfiltered (gdb_stdlog, - "Expanding symtab of %s at offset 0x%x\n", - per_cu->is_debug_types ? "TU" : "CU", - per_cu->offset.sect_off); + struct signatured_type *sig_type = + (struct signatured_type *) per_cu; + hooks/post-receive -- Repository for Project Archer.