aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-04-25Set GDB version number to 10.2.gdb-10.2-releaseJoel Brobecker2-1/+5
gdb/ChangeLog: * version.in: Set GDB version number to 10.2.
2021-04-25Automatic date update in version.inGDB Administrator1-1/+1
2021-04-24Automatic date update in version.inGDB Administrator1-1/+1
2021-04-23Automatic date update in version.inGDB Administrator1-1/+1
2021-04-22gdb/testsuite: add Python support check in gdb.python/flexible-array-member.expSimon Marchi2-0/+8
We don't want to execute this test if Python support is not compiled in GDB, add the necessary check. gdb/testsuite/ChangeLog: * gdb.python/flexible-array-member.exp: Add check for Python support. Change-Id: I853b937d2a193a0bb216566bef1a35354264b1c5
2021-04-22gdb: fix getting range of flexible array member in PythonSimon Marchi8-4/+227
As reported in bug 27757, we get an internal error when doing: $ cat test.c struct foo { int len; int items[]; }; struct foo *p; int main() { return 0; } $ gcc test.c -g -O0 -o test $ ./gdb -q -nx --data-directory=data-directory ./test -ex 'python gdb.parse_and_eval("p").type.target()["items"].type.range()' Reading symbols from ./test... /home/simark/src/binutils-gdb/gdb/gdbtypes.h:435: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) This is because the Python code (typy_range) blindly reads the high bound of the type of `items` as a constant value. Since it is a flexible array member, it has no high bound, the property is undefined. Since commit 8c2e4e0689 ("gdb: add accessors to struct dynamic_prop"), the getters check that you are not getting a property value of the wrong kind, so this causes a failed assertion. Fix it by checking if the property is indeed a constant value before accessing it as such. Otherwise, use 0. This restores the previous GDB behavior: because the structure was zero-initialized, this is what was returned before. But now this behavior is explicit and not accidental. Add a test, gdb.python/flexible-array-member.exp, that is derived from gdb.base/flexible-array-member.exp. It tests the same things, but through the Python API. It also specifically tests getting the range from the various kinds of flexible array member types (AFAIK it wasn't possible to do the equivalent through the CLI). gdb/ChangeLog: PR gdb/27757 * python/py-type.c (typy_range): Check that bounds are constant before accessing them as such. * guile/scm-type.c (gdbscm_type_range): Likewise. gdb/testsuite/ChangeLog: PR gdb/27757 * gdb.python/flexible-array-member.c: New test. * gdb.python/flexible-array-member.exp: New test. * gdb.guile/scm-type.exp (test_range): Add test for flexible array member. * gdb.guile/scm-type.c (struct flex_member): New. (main): Use it. Change-Id: Ibef92ee5fd871ecb7c791db2a788f203dff2b841
2021-04-22Automatic date update in version.inGDB Administrator1-1/+1
2021-04-21Automatic date update in version.inGDB Administrator1-1/+1
2021-04-20Automatic date update in version.inGDB Administrator1-1/+1
2021-04-19Automatic date update in version.inGDB Administrator1-1/+1
2021-04-18Automatic date update in version.inGDB Administrator1-1/+1
2021-04-17Automatic date update in version.inGDB Administrator1-1/+1
2021-04-16Automatic date update in version.inGDB Administrator1-1/+1
2021-04-15Automatic date update in version.inGDB Administrator1-1/+1
2021-04-14Automatic date update in version.inGDB Administrator1-1/+1
2021-04-13Automatic date update in version.inGDB Administrator1-1/+1
2021-04-12Automatic date update in version.inGDB Administrator1-1/+1
2021-04-11Automatic date update in version.inGDB Administrator1-1/+1
2021-04-10Automatic date update in version.inGDB Administrator1-1/+1
2021-04-09Automatic date update in version.inGDB Administrator1-1/+1
2021-04-08Automatic date update in version.inGDB Administrator1-1/+1
2021-04-07Automatic date update in version.inGDB Administrator1-1/+1
2021-04-06Automatic date update in version.inGDB Administrator1-1/+1
2021-04-05Automatic date update in version.inGDB Administrator1-1/+1
2021-04-04Automatic date update in version.inGDB Administrator1-1/+1
2021-04-03Automatic date update in version.inGDB Administrator1-1/+1
2021-04-02Automatic date update in version.inGDB Administrator1-1/+1
2021-04-01Automatic date update in version.inGDB Administrator1-1/+1
2021-03-31Automatic date update in version.inGDB Administrator1-1/+1
2021-03-30gdb/dwarf: disable per-BFD resource sharing for -readnow objfilesSimon Marchi6-45/+121
As described in PR 27541, we hit an internal error when loading a binary the standard way and then loading it with the -readnow option: $ ./gdb -nx -q --data-directory=data-directory ~/a.out -ex "set confirm off" -ex "file -readnow ~/a.out" Reading symbols from /home/simark/a.out... Reading symbols from ~/a.out... /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8098: internal-error: void create_all_comp_units(dwarf2_per_objfile*): Assertion `per_objfile->per_bfd->all_comp_units.empty ()' failed. This is a recurring problem that exposes a design issue in the DWARF per-BFD sharing feature. Things work well when loading a binary with the same method (with/without index, with/without readnow) twice in a row. But they don't work so well when loading a binary with different methods. See this previous fix, for example: efb763a5ea35 ("gdb: check for partial symtab presence in dwarf2_initialize_objfile") That one handled the case where the first load is normal (uses partial symbols) and the second load uses an index. The problem is that when loading an objfile with a method A, we create a dwarf2_per_bfd and some dwarf2_per_cu_data and initialize them with the data belonging to that method. When loading another obfile sharing the same BFD but with a different method B, it's not clear how to re-use the dwarf2_per_bfd/dwarf2_per_cu_data previously created, because they contain the data specific to method A. I think the most sensible fix would be to not share a dwarf2_per_bfd between two objfiles loaded with different methods. That means that two objfiles sharing the same BFD and loaded the same way would share a dwarf2_per_bfd. Two objfiles sharing the same BFD but loaded with different methods would use two different dwarf2_per_bfd structures. However, this isn't a trivial change. So to fix the known issue quickly (including in the gdb 10 branch), this patch just disables all dwarf2_per_bfd sharing for objfiles using READNOW. Generalize the gdb.base/index-cache-load-twice.exp test to test all the possible combinations of loading a file with partial symtabs, index and readnow. Move it to gdb.dwarf2, since it really exercises features of the DWARF reader. gdb/ChangeLog: PR gdb/27541 * dwarf2/read.c (dwarf2_has_info): Don't share dwarf2_per_bfd with objfiles using READNOW. gdb/testsuite/ChangeLog: PR gdb/27541 * gdb.base/index-cache-load-twice.exp: Remove. * gdb.base/index-cache-load-twice.c: Remove. * gdb.dwarf2/per-bfd-sharing.exp: New. * gdb.dwarf2/per-bfd-sharing.c: New. Change-Id: I9ffcf1e136f3e75242f70e4e58e4ba1fd3083389
2021-03-30Automatic date update in version.inGDB Administrator1-1/+1
2021-03-29Automatic date update in version.inGDB Administrator1-1/+1
2021-03-28Automatic date update in version.inGDB Administrator1-1/+1
2021-03-27Automatic date update in version.inGDB Administrator1-1/+1
2021-03-26Automatic date update in version.inGDB Administrator1-1/+1
2021-03-25Automatic date update in version.inGDB Administrator1-1/+1
2021-03-24Automatic date update in version.inGDB Administrator1-1/+1
2021-03-23Automatic date update in version.inGDB Administrator1-1/+1
2021-03-22Automatic date update in version.inGDB Administrator1-1/+1
2021-03-21Automatic date update in version.inGDB Administrator1-1/+1
2021-03-20Automatic date update in version.inGDB Administrator1-1/+1
2021-03-19Automatic date update in version.inGDB Administrator1-1/+1
2021-03-18Automatic date update in version.inGDB Administrator1-1/+1
2021-03-17Automatic date update in version.inGDB Administrator1-1/+1
2021-03-16Automatic date update in version.inGDB Administrator1-1/+1
2021-03-15Automatic date update in version.inGDB Administrator1-1/+1
2021-03-14Automatic date update in version.inGDB Administrator1-1/+1
2021-03-13Automatic date update in version.inGDB Administrator1-1/+1
2021-03-12Use RAII to set the per-thread SIGSEGV handlerChristian Biesinger4-12/+51
This avoids using a thread-local extern variable, which causes link errors on some platforms, notably Cygwin. But I think this is a better pattern even outside of working around linker bugs because it encapsulates direct access to the variable inside the class, instead of having a global extern variable. The cygwin link error is: cp-support.o: in function `gdb_demangle(char const*, int)': /home/Christian/binutils-gdb/obj/gdb/../../gdb/cp-support.c:1619:(.text+0x6472): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `TLS init function for thread_local_segv_handler' /home/Christian/binutils-gdb/obj/gdb/../../gdb/cp-support.c:1619:(.text+0x648b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `TLS init function for thread_local_segv_handler' collect2: error: ld returned 1 exit status 2021-03-12 Christian Biesinger <cbiesinger@google.com> PR threads/27239 * cp-support.c: Use scoped_segv_handler_restore. * event-top.c (thread_local_segv_handler): Made static. (scoped_segv_handler_restore::scoped_segv_handler_restore): New function. (scoped_segv_handler_restore::~scoped_segv_handler_restore): New function. * event-top.h (class scoped_segv_handler_restore): New class. (thread_local_segv_handler): Removed.
2021-03-12Automatic date update in version.inGDB Administrator1-1/+1