summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-09-16Update GDB to properly handle DWARF v5 format.HEADndk-r23-beta6ndk-r23-beta5ndk-r23-beta4ndk-r23-beta3ndk-r23-beta2ndk-r23-beta1ndk-r22-beta1ndk-r22ndk-release-r23ndk-release-r22mastermainbusytown-mac1010-releaseCaroline Tice
Minimum updates to add proper handling for DWARF v5. Test: built gdb, ran gdb on 4 variants of test program: dwarf4 with dwo files; dwarf4 with .dwp file; dwarf5 with dwo files; dwarf5 with dwp file. Change-Id: Ibf752386adb14b7bf4e60d8ec79851f29bf17e11
2020-09-14Remove gdb-9.1Haibo Huang
Change-Id: I9206e66f0425bfca1dec53b705c06d01ab391474
2020-09-14Cherry-pick local changes to 9.2Haibo Huang
Cherry-picked commits: b711aa8: Add Unix domain socket support to gdbserver 7.9.1. 4c58332: Go back to snprintf rather than strlcpy. c64829b: Fallback to open if multifs_open fails. 2177073: Fix gdbserver process interruption. 35ee683: Remove gdb hack. 78af0f6: Handle cross compile for locale configuration dfc5ca4: Set the default gdb osabi to GNU/Linux. 5cbd102: Specify osabi in arm/aarch64 tdescs. (updated) d378e66: Explicit link -ldl for gdbserver Test: build Change-Id: Iea7f0159ad5d4f5edba0db215a96bc85b3f332cd
2020-09-14Add vanilla gdb-9.2Haibo Huang
Change-Id: I8d6e442049d88248f418d1304c611ae18e17b858
2020-09-02Revert aosp/989766Haibo Huang
It is no longer needed. Bug: 166741062 Bug: 136093140 Change-Id: I3c7d3cebd0cd77b1a490b9f040a9102901e60b47
2020-03-18Merge "Remove old gdb sources"Treehugger Robot
2020-03-18Remove old gdb sourcesHaibo Huang
Removed gdb-7.11, gdb-8.0.1, gdb-8.2 Only gdb-8.3 and gdb-9.1 are kept after this change. Change-Id: If91524cab69aadaed2db5255014ccf38d68ab4bc
2020-03-18Merge "Explicit link -ldl for gdbserver"Treehugger Robot
2020-03-18Explicit link -ldl for gdbserverHaibo Huang
Without this the build fails on x86. Change-Id: I3166bfb63bc754fc81acd89eeb7e4c729de58ee4
2020-03-18Cherry-pick local changes to 9.1Haibo Huang
Cherry-picked commits: b711aa8: Add Unix domain socket support to gdbserver 7.9.1. 4c58332: Go back to snprintf rather than strlcpy. b2aa3bd: [NDK] fix gdb 8.3 build for windows (updated) c64829b: Fallback to open if multifs_open fails. 2177073: Fix gdbserver process interruption. 35ee683: Remove gdb hack. 78af0f6: Handle cross compile for locale configuration dfc5ca4: Set the default gdb osabi to GNU/Linux. 5cbd102: Specify osabi in arm/aarch64 tdescs. (updated) Test: build Change-Id: I098bc2f1696580f2c1de6b58af8047fd5e9b40e9
2020-03-17Adds vanilla gdb-9.1Haibo Huang
Downloaded from https://ftp.gnu.org/gnu/gdb/gdb-9.1.tar.xz Change-Id: Ib922019507a27e5813a2fcdf4a590f752faa0e3d
2019-12-12Go back to snprintf rather than strlcpy.Elliott Hughes
ChromeOS uses the same copy of the gdb source, and glibc doesn't have strlcpy. snprintf is what we used historically anyway. Bug: http://b/146175305 Test: treehugger Change-Id: If048bc5baf5353690b29d78347e425f9f48afcd4
2019-12-04gdb: Don't fault for 'maint print psymbols' when using an indexElliott Hughes
Cherrypick of upstream 3dd9bb462012df685d6d41300dacedae1c81e28a. Original commit message: I found that these tests: make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp" make check-gdb RUNTESTFLAGS="--target_board=cc-with-debug-names gdb.base/maint.exp" were causing GDB to segfault. It turns out that this test runs this command: maint print psymbols -pc main /path/to/some/file which tries to lookup the partial_symtab for 'main'. The problem is that there is no partial_symtab for 'main' as we are using the .gdb_index or .debug_names instead of partial_symtabs. What happens is that maintenance_print_symbols calls find_pc_sect_psymtab, which looks for the partial_symtab in the objfile's objfile->partial_symtabs->psymtabs_addrmap. This is a problem because when we are using the indexes psymtabs_addrmap is reused to hold things other than partial_symtabs, this can be seen in dwarf2read.c in create_addrmap_from_index and create_addrmap_from_aranges. If we then lookup in psymtabs_addrmap we end up returning a pointer to something that isn't really a partial_symtab, after which everything goes wrong. Initially I simply added a check at the start of find_pc_sect_psymtab that the objfile had some partial_symtabs, like: if (objfile->partial_symtabs->psymtabs == NULL) return NULL; Figuring that if there were no partial_symtabs at all then this function should always return NULL, however, this caused a failure in the test gdb.python/py-event.exp which I didn't dig into too deeply, but seems to be that in this tests there are initially no psymtabs, but the second part of find_pc_sect_psymtab does manage to read some in from somewhere, with the check I added the test fails as we returned NULL here and this caused GDB to load in the full symtabs earlier than was expected. Instead I chose to guard only the access to psymtabs_addrmap with a check that the function has some psymtabs. This allows my original tests to pass, and the py-event.exp test to pass too. Now, a good argument can be made that we simply should never call find_pc_sect_psymtab on an objfile that is using indexes instead of partial_symtabs. I did consider this approach, we could easily add an assert into find_pc_sect_psymtab that if we find a partial_symtab in psymtabs_addrmap then the psymtabs pointer must be non-null. The responsibility would then be on the user of find_pc_sect_psymtab to ensure that the objfile being checked is suitable. In the end I didn't take this approach as the check in find_pc_sect_psymtab is cheap and this ensures that any future miss-uses of the function will not cause problems. I also extended the comment on psymtabs_addrmap to indicate that it holds more than just partial_symtabs as this was not at all clear from the original comment, and caused me some confusion when I was initially debugging this problem. gdb/ChangeLog: * psymtab.c (find_pc_sect_psymtab): Move baseaddr local into more inner scope, add check that the objfile has psymtabs before checking psymtabs_addrmap. * psymtab.h (psymtab_storage) <psymtabs_addrmap>: Extend comment. Bug: http://b/144102122 Test: gdbclient.py -p `adb shell pgrep dialer` Change-Id: I0ad68ac5dd29d86d5b1df06cca5fe02206afcfdb
2019-08-27[NDK] Remove old gdb build scriptndk-r21-rc1ndk-r21-beta2ndk-r21-beta1ndk-r21sparse-6113669-L69200000513850779Haibo Huang
Test: build Change-Id: If722b485870c9fce253237707e8f4d7a106dc215
2019-07-03Merge "Cherry-pick more 7.11 changes to 8.3"Treehugger Robot
2019-07-03Cherry-pick more 7.11 changes to 8.3Haibo Huang
Cherry-picked commits: b711aa8: Add Unix domain socket support to gdbserver 7.9.1. The upstream domain socket change actually get reverted. Original upstream change: f19c7ff839d7a32ebb48482ae7d318fb46ca823d Reverted in: 80e24d09860dbeba7d435b4a4f0990f85dbc084e Test: build Bug: 62547070 Change-Id: I574cc11792fac018453e05d82fd835c4d45de7c1
2019-07-03[NDK] fix gdb 8.3 build for windowsHaibo Huang
a) can not override operator new for libc++ for windows. b) libc++ needs libucrt but clang didn't add that automatically. Bug: 135839860 Bug: 62547070 Test: build Change-Id: I11b2fad66e2a66214c9a92b2b2cb32b9eba3de54
2019-07-02Cherry-pick 7.11 changes to 8.3Haibo Huang
Cherry-picked commits: c64829b: Fallback to open if multifs_open fails. 2177073: Fix gdbserver process interruption. 35ee683: Remove gdb hack. 78af0f6: Handle cross compile for locale configuration 5cbd102: Specify osabi in arm/aarch64 tdescs. dfc5ca4: Set the default gdb osabi to GNU/Linux. Bug: 62547070 Test: build Change-Id: I00a97aa866255ed853c13b8f11dc1a996ea810f2
2019-07-02Add gdb 8.3Haibo Huang
Bug: 62547070 Test: build Change-Id: I3cbf926ca52f3bd7cb151153e01357750acdb9d1
2019-03-22Adapt to ndk.hosts changes.Dan Albert
Test: ndk/checkbuild.py Bug: None Change-Id: I74e02a15a320a6f452c0d45d6ce7b8707e51a409
2019-02-05Make libthread-db.h file only be compiled with Cndk-r20bndk-r20-beta3ndk-r20-beta2ndk-r20-beta1ndk-r20ndk-release-r20Zhizhou Yang
GDB 8.2 will use C++ to compile in Android, and it will cause the problem that extern variables from libthread_db will be compiled into C++ symbols and cause a linker error. Fixed this by adding a macro to check whether we are using C++. Bug: 123031421 Test: GDB 8.2 linked correctly. Change-Id: I660147a4199e88f394ad0fbe365960f4691678d8
2019-02-05Cherry-pick 7.11 changes to 8.2Zhizhou Yang
Cherry-picked commits: c64829b: Fallback to open if multifs_open fails. 2177073: Fix gdbserver process interruption. b711aa8: Add Unix domain socket support to gdbserver 7.9.1. 35ee683: Remove gdb hack. 78af0f6: Handle cross compile for locale configuration a7e49fd: bfd: add experimental support for SHT_RELR sections. 689b53d: Fix debugging of stripped PIE executables with padded PT_TLS Fixed transport_is_reliable variable in b711aa8 so that it is consistent with 8.2 changes. Bug:62547070 Change-Id: I14a6b819cc0590dc11853dbce91111adfe2cb489
2018-12-12Add gdb-8.2.Elliott Hughes
Bug: http://b/62547070 Test: N/A Change-Id: I30b3c9fd63e15a31e7d2d7d2cb59e9eddc77addf
2018-08-20Fix debugging of stripped PIE executables with padded PT_TLSndk-r19cndk-r19bndk-r19-beta2ndk-r19-beta1ndk-r19ndk-release-r19Michael Spang
Certain PIE executables produced by gold cannot be debugged by gdb after being stripped. GDB requires program headers of PIE executables to match, and those checks may fail due to adjustments made during stripping. One case of this occurs because strip recomputes the memsz of PT_TLS and does not add alignment, while gold does. This is another variant of PR 11786, so apply the same fix of relaxing the program header matching. gdb/ChangeLog: PR gdb/11786 * solib-svr4.c (svr4_exec_displacement): Ignore memsz fields for PT_TLS segments. gdb/testsuite/ChangeLog: PR gdb/11786 * gdb.base/gcore-tls-pie.c: New file. * gdb.base/gcore-tls-pie.exp: New file. (cherry picked from commit be2d111a878e1422c921226bc7714131a5c470fa) Change-Id: I33ea8f871d74f8822f5c836c1edcafb53cfc7beb
2018-05-01bfd: add experimental support for SHT_RELR sections.ndk-r18bndk-r18-beta2ndk-r18-beta1ndk-release-r18Rahul Chaudhry
This change adds experimental support for SHT_RELR sections, proposed here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg This is a subset of the change that was merged into the aosp/binutils repo (https://android-review.googlesource.com/572669). It contains the definitions for the new section type / dynamic tags, and support in bfd for recognizing the new section type. Gdb uses bfd to read the program binary, and without this support, it fails to detect some architecture related settings. Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=836845 Test: Built gdb inside a Chrome OS chroot. Verified that architecture auto-detection works for an x86_64 binary containing a '.relr.dyn' section. The message "don't know how to handle section `.relr.dyn'" is no longer printed. Change-Id: Id199a7201d4750d2c6cb41a0c1a811777c322621
2017-10-24Merge "Fix dwarf2_string_attr for -gsplit-dwarf"ndk-r17bndk-r17-beta2ndk-r17-beta1ndk-r17ndk-release-r17Treehugger Robot
2017-10-24Fix dwarf2_string_attr for -gsplit-dwarfYunlian Jiang
This cherrypicks the upstream commit: commit 16eb6b2db49e6cf2fdca56efd37689fcc170cd37 Author: Leszek Swirski <leszeks@google.com> Date: Mon Aug 7 16:40:38 2017 +0200 Fix dwarf2_string_attr for -gsplit-dwarf The dwarf2_string_attr did not allow DW_FORM_GNU_str_index as a form for string types. This manifested as null strings in the namespace_name lookup (replaced with "(anonymous namespace)") when debugging Fission-compiled code. Change-Id: I81ead0d0cad0dce5d40b6d4efa08af60606ef560
2017-10-18Fix a segmenation fault when python evironment changes.Yunlian Jiang
This is a follow up CL for commit: e24220e: disable python when python is not available. BUG: None TEST: Build gdb inside ChromeOS chroot and run gdb outside it. There is no crash. Change-Id: I922c5dbac51b1e2808775f7b24edca63fc19d013
2017-10-16cherrypick a patch from 7.11Yunlian Jiang
This cherrypicks the commit: 78af0f6: Handle cross compile for locale configuration BUG=None TEST=./checkbuild.py on linux x86 Change-Id: I55ab0c97771b5efc3c317c20e7704bd94cb21a25
2017-10-13gdb: cherry-pick osabi patches from 7.11 to 8.0.1Yunlian Jiang
Cherry-picked commits: dfc5ca4 Set the default gdb osabi to GNU/Linux. 5cbd102 Specify osabi in arm/aarch64 tdescs. Change-Id: I787f5cafd4bb216934c3cf71aba6f77492c436bc
2017-10-12Cherry-pick 7.10 changes to 8.0.1.Yunlian Jiang
Cherry-picked commits: e24220e gdb: disable python when python is not available. d73c546 use snprintf instead of strlcpy for portablitly c64829b Fallback to open if multifs_open fails. 2177073 Fix gdbserver process interruption. b711aa8 Add Unix domain socket support to gdbserver 7.9.1 Test: build.py passes with gdb 8.0.1.
2017-10-11gdb: pull upstream gdb-8.0.1Yunlian Jiang
This pulls upstream gdb-8.0.1 to our repository. It does not affect current gdb builds. BUG=None TEST=gdb still builds gdb 7.11
2017-09-14Fix more TMPDIR issues in build-gdb.sh.Dan Albert
Test: TMPDIR=foo ndk/checkbuild.py --module host-tools Bug: None Change-Id: I214561f6fec21cfb8d6d8522421e1d8deae00a00
2017-09-14Don't use TMPDIR when building GDB.Dan Albert
Test: TMPDIR=foo ndk/checkbuild.py --module host-tools Bug: None Change-Id: Ia37d62443f59015be4d9aa00d535dfe750caa76d
2017-05-03Merge "gdb: backport an upstream patch to support fission with split debug."ndk-r16-beta2ndk-r16-beta1ndk-r16ndk-release-r16ndk-r16-releaseTreehugger Robot
2016-10-27Handle cross compile for locale configurationndk-r15-beta2ndk-r15-beta1ndk-r14-beta2ndk-r14-beta1ndk-r14ndk-r15-releasendk-r14-releaseMike Stroyan
Make gdb-7.11/gdb/gnulib/configure always check cross_compiling. Four locale checks were running executables to discover that. Running android executables on linux can hang a build. Test: ./checkbuild.py on linux x86 Bug: http://b/31347799 Change-Id: I3ca8977eb4b226c74c9d822033c733314cd7ed59
2016-09-16Prevent segfault in GDB when searching for architecture matchesBhushan Attarde
Cherry-picked from upstream: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=5d9bbb73c1df68741048c3d0f837b50c289ea608 This fixes gdb host crash when trying to read symbols from target. While patch is arch-neutral, we could only reproduce the issue for mips. * format.c (struct bfd_preserve): New "build_id" field. (bfd_preserve_save): Save "build_id". (bfd_preserve_restore): Restore "build_id". From https://sourceware.org/ml/gdb-patches/2016-09/msg00070.html : Currently the "build_id" field of "struct bfd" is not preserved by "struct bfd_preserve" when "bfd_check_format_matches" is going through all target vectors trying to find a compatible target vector. This leads to a segmentation fault in GDB. Consider a case where one compatible target vector has already been found (so the subset of bfd state is saved in struct bfd_preserve) and then an attempt to find a better match fails after it has modified bfd's build_id pointer. Since this attempt is failed, all its side effects will be undone and all memory allocations done by this vector will be free'd. This will eventually free the memory block that build_id pointer is pointing to. This free'd block then gets reallocated and used for storing something else -- leaving build_id pointing to incorrect contents. This patch adds "build_id" pointer to "struct bfd_preserve" so that it will be preserved on success which can then be recoverable on failure. Change-Id: I3e81c3a8a1d25869659bbf99bebe8b00062cea72
2016-07-01[mips] Add support for mips r6, microMIPS r6 and MSAndk-r13-beta2ndk-r13ndk-r13-releaseJaydeep Patil
Verified for all mips archs (mips32, mips32r6. mips64r6). Patch is a rebased version of: https://android-review.googlesource.com/153821 Change-Id: I60f576cc44571afd0000ddec4716e1fb0d02d660
2016-06-24Define DT_MIPS_RLD_MAP_REL in code, until renamed in sysrootndk-r13-beta1Nikola Veljkovic
Gdbserver is using prebuilts/ndk sysroot, where we haven't updated the tag. There we have old DT_MIPS_RLD_MAP2 tag defined (just a different name, same value). Until sysroot used to build gdbserver is fixed, we need to define the tag directly in the source code. Updating the tag is the job of: https://android-review.googlesource.com/233345. Workaround is based on change: I4dd0969c1a6f847fd5b11b1206c7bd6ef1f30137 Verified on: mips, mips64, arm, arm64 emulators. Change-Id: I552654458d506e219d19c7345d127c6bb2337997
2016-05-11gdb: fix "optimized out" error with debug fission.Yunlian Jiang
This patch comes from https://sourceware.org/ml/gdb-patches/2016-04/msg00658.html The bug entry is https://sourceware.org/bugzilla/show_bug.cgi?id=19999 This patch fixes symtab/19999. The problem here is that while we don't want to add the DWARF "base address" for DWO files (where addresses come from .debug_addr where the base address has already been added), we still need to add base_offset for PIE. Regression tested on amd64-linux. 2016-04-29 Doug Evans <dje@google.com> PR symtab/19999 * dwarf2loc.c (dwarf2_find_location_expression): For DWO files still add base_offset. testsuite/ * lib/dwarf.exp (build_executable_from_fission_assembler): Pass $options when building executable. * gdb.dwarf2/fission-loclists-pie.S: New file. * gdb.dwarf2/fission-loclists-pie.exp: New file. BUG=chromium:439320 TEST=the unittest in the patch passe
2016-05-05gdb: backport an upstream patch to support fission with split debug.Yunlian Jiang
The upstream patch was commit 6c4474237ab3356b100ebbdd6ff1a8839745023d Author: Doug Evans <dje@google.com> Date: Tue May 3 16:30:58 2016 -0700 PR symtab/19914 fix handling of dwp + split debug PR symtab/19914 * dwarf2read.c (open_and_init_dwp_file): Look at backlink if objfile is separate debug file. testsuite/ * gdb.dwarf2/dwp-sepdebug.c: New file. * gdb.dwarf2/dwp-sepdebug.exp: New file. TEST=build chrome with debug fission and put the .dwp file in the debug dir. gdb can read debug information from there.
2016-05-02Actually don't build lzma on windows.ndk-r12bndk-r12-beta2ndk-r12-releaseJosh Gao
Change-Id: I539f78c2d8d32ab7561b6f8eab8ff56d7000fb47
2016-04-29Don't build lzma on Windows.Josh Gao
Change-Id: I4a1a3dbba6ea09e97d65c4468033153eac3c86e7
2016-04-29Handle darwin's crappy touch(1).Josh Gao
Change-Id: I35549f7dc21399d6a7be786ef087557dc2990f8e
2016-04-28Make sure autoconf doesn't try to regenerate.Josh Gao
Bug: http://b/27926543 Change-Id: Ib6f0cb7bc08b4979ca7bcc1677e6c7c67f583601
2016-04-28Build and use liblzma in gdb.Josh Gao
Bug: http://b/27926543 Change-Id: If8d689b68c0a274d3cf6011be3a56a4bbfe70603
2016-03-31Set the default gdb osabi to GNU/Linux.ndk-r12-beta1Josh Gao
Bug: http://b/27926981 Change-Id: I9d8da00f74272e4cdcb9bb55d4b0c87411c87d02
2016-03-31Specify osabi in arm/aarch64 tdescs.Josh Gao
Upstream probably won't like this. Presumably, the correct fix is to add a new -linux version of each of these. Bug: http://b/27926981 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19895 Change-Id: I1eb1d821b027e18c152f025768e2c4d24f3d2729
2016-03-31Remove gdb hack.Josh Gao
Change-Id: I4b5ba65af700126048ef0dfa802c08db4ef66031
2016-03-31Cherry-pick 7.10 changes to 7.11.Josh Gao
Cherry-picked commits: e24220e gdb: disable python when python is not available. d73c546 use snprintf instead of strlcpy for portablitly c64829b Fallback to open if multifs_open fails. 2177073 Fix gdbserver process interruption. b711aa8 Add Unix domain socket support to gdbserver 7.9.1 Change-Id: I2cba7ae5c05503afb81f732cbd78440ebd2c45e8