From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84648 invoked by alias); 21 Aug 2015 20:04:19 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 84608 invoked by uid 9674); 21 Aug 2015 20:04:18 -0000 Date: Fri, 21 Aug 2015 20:04:00 -0000 Message-ID: <20150821200418.84505.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] jankratochvil/gdbserverbuildid: Support build-id for main executables X-Git-Refname: refs/heads/jankratochvil/gdbserverbuildid X-Git-Reftype: branch X-Git-Oldrev: ab595d5e41323a5e17d4fa2d73fe534f3f83b08a X-Git-Newrev: b4e4b4764ce753d336d6b6de12c5ec5296bd4d2b X-SW-Source: 2015-q3/txt/msg00038.txt.bz2 List-Id: The branch, jankratochvil/gdbserverbuildid has been updated discards ab595d5e41323a5e17d4fa2d73fe534f3f83b08a (commit) discards 6fb3663ddc5d5a99199833d949942aad7b681380 (commit) discards bf911121a5734434aad51b715cc19eb8170eb5ef (commit) discards fcda11731bd2c9c40339e82bc80d5e35d6dcdeb8 (commit) discards cbeb2450722667ef8d7f1266f3099c3406e150ea (commit) discards ae205911e654b6b405807fc7c650ac0e2b2888f2 (commit) discards 5a62beb82130814843c612d9359ec13f54308202 (commit) discards b6717c38a322af00f62a943721db158dbc19f30d (commit) discards 99f2fd6bfd044c983ded576e832d7887e48c2ebe (commit) discards cb74b650510f3b6dd0ae6a03f6ba19ae2d7afc47 (commit) discards 0f04cc7c1c666445744eea4a3eed119d9bec16b0 (commit) discards de7fa43d28da0caea1fcd790d4b4e99b0ba3e2cc (commit) discards 6015f7902e795eccac05b40bc55712c7f9603bab (commit) discards 0d912487e5a386df01bc02645a44a9faef7de5d7 (commit) discards e99ca88a03cd89a75e036bed16697f80f36a6c18 (commit) discards 7cff29ba8a59f275ed0611fd71d6ffe00e1dd75f (commit) discards 50c3d7c8425f78c29dcc6af0e46c0e0ad5456388 (commit) discards 4824eb06420698e713da82269d23d809e153cd17 (commit) discards 46eada5a83c042621b96bc61780f55289ef3d101 (commit) discards cabfd87f9edbc4f6dcd3b13830788cae270adcff (commit) discards 730480bb5f5546e854ee8b0bd1ac2675d1c78f6f (commit) discards 20724d37ccb6523d45cc963f67ab6e39d346d7b8 (commit) discards 0259aa4b5c8a64eaa5df90af54ed4721e052ad09 (commit) discards 77fd6bd0e8adafc12638379be6c2f380e60f7c8f (commit) discards 521bf6f14bd907949c0afe161a291392137f54f9 (commit) discards 29a2e15387c7b901d3ff724eefc17da1d7c7972b (commit) discards 98f9d97afa805f97e4d458b16487b3eda72d67f0 (commit) discards 78902252d958c60f2e8bdc636a8580e685a42214 (commit) discards 297e4cca9e1ddd859a9409063e6edeb75cc5c164 (commit) discards dcf8f42dd92db632477b9d0f803c098951eb771a (commit) discards c3ff2fcf809287543c310c40edb5a9fd872177c7 (commit) discards 7d6a0cf97bf0080bac4686dbeb795f2bfbd7f4d2 (commit) via b4e4b4764ce753d336d6b6de12c5ec5296bd4d2b (commit) via eae34a38b1b6073a6380a670f832abeb31ac8e3e (commit) via e30bfa019ec125c5c91edae344546a22c82b8fb5 (commit) via 6e63fc41f7eb6f24fe07e39468576d5460816cfd (commit) via adf6af424c8843a91660a011d23492fd2775bd77 (commit) via 75428cfacf113f24c18c011cd371f1c17d55927a (commit) via 232606b55fd080d61dc80088be4f90273a42152b (commit) via 2f69fd3f00008f55d525365efb264d1411ffe706 (commit) via 157a9ea4235c203ffef98a1d01076b331a9dc7b3 (commit) via b81b03b2d5a74e42fb3db91683f2e2e21350e384 (commit) via 46116c84f334482a7919c903e70e49302ded3113 (commit) via 57b773b9c32050bf0171feef3890ce59dce04be7 (commit) via 7126338cca73b4c8c626209d5135921be145c2a6 (commit) via 8a46a0bb6d85d35867afff33b23f5141a4d44257 (commit) via 52a72e3685e8d87315f61ab0eeb9abec75649c7e (commit) via 406712ee5ea7c37d0f585ce576e1577135cf72fe (commit) via fa37623340e12495a724e520fa4c2c2419cc350c (commit) via 08a325927e2c8cacb0c68f18394bb4a4aeea55cb (commit) via 0092a2b7a1b7cb7cc73b9dbc663ffa4aff582738 (commit) via 5c773a41ae721c2260f8bdd440b2352d2f9d8754 (commit) via 1bf9fe0773948520ea46435f5cec76236384f898 (commit) via 405b76a55bd811ecd691e330dc62ded0410a0398 (commit) via 9190ee41e215de2239fb7fdfe1b350379e8fa406 (commit) via 86c34d43e014fdde2a8ead404bccf250515a1c9b (commit) via 0e392b9bb75d77f7b72f4e774c50471c28f86f5d (commit) via 0a26b660f625479dd1b44f9399d8635f59496d25 (commit) via 940be657e23cd76a0ccf1a40bec9b2d2ee3a1fe3 (commit) via 3c14f41e452101f2b334e3457e192cdaf6399ab4 (commit) via 4e740c7af8897af2135eccf99b462d66e21944a6 (commit) via ee82cb85c7a59dc6a5dfcec0871a655e23212dc9 (commit) via 916c08762b5f7b08d55982ed0e8425407a924a67 (commit) via 6061861af8d9249058b90c604068a4f3600cc324 (commit) via 465a859e0a991d3bfe8a9ee65a29a223c42e2ce7 (commit) via f0db101d9897732d6556456e542d12ecf9e12e42 (commit) via 2d7711a36720b0bc44fee20d0bf057614ead21c2 (commit) via 4313b8c0ed5877feb5034bfff4056e1ccfe221f1 (commit) via f36b87190aed31b1ef7787e5966be542e8abdb58 (commit) via d02603dc201f80cd9d2a1f4b1a16110b1e04222b (commit) via 40045d91812b25c88c8275b8c08d27c234b68ba8 (commit) via ab4e4ed5dabc378c06ee647afd5793513393ae3f (commit) via 80152258b9dfe033828e5c5b6dc3252be1ba7a84 (commit) via 88fc5eb7e23af132eacb895e475b31be0f7623e6 (commit) via 6f1cb6eac2f28c6e1cb49c011f2b916afb90b4ff (commit) via 8e804db96b40c5c88d26b933fb19b6bfcfcb1101 (commit) from ab595d5e41323a5e17d4fa2d73fe534f3f83b08a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit b4e4b4764ce753d336d6b6de12c5ec5296bd4d2b Author: Jan Kratochvil Date: Fri Aug 21 21:40:56 2015 +0200 Support build-id for main executables Hi, make all the existing shlibs build-id functionality working also for the main executables. I think target_so_ops::open_symbol_file_object() is already replaced by what exec_file_and_symbols_resync(), target_pid_to_exec_file() etc. does but open_symbol_file_object() has been forgotten. This patch adds target_so_ops::main_build_id() which could be possibly marged with open_symbol_file_object() but I made it a separate function as I think it is easier to rather remove target_so_ops::open_symbol_file_object(). Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c (build_id_verify): Add parameter advice. * build-id.h (build_id_verify): Likewise. * dwarf2read.c (dwarf2_get_dwz_file): Update build_id_verify caller. * exec.c: Include build-id.h. (exec_file_and_symbols_resync): Detect and use build-id by solib_main_build_id. * features/library-list-svr4.dtd: Add main-build-id. * solib-svr4.c (struct svr4_info, struct svr4_library_list): Add fields main_build_idsz and main_build_id. (hex2bin_allocate): Generalize messages to binary files. (svr4_library_list_start_list): Parse main-build-id. (svr4_library_list_attributes): Add main-build-id. (svr4_current_sos_direct): Set svr4_info main_build_id*. (svr4_main_build_id): New function. (svr4_clear_solib): Clear svr4_info main_build_id*. (_initialize_svr4_solib): Install svr4_main_build_id. * solib.c (solib_main_build_id): New function. * solist.h (struct target_so_ops): Add method main_build_id. (solib_main_build_id): New prototype. * source.c (file_location_from_filename): Update build_id_verify caller. gdb/gdbserver/ChangeLog 2015-08-20 Jan Kratochvil * linux-low.c (linux_qxfer_libraries_svr4): Print main-build-id. gdb/doc/ChangeLog 2015-08-20 Jan Kratochvil FIXME * gdb.texinfo (Files): (address the file was prelinked to during the library load.): (A simple memory map): (The format of an SVR4 library list is described by this DTD): gdb/testsuite/ChangeLog 2015-08-20 Jan Kratochvil * gdb.base/main-mismatch-mod.c: New file. * gdb.base/main-mismatch.c: New file. * gdb.base/main-mismatch.exp: New file. commit eae34a38b1b6073a6380a670f832abeb31ac8e3e Author: Jan Kratochvil Date: Fri Aug 21 21:40:55 2015 +0200 Make only user-specified executable and symbol filenames sticky Message-ID: <559A7C37.6020501@redhat.com> On 07/03/2015 04:44 PM, Pedro Alves wrote: > (I still suspect that if we reverse the sense of the flag, then > its management ends up being more centralized, as then the > place that sets it is also the place that needs to check it, > instead of doing that in multiple places. But, see below.) It didn't seem fair to impose a subjective preference, so I tried this in order to understand it myself, and I now agree that is really doesn't make much difference, as then we'd have to mark auto-discovered in a few more places that I wasn't originally seeing. There's at least the execd handling in infrun.c, and also spu_symbol_file_add_from_memory. As I was playing with this already, I poked at the other review points I made, and came up with the variant of the patch below. > This function is called while the passed in PID is not the > current inferior. E.g., the remote_add_inferior path. > > Therefore seems to me that these symbol_file_add_main / exec_file_attach > calls can change the symbols of the wrong inferior. ... > I also notice that reread_symbols has an exec_file_attach > call which seems to me results in losing the is_user_supplied > flag if the executable's timestamp changed, at least here: > >> + /* Attempt to open the file that was executed to create this >> + inferior. If the user has explicitly specified executable >> + and/or symbol files then warn the user if their choices do >> + not match. Otherwise, set exec_file and symfile_objfile to >> + the new file. */ >> + exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty); >> + >> + if (exec_file_is_user_supplied) >> { >> reopen_exec_file (); >> reread_symbols (); > > > I also notice that the clone-inferior command ends up with > an exec_file_attach call in clone_program_space. That one > should probably be setting the is_user_supplied flag too, > I'd think. Or at least, copying it from the original. > > At this point, I'm wondering about adding a parameter to > exec_file_attach to force considering (now and in future) > the right value to put in the flag in each case. I tried this too (see patch below). As this requires touching the user-supplied paths anyway, it didn't really matter to tag files user-supplied or auto-discovered, so I reverted back to user-supplied. For symbols, we already have the add_flags, so I added SYMFILE_USER_SUPPLIED instead of a new boolean. > >> @@ -2490,11 +2490,14 @@ attach_command_post_wait (char *args, int from_tty, int async_exec) >> inferior = current_inferior (); >> inferior->control.stop_soon = NO_STOP_QUIETLY; >> >> - /* If no exec file is yet known, try to determine it from the >> - process itself. */ >> - if (get_exec_file (0) == NULL) >> - exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty); >> - else >> + /* Attempt to open the file that was executed to create this >> + inferior. If the user has explicitly specified executable >> + and/or symbol files then warn the user if their choices do >> + not match. Otherwise, set exec_file and symfile_objfile to >> + the new file. */ >> + exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty); >> + >> + if (exec_file_is_user_supplied) >> { >> reopen_exec_file (); >> reread_symbols (); > > It seems to me that we should be able to move these reopen/reread > calls inside exec_file_locate_attach. I did this too. What do you think of the version below? I also tweaked the warnings a bit, to explicitly say "mismatch". This would still need docs/NEWS changes, and a test would be good too. ---------- - pass user-supplied / auto-discovered as arguments to exec_file_attach and symbol_file_add_main - Change exec_file_locate_attach parameter from pid to inferior pointer. - Flip current program space temporarily to make sure we add/reload symbols to/of the right inferior/program space. - Move reopen_exec_file and reread_symbols calls inside exec_file_locate_attach. - Warning message tweaks. - Rename exec_file_locate_attach -> exec_file_and_symbols_resync commit e30bfa019ec125c5c91edae344546a22c82b8fb5 Author: Jan Kratochvil Date: Fri Aug 21 21:40:55 2015 +0200 Code cleanup: New hex2bin_allocate() Hi, make hex->bin parsing standalone, to be reused in later patch. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * solib-svr4.c (hex2bin_allocate): New function from ... (library_list_start_library): ... here, call it. commit 6e63fc41f7eb6f24fe07e39468576d5460816cfd Author: Jan Kratochvil Date: Fri Aug 21 21:40:55 2015 +0200 testcase: Test also locating shlibs by build-id Hi, testcase from the previous patch tests verification of build-id in shared libraries found by their name. This test adds testing that a library can be found by its build-id (debug-file-directory/.build-id/XX/YYYYY...YYYYY). Jan gdb/testsuite/ChangeLog 2015-08-20 Jan Kratochvil * gdb.base/solib-mismatch.exp (nocrlf, expected_header): Make them global. (solib_locate_test): New function. commit adf6af424c8843a91660a011d23492fd2775bd77 Author: Jan Kratochvil Date: Fri Aug 21 21:40:55 2015 +0200 Tests for validate symbol file using build-id Hi, new testcase only. Jan gdb/testsuite/ChangeLog 2015-07-15 Aleksandar Ristovski Date: Fri Aug 21 21:40:55 2015 +0200 build_id_verify: Make it more verbose Hi, it was discussed on this list that if build-ids do not match they should be printed for troubleshooting. It is mostly independent from the other patches. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c: Include rsp-low.h. (build_id_verify): Print non-matching build-ids, update the messages. commit 232606b55fd080d61dc80088be4f90273a42152b Author: Jan Kratochvil Date: Fri Aug 21 21:40:54 2015 +0200 solib_bfd_open: Optimize opening twice Hi, this is one of the optimizations allowed by file_location that prevents opening file twice when target build-id is known and it needs to be verified. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * solib.c (solib_bfd_fopen): Replace solib_find and solib_bfd_fopen by solib_find_file. commit 2f69fd3f00008f55d525365efb264d1411ffe706 Author: Jan Kratochvil Date: Fri Aug 21 21:40:54 2015 +0200 Verify the build-id Hi, now it is possible to filter-out from openp() search files with non-matching build-id. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * source.c: Include build-id.h. (file_location_from_filename): Call build_id_verify for the build-id parameters. commit 157a9ea4235c203ffef98a1d01076b331a9dc7b3 Author: Jan Kratochvil Date: Fri Aug 21 21:40:54 2015 +0200 solib_find: Search also by build-id Hi, solib_find() can now try to search also by build-id. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * solib.c: Include build-id.h. (solib_find_3): Call build_id_to_file. commit b81b03b2d5a74e42fb3db91683f2e2e21350e384 Author: Jan Kratochvil Date: Fri Aug 21 21:40:54 2015 +0200 build_id_to_bfd: Make it return file_location Hi, refactor build_id_to_bfd so that it returns file_location. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c: Include source.h. (build_id_to_bfd): Rename to ... (build_id_to_file): ... here, return file_location, add parameter opts, make it public. (build_id_to_debug_bfd): Use build_id_to_file. * build-id.h (build_id_to_file): New prototype. commit 46116c84f334482a7919c903e70e49302ded3113 Author: Jan Kratochvil Date: Fri Aug 21 21:40:54 2015 +0200 Add dummy build-id params to prototypes Hi, it is a lot of text with no functionality. Add build-id parameters where needed, pass them where they are already available, otherwise pass 0 in the top callers. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Pass zero build-id. * defs.h (openp, openp_file, source_full_path_of): Add build-id parameters. * dwarf2read.c (try_open_dwop_file): Pass zero build-id. * exec.c (exec_file_locate_attach): Likewise. * infrun.c (follow_exec): Likewise. * nto-tdep.c (nto_find_and_open_solib): Add build-id parameters, pass them. * nto-tdep.h (nto_find_and_open_solib): Add build-id parameters. * solib-aix.c (solib_aix_bfd_open): Add build-id parameters, pass them. * solib-darwin.c (darwin_bfd_open): Likewise. * solib-dsbt.c (enable_break): Pass zero build-id. * solib-frv.c (enable_break2): Likewise. * solib-spu.c (spu_bfd_open): Add build-id parameters, pass them. * solib-svr4.c (enable_break): Pass zero build-id. * solib.c (solib_find_3, solib_find_2, solib_find_1, exec_file_find) (solib_find_file, solib_find, solib_bfd_open): Add build-id parameters, pass them. (solib_map_sections): Pass so->build-id* to bfd_open. (reload_shared_libraries_1): Pass so->build-id* to solib_bfd_open. * solist.h (struct target_so_ops): Add build-id parameters to bfd_open and find_and_open_solib. (exec_file_find, solib_find, solib_bfd_open): Add build-id parameters. * source.c (file_location_from_filename): Add build-id parameters. (filename_to_bfd): Pass zero build-id. (openp): Add build-id parameters, pass them. (openp_bfd): Pass zero build-id. (openp_file, source_full_path_of): Add build-id parameters, pass them. (find_and_open_source): Pass zero build-id. * source.h (file_location_from_filename): Add build-id parameters. commit 57b773b9c32050bf0171feef3890ce59dce04be7 Author: Jan Kratochvil Date: Fri Aug 21 21:40:53 2015 +0200 build_id_to_debug_bfd: Make it also non-.debug capable Hi, generalize the function by adding 'suffix' parameter. To be reused later. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c (build_id_to_debug_bfd): Rename to ... (build_id_to_bfd): ... here, add parameter suffix. (build_id_to_debug_bfd): New function. commit 7126338cca73b4c8c626209d5135921be145c2a6 Author: Jan Kratochvil Date: Fri Aug 21 21:40:53 2015 +0200 symfile_bfd_open: Make it use openp_bfd() Hi, another function gets converted to the new API. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * symfile.c (symfile_bfd_open): Use openp_bfd instead of openp and gdb_bfd_open. commit 8a46a0bb6d85d35867afff33b23f5141a4d44257 Author: Jan Kratochvil Date: Fri Aug 21 21:40:53 2015 +0200 solib_find: Make it use file_location Hi, refactor the solib*() code to use file_location functions. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * nto-tdep.c: Include source.h. (nto_find_and_open_solib): Return file_location, remove parameter temp_pathname. Change openp to openp_file. * nto-tdep.h (nto_find_and_open_solib): Update prototype. * solib.c (solib_find_2): Rename to ... (solib_find_3): ... here, return file_location, change parameter fd to opts. Change gdb_open_cloexec to file_location_from_filename and openp to openp_file calls. (solib_find_1): Rename to ... (solib_find_2): ... here, return file_location, change parameter fd to opts. (solib_find_1): New function. (solib_find): Rename to ... (solib_find_file) ... here, return file_location, change parameter fd to opts. (solib_find): New function. * solist.h (find_and_open_solib): Return file_location, remove parameter temp_pathname. commit 52a72e3685e8d87315f61ab0eeb9abec75649c7e Author: Jan Kratochvil Date: Fri Aug 21 21:40:53 2015 +0200 Refactor openp() to return file_location Hi, openp() remains as a backward compatibility wrapper around renamed openp->openp_file(). Jan gdb/ChangeLog 2015-08-19 Jan Kratochvil * defs.h (enum openp_flags): Remove OPF_OPEN_RW_TMP, add OPF_BFD_CANONICAL. (openp_bfd, openp_file): Add prototypes. * exec.c (exec_file_attach): Replace openp by openp_bfd calls. * source.c (file_location_from_filename): Support OPF_BFD_CANONICAL. (openp, openp_bfd): New functions. (openp): Rename to ... (openp_file): ... here, return file_location, remove filename_opened parameter. commit 406712ee5ea7c37d0f585ce576e1577135cf72fe Author: Jan Kratochvil Date: Fri Aug 21 21:40:53 2015 +0200 Add file_location utility functions Hi, build id verification faces a problem current codebase calls openp() and similar functions which search many directories and after they find the file they return its filename. Caller then typically opens that file as BFD. But to search the directories openp() needs to open each file it iterates to verify their build-id. Then it would close the file and caller would reopen it again. This is inefficient (+racy), so a new intermediate representation of the found files is created (file_location). Another possibility would be to depends on bfd cache as being done in exec_file_attach. But then a similar problem is needed for callers which want only fd (and not bfd). Besides that I find depending on pending make_cleanup_bfd_unref() from openp() calls would be tricky. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * defs.h (enum openp_flags): Add OPF_IS_BFD. * gdb_bfd.c (fileio_errno_to_host): Make it public. * gdb_bfd.h (fileio_errno_to_host): Add prototype. * source.c: Include inferior.h and gdb/fileio.h. (file_location_enoent, file_location_free, file_location_cleanup) (file_location_is_valid, file_location_from_filename) (file_location_to_bfd, filename_to_bfd): New functions. * source.h (struct file_location): New definition. (file_location_enoent, file_location_free, file_location_is_valid) (file_location file_location_from_filename, file_location_to_bfd) (filename_to_bfd): New prototypes. commit fa37623340e12495a724e520fa4c2c2419cc350c Author: Jan Kratochvil Date: Fri Aug 21 21:40:52 2015 +0200 gdb_bfd_open_from_target: Optionally do not close fd Hi, gdb_bfd_open_from_target currently always embedded passed fd into returned BFD and closed that fd after closing that BFD. As one cannot do dup() for target fileio FDs one could not use FD after BFD using it has been closed. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * gdb_bfd.c (gdb_bfd_iovec_fileio_close_nop): New function. (gdb_bfd_open_from_target): Add parameter do_close. Optionally pass gdb_bfd_iovec_fileio_close_nop. (gdb_bfd_open): Update caller. * gdb_bfd.h (gdb_bfd_open_from_target): Update prototype. commit 08a325927e2c8cacb0c68f18394bb4a4aeea55cb Author: Jan Kratochvil Date: Fri Aug 21 21:40:52 2015 +0200 gdb_bfd_open_from_target: Support real fd Hi, gdb_bfd_open_from_target is extended so that it can be now passed also some non-(-1) fd. non-(-1) fd was not supported for remote files in mainline. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * gdb_bfd.c (gdb_bfd_iovec_fileio_open_fd): New function. (gdb_bfd_open_from_target): Conditionally use it. commit 0092a2b7a1b7cb7cc73b9dbc663ffa4aff582738 Author: Jan Kratochvil Date: Fri Aug 21 21:40:52 2015 +0200 Provide new gdb_bfd_open_from_target Hi, later code needs to call the gdb_bfd_openr_iovec part of gdb_bfd_open with more special parameters. So it is refactored out first (and extended later in the next patches). Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * gdb_bfd.c (gdb_bfd_open_from_target): New function from ... (gdb_bfd_open): ... here. Call it. * gdb_bfd.h (gdb_bfd_open_from_target): New prototype. commit 5c773a41ae721c2260f8bdd440b2352d2f9d8754 Author: Jan Kratochvil Date: Fri Aug 21 21:40:52 2015 +0200 Code cleanup: openp parameter filename_opened is never NULL Hi, this parameter is never passed as NULL in the codebase so the check can be removed. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * source.c (openp): Update function comment for filename_opened. Remove NULL check for filename_opened. commit 1bf9fe0773948520ea46435f5cec76236384f898 Author: Jan Kratochvil Date: Fri Aug 21 21:40:51 2015 +0200 Code cleanup: Remove openp parameter mode Hi, simplify the code, make it also suitable for more code refactorings. The new flag OPF_OPEN_RW_TMP is removed later in this patch series. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Update openp caller. * defs.h (enum openp_flags): Add OPF_OPEN_RW_TMP. (openp): Remove parameter mode. * dwarf2read.c (try_open_dwop_file): Update openp caller. * exec.c (exec_file_attach): Likewise. * nto-tdep.c (nto_find_and_open_solib): Remove parameter o_flags, update openp caller. * nto-tdep.h (nto_find_and_open_solib): Remove parameter o_flags. * solib.c (solib_find_2): Update openp and find_and_open_solib caller. * solist.h (struct target_so_ops): Remove parameter o_flags from find_and_open_solib method. * source.c (openp): Change parameter mode to a new variable. (source_full_path_of, find_and_open_source): Update openp caller. * symfile.c (symfile_bfd_open): Likewise. commit 405b76a55bd811ecd691e330dc62ded0410a0398 Author: Jan Kratochvil Date: Fri Aug 21 21:40:51 2015 +0200 Code cleanup: Remove OPF_RETURN_REALPATH Hi, OPF_RETURN_REALPATH is used only at the end of openp() to convert the returned values. That is not useful, code can be simplified if callers that passed OPF_RETURN_REALPATH adjust the returned values on their own. Or at least it helps further refactorizations. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree. * defs.h (enum openp_flags): Add OPF_NONE, remove OPF_RETURN_REALPATH. * dwarf2read.c (try_open_dwop_file): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree. * nto-tdep.c (nto_find_and_open_solib): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree and xstrdup. * solib.c (solib_find_2): New variable temp_pathname_is_realpath. Remove OPF_RETURN_REALPATH. Conditionally call gdb_realpath_and_xfree. * source.c (openp): Remove OPF_RETURN_REALPATH processing. (source_full_path_of, find_and_open_source): Remove OPF_RETURN_REALPATH. Call gdb_realpath_and_xfree. * symfile.c (symfile_bfd_open): Likewise. * utils.c (gdb_realpath_and_xfree): New function. * utils.h (gdb_realpath_and_xfree): New prototype. commit 9190ee41e215de2239fb7fdfe1b350379e8fa406 Author: Jan Kratochvil Date: Fri Aug 21 21:40:51 2015 +0200 Code cleanup: Add enum for openp_flags Hi, it is for many reasons better, in C++ it could be even type safe. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * cli/cli-cmds.c (find_and_open_script): Use enum openp_flags for search_flags. * defs.h (OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH): Wrap them to a new ... (enum openp_flags): ... enum. (openp): Update prototype. * dwarf2read.c (try_open_dwop_file): Use enum openp_flags for flags. * source.c (openp): Update opts parameter type. Move out OPF_* comments. commit 86c34d43e014fdde2a8ead404bccf250515a1c9b Author: Jan Kratochvil Date: Fri Aug 21 21:40:51 2015 +0200 Change sysroot to ":target:" Hi, that is try "" first and "target:" second. Various performance problems should be fixed by trying to look up the remote file first on local filesystem. Thanks to build-ids it is quick and safe to verify both files are the same build. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * NEWS (Changes since GDB 7.10): Mention sysroot. * main.c (captured_main): Initialize new gdb_sysroot. gdb/testsuite/ChangeLog * gdb.base/attach.exp (do_attach_tests): Update sysroot parsing. * gdb.base/break-probes.exp: Likewise. commit 0e392b9bb75d77f7b72f4e774c50471c28f86f5d Author: Jan Kratochvil Date: Fri Aug 21 21:40:51 2015 +0200 Permit multiple sysroot directories Hi, the goal is to have both "" and "target:" as the default gdb_sysroot, in this order. Therefore permit multiple directory components of gdb_sysroot. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * NEWS (Changes since GDB 7.10): Mention set sysroot and show sysroot. * solib.c: Include source.h. (solib_find_1): Rename to ... (solib_find_2): ... here and change the sysroot variable to parameter. (solib_find_1): Call it using dirnames_to_char_ptr_vec_target_exc. * source.c (dirnames_to_char_ptr_vec_target_exc): New function. * source.h (dirnames_to_char_ptr_vec_target_exc): New declaration. gdb/doc/ChangeLog 2015-08-18 Jan Kratochvil * gdb.texinfo (Files): Permit set sysroot and show sysroot to have multiple components. commit 0a26b660f625479dd1b44f9399d8635f59496d25 Author: Jan Kratochvil Date: Fri Aug 21 21:40:50 2015 +0200 Code cleanup: Make solib_find_1 variable const Hi, it gets used in the next patch. Jan 2015-08-18 Jan Kratochvil * solib.c (solib_find_1): Make sysroot variable const. commit 940be657e23cd76a0ccf1a40bec9b2d2ee3a1fe3 Author: Jan Kratochvil Date: Fri Aug 21 21:40:50 2015 +0200 Validate symbol file using build-id Consumer part of the "build-id" attribute. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Validate symbol file using build-id. * NEWS (Changes since GDB 7.10): Add 'set validate-build-id' and 'show validate-build-id'. Add build-id attribute. * build-id.c: Include gdbcmd.h. (validate_build_id, show_validate_build_id, _initialize_build_id): New. * build-id.h (validate_build_id): New declaration. * solib-svr4.c: Include rsp-low.h. (svr4_copy_library_list): Duplicate field build_id. (library_list_start_library): Parse 'build-id' attribute. (svr4_library_attributes): Add 'build-id' attribute. * solib.c (free_so): Free build_id. * solist.h (struct so_list): New fields 'build_idsz' and 'build_id'. gdb/doc/ChangeLog 2015-07-15 Jan Kratochvil * gdb.texinfo (Files): Add 'set validate-build-id' and 'show validate-build-id'. commit 3c14f41e452101f2b334e3457e192cdaf6399ab4 Author: Jan Kratochvil Date: Fri Aug 21 21:40:50 2015 +0200 gdbserver build-id attribute generator Producer part of the new "build-id" XML attribute. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski gdbserver build-id attribute generator. * features/library-list-svr4.dtd (library-list-svr4): New 'build-id' attribute. gdb/doc/ChangeLog 2015-07-15 Aleksandar Ristovski gdbserver build-id attribute generator. * gdb.texinfo (Library List Format for SVR4 Targets): Add 'build-id' in description, example, new attribute in dtd. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski gdbserver build-id attribute generator. * linux-low.c (linux-maps.h, search.h, rsp-low.h): Include. (ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New. (ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New. (find_phdr): New. (get_dynamic): Use find_pdhr to traverse program headers. (struct mapping_entry, mapping_entry_s, free_mapping_entry_vec) (compare_mapping_entry_range, struct find_memory_region_callback_data) (read_build_id, find_memory_region_callback, lrfind_mapping_entry) (get_hex_build_id): New. (linux_qxfer_libraries_svr4): Add optional build-id attribute to reply XML document. commit 4e740c7af8897af2135eccf99b462d66e21944a6 Author: Jan Kratochvil Date: Fri Aug 21 21:40:50 2015 +0200 Move linux_find_memory_regions_full & co. This should be just a move with no changes. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Move linux_find_memory_regions_full & co. * linux-tdep.c (linux-maps.h): Include. (gdb_regex.h): Remove the include. (enum filterflags, struct smaps_vmflags, read_mapping, decode_vmflags) (mapping_is_anonymous_p, dump_mapping_p): Moved to common/linux-maps.c. (linux_find_memory_region_ftype): Moved typedef to common/linux-maps.h. (linux_find_memory_regions_full): Moved definition to common/linux-maps.c. * common/linux-maps.c: Include ctype.h, target/target-utils.h, gdb_regex.h and target/target.h. (struct smaps_vmflags, read_mapping, decode_vmflags) (mapping_is_anonymous_p, dump_mapping_p): Move from linux-tdep.c. (linux_find_memory_regions_full): Move from linux-tdep.c. * common/linux-maps.h (read_mapping): New declaration. (linux_find_memory_region_ftype, enum filterflags): Moved from linux-tdep.c. (linux_find_memory_regions_full): New declaration. * target.c (target/target-utils.h): Include. (read_alloc_pread_ftype): Moved typedef to target/target-utils.h. (read_alloc, read_stralloc_func_ftype, read_stralloc): Moved definitions to target/target-utils.c. * target.h (target_fileio_read_stralloc): Move it to target/target.h. * target/target-utils.c (read_alloc, read_stralloc): Move definitions from target.c. * target/target-utils.h (read_alloc_pread_ftype): New typedef. (read_alloc): New declaration. (read_stralloc_func_ftype): New typedef. (read_stralloc): New declaration. * target/target.h (target_fileio_read_stralloc): Move it from target.h. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski * target.c: Include target/target-utils.h and fcntl.h. (target_fileio_read_stralloc_1_pread, target_fileio_read_stralloc_1) (target_fileio_read_stralloc): New functions. commit ee82cb85c7a59dc6a5dfcec0871a655e23212dc9 Author: Jan Kratochvil Date: Fri Aug 21 21:40:49 2015 +0200 Prepare linux_find_memory_regions_full & co. for move Prepare code for move into gdb/common/. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Prepare linux_find_memory_regions_full & co. for move. * linux-tdep.c (linux_find_memory_region_ftype): Comment. (linux_find_memory_regions_full): Change signature and prepare for moving to linux-maps. (linux_find_memory_regions_data): Rename field 'obfd' to 'data'. (linux_find_memory_regions_thunk): New. (linux_find_memory_regions_thunk): Use 'data' field instead of 'obfd'. (linux_find_memory_regions_gdb): New. (linux_find_memory_regions): Rename argument 'obfd' to 'func_data'. (linux_make_mappings_corefile_notes): Use linux_find_memory_regions_gdb. * target.c (read_alloc_pread_ftype): New typedef. (target_fileio_read_alloc_1_pread): New function. (read_alloc): Refactor from target_fileio_read_alloc_1. (read_stralloc_func_ftype): New typedef. (target_fileio_read_alloc_1): New implementation. Use read_alloc. (read_stralloc): Refactored from target_fileio_read_stralloc. (target_fileio_read_stralloc): New implementation, use read_stralloc. commit 916c08762b5f7b08d55982ed0e8425407a924a67 Author: Jan Kratochvil Date: Fri Aug 21 21:40:49 2015 +0200 Move gdb_regex* to common/ Later patches need regex support also in gdbserver. gdb/ChangeLog 2015-07-15 Jan Kratochvil * Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to common/gdb_regex.h. (COMMON_OBS): Add gdb_regex.o. (gdb_regex.o): New. * common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex, --without-included-regex and USE_INCLUDED_REGEX. * common/gdb_regex.c: New file from utils.c functions. * common/gdb_regex.h: Move it here from gdb_regex.h, update include file wrapping define name. * configure: Rebuilt. * configure.ac (gdb_use_included_regex, --without-included-regex) (USE_INCLUDED_REGEX): Move them to common/common.m4. * gdb_regex.h: Move it to common/gdb_regex.h. * utils.c: Remove include gdb_regex.h. (do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error) (compile_rx_or_error): Move them to common/gdb_regex.c. gdb/gdbserver/ChangeLog 2015-07-15 Jan Kratochvil * Makefile.in (OBS): Add gdb_regex.o. (gdb_regex.o): New. * config.in: Rebuilt. * configure: Rebuilt. commit 6061861af8d9249058b90c604068a4f3600cc324 Author: Jan Kratochvil Date: Fri Aug 21 21:40:49 2015 +0200 Create empty common/linux-maps.[ch] and common/target-utils.[ch] Prepare new files for later move. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski Create empty common/linux-maps.[ch] and common/target-utils.[ch]. * Makefile.in (ALL_TARGET_OBS): Add linux-maps.o. (HFILES_NO_SRCDIR); Add common/linux-maps.h, common/target-utils.h. (COMMON_OBS): Add target-utils.o. (linux-maps.o, target-utils.o): New. * target/target-utils.c: New file. * target/target-utils.h: New file. * common/linux-maps.c: New file. * common/linux-maps.h: New file. * configure.tgt (aarch64*-*-linux*, alpha*-*-linux*) (am33_2.0*-*-linux*, arm*-*-linux*, bfin-*-*linux*, cris*, frv-*-*) (hppa*-*-linux*, i[34567]86-*-linux*, ia64-*-linux*, m32r*-*-linux*) (m68*-*-linux*, microblaze*-linux-*, microblaze*-*-linux*) (mips*-*-linux*, nios2*-*-linux*, powerpc*-*-linux*, s390*-*-linux*) (sh*-*-linux*, sparc-*-linux*, sparc64-*-linux*, tic6x-*-*linux) (tilegx-*-linux*, x86_64-*-linux*, xtensa*-*-linux*): Add linux-maps.o to gdb_target_obs. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski Create empty common/linux-maps.[ch] and common/target-utils.[ch]. * Makefile.in (OBS): Add target-utils.o. (linux-maps.o, target-utils.o): New. * configure.srv (srv_linux_obj): Add linux-maps.o. commit 465a859e0a991d3bfe8a9ee65a29a223c42e2ce7 Author: Pedro Alves Date: Fri Aug 21 19:52:36 2015 +0100 Fix gdbserver crash exposed by gdb.threads/process-dies-while-handling-bp.exp Running that test in a loop, I found a gdbserver core dump with the following back trace: Core was generated by `../gdbserver/gdbserver --once --multi :2346'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000406ab6 in inferior_regcache_data (inferior=0x0) at src/gdb/gdbserver/inferiors.c:236 236 return inferior->regcache_data; (gdb) up #1 0x0000000000406d7f in get_thread_regcache (thread=0x0, fetch=1) at src/gdb/gdbserver/regcache.c:31 31 regcache = (struct regcache *) inferior_regcache_data (thread); (gdb) bt #0 0x0000000000406ab6 in inferior_regcache_data (inferior=0x0) at src/gdb/gdbserver/inferiors.c:236 #1 0x0000000000406d7f in get_thread_regcache (thread=0x0, fetch=1) at src/gdb/gdbserver/regcache.c:31 #2 0x0000000000409271 in prepare_resume_reply (buf=0x20dd593 "", ptid=..., status=0x20edce0) at src/gdb/gdbserver/remote-utils.c:1147 #3 0x000000000040ab0a in vstop_notif_reply (event=0x20edcc0, own_buf=0x20dd590 "T05") at src/gdb/gdbserver/server.c:183 #4 0x0000000000426b38 in notif_write_event (notif=0x66e6c0 , own_buf=0x20dd590 "T05") at src/gdb/gdbserver/notif.c:69 #5 0x0000000000426c55 in handle_notif_ack (own_buf=0x20dd590 "T05", packet_len=8) at src/gdb/gdbserver/notif.c:113 #6 0x000000000041118f in handle_v_requests (own_buf=0x20dd590 "T05", packet_len=8, new_packet_len=0x7fff742c77b8) at src/gdb/gdbserver/server.c:2862 #7 0x0000000000413850 in process_serial_event () at src/gdb/gdbserver/server.c:4148 #8 0x0000000000413945 in handle_serial_event (err=0, client_data=0x0) at src/gdb/gdbserver/server.c:4196 #9 0x000000000041a1ef in handle_file_event (event_file_desc=5) at src/gdb/gdbserver/event-loop.c:429 #10 0x00000000004199b6 in process_event () at src/gdb/gdbserver/event-loop.c:184 #11 0x000000000041a735 in start_event_loop () at src/gdb/gdbserver/event-loop.c:547 #12 0x00000000004123d2 in captured_main (argc=4, argv=0x7fff742c7ac8) at src/gdb/gdbserver/server.c:3562 #13 0x000000000041252e in main (argc=4, argv=0x7fff742c7ac8) at src/gdb/gdbserver/server.c:3631 Clearly this means that a thread pushed a stop reply in the event queue, and then before GDB confused the event, the whole process died, along with its thread. But the pending thread event was left dangling. When GDB fetched that event, gdbserver looked up the corresponding thread, but found NULL; not expecting this, gdbserver crashes when it tries to read this thread's registers. gdb/gdbserver/ 2015-08-21 Pedro Alves PR gdb/18749 * inferiors.c (remove_thread): Discard any pending stop reply for this thread. * server.c (remove_all_on_match_pid): Rename to ... (remove_all_on_match_ptid): ... this. Work with a filter ptid instead of a pid. (discard_queued_stop_replies): Change parameter to a ptid. Now extern. (handle_v_kill, kill_inferior_callback) (process_serial_event): Adjust. (captured_main): Call initialize_notif before starting the program, thus before threads are created. * server.h (discard_queued_stop_replies): Declare. commit f0db101d9897732d6556456e542d12ecf9e12e42 Author: Pedro Alves Date: Fri Aug 21 19:20:31 2015 +0100 gdbserver: don't pick a random thread if the current thread dies In all-stop mode, if the current thread disappears while stopping all threads, gdbserver calls set_desired_thread(0) ['0' means "I want the continue thread"] which just picks the first thread in the list. This looks like a dangerous thing to do. GDBserver continues processing whatever it was doing, but to the wrong thread. If debugging more than one process, we may even pick the wrong process. Instead, GDBserver should detect the situation and bail out of whatever is was doing. The backends used to pay attention to the set 'cont_thread' (the Hc thread, used in the old way to resume threads, before vCont), but all such 'cont_thread' checks have been eliminated meanwhile. The remaining implicit dependencies that I found on there being a selected thread in the backends are in the Ctrl-C handling, which some backends use as thread to send a signal to. Even that seems to me to be better handled by always using the first thread in the list or by using the signal_pid PID. In order to make this a systematic approach, I'm making set_desired_thread never fallback to a random thread, and instead end up with current_thread == NULL, like already done in non-stop mode. Then I updated all callers to handle the situation. I stumbled on this while fixing other bugs exposed by gdb.threads/fork-plus-threads.exp test. The problems I saw were fixed in a different way, but in any case, I think the potential for problems is more or less obvious, and the resulting code looks a bit less magical to me. Tested on x86-64 Fedora 20, w/ native-extended-gdbserver board. gdb/gdbserver/ChangeLog: 2015-08-21 Pedro Alves * linux-low.c (wait_for_sigstop): Always switch to no thread selected if the previously current thread dies. * lynx-low.c (lynx_request_interrupt): Use the first thread's process instead of the current thread's. * remote-utils.c (input_interrupt): Don't check if there's no current thread. * server.c (gdb_read_memory, gdb_write_memory): If setting the current thread to the general thread fails, error out. (handle_qxfer_auxv, handle_qxfer_libraries) (handle_qxfer_libraries_svr4, handle_qxfer_siginfo) (handle_qxfer_spu, handle_qxfer_statictrace, handle_qxfer_fdpic) (handle_query): Check if there's a thread selected instead of checking whether there's any thread in the thread list. (handle_qxfer_threads, handle_qxfer_btrace) (handle_qxfer_btrace_conf): Don't error out early if there's no thread in the thread list. (handle_v_cont, myresume): Don't set the current thread to the continue thread. (process_serial_event) : Also set thread_id if the previous general thread is still alive. (process_serial_event) : If setting the current thread to the general thread fails, error out. * spu-low.c (spu_resume, spu_request_interrupt): Use the first thread's lwp instead of the current thread's. * target.c (set_desired_thread): If the desired thread was not found, leave the current thread pointing to NULL. Return an int (boolean) indicating success. * target.h (set_desired_thread): Change return type to int. commit 2d7711a36720b0bc44fee20d0bf057614ead21c2 Author: Gary Benson Date: Fri Aug 21 17:10:24 2015 +0100 Make remote file transfers interruptible This commit makes it possible to interrupt remote file transfers. commit 4313b8c0ed5877feb5034bfff4056e1ccfe221f1 Author: Gary Benson Date: Fri Aug 21 17:09:20 2015 +0100 Warn when accessing binaries from remote targets GDB provides no indicator of progress during file operations, and can appear to have locked up during slow remote transfers. This commit updates GDB to print a warning each time a file is accessed over RSP. An additional message detailing how to avoid remote transfers is printed for the first transfer only. gdb/ChangeLog: * target.h (struct target_ops) : New argument warn_if_slow. Update comment. All implementations updated. (target_fileio_open_warn_if_slow): New declaration. * target.c (target_fileio_open): Renamed as... (target_fileio_open_1): ...this. New argument warn_if_slow. Pass warn_if_slow to implementation. Update debug printing. (target_fileio_open): New function. (target_fileio_open_warn_if_slow): Likewise. * gdb_bfd.c (gdb_bfd_iovec_fileio_open): Use new function target_fileio_open_warn_if_slow. gdb/testsuite/ChangeLog: * gdb.trace/pending.exp: Cope with remote transfer warnings. commit f36b87190aed31b1ef7787e5966be542e8abdb58 Author: Gary Benson Date: Fri Aug 21 16:55:53 2015 +0100 Fix stale cleanup left by linux_mntns_access_fs This commit fixes a stale cleanup left by linux_mntns_access_fs. gdb/ChangeLog: * nat/linux-namespaces.c (linux_mntns_access_fs): Do not overwrite old_chain. commit d02603dc201f80cd9d2a1f4b1a16110b1e04222b Author: Nick Clifton Date: Fri Aug 21 16:42:14 2015 +0100 Allow symbol and label names to be enclosed in double quotes. gas PR gas/18581 * expr.c (get_symbol_end): Rename to get_symbol_name. Add a return parameter pointing to the start of the symbol. Allow symbol names enclosed in double quotes. (restore_line_pointer): New function. Replace the NUL character inserted into the input stream with the given character. If the character was a double quote, advance the input pointer. * expr.h (get_symbol_end): Delete. (get_symbol_name): Add prototype. (restore_line_pointer): Prototype. * read.h (SKIP_WHITESPACE_AFTER_NAME): New macro. * doc/as.texinfo (Symbol Intro): Document that symbol names can now be enclosed in double quotes. * cond.c (s_ifdef): Replace get_symbol_end with get_symbol_name. Use restore_line_pointer to replace the NUL in the input stream. Use SKIP_WHITESPACE_AFTER_NAME to skip past the end of a symbol. Check for the use of double quoted symbol names. * expr.c: Likewise. * config/obj-aout.c: Likewise. * config/obj-coff-seh.c: Likewise. * config/obj-coff.c: Likewise. * config/obj-elf.c: Likewise. * config/obj-evax.c: Likewise. * config/obj-macho.c: Likewise. * config/obj-som.c: Likewise. * config/tc-alpha.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-dlx.c: Likewise. * config/tc-h8300.c: Likewise. * config/tc-hppa.c: Likewise. * config/tc-i370.c: Likewise. * config/tc-i386-intel.c: Likewise. * config/tc-i386.c: Likewise. * config/tc-i960.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-iq2000.c: Likewise. * config/tc-m32r.c: Likewise. * config/tc-m68hc11.c: Likewise. * config/tc-m68k.c: Likewise. * config/tc-microblaze.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-mmix.c: Likewise. * config/tc-mn10200.c: Likewise. * config/tc-mn10300.c: Likewise. * config/tc-nios2.c: Likewise. * config/tc-ppc.c: Likewise. * config/tc-s390.c: Likewise. * config/tc-score.c: Likewise. * config/tc-score7.c: Likewise. * config/tc-sparc.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-tic6x.c: Likewise. * config/tc-tilegx.c: Likewise. * config/tc-tilepro.c: Likewise. * config/tc-v850.c: Likewise. * config/tc-xtensa.c: Likewise. * config/tc-z80.c: Likewise. * dw2gencfi.c: Likewise. * dwarf2dbgc.: Likewise. * ecoff.c: Likewise. * read.c: Likewise. * stabs.c: Likewise. tests PR gas/18581 * gas/all/byte.d: Disable this test. Quoted expressions are now allowed in .byte directives. * gas/all/quoted-sym-names.s: New test. * gas/all/quoted-sym-names.d: Expected output. * gas/all/gas.exp: Run the new test. commit 40045d91812b25c88c8275b8c08d27c234b68ba8 Author: Max Filippov Date: Thu Jul 2 15:10:58 2015 +0300 xtensa: implement NPTL helpers These changes allow debugging multithreaded NPTL xtensa applications. 2015-08-20 Max Filippov gdb/gdbserver/ * configure.srv (xtensa*-*-linux*): Add srv_linux_thread_db=yes. * linux-xtensa-low.c (arch/xtensa.h gdb_proc_service.h): New #includes. (ps_get_thread_area): New function. 2015-08-20 Max Filippov gdb/ * arch/xtensa.h: New file. * xtensa-linux-nat.c (gdb_proc_service.h): New #include. (ps_get_thread_area): New function. * xtensa-linux-tdep.c (xtensa_linux_init_abi): Add call to set_gdbarch_fetch_tls_load_module_address to enable TLS support. * xtensa-tdep.c (osabi.h): New #include. (xtensa_gdbarch_init): Call gdbarch_init_osabi to register xtensa-specific hooks. * xtensa-tdep.h (struct xtensa_elf_gregset_t): Add threadptr member and move the structure to arch/xtensa.h. commit ab4e4ed5dabc378c06ee647afd5793513393ae3f Author: Alexander Fomin Date: Fri Aug 21 14:06:41 2015 +0300 PR binutils/18257: Properly decode x86/Intel mask instructions. opcodes/ PR binutils/18257 * i386-dis.c: Use MOD_TABLE for most of mask instructions. (MOD enum): Add MOD_VEX_W_0_0F41_P_0_LEN_1, MOD_VEX_W_1_0F41_P_0_LEN_1, MOD_VEX_W_0_0F41_P_2_LEN_1, MOD_VEX_W_1_0F41_P_2_LEN_1, MOD_VEX_W_0_0F42_P_0_LEN_1, MOD_VEX_W_1_0F42_P_0_LEN_1, MOD_VEX_W_0_0F42_P_2_LEN_1, MOD_VEX_W_1_0F42_P_2_LEN_1, MOD_VEX_W_0_0F44_P_0_LEN_1, MOD_VEX_W_1_0F44_P_0_LEN_1, MOD_VEX_W_0_0F44_P_2_LEN_1, MOD_VEX_W_1_0F44_P_2_LEN_1, MOD_VEX_W_0_0F45_P_0_LEN_1, MOD_VEX_W_1_0F45_P_0_LEN_1, MOD_VEX_W_0_0F45_P_2_LEN_1, MOD_VEX_W_1_0F45_P_2_LEN_1, MOD_VEX_W_0_0F46_P_0_LEN_1, MOD_VEX_W_1_0F46_P_0_LEN_1, MOD_VEX_W_0_0F46_P_2_LEN_1, MOD_VEX_W_1_0F46_P_2_LEN_1, MOD_VEX_W_0_0F47_P_0_LEN_1, MOD_VEX_W_1_0F47_P_0_LEN_1, MOD_VEX_W_0_0F47_P_2_LEN_1, MOD_VEX_W_1_0F47_P_2_LEN_1, MOD_VEX_W_0_0F4A_P_0_LEN_1, MOD_VEX_W_1_0F4A_P_0_LEN_1, MOD_VEX_W_0_0F4A_P_2_LEN_1, MOD_VEX_W_1_0F4A_P_2_LEN_1, MOD_VEX_W_0_0F4B_P_0_LEN_1, MOD_VEX_W_1_0F4B_P_0_LEN_1, MOD_VEX_W_0_0F4B_P_2_LEN_1, MOD_VEX_W_0_0F91_P_0_LEN_0, MOD_VEX_W_1_0F91_P_0_LEN_0, MOD_VEX_W_0_0F91_P_2_LEN_0, MOD_VEX_W_1_0F91_P_2_LEN_0, MOD_VEX_W_0_0F92_P_0_LEN_0, MOD_VEX_W_0_0F92_P_2_LEN_0, MOD_VEX_W_0_0F92_P_3_LEN_0, MOD_VEX_W_1_0F92_P_3_LEN_0, MOD_VEX_W_0_0F93_P_0_LEN_0, MOD_VEX_W_0_0F93_P_2_LEN_0, MOD_VEX_W_0_0F93_P_3_LEN_0, MOD_VEX_W_1_0F93_P_3_LEN_0, MOD_VEX_W_0_0F98_P_0_LEN_0, MOD_VEX_W_1_0F98_P_0_LEN_0, MOD_VEX_W_0_0F98_P_2_LEN_0, MOD_VEX_W_1_0F98_P_2_LEN_0, MOD_VEX_W_0_0F99_P_0_LEN_0, MOD_VEX_W_1_0F99_P_0_LEN_0, MOD_VEX_W_0_0F99_P_2_LEN_0, MOD_VEX_W_1_0F99_P_2_LEN_0, MOD_VEX_W_0_0F3A30_P_2_LEN_0, MOD_VEX_W_1_0F3A30_P_2_LEN_0, MOD_VEX_W_0_0F3A31_P_2_LEN_0, MOD_VEX_W_1_0F3A31_P_2_LEN_0, MOD_VEX_W_0_0F3A32_P_2_LEN_0, MOD_VEX_W_1_0F3A32_P_2_LEN_0, MOD_VEX_W_0_0F3A33_P_2_LEN_0, MOD_VEX_W_1_0F3A33_P_2_LEN_0. (vex_w_table): Replace terminals with MOD_TABLE entries for most of mask instructions. gas/testsuite PR binutils/18257 * gas/i386/disassem.s: Add mask instructions with invalid ModR/M byte. * gas/i386/x86-64-disassem.s: Likewise. * gas/i386/disassem.d: Updated. * gas/i386/x86-64-disassem.d: Likewise. commit 80152258b9dfe033828e5c5b6dc3252be1ba7a84 Author: Pedro Alves Date: Fri Aug 21 10:13:27 2015 +0100 Add readahead cache to gdb's vFile:pread This patch almost halves the time it takes to "target remote + run to main" on a higher-latency connection. E.g., I've got a ping time of ~85ms to an x86-64 machine on the gcc compile farm (almost 2000km away from me), and I'm behind a ~16Mbit ADSL. When I connect to a gdbserver debugging itself on that machine and run to main, it takes almost 55 seconds: [palves@gcc76] $ ./gdbserver :9999 ./gdbserver [palves@home] $ ssh -L 9999:localhost:9999 gcc76.fsffrance.org [palves@home] $ time ./gdb -data-directory=data-directory -ex "tar rem :9999" -ex "b main" -ex "c" -ex "set confirm off" -ex "quit" Pristine gdb 7.10.50.20150820-cvs gets us: ... Remote debugging using :9999 Reading symbols from target:/home/palves/gdb/build/gdb/gdbserver/gdbserver...done. Reading symbols from target:/lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. 0x00007ffff7ddd190 in ?? () from target:/lib64/ld-linux-x86-64.so.2 Breakpoint 1 at 0x41200c: file ../../../src/gdb/gdbserver/server.c, line 3635. Continuing. Breakpoint 1, main (argc=1, argv=0x7fffffffe3d8) at ../../../src/gdb/gdbserver/server.c:3635 3635 ../../../src/gdb/gdbserver/server.c: No such file or directory. /home/palves/gdb/build/gdb/gdbserver/gdbserver: No such file or directory. real 0m54.803s user 0m0.329s sys 0m0.064s While with the readahead cache added by this patch, it drops to: real 0m29.462s user 0m0.454s sys 0m0.054s I added a few counters to show cache hit/miss, and got: readahead cache miss 142 readahead cache hit 310 Tested on x86_64 Fedora 20. gdb/ChangeLog: 2015-08-21 Pedro Alves * remote.c (struct readahead_cache): New. (struct remote_state) : New field. (remote_open_1): Invalidate the cache. (readahead_cache_invalidate, readahead_cache_invalidate_fd): New functions. (remote_hostio_pwrite): Invalidate the readahead cache. (remote_hostio_pread): Rename to ... (remote_hostio_pread_vFile): ... this. (remote_hostio_pread_from_cache): New function. (remote_hostio_pread): Reimplement. (remote_hostio_close): Invalidate the readahead cache. commit 88fc5eb7e23af132eacb895e475b31be0f7623e6 Author: Marcin Cieslak Date: Wed Aug 19 16:51:31 2015 +0000 procfs.c: Include "filestuff.h" Fixes implicit function declaration error in gdb/procfs.c:4927 about undeclared make_cleanup_close(). gdb/ChangeLog: PR build/18843 * procfs.c: Include "filestuff.h". commit 6f1cb6eac2f28c6e1cb49c011f2b916afb90b4ff Author: Patrick Palka Date: Tue Aug 18 21:08:57 2015 -0400 Remove fields curch and cur_line from TUI_CMD_WIN These fields are currently used to track the location of the cursor inside the command window. But their usefulness is questionable because ncurses already internally keeps track of the location of the cursor, whose coordinates we can query using the functions getyx(), getcurx() or getcury(). It is an unnecessary pain to keep these fields in sync with ncurses, and their meaning is not well-defined anyway. For instance, it is not clear whether the coordinates held in these fields are authoritative, or whether the coordinates reported by ncurses are. So to keep things simple, this patch removes these fields and replaces existing reads of these fields with calls to the appropriate ncurses querying functions, and replaces writes to these fields with calls to wmove() (when necessary and applicable). In the function tui_cont_sig(), I removed the call to wmove() entirely because moving to (start_line, curch) makes no sense. The move should have been to (cur_line, curch) -- which would now be a no-op. Tested on x86_64 Fedora 22, no obvious regressions. gdb/ChangeLog: * tui/tui-data.h (tui_command_info): Remove fields cur_line and curch. * tui/tui-data.c (tui_clear_win_detail) [CMD_WIN]: Don't set cur_line or curch, instead call wmove(). (init_win_info) [CMD_WIN]: Likewise. * tui/tui-io.c (tui_puts): Likewise. Don't read cur_line, instead call getcury(). (tui_redisplay_readline): Don't set cur_line or curch. (tui_mld_erase_entire_line): Don't read cur_line, instead call getcury(). (tui_cont_sig): Remove call to wmove. (tui_getc): Don't read cur_line or curch, instead call getcury() or getyx(). Don't set curch. * tui/tui-win.c (make_visible_with_new_height) [CMD_WIN]: Don't set cur_line or curch. Always move cursor to (0,0). commit 8e804db96b40c5c88d26b933fb19b6bfcfcb1101 Author: GDB Administrator Date: Fri Aug 21 00:00:07 2015 +0000 Automatic date update in version.in ----------------------------------------------------------------------- Summary of changes: bfd/version.h | 2 +- gas/ChangeLog | 67 +++++ gas/NEWS | 4 + gas/cond.c | 6 +- gas/config/obj-aout.c | 10 +- gas/config/obj-coff-seh.c | 20 +- gas/config/obj-coff.c | 31 +-- gas/config/obj-elf.c | 42 ++-- gas/config/obj-evax.c | 5 +- gas/config/obj-macho.c | 20 +- gas/config/obj-som.c | 5 +- gas/config/tc-alpha.c | 90 +++--- gas/config/tc-arc.c | 20 +- gas/config/tc-arm.c | 15 +- gas/config/tc-dlx.c | 10 +- gas/config/tc-h8300.c | 2 +- gas/config/tc-hppa.c | 193 +++++------- gas/config/tc-i370.c | 9 +- gas/config/tc-i386-intel.c | 11 +- gas/config/tc-i386.c | 36 ++- gas/config/tc-i960.c | 5 +- gas/config/tc-ia64.c | 105 +++---- gas/config/tc-iq2000.c | 5 +- gas/config/tc-m32r.c | 12 +- gas/config/tc-m68hc11.c | 5 +- gas/config/tc-m68k.c | 13 +- gas/config/tc-microblaze.c | 13 +- gas/config/tc-mips.c | 51 ++-- gas/config/tc-mmix.c | 26 +- gas/config/tc-mn10200.c | 37 +-- gas/config/tc-mn10300.c | 103 ++++---- gas/config/tc-nios2.c | 7 +- gas/config/tc-ppc.c | 126 +++----- gas/config/tc-s390.c | 29 +-- gas/config/tc-score.c | 10 +- gas/config/tc-score7.c | 10 +- gas/config/tc-sparc.c | 21 +- gas/config/tc-tic4x.c | 51 ++-- gas/config/tc-tic54x.c | 70 ++--- gas/config/tc-tic6x.c | 13 +- gas/config/tc-tilegx.c | 31 +- gas/config/tc-tilepro.c | 5 +- gas/config/tc-v850.c | 68 ++--- gas/config/tc-xtensa.c | 8 +- gas/config/tc-z80.c | 7 +- gas/doc/as.texinfo | 7 +- gas/dw2gencfi.c | 30 +- gas/dwarf2dbg.c | 13 +- gas/ecoff.c | 50 ++-- gas/expr.c | 78 ++++-- gas/expr.h | 3 +- gas/read.c | 160 +++++----- gas/read.h | 10 + gas/stabs.c | 5 +- gas/testsuite/ChangeLog | 17 + gas/testsuite/gas/all/byte.d | 5 +- gas/testsuite/gas/all/gas.exp | 2 + gas/testsuite/gas/all/quoted-sym-names.d | 6 + gas/testsuite/gas/all/quoted-sym-names.s | 4 + gas/testsuite/gas/i386/disassem.d | 332 +++++++++++++++++++++- gas/testsuite/gas/i386/disassem.s | 166 +++++++++++ gas/testsuite/gas/i386/x86-64-disassem.d | 332 +++++++++++++++++++++- gas/testsuite/gas/i386/x86-64-disassem.s | 166 +++++++++++ gas/testsuite/gas/ia64/group-1.d | 2 +- gdb/ChangeLog | 72 +++++ gdb/arch/xtensa.h | 46 +++ gdb/gdb_bfd.c | 11 +- gdb/gdbserver/ChangeLog | 52 ++++ gdb/gdbserver/configure.srv | 1 + gdb/gdbserver/inferiors.c | 1 + gdb/gdbserver/linux-low.c | 16 +- gdb/gdbserver/linux-xtensa-low.c | 21 ++ gdb/gdbserver/lynx-low.c | 2 +- gdb/gdbserver/remote-utils.c | 2 +- gdb/gdbserver/server.c | 102 ++++--- gdb/gdbserver/server.h | 3 + gdb/gdbserver/spu-low.c | 9 +- gdb/gdbserver/target.c | 8 +- gdb/gdbserver/target.h | 2 +- gdb/inf-child.c | 3 +- gdb/linux-nat.c | 3 +- gdb/nat/linux-namespaces.c | 2 +- gdb/procfs.c | 1 + gdb/remote.c | 165 ++++++++++- gdb/target.c | 38 ++- gdb/target.h | 17 +- gdb/testsuite/ChangeLog | 4 + gdb/testsuite/gdb.trace/pending.exp | 8 +- gdb/tui/tui-data.c | 5 +- gdb/tui/tui-data.h | 2 - gdb/tui/tui-io.c | 36 +-- gdb/tui/tui-win.c | 6 +- gdb/xtensa-linux-nat.c | 22 ++ gdb/xtensa-linux-tdep.c | 4 + gdb/xtensa-tdep.c | 4 + gdb/xtensa-tdep.h | 24 +-- opcodes/ChangeLog | 37 +++ opcodes/i386-dis.c | 472 ++++++++++++++++++++++++++---- 98 files changed, 2885 insertions(+), 1133 deletions(-) create mode 100644 gas/testsuite/gas/all/quoted-sym-names.d create mode 100644 gas/testsuite/gas/all/quoted-sym-names.s create mode 100644 gdb/arch/xtensa.h First 500 lines of diff: diff --git a/bfd/version.h b/bfd/version.h index 737b89a..a00b9d7 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20150820 +#define BFD_VERSION_DATE 20150821 #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/gas/ChangeLog b/gas/ChangeLog index 5714982..3bcd8e6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,70 @@ +2015-08-21 Nick Clifton + + PR gas/18581 + * expr.c (get_symbol_end): Rename to get_symbol_name. Add a + return parameter pointing to the start of the symbol. Allow + symbol names enclosed in double quotes. + (restore_line_pointer): New function. Replace the NUL character + inserted into the input stream with the given character. If the + character was a double quote, advance the input pointer. + * expr.h (get_symbol_end): Delete. + (get_symbol_name): Add prototype. + (restore_line_pointer): Prototype. + * read.h (SKIP_WHITESPACE_AFTER_NAME): New macro. + * doc/as.texinfo (Symbol Intro): Document that symbol names can + now be enclosed in double quotes. + * cond.c (s_ifdef): Replace get_symbol_end with get_symbol_name. + Use restore_line_pointer to replace the NUL in the input stream. + Use SKIP_WHITESPACE_AFTER_NAME to skip past the end of a symbol. + Check for the use of double quoted symbol names. + * expr.c: Likewise. + * config/obj-aout.c: Likewise. + * config/obj-coff-seh.c: Likewise. + * config/obj-coff.c: Likewise. + * config/obj-elf.c: Likewise. + * config/obj-evax.c: Likewise. + * config/obj-macho.c: Likewise. + * config/obj-som.c: Likewise. + * config/tc-alpha.c: Likewise. + * config/tc-arc.c: Likewise. + * config/tc-arm.c: Likewise. + * config/tc-dlx.c: Likewise. + * config/tc-h8300.c: Likewise. + * config/tc-hppa.c: Likewise. + * config/tc-i370.c: Likewise. + * config/tc-i386-intel.c: Likewise. + * config/tc-i386.c: Likewise. + * config/tc-i960.c: Likewise. + * config/tc-ia64.c: Likewise. + * config/tc-iq2000.c: Likewise. + * config/tc-m32r.c: Likewise. + * config/tc-m68hc11.c: Likewise. + * config/tc-m68k.c: Likewise. + * config/tc-microblaze.c: Likewise. + * config/tc-mips.c: Likewise. + * config/tc-mmix.c: Likewise. + * config/tc-mn10200.c: Likewise. + * config/tc-mn10300.c: Likewise. + * config/tc-nios2.c: Likewise. + * config/tc-ppc.c: Likewise. + * config/tc-s390.c: Likewise. + * config/tc-score.c: Likewise. + * config/tc-score7.c: Likewise. + * config/tc-sparc.c: Likewise. + * config/tc-tic4x.c: Likewise. + * config/tc-tic54x.c: Likewise. + * config/tc-tic6x.c: Likewise. + * config/tc-tilegx.c: Likewise. + * config/tc-tilepro.c: Likewise. + * config/tc-v850.c: Likewise. + * config/tc-xtensa.c: Likewise. + * config/tc-z80.c: Likewise. + * dw2gencfi.c: Likewise. + * dwarf2dbgc.: Likewise. + * ecoff.c: Likewise. + * read.c: Likewise. + * stabs.c: Likewise. + 2015-08-19 Jiong Wang * config/tc-aarch64.c (reloc_table): New relocation types support for diff --git a/gas/NEWS b/gas/NEWS index 02a8d00..13a1911 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -2,6 +2,10 @@ Changes in 2.26: +* Symbol and label names can now be enclosed in double quotes (") which allows + them to contain characters that are not part of valid symbol names in high + level languages. + * Added the correctly spelled -march=armv6kz, for ARMv6KZ support. The previous spelling, -march=armv6zk, is still accepted. diff --git a/gas/cond.c b/gas/cond.c index 2649976..e3b30f0 100644 --- a/gas/cond.c +++ b/gas/cond.c @@ -77,7 +77,7 @@ s_ifdef (int test_defined) SKIP_WHITESPACE (); name = input_line_pointer; - if (!is_name_beginner (*name)) + if (!is_name_beginner (*name) && *name != '"') { as_bad (_("invalid identifier for \".ifdef\"")); obstack_1grow (&cond_obstack, 0); @@ -85,9 +85,9 @@ s_ifdef (int test_defined) return; } - c = get_symbol_end (); + c = get_symbol_name (& name); symbolP = symbol_find (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); initialize_cframe (&cframe); diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 5500ac9..401b3a7 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -152,10 +152,9 @@ obj_aout_weak (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); S_SET_WEAK (symbolP); if (c == ',') @@ -182,10 +181,9 @@ obj_aout_type (int ignore ATTRIBUTE_UNUSED) int c; symbolS *sym; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); sym = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); if (*input_line_pointer == ',') { diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c index 2ffefa8..ec53585 100644 --- a/gas/config/obj-coff-seh.c +++ b/gas/config/obj-coff-seh.c @@ -329,8 +329,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) if (*input_line_pointer == '@') { - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); seh_ctx_cur->handler.X_op = O_constant; seh_ctx_cur->handler.X_add_number = 0; @@ -343,7 +342,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) else as_bad (_("unknown constant value '%s' for handler"), symbol_name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } else expression (&seh_ctx_cur->handler); @@ -359,8 +358,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) { do { - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); if (strcasecmp (symbol_name, "@unwind") == 0) seh_ctx_cur->handler_flags |= UNW_FLAG_UHANDLER; @@ -369,7 +367,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) else as_bad (_(".seh_handler constant '%s' unknown"), symbol_name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } while (skip_whitespace_and_comma (0)); } @@ -454,10 +452,9 @@ obj_coff_seh_proc (int what ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); seh_ctx_cur->func_name = xstrdup (symbol_name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); @@ -549,14 +546,13 @@ seh_x64_read_reg (const char *directive, int kind) SKIP_WHITESPACE (); if (*input_line_pointer == '%') ++input_line_pointer; - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (& symbol_name); for (i = 0; i < 16; i++) if (! strcasecmp (regs[i], symbol_name)) break; - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); /* Error if register not found, or EAX used as a frame pointer. */ if (i == 16 || (kind == 0 && i == 0)) diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 449cb4f..c0a3f1f 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -603,8 +603,7 @@ obj_coff_def (int what ATTRIBUTE_UNUSED) SKIP_WHITESPACES (); - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); symbol_name_length = strlen (symbol_name); symbol_name_copy = xmalloc (symbol_name_length + 1); strcpy (symbol_name_copy, symbol_name); @@ -620,7 +619,7 @@ obj_coff_def (int what ATTRIBUTE_UNUSED) if (S_IS_STRING (def_symbol_in_progress)) SF_SET_STRING (def_symbol_in_progress); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } @@ -973,8 +972,7 @@ obj_coff_tag (int ignore ATTRIBUTE_UNUSED) } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); #ifdef tc_canonicalize_symbol_name symbol_name = tc_canonicalize_symbol_name (symbol_name); @@ -988,8 +986,8 @@ obj_coff_tag (int ignore ATTRIBUTE_UNUSED) as_warn (_("tag not found for .tag %s"), symbol_name); SF_SET_TAGGED (def_symbol_in_progress); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } @@ -1024,11 +1022,11 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED) if (is_name_beginner (*input_line_pointer)) { - char *symbol_name = input_line_pointer; - char name_end = get_symbol_end (); + char *symbol_name; + char name_end = get_symbol_name (&symbol_name); #ifdef tc_canonicalize_symbol_name - symbol_name = tc_canonicalize_symbol_name (symbol_name); + symbol_name = tc_canonicalize_symbol_name (symbol_name); #endif if (streq (symbol_name, ".")) { @@ -1059,7 +1057,7 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED) } /* Otherwise, it is the name of a non debug symbol and its value will be calculated later. */ - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } else { @@ -1170,8 +1168,7 @@ obj_coff_weak (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); if (*name == 0) { as_warn (_("badly formed .weak directive ignored")); @@ -1181,7 +1178,7 @@ obj_coff_weak (int ignore ATTRIBUTE_UNUSED) c = 0; symbolP = symbol_find_or_make (name); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); S_SET_WEAK (symbolP); if (c == ',') @@ -1564,15 +1561,11 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED) return; } - section_name = input_line_pointer; - c = get_symbol_end (); - + c = get_symbol_name (§ion_name); name = xmalloc (input_line_pointer - section_name + 1); strcpy (name, section_name); - *input_line_pointer = c; - - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); exp = 0; flags = SEC_NO_FLAGS; diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 08ae853..031fafb 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -406,11 +406,10 @@ get_sym_from_input_line_and_check (void) char c; symbolS *sym; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (& name); sym = symbol_find_or_make (name); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* There is no symbol name if input_line_pointer has not moved. */ if (name == input_line_pointer) @@ -1043,9 +1042,9 @@ obj_elf_section (int push) } else if (c == '@' || c == '%') { - beg = ++input_line_pointer; - c = get_symbol_end (); - *input_line_pointer = c; + ++input_line_pointer; + c = get_symbol_name (& beg); + (void) restore_line_pointer (c); type = obj_elf_section_type (beg, input_line_pointer - beg, TRUE); } else @@ -1125,9 +1124,9 @@ obj_elf_section (int push) ignore_rest_of_line (); return; } - beg = ++input_line_pointer; - c = get_symbol_end (); - *input_line_pointer = c; + ++input_line_pointer; + c = get_symbol_name (& beg); + (void) restore_line_pointer (c); attr |= obj_elf_section_word (beg, input_line_pointer - beg, & type); @@ -1319,19 +1318,18 @@ obj_elf_symver (int ignore ATTRIBUTE_UNUSED) ++input_line_pointer; SKIP_WHITESPACE (); - name = input_line_pointer; /* Temporarily include '@' in symbol names. */ old_lexat = lex_type[(unsigned char) '@']; lex_type[(unsigned char) '@'] |= LEX_NAME; - c = get_symbol_end (); + c = get_symbol_name (& name); lex_type[(unsigned char) '@'] = old_lexat; if (symbol_get_obj (sym)->versioned_name == NULL) { symbol_get_obj (sym)->versioned_name = xstrdup (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); if (strchr (symbol_get_obj (sym)->versioned_name, ELF_VER_CHR) == NULL) @@ -1354,7 +1352,7 @@ obj_elf_symver (int ignore ATTRIBUTE_UNUSED) return; } - *input_line_pointer = c; + (void) restore_line_pointer (c); } demand_empty_rest_of_line (); @@ -1374,8 +1372,7 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED) if (*input_line_pointer == '#') ++input_line_pointer; - cname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (& cname); csym = symbol_find (cname); /* GCFIXME: should check that we don't have two .vtable_inherits for @@ -1391,7 +1388,7 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED) *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { as_bad (_("expected comma after name in .vtable_inherit")); @@ -1414,10 +1411,9 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED) } else { - pname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (& pname); psym = symbol_find_or_make (pname); - *input_line_pointer = c; + restore_line_pointer (c); } demand_empty_rest_of_line (); @@ -1767,15 +1763,15 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) static void obj_elf_size (int ignore ATTRIBUTE_UNUSED) { - char *name = input_line_pointer; - char c = get_symbol_end (); + char *name; + char c = get_symbol_name (&name); char *p; expressionS exp; symbolS *sym; p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { *p = 0; @@ -1847,7 +1843,7 @@ obj_elf_type_name (char *cp) *input_line_pointer = '\0'; } else - *cp = get_symbol_end (); + *cp = get_symbol_name (&p); return p; } diff --git a/gas/config/obj-evax.c b/gas/config/obj-evax.c index b3702ef..b712e13 100644 --- a/gas/config/obj-evax.c +++ b/gas/config/obj-evax.c @@ -60,10 +60,9 @@ s_evax_weak (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); S_SET_WEAK (symbolP); if (c == ',') diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 10e8dbf..d0a4053 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -475,8 +475,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED) input_line_pointer++; /* Skip ',' */ SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; @@ -488,7 +487,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED) goto done; } hooks/post-receive -- Repository for Project Archer.