aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-08-02Fix kill issue leading to zombie process on MacOS SierraXavier Roirand2-0/+24
Starting with MacOS version Sierra, the gdb kill command seems to work but inferior remains as zombie on the host. Notice that, as zombie process, the inferior is not killable by the user, nor by root. The kill signal gdb sent to the inferior is not handled in gdb as a signal sent by gdb thus no reply is made and the process remains (since MacOS does not "release" the inferior because no reply have been made to the signal message). This patch fixes this problem. gdb/ChangeLog 2018-08-02 Xavier Roirand <roirand@adacore.com> PR gdb/22629: * darwin-nat.c (darwin_kill_inferior): Fix handling of kill inferior.
2018-08-02Check results of get_darwin_inferiorTom Tromey2-14/+28
I noticed that the existing kill-detach-inferiors-cmd.exp test was causing gdb to crash on macOS 10.13. The bug was that an inferior that hadn't yet been started would cause get_darwin_inferior to return NULL, and this was not checked. I went through the places calling get_darwin_inferior and added checks where appropriate. This makes the test get a bit further. Not all of these spots are exercised by the test, but they seem safe enough in any case. gdb/ChangeLog 2018-08-02 Tom Tromey <tom@tromey.com> * darwin-nat.c (find_inferior_task_it, darwin_find_thread) (darwin_suspend_inferior, darwin_resume_inferior) (darwin_decode_notify_message, darwin_resume_inferior_threads) (darwin_check_new_threads): Check result of get_darwin_inferior.
2018-08-02Backport gettext fixes to get rid of warnings on macOSSimon Marchi2-12/+29
Two fixes were committed recently to the gettext repo in order to make gdb build warning-free on macOS. This patch backports them both: - Make the format_arg attribute effective also in the case _INTL_REDIRECT_INLINE. 113893dce80358a4ae0d9463ce73c5670c81cf0c http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=113893dce80358a4ae0d9463ce73c5670c81cf0c - Enable the format_arg attribute also on clang on Mac OS X. bd6a52241c7c83c90e043ace2082a2508d273f55 http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=bd6a52241c7c83c90e043ace2082a2508d273f55 intl/ChangeLog: * libgnuintl.h (_INTL_MAY_RETURN_STRING_ARG, gettext, dgettext, dcgettext, ngettext, dngettext, dcngettext): Backport changes from upstream gettext.
2018-08-02Disable the PR12982 test for HPPA targets.Nick Clifton3-6/+20
PR 23463 * testsuite/ld-plugin/pr12982.d: Revert previous delta. * testsuite/ld-plugin/lto.exp: Skip the pr12982 test for HPPA targets.
2018-08-02ifunc.exp: Always build static_nonifunc_progH.J. Lu2-4/+8
Since static_nonifunc_prog isn't linked against libc.a, we can always build it. * testsuite/ld-ifunc/ifunc.exp: Always build static_nonifunc_prog.
2018-08-02Add a testcase for PR binutils/23460H.J. Lu8-0/+61
Add a testcase to limit open files to 16 for AR with plugin. Before commit 103da91bc083f94769e3758175a96d06cef1f8fe Author: Nick Clifton <nickc@redhat.com> Date: Wed Aug 1 14:34:41 2018 +0100 Close resource leaks in the BFD library's plugin handler. it failed with: ../binutils/ar: tmpdir/pr23460f.o: plugin needed to handle lto object PR binutils/23460 * testsuite/ld-plugin/lto.exp: Run the PR binutils/23460 test. * testsuite/ld-plugin/pr23460a.c: New file. * testsuite/ld-plugin/pr23460b.c: Likewise. * testsuite/ld-plugin/pr23460c.c: Likewise. * testsuite/ld-plugin/pr23460d.c: Likewise. * testsuite/ld-plugin/pr23460e.c: Likewise. * testsuite/ld-plugin/pr23460f.c: Likewise.
2018-08-02Automatic date update in version.inGDB Administrator1-1/+1
2018-08-01Fix spurious check-ld failures on aarch64-elfRoland McGrath7-14/+24
ld/ * testsuite/ld-aarch64/ifunc-1-local.d: Adjust regexps to match the offsets emitted by aarch64-elf configurations. * testsuite/ld-aarch64/ifunc-1.d: Likewise. * testsuite/ld-aarch64/ifunc-2-local.d: Likewise. * testsuite/ld-aarch64/ifunc-2.d: Likewise. * testsuite/ld-aarch64/ifunc-21.d: Likewise. * testsuite/ld-aarch64/ifunc-3a.d: Likewise.
2018-08-01Add a note about regenerating the info files when creating a new release.Nick Clifton2-3/+8
* README-how-to-make-a-release: Add note about regenerating the info files prior to the release.
2018-08-01Skip the test for PR12982 on HPPA targets as they always need an executable ↵Nick Clifton2-0/+9
stack. PR 23463 * testsuite/ld-plugin/pr12982.d: Skip thios test for the HPPA target.
2018-08-01Fix bug in PDP11 assembler when handling a JSr instruction with deferred ↵James Patrick Conlon5-3/+57
auto increment. PR 14480 * config/tc-pdp11.c (parse_op_noreg): Check for and handle auto increment deferred. * testsuite/gas/pdp11/pr14480.d: New test driver file. * testsuite/gas/pdp11/pr14480.s: New test source file file. * testsuite/gas/pdp11/pdp11.exp: Run the new test.
2018-08-01Suppress compile time warning message when compiling coff-rs6000.c with gcc v8.Nick Clifton2-0/+24
* coff-rs6000.c (_bfd_xcoff_put_ldsymbol_name): Suppress warnings about potentially truncated strncpy operations. (_bfd_xcoff_put_symbol_name): Likewise.
2018-08-01Fix potential illegal memory access in AVR backend.Nick Clifton2-4/+9
* elf32-avr.c (avr_stub_name): Check for a NULL return from bfd_malloc.
2018-08-01Fix compile time warning problem with gcc 8 and the NS32K assembler sources.Nick Clifton2-1/+7
* config/tc-ns32k.c (addr_mode): Replace "Drop through" comment with "Fall through" so that it will be recognised by gcc's switch statment error checker.
2018-08-01Close resource leaks in the BFD library's plugin handler.Nick Clifton2-7/+30
PR 23460 * plugin.c (bfd_plugin_open_input): Close file descriptor if the call to fstat fails. (try_claim): Always close the file descriptor at the end of the function. (try_load_plugin): If a plugin has already been registered, then skip the dlopen and onload steps and go straight to claiming the file. If these is an error, close the plugin.
2018-08-01Copy from GCC: Add linker_output as prefix for LTO temps (PR lto/86548).marxin4-6/+42
2018-07-26 Martin Liska <mliska@suse.cz> PR lto/86548 * libiberty.h (make_temp_file_with_prefix): New function. 2018-07-26 Martin Liska <mliska@suse.cz> PR lto/86548 * make-temp-file.c (TEMP_FILE): Remove leading 'cc'. (make_temp_file): Call make_temp_file_with_prefix with first argument set to NULL. (make_temp_file_with_prefix): Support also prefix. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262999 138bc75d-0d04-0410-961f-82ee72b054a4
2018-08-01Re: PowerPC64 __tls_get_addr_opt stub .eh_frame fixAlan Modra2-1/+6
The modified test failed on some powerpc targets due to differences in default hash style. If the default hash style is both, then more sections are created, bumping section ids. Section id is used in stub symbols and although the test is careful to not depend on id in labels, the stub hash traversal order changes when stub names change. That lead to the stubs being emitted in a different order and thus not matching expected output. * testsuite/ld-powerpc/powerpc.exp: Run tlsopt5 with hash-style specified.
2018-08-01PowerPC64 __tls_get_addr_opt stub .eh_frame fixAlan Modra7-67/+103
This patch sets stub_offset in ppc_size_one_stub rather than in ppc_build_one_stub. That allows the plt stub alignment to be done in just ppc_size_one_stub rather than both functions. The patch also corrects the place where the alignment was done, fixing a possible error in .eh_frame data, and tidies some offset calculations. bfd/ * elf64-ppc.c (plt_stub_pad): Delay plt_stub_size call until needed. (ppc_build_one_stub): Don't set stub_offset, instead assert that it is sane. Don't adjust stub_offset for alignment. Adjust size calculation. Use "targ" temp when calculating offsets. (ppc_size_one_stub): Set stub_offset here. Use "targ" temp when calculating offsets. Adjust for alignment before setting tls_get_addr_opt_bctrl. ld/ * testsuite/ld-powerpc/powerpc.exp: Run tlsopt5 with plt alignment. * testsuite/ld-powerpc/tlsopt5.s: Add extra call. * testsuite/ld-powerpc/tlsopt5.wf: Adjust expected output. * testsuite/ld-powerpc/tlsopt5.d: Likewise.
2018-08-01csky regenAlan Modra8-0/+27
bfd/ * po/SRC-POTFILES.in: Regenerate. gas/ * po/POTFILES.in: Regenerate. ld/ * po/BLD-POTFILES.in: Regenerate. opcodes/ * po/POTFILES.in: Regenerate.
2018-08-01Automatic date update in version.inGDB Administrator1-1/+1
2018-07-31Correct previous update - new translation for the opcodes subdirectory.Nick Clifton4-1961/+12760
opcodes * po/sv.po: Updated Swedish translation.
2018-07-31Updated Swedish translation for the binutils sub-directory.Nick Clifton2-10851/+1568
* po/sv.po: Updated Swedish translation.
2018-07-31Document the GDB 8.1.1 release in gdb/ChangeLogJoel Brobecker1-0/+4
gdb/ChangeLog: GDB 8.1.1 released.
2018-07-31Fix segfault when invoking -var-info-path-expression on a dynamic varobjJan Vrany6-0/+223
Invoking -var-info-path-expression on a dynamic varobj lead either in wrong (nonsense) result or to a segmentation fault in cplus_describe_child(). This was caused by the fact that varobj_get_path_expr() called cplus_path_expr_of_child() ignoring the fact the parent of the variable is dynamic. Then, cplus_describe_child() accessed the underlaying C type members by index, causing (i) either wrong (nonsense) expression being returned (since dynamic child may be completely arbibtrary value) or (ii) segmentation fault (in case the index higher than number of underlaying C type members. This fixes the problem by checking whether a varobj is a child of a dynamic varobj and, if so, reporting an error as described in documentation. gdb/ChangeLog: * varobj.c (varobj_get_path_expr_parent): Report an error if parent is a dynamic varobj. gdb/testsuite/Changelog: * gdb.python/py-mi-var-info-path-expression.c: New file. * gdb.python/py-mi-var-info-path-expression.py: New file. * gdb.python/py-mi-var-info-path-expression.exp: New file.
2018-07-31Re-generate gnulib importSimon Marchi7-572/+1092
I noticed that re-generating our gnulib import introduced some changes. I supposed that this comes from the recent upgrade to autoconf 2.69 (though I haven't checked). Tested by rebuilding on GNU/Linux x86-64 and mingw (cross-compiled from GNU/Linux). gdb/ChangeLog: * gnulib/aclocal.m4: Re-generate. * gnulib/config.in: Re-generate. * gnulib/configure: Re-generate. * gnulib/import/Makefile.in: Re-generate. * gnulib/import/m4/gnulib-comp.m4: Re-generate. * gnulib/import/m4/onceonly.m4: Re-generate.
2018-07-31Delete test target descriptions when exitingSimon Marchi3-8/+28
Looking at the address sanitizer output, this was a quite low hanging fruit. We create target_desc objects for testing that we never free. Saving them in unique_ptrs takes care of it. I created a small struct to hold these because I thought it would help readability. gdb/ChangeLog: * target-descriptions.c (struct xml_test_tdesc): New. (xml_tdesc): Change type to std::vector<xml_test_tdesc>. (record_xml_tdesc): Update. (maintenance_check_xml_descriptions): Update. * target-descriptions.h (record_xml_tdesc): Update comment.
2018-07-31x86: also optimize KXOR{D,Q} and KANDN{D,Q}Jan Beulich9-9/+56
These can be converted to 2-byte VEX encoding when both source registers are the same, by using KXORW / KANDNW as replacement.
2018-07-31x86: fold various AVX512 templates with so far differing Masking attributesJan Beulich6-1449/+367
There's no insn allowing ZEROING_MASKING alone. Re-purpose its value for handling the not uncommon case of insns allowing either form of masking with register operands, but only merging masking with a memory operand.
2018-07-31x86: add more exhaustive tests for invalid AVX512 zeroing-maskingJan Beulich3-0/+414
Before changing how things get handled, install a full set of tests, such that it can be demonstrated that the subsequent change doesn't break things.
2018-07-31x86/Intel: correct permitted operand sizes for AVX512 scatter/gatherJan Beulich13-633/+742
AVX gather insns correctly allow the element size to be specified rather than the full vector size. Make AVX512 ones match.
2018-07-31x86: don't abort() upon DATA16 prefix on (E)VEX encoded insnJan Beulich7-5/+142
Instead of hitting the abort() in output_insn() (commented by "There should be no other prefixes for instructions with VEX prefix"), report a proper diagnostic instead, just like we do e.g. for invalid REP prefixes.
2018-07-31x86: drop CpuVREXJan Beulich7-4352/+4361
It is fully redundant with CpuAVX512F.
2018-07-31Automatic date update in version.inGDB Administrator1-1/+1
2018-07-30Match any kind of error after "cannot resolve name" on ↵Sergio Durigan Junior2-1/+6
lib/gdbserver-support.exp:gdbserver_start On commit: commit 7f1f7e23939adc7d71036a17fc6081e3af7ca585 Author: Sergio Durigan Junior <sergiodj@redhat.com> Date: Fri Jul 13 16:20:34 2018 -0400 Expect for another variant of error message when gdbserver cannot resolve hostname I extended the regular expression being used to identify whether gdbserver could not resolve a (host)name. This was needed because the error message being printed had a different variation across some systems. However, as it turns out, I've just noticed that the message has yet another variation: target remote tcp8:123:2353 tcp8:123:2353: cannot resolve name: System error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tcp8:123:2353: No such file or directory. (gdb) FAIL: gdb.server/server-connect.exp: tcp8: connect to gdbserver using tcp8:123 which is causing FAILs on some systems (namely, Fedora-i686 on BuildBot). So instead of trying to predict everything that can be printed, I decided to just match anything after the "cannot resolve name: " part. This patch implements that. Regression tested on the BuildBot. gdb/testsuite/ChangeLog: 2018-07-30 Sergio Durigan Junior <sergiodj@redhat.com> * lib/gdbserver-support.exp (gdbserver_start): Match any kind of error after "cannot resolve name" string.
2018-07-30RISC-V: Set insn info fields correctly when disassembling.Jim Wilson5-178/+242
include/ * opcode/riscv.h (INSN_TYPE, INSN_BRANCH, INSN_CONDBRANCH, INSN_JSR) (INSN_DREF, INSN_DATA_SIZE, INSN_DATA_SIZE_SHIFT, INSN_1_BYTE) (INSN_2_BYTE, INSN_4_BYTE, INSN_8_BYTE, INSN_16_BYTE): New. opcodes/ * riscv-dis.c (riscv_disassemble_insn): Set insn_type and data_size fields. * riscv-opc.c (riscv_opcodes): Use new INSN_* flags to annotate insns.
2018-07-30gdb: Fix sizeof for dynamic types other than arraysAndrew Burgess2-1/+8
In commit: commit 37cc0caeca4c9a8552370040f4cfeaeceaa03369 Date: Wed Jul 18 13:38:35 2018 +0200 [gdb/exp] Interpret size of vla with unknown size as <optimized out> All dynamic types are treated as arrays in the 'sizeof' code path, which means that structures can incorrectly be treated as arrays. This can cause a failure in the gdb.base/vla-datatypes.exp test script. This commit adds a check that we do have an array before checking the array bounds, and I also check that the array index type is dynamic too. This second check probably isn't strictly necessary, but shouldn't hurt, a non-dynamic index type shouldn't have undefined high bound. gdb/ChangeLog: * eval.c (evaluate_subexp_for_sizeof): Check for array type before checking array bounds are defined.
2018-07-30x86: don't mistakenly scale non-8-bit displacementsJan Beulich6-1/+60
In commit b5014f7af2 I've removed (instead of replaced) a conditional, resulting in addressing forms not allowing 8-bit displacements to now get their displacements scaled under certain circumstances. Re-add the missing conditional.
2018-07-30 * MAINTAINERS (C-SKY): Add Yunhai Shang as co-maintainer.Andrew Jenner2-0/+5
2018-07-30 * MAINTAINERS (C-SKY): Add Lifang Xia as maintainer.Andrew Jenner2-0/+5
2018-07-30Fix crash with -D_GLIBCXX_DEBUGTom Tromey2-3/+10
I noticed a buildbot failure where gdb crashed in info-os.exp, when compiled with -D_GLIBCXX_DEBUG: (gdb) info os procgroups /usr/include/c++/7/bits/stl_algo.h:4834: Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)). Objects involved in the operation: iterator::value_type "< operator type" { type = pid_pgid_entry; } The bug here is that pid_pgid_entry::operator< violates the C++ irreflexivity rule; that is, that an object cannot be less than itself. Tested locally by re-running info-os.exp. gdb/ChangeLog 2018-07-30 Tom Tromey <tom@tromey.com> * nat/linux-osdata.c (pid_pgid_entry::operator<): Fix irreflexivity violation.
2018-07-30Remove old lint codeTom Tromey5-20/+11
This removes dead code that, according to the comments, existed to placate lint. I don't think this has been relevant in a long time, and certainly not since gdb switched to C++. Tested by rebuilding. ChangeLog 2018-07-30 Tom Tromey <tom@tromey.com> * cli/cli-decode.c (lookup_cmd): Remove lint code. * value.c (unpack_long): Remove lint code. * valops.c (value_ind): Remove lint code. * valarith.c (value_x_binop, value_x_unop, value_equal) (value_pos): Remove lint code.
2018-07-30Prevent a seg-fault in the linker when trying to process SH object files ↵Nick Clifton2-17/+112
with bogus relocs. PR 22706 * elf32-sh.c (sh_elf_relocate_section): When processing translation relocs, fail if the relocation offset is too small. Replace BFD_ASSERTs with more helpful error messages.
2018-07-30Fix thinko in the placement of the .gnu.build.attributes section.Nick Clifton2-1/+7
* scripttempl/elf.sc: Move the .gnu.build.attributes section to after the .comment section.
2018-07-30Add support for the C_SKY series of processors.Andrew Jenner162-5/+27187
This patch series is a new binutils port for C-SKY processors, including support for both the V1 and V2 processor variants. V1 is derived from the MCore architecture while V2 is substantially different, with mixed 16- and 32-bit instructions, a larger register set, a different (but overlapping) ABI, etc. There is support for bare-metal ELF targets and Linux with both glibc and uClibc. This code is being contributed jointly by C-SKY Microsystems and Mentor Graphics. C-SKY is responsible for the technical content and has proposed Lifang Xia and Yunhai Shang as port maintainers. (Note that C-SKY does have a corporate copyright assignment on file with the FSF.) Mentor Graphics' role has been cleaning up the code, adding documentation and additional test cases, etc, to address issues we anticipated reviewers would complain about. bfd * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES): Add C-SKY. (BFD32_BACKENDS, BFD_BACKENDS_CFILES): Likewise. * Makefile.in: Regenerated. * archures.c (enum bfd_architecture): Add bfd_arch_csky and related bfd_mach defines. (bfd_csky_arch): Declare. (bfd_archures_list): Add C-SKY. * bfd-in.h (elf32_csky_build_stubs): Declare. (elf32_csky_size_stubs): Declare. (elf32_csky_next_input_section: Declare. (elf32_csky_setup_section_lists): Declare. * bfd-in2.h: Regenerated. * config.bfd: Add C-SKY. * configure.ac: Likewise. * configure: Regenerated. * cpu-csky.c: New file. * elf-bfd.h (enum elf_target_id): Add C-SKY. * elf32-csky.c: New file. * libbfd.h: Regenerated. * reloc.c: Add C-SKY relocations. * targets.c (csky_elf32_be_vec, csky_elf32_le_vec): Declare. (_bfd_target_vector): Add C-SKY target vector entries. binutils* readelf.c: Include elf/csky.h. (guess_is_rela): Handle EM_CSKY. (dump_relocations): Likewise. (get_machine_name): Likewise. (is_32bit_abs_reloc): Likewise. include * dis-asm.h (csky_symbol_is_valid): Declare. * opcode/csky.h: New file. opcodes * Makefile.am (TARGET_LIBOPCODES_CFILES): Add csky-dis.c. * Makefile.in: Regenerated. * configure.ac: Add C-SKY. * configure: Regenerated. * csky-dis.c: New file. * csky-opc.h: New file. * disassemble.c (ARCH_csky): Define. (disassembler, disassemble_init_for_target): Add case for ARCH_csky. * disassemble.h (print_insn_csky, csky_get_disassembler): Declare. gas * Makefile.am (TARGET_CPU_CFILES): Add entry for C-SKY. (TARGET_CPU_HFILES, TARGET_ENV_HFILES): Likewise. * Makefile.in: Regenerated. * config/tc-csky.c: New file. * config/tc-csky.h: New file. * config/te-csky_abiv1.h: New file. * config/te-csky_abiv1_linux.h: New file. * config/te-csky_abiv2.h: New file. * config/te-csky_abiv2_linux.h: New file. * configure.tgt: Add C-SKY. * doc/Makefile.am (CPU_DOCS): Add entry for C-SKY. * doc/Makefile.in: Regenerated. * doc/all.texi: Set CSKY feature. * doc/as.texi (Overview): Add C-SKY options. (Machine Dependencies): Likewise. * doc/c-csky.texi: New file. * testsuite/gas/csky/*: New test cases. ld * Makefile.am (ALL_EMULATION_SOURCES): Add C-SKY emulations. (ecskyelf.c, ecskyelf_linux.c): New rules. * Makefile.in: Regenerated. * configure.tgt: Add C-SKY. * emulparams/cskyelf.sh: New file. * emulparams/cskyelf_linux.sh: New file. * emultempl/cskyelf.em: New file. * gen-doc.texi: Add C-SKY. * ld.texi: Likewise. (Options specific to C-SKY targets): New section. * testsuite/ld-csky/*: New tests.
2018-07-30Combine ,gnu.build.attributes.* sections into one .gnu.build.attributes ↵Nick Clifton4-0/+12
section during linking. gold * layout.cc (section_name_mapping): Add an entry for .gnu.build.attributes. ld * scripttempl/elf.sc: Place .gnu.build.attributes sections with other read-only sections.
2018-07-30Automatic date update in version.inGDB Administrator1-1/+1
2018-07-29Fix unwind offset for start_symbol.John David Anglin2-1/+9
* config/tc-hppa.c: Include "struc-symbol.h". (pa_build_unwind_subspace): Use call_info->start_symbol->sy_frag instead of frag_now for local symbol replacement.
2018-07-29Automatic date update in version.inGDB Administrator1-1/+1
2018-07-28gdb: Don't call gdb_load_shlib unless GDB is runningAndrew Burgess3-1/+15
The gdb_load_shlib function will, on remote targets, try to run some GDB commands. This obviously isn't going to work unless GDB is running. The gdb.trace/tspeed.exp test calls gdb_load_shlib before starting GDB. Don't do that. The failure that's triggered is actually DeJaGNU complaining that the variable $use_gdb_stub doesn't exist, this is only created when GDB is started. Something like this should trigger a failure: make check-gdb \ RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost \ gdb.trace/tspeed.exp" This commit also adds a check to gdb_load_shlib that GDB is running. The check is always performed, so this should catch cases where a GDB developer adds a use of gdb_load_shlib but doesn't test their code with a remote target. gdb/testsuite/ChangeLog: * gdb.trace/tspeed.exp: Only call gdb_load_shlib after gdb has started. * lib/gdb.exp (gdb_load_shlib): Call perror if GDB is not running.
2018-07-28[gdb/exp] Interpret size of vla with unknown size as <optimized out>Tom de Vries4-0/+51
At -O3 -g -gstrict-dwarf, gcc generates for an optimized out vla 'a' a DW_TAG_variable with type DW_TAG_array_type containing one DW_TAG_subrange_type, but without DW_AT_upper_bound or DW_AT_count, which makes the upper bound value 'unknown': ... .uleb128 0x15 # (DIE (0x161) DW_TAG_variable) .long 0xec # DW_AT_abstract_origin .long 0x170 # DW_AT_type ... .uleb128 0xa # (DIE (0x170) DW_TAG_array_type) .long 0x110 # DW_AT_type .long 0x17f # DW_AT_sibling .uleb128 0x17 # (DIE (0x179) DW_TAG_subrange_type) .long 0xc6 # DW_AT_type .byte 0 # end of children of DIE 0x170 ... But gdb prints '0' for the size of 'a': ... /gdb ./vla-1.exe -batch -ex "b f1" -ex "run" -ex "p sizeof(a)" Breakpoint 1 at 0x4004c0: f1. (2 locations) Breakpoint 1, f1 (i=<optimized out>) at vla-1.c:18 18 } $1 = 0 ... while <optimized out> would be more appropriate. This patch fixes that in evaluate_subexp_for_sizeof. Build and reg-tested on x86_64-linux. 2018-07-28 Tom de Vries <tdevries@suse.de> * eval.c (evaluate_subexp_for_sizeof): Interpret size of dynamic type with undefined upper bound as <optimized out>. * gdb.base/vla-optimized-out-o3-strict.exp: New file.