aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2014-05-16mi-support.exp: Fix some pastos.Pedro Alves2-4/+9
gdb/testsuite/ 2014-05-16 Pedro Alves <palves@redhat.com> * lib/mi-support.exp (mi_expect_stop): On timeout, say "timeout" instead of "unknown output after running".
2014-05-16Copy file1.txt to remote host in dw2-filename.exp and dw2-anonymous-func.expYao Qi3-0/+17
Some gdb.dwarf2/*.exp tests copy file1.txt to host via gdb_remote_download but dw2-filename.exp and dw2-anonymous-func.exp don't do that. Looks like an oversight in this patch https://sourceware.org/ml/gdb-patches/2013-08/msg00365.html There are some fails in remote host testing. FAIL: gdb.dwarf2/dw2-anonymous-func.exp: list file1.txt FAIL: gdb.dwarf2/dw2-filename.exp: interpreter-exec mi -file-list-exec-source-files FAIL: gdb.dwarf2/dw2-filename.exp: info sources This patch is to invoke gdb_remote_download to copy file1.txt to host and remote it at the end. This patch fixes these fails above. gdb/testsuite: 2014-05-16 Yao Qi <yao@codesourcery.com> * gdb.dwarf2/dw2-filename.exp: Copy file1.txt to host. Remove file1.txt from host at the end. * gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
2014-05-16Fix display of tabulation character for mingw hosts.Yao Qi2-59/+70
Pierre proposed this patch https://sourceware.org/ml/gdb-patches/2013-10/msg00011.html and Tom gave a suggestion that it's better to do check \t in print_wchar <https://sourceware.org/ml/gdb-patches/2013-11/msg00148.html> However, I don't see the follow-up to this discussion. We encounter two fails in printcmds.exp on mingw host, and Pierre's patch fixes them. I pick it up, update a little per Tom's comments, and post it here for review. This patch fixes these fails below on mingw32 host. FAIL: gdb.base/charset.exp: print string in ASCII FAIL: gdb.base/charset.exp: try printing '\t' in ASCII FAIL: gdb.base/charset.exp: print string in ISO-8859-1 FAIL: gdb.base/charset.exp: try printing '\t' in ISO-8859-1 FAIL: gdb.base/charset.exp: print string in UTF-32 FAIL: gdb.base/charset.exp: try printing '\t' in UTF-32 FAIL: gdb.base/printcmds.exp: p ctable1[9] FAIL: gdb.base/printcmds.exp: p &ctable1[1*8] Also regression tested on x86_64-linux. Is it OK? gdb: 2014-05-16 Pierre Muller <muller@sourceware.org> Yao Qi <yao@codesourcery.com> * valprint.c (print_wchar): Move the code on checking whether W is a printable wide char to the default branch of switch statement below. Call wchar_printable instead of gdb_iswprint.
2014-05-16Fix changelong entry.Yao Qi1-1/+1
Each changelog entry should be tab-prefixed.
2014-05-16Fix prologue analysis for ldr.w and ldrd instructionTaimoor Mirza2-2/+7
Prologue analysis for ldr.w and ldrd instruction obtains offset from first two bytes that contains opcode of instruction. It should obtain offset from next two bytes that actually contain operands. * arm-tdep.c (thumb_analyze_prologue): Fix offset calculation for ldr.w and ldrd instructions. Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
2014-05-15Make more robust when run in parallel mode.Doug Evans3-3/+18
Since we're not compiling with gcc, we don't know where the DWO file will ultimately be built. It could be built in testsuite/gdb.dwarf2/foo (non-parallel mode) or testsuite/outputs/gdb.dwarf2/foo (parallel mode). * gdb.dwarf2/fission-reread.S: Remove directory from .dwo file path. * gdb.dwarf2/fission-reread.exp: Set debug-file-directory before loading file. Add test for TU lookup.
2014-05-15* dwarf2read.c (read_structure_type): Delete outdated comments.Doug Evans2-9/+8
2014-05-15Fix argument passing in mi_run_cmd_fullSimon Marchi2-1/+18
Passing arguments did not work when use_mi_command was set. gdb/testsuite/ChangeLog: 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> * lib/mi-support.exp (mi_run_cmd_full): Set arguments by calling "-exec-arguments" or "set args" before running the inferior.
2014-05-15Fix mi_expect_stop for non-zero exit codesSimon Marchi2-0/+19
The message displayed by gdb is different when the inferior exits with zero and non-zero values, this fix takes that into account. gdb/testsuite/ChangeLog: 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> * lib/mi-support.exp (mi_expect_stop): Expect message for inferiors that exit with non-zero exit code.
2014-05-14reindent print_macro_definitionTom Tromey2-24/+28
I happened to notice that print_macro_definition is indented improperly. All the lines were a few extra spaces to the right. This patch fixes the indentation. Tested by rebuilding, committed. 2014-05-14 Tom Tromey <tromey@redhat.com> * macrocmd.c (print_macro_definition): Reindent.
2014-05-14Fix mi-file.exp fails on remote hostYao Qi2-2/+13
This patch fixes mi-file.exp fails on remote host. First, we can't assume ${srcdir}/${subdir}/${srcfile} directory exists on remote host, so this patch changes it to match ${srcfile} only on remote host. Second, regexp pattern ".*/${srcfile}" isn't friendly to Windows path. The file name is "basics.c" in my test env and can't match the pattern due to "/" in it. Remove "/" from the pattern. gdb/testsuite: 2014-05-14 Yao Qi <yao@codesourcery.com> * gdb.mi/mi-file.exp (test_file_list_exec_source_file): Don't match absolute path on remote host. (test_file_list_exec_source_files): Remove "/" from the pattern.
2014-05-14Overwrite ${board}_file in local-remote-hostYao Qi2-0/+12
After I run test like this, $ make check RUNTESTFLAGS='--host_board=local-remote-host dw2-basic.exp' gdb.dwarf2/file1.txt in source tree was removed. In some gdb.dwarf2/*.exp, file1.txt is copied to host and then removed at the end. However, in local-remote-host-notty.exp, ${board}_download doesn't copy the file but return the absolute path of the src file. 'remote_file host delete' at the end will remove the file in source tree. This patch is to overwrite ${board}_file, and specially make "delete" option do nothing. This approach is used in gdbserver-base.exp and remote-stdio-gdbserver.exp too. gdb/testsuite: 2014-05-14 Yao Qi <yao@codesourcery.com> * boards/local-remote-host-notty.exp (${board}_file): New proc.
2014-05-13* python/py-cmd.c (cmdpy_completer): Add comment.Doug Evans2-2/+9
(completers): Make const.
2014-05-13Remove unused variableSimon Marchi2-74/+74
should_resume is set to 1 at the beginning and never changed. gdb/ChangeLog: 2014-05-13 Simon Marchi <simon.marchi@ericsson.com> * infrun.c (resume): Remove should_resume (unused). Move up declaration of resume_ptid.
2014-05-13remove an unused macro and an unused declarationTom Tromey2-6/+5
This patch removes an unused macro from language.h. It also removes the declaration of a function which is not defined. I'm checking this in as obvious. Tested by rebuilding. 2014-05-13 Tom Tromey <tromey@redhat.com> * language.h (unop_type_check): Remove. (binop_type_check): Don't declare.
2014-05-13S390: Fix erroneous offset in fill_gregset.Andreas Arnez2-1/+6
This fixes a bug that leads to various failures when debugging a 31-bit inferior with a 64-bit gdb on s390x.
2014-05-12Add link to older changes in ChangeLog-1993-2013.Doug Evans1-0/+1
2014-05-12Split out older testsuite/ChangeLog entries (prior to 2014)Doug Evans2-33653/+33664
into separate file: ChangeLog-1993-2013.
2014-05-12mi: Use the value in mi_console_file->quote as the quoting characterSimon Marchi2-3/+9
In mi_interpreter_init, multiple MI consoles/channels are created and a quoting character is given. In mi_console_raw_packet, we check if the value is not 0 to decide if we should quote the string, but we don't use the value. It is hardcoded to ". We might never use another quoting character than an actual quote, but I suggest we change it, for correctness. There is not visible behavior change. I changed the latest fputs_unfiltered changed to fputc_unfiltered just to stay consistent. gdb/ChangeLog: 2014-05-12 Simon Marchi <simon.marchi@ericsson.com> * mi/mi-console.c (mi_console_raw_packet): Use the value from mi_console->quote as the quoting character.
2014-05-12Add myself as write after approval maintainerSimon Marchi2-0/+5
2014-05-12 Simon Marchi <simon.marchi@ericsson.com> * MAINTAINERS (Write After Approval): Add "Simon Marchi".
2014-05-09Add obviously forgotten "PACKAGE = @PACKAGE@" to gdb/doc/Makefile.inSamuel Bronson2-0/+8
* gdb/doc/Makefile.in (PACKAGE): Copy from ../Makefile.in in case of "make -C".
2014-05-08rename "set debugvarobj" to "set debug varobj"Tom Tromey4-4/+14
I think "set debugvarobj" has the wrong name. It ought to be "set debug varobj", like gdb's other debug settings. This patch makes the change. I chose not to install deprecated aliases, since this is only a debug setting; but if someone feels strongly about it I will add them. Built and regtested on x86-64 Fedora 20. 2014-04-29 Tom Tromey <tromey@redhat.com> * varobj.c (_initialize_varobj): Rename to "set debug varobj" and "show debug varobj". 2014-04-29 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Debugging Output): Rename to "set debug varobj" and "show debug varobj".
2014-05-07aarch64: detect atomic sequences like other ll/sc architecturesKyle McMartin5-0/+188
gdb/Changelog: * aarch64-tdep.c (aarch64_software_single_step): New function. (aarch64_gdbarch_init): Handle single stepping of atomic sequences with aarch64_software_single_step. gdb/testsuite/ChangeLog: * gdb.arch/aarch64-atomic-inst.c: New file. * gdb.arch/aarch64-atomic-inst.exp: New file.
2014-05-07Relax the pattern in dwzbuildid.expYao Qi2-1/+6
Hi, I recently see the fail in dwzbuildid.exp below on some targets, (gdb) print the_int No symbol "the_int" in current context. (gdb) FAIL: gdb.dwarf2/dwzbuildid.exp: mismatch: print the_int Looks the pattern expects to see "No symbol table is loaded", which is emitted in c-exp.y, variable: name_not_typename .... if (msymbol.minsym != NULL) write_exp_msymbol (pstate, msymbol); else if (!have_full_symbols () && !have_partial_symbols ()) error (_("No symbol table is loaded. Use the \"file\" command.")); else error (_("No symbol \"%s\" in current context."), copy_name ($1.stoken)); it is expected to have no full symbols nor partial symbols, but something brings full symbols or partial symbols in. I added "maint info symtabs" and "maint info psymtabs" in dwzbuildid.exp, and it shows symbols are from ld.so, which has debug information. Then, I reproduce the fail like this, $ make check RUNTESTFLAGS="CFLAGS_FOR_TARGET='-Wl,-rpath=${glibc_build}:${glibc_build}/math -Wl,--dynamic-linker=${glibc_build}/elf/ld.so' dwzbuildid.exp" ${glibc_build} is the glibc build tree. Debug information is not striped, so the test fail. However, if I strip debug information from libc.so, libm.so and ld.so. The test passes. This patch is to relax the pattern to match the both cases that glibc build has and has not debug information. gdb/testsuite: 2014-05-07 Yao Qi <yao@codesourcery.com> * gdb.dwarf2/dwzbuildid.exp: Match output "No symbol "the_int" in current context" too.
2014-05-05Document the GDB 7.7.1 release in gdb/ChangeLogJoel Brobecker1-0/+4
gdb/ChangeLog: GDB 7.7.1 released.
2014-05-05Fix a dangling cleanup in linspec_parse_basic.Keith Seitz4-1/+24
2014-05-05 Keith Seitz <keiths@redhat.com> * linespec.c (linespec_parse_basic): Run cleanups if a convenience variable or history value is successfully parsed. 2014-05-05 Keith Seitz <keiths@redhat.com> * gdb.linespec/ls-dollar.exp: Add test for linespec file:convenience_variable.
2014-05-05Partially available/unavailable data in requested rangeYao Qi5-2/+183
In gdb.trace/unavailable.exp, an action is defined to collect struct_b.struct_a.array[2] and struct_b.struct_a.array[100], struct StructB { int d, ef; StructA struct_a; int s:1; static StructA static_struct_a; const char *string; }; and the other files are not collected. When GDB examine traceframe collected by the action, "struct_b" is unavailable completely, which is wrong. (gdb) p struct_b $1 = <unavailable> When GDB reads 'struct_b', it will request to read memory at struct_b's address of length LEN. Since struct_b.d is not collected, no 'M' block includes the first part of the desired range, so tfile_xfer_partial returns TARGET_XFER_UNAVAILABLE and GDB thinks the whole requested range is unavailable. In order to fix this problem, in the iteration to 'M' blocks, we record the lowest address of blocks within the request range. If it has, the requested range isn't unavailable completely. This applies to ctf too. With this patch applied, the result looks good and fails in unavailable.exp is fixed. (gdb) p struct_b $1 = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>} gdb: 2014-05-05 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * tracefile-tfile.c (tfile_xfer_partial): Record the lowest address of blocks that intersects the requested range. Trim LEN up to LOW_ADDR_AVAILABLE if read from executable read-only sections. * ctf.c (ctf_xfer_partial): Likewise. gdb/testsuite: 2014-05-05 Yao Qi <yao@codesourcery.com> * gdb.trace/unavailable.exp (gdb_collect_args_test): Save traceframes into tfile and ctf trace files. Read data from trace file and test collected data. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_unavailable_floats): Likewise. (gdb_collect_globals_test): Likewise. (top-level): Append "ctf" to trace_file_targets if GDB supports.
2014-05-05Show new created displayYao Qi2-1/+6
When I run refactored unavailable.exp, I find command display behaves a little different on live inferior and on examining traceframes. In live inferior, when command "display argc" is typed, the value of "argc" is shown. (gdb) display argc 1: argc = 1 '\001' however, on tfile target, when command "display argc" is typed, the value of "argc" is not shown. (gdb) tfind Found trace frame 0, tracepoint 1 at ../../../../git/gdb/testsuite/gdb.trace/unavailable.cc:198 198 i = (int) argc + argi + argf + argd + argstruct.memberi + argarray[1]; (gdb) display argc I also notice that on "core" target, the value of "argc" isn't shown either. This difference is caused by the code below in printcmd.c:display_command, if (from_tty && target_has_execution) do_one_display (new); Looks the value of each display is shown if the target has execution. Source code archaeology doesn't tell much about this requirement. However, if we type command "display" then on "core" or "tfile" target, the value of "argc" is still displayed, for "core" target, (gdb) display argc (gdb) display 1: argc = 1 '\001' for "tfile" target, (gdb) display argc (gdb) display 1: argc = <unavailable> I feel that it is not necessary to have such "target has execution" requirement to show the value of new created display. Auto-display is a feature to show the value of expression frequently, has nothing to do with whether target has execution or not. On the other hand, GDB has the requirement for new created display, but command "display" can still show them, this is an inconsistency, which should be fixed. This patch is to remove the checking to target_has_execution from the condition. gdb: 2014-05-05 Yao Qi <yao@codesourcery.com> * printcmd.c (display_command): Remove the check to target_has_execution.
2014-05-05Move traceframe checking out of traceframe generationYao Qi2-298/+332
This patch moves traceframe checking code out of traceframe generation, so that we can generation traceframe once, and do the checking in multiple times (with target remote, tfile and ctf respectively). This is a pure refactor, not functional changes in unavailable.exp. gdb/testsuite: 2014-05-05 Yao Qi <yao@codesourcery.com> * gdb.trace/unavailable.exp (gdb_collect_args_test): Move some code to ... (gdb_collect_args_test_1): ... it. New proc. (gdb_collect_locals_test): Move some code to ... (gdb_collect_locals_test_1): ... it. New proc. (gdb_unavailable_registers_test): Move some code to ... (gdb_unavailable_registers_test_1): ... it. New proc. (gdb_unavailable_floats): Move some code to ... (gdb_unavailable_floats_1): ... it. New proc.
2014-05-03Git sucks!Mark Kettenis1-1/+2
2014-05-03Enable rthreads support on OpenBSD/powerpc.Mark Kettenis2-1/+8
gdb/ChangeLog: * ppcobsd-nat.c: Include "obsd-nat.h". (_initialize_ppcobsd_nat): Call obsd_add_target instead of add_target. * config/powerpc/obsd.mh (NATDEPFILES): Add obsd-nat.o.
2014-05-02Extend recognized types of SDT probe's argumentsSergio Durigan Junior5-14/+111
This commit is actually an update to make the parser in gdb/stap-probe.c be aware of all the possible prefixes that a probe argument can have. According to the section "Argument Format" in: <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation> The bitness of the arguments can be 8, 16, 32 or 64 bits, signed or unsigned. Currently GDB recognizes only 32 and 64-bit arguments. This commit extends this. It also provides a testcase, only for x86_64 systems. gdb/ 2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com> * stap-probe.c (enum stap_arg_bitness): New enums to represent 8 and 16-bit signed and unsigned arguments. Update comment. (stap_parse_probe_arguments): Extend code to handle such arguments. Use warning instead of complaint to notify about unrecognized bitness. gdb/testsuite/ 2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.arch/amd64-stap-optional-prefix.S (main): Add several probes to test for bitness recognition. * gdb.arch/amd64-stap-optional-prefix.exp (test_probe_value_without_reg): New procedure. Add code to test for different kinds of bitness.
2014-05-02Fix PR breakpoints/16889: gdb segfaults when printing ASM SDT argumentsSergio Durigan Junior5-5/+109
This commit fixes PR breakpoints/16889, which is about a bug that triggers when GDB tries to parse probes whose arguments do not contain the initial (and optional) "N@" part. For reference sake, the de facto format is described here: <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation> Anyway, this PR actually uncovered two bugs (related) that were happening while parsing the arguments. The first one was that the parser *was* catching *some* arguments that were missing the "N@" part, but it wasn't correctly setting the argument's type. This was causing a NULL pointer being dereferenced, ouch... The second bug uncovered was that the parser was not catching all of the cases for a probe which did not provide the "N@" part. The fix for that was to simplify the check that the code was making to identify non-prefixed probes. The code is simpler and easier to read now. I am also providing a testcase for this bug, only for x86_64 architectures. gdb/ 2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/16889 * stap-probe.c (stap_parse_probe_arguments): Simplify check for non-prefixed probes (i.e., probes whose arguments do not start with "N@"). Always set the argument type to a sane value. gdb/testsuite/ 2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/16889 * gdb.arch/amd64-stap-optional-prefix.S: New file. * gdb.arch/amd64-stap-optional-prefix.exp: Likewise.
2014-05-02gdb_load: Fix latent bugsPedro Alves3-3/+14
In a test I was writting, I needed a procedure that would connect to the target, and do "load", or equivalent. Years ago, boards would override gdb_load to implement that. Then gdb_reload was added, and gdb_load was relaxed to allow boards avoid the spawing and connecting to the target. This sped up gdbserver testing. See https://www.sourceware.org/ml/gdb-patches/2007-02/msg00318.html. To actually spawn the target and load the executable on the target side, gdb_reload was born: # gdb_reload -- load a file into the target. Called before "running", # either the first time or after already starting the program once, # for remote targets. Most files that override gdb_load should now # override this instead. proc gdb_reload { } { # For the benefit of existing configurations, default to gdb_load. # Specifying no file defaults to the executable currently being # debugged. return [gdb_load ""] } Note the comment about specifying no file. Indeed looking at config/sid.exp, or config/monitor.exp, we see examples of that. However, the default gdb_load itself doesn't handle the case of no file specified. When passed no file, it just calls gdb_file_cmd with no file either, which ends up invocing the "file" command with no argument, which means unloading the file and its symbols... That means calling gdb_reload when testing against native targets is broken. We don't see that today because the only call to gdb_reload that exists today is guarded by target_info exists gdb,do_reload_on_run. The native-extended-gdbserver.exp board is likewise broken here. When [gdb_load ""] is called, the board sets the remote exec-file to "" ... Tested on x86_64 Fedora 17, native, remote gdbserver and extended-remote gdbserver. testsuite/ 2014-05-01 Pedro Alves <palves@redhat.com> * lib/gdb.exp (gdb_load): Extend comment. Skip calling gdb_file_cmd if no file is specified. * boards/native-extended-gdbserver.exp (gdb_load): Use the last_loaded_file to set the remote exec-file.
2014-05-01compare-sections: New -r option.David Taylor4-3/+25
When connecting to a remote system, we use the compare-sections command to verify that the box is running the code that we think it is running. Since the system is up and running and *NOT* 'freshly downloaded without yet executing anything', read-write sections, of course, differ from what they were in the executable file. Comparing read-write sections takes time and more importantly the MIS-MATCHED output is confusing to some users. The compare-sections command compares all loadable sections including read-write sections. This patch gives the user the option to compare just the loadable read-only sections. gdb/ 2014-05-01 David Taylor <dtaylor@emc.com> * remote.c (compare_sections_command): Add -r option to compare all loadable read-only sections. gdb/doc/ 2014-05-01 David Taylor <dtaylor@emc.com> * gdb.texinfo (compare-sections): Document the new -r (read-only) option.
2014-05-01New testsuite/boards/local-remote-host.exp board, now with editing onPedro Alves2-0/+36
This adds a variant of local-remote-host-notty.exp that forces pseudo-tty allocation, so that readline/editing is enabled. $ ssh localhost gdb -q (gdb) show editing Editing of command lines as they are typed is off. (gdb) vs: $ ssh -t localhost gdb -q (gdb) show editing Editing of command lines as they are typed is on. We now get, e.g.: Running ../../../src/gdb/testsuite/gdb.base/filesym.exp ... PASS: gdb.base/filesym.exp: complete on "filesy" PASS: gdb.base/filesym.exp: completion list for "filesym" PASS: gdb.base/filesym.exp: set breakpoint at filesym gdb/testsuite/ 2014-05-01 Pedro Alves <palves@redhat.com> * boards/local-remote-host.exp: New file.
2014-05-01Rename testsuite/boards/local-remote-host.exp -> ↵Pedro Alves2-0/+5
testsuite/boards/local-remote-host-notty.exp When testing with this board, stdin is not a tty, and so readline/editing is disabled: $ ssh localhost gdb -q (gdb) show editing Editing of command lines as they are typed is off. (gdb) Rename the file, to make room for a version of this board that forces a pseudo-tty. gdb/testsuite/ 2014-05-01 Pedro Alves <palves@redhat.com> * boards/local-remote-host.exp: Rename to ... * boards/local-remote-host-notty.exp: ... this.
2014-04-30Remove unused arguments to few functions in dwarf2loc.c and gdbtypes.c.Siva Chandra4-13/+21
gdb/ChangeLog: * dwarf2loc.c (dwarf2_locexpr_baton_eval, dwarf2_evaluate_property): Remove unused CORE_ADDR argument. Update all callers. * dwarf2loc.h (dwarf2_evaluate_property): Update signature. * gdbtypes.c (resolve_dynamic_range, resolve_dynamic_array): Remove unused CORE_ADDR argument. Update all callers.
2014-04-29Fix remote connection to targets that don't support the QNonStop packet.Pedro Alves2-6/+68
... and others. The recent patch that fixed several "set remote foo-packet on/off" commands introduced a regression, observable when connecting GDB to QEMU. For instance: (gdb) set debug remote 1 (gdb) tar rem :4444 Remote debugging using :4444 Sending packet: $qSupported:multiprocess+;qRelocInsn+#2a...Ack Packet received: PacketSize=1000;qXfer:features:read+ Packet qSupported (supported-packets) is supported Sending packet: $Hgp0.0#ad...Ack Packet received: OK Sending packet: $qXfer:features:read:target.xml:0,ffb#79...Ack Packet received: [...] Sending packet: $qXfer:features:read:arm-core.xml:0,ffb#08...Ack Packet received: [...] !!! -> Sending packet: $QNonStop:0#8c...Ack Packet received: Remote refused setting all-stop mode with: The "QNonStop" feature is associated with the PACKET_QNonStop packet, with a default of PACKET_DISABLE, so GDB should not be sending the packet at all. The patch that introduced the regression decoupled packet_config's 'detect' and 'support' fields, making the former (an auto_boolean) purely the associated "set remote foo-packet" command's variable. In the example above, the packet config's 'supported' field does end up correctly set to PACKET_DISABLE. However, nothing is presently initializing packet configs that don't actually have a command associated. Those configs's 'detect' field then ends up set to AUTO_BOOLEAN_TRUE, simply because that happens to be 0. This forces GDB to assume the packet is supported, irrespective of what the target claims it supports, just like if the user had done "set remote foo-packet on" (this being the associated command, if there was one). Ideally, all packet configs would have a command associated. While that isn't true, make sure all packet configs are initialized, even if no command is associated, and add an assertion that prevents adding more packets/features without an associated command. Tested on x86_64 Fedora 17, against pristine gdbserver, and against a gdbserver with the QNonStop packet/feature disabled with a local hack. gdb/ 2014-04-29 Pedro Alves <palves@redhat.com> * remote.c (struct packet_config) <detect>: Extend comment. (add_packet_config_cmd): Don't set the config's detect or support fields here. (init_all_packet_configs): Also initialize the config's 'detect' field. (reset_all_packet_configs_support): New function. (remote_open_1): Call reset_all_packet_configs_support instead of init_all_packet_configs. (_initialize_remote): Initialize all packet configs. Assert that all packets have an associated command, except a few known outliers.
2014-04-28Add gdb.ada/dyn_arrayidx testcase.Joel Brobecker3-0/+72
This add a testcases that verifies correct handling of dynamicity for lower bounds of arrays. gdb/testsuite/ChangeLog: * gdb.ada/dyn_arrayidx: New testcase.
2014-04-28dwarf2read.c::read_subrange_type: Handle dynamic lower boundsJoel Brobecker2-5/+6
Currently, read_subrange_type handles dynamicity only in the case of the upper bound, and assumes that the lower bound is always static. That's rooted in the fact that dynamicity was added to support C99 variable-length arrays, where the lower bound is always zero, and therefore never dynamic. But the lower bound can, in fact, be dynamic in other languages such as Ada. Consider for instance the following declaration in Ada... type Array_Type is array (L .. U) of Natural; ... where L and U are parameters of the function where the declaration above was made, and whose value are 5 and 10. Currently, the debugger is able to print the value of the upper bound correctly, but not the lower bound: (gdb) ptype array_type type = array (1 .. 10) of natural After this patch, the debugger now prints: (gdb) ptype array_type type = array (5 .. 10) of natural gdb/ChangeLog: * dwarf2read.c (read_subrange_type): Handle dynamic DW_AT_lower_bound attributes.
2014-04-28Improve Ada dynamic range type handling.Joel Brobecker2-0/+8
Consider the following declaration in Ada... type Array_Type is array (L .. U) of Natural; ... where L and U are parameters of the function where the declaration above was made. At the moment, GDB relies on descriptive types in order to properly decode the array bounds. For instance, if L was 5, and U was 10, we would see the following: (gdb) ptype array_type type = array (5 .. 10) of natural (gdb) maintenance set ada ignore-descriptive-types (gdb) ptype array_type type = array (1 .. 28544912) of natural This patch enhances ada_discrete_type_{high,low}_bound to resolve any dynamicity. This is sufficient to fix the case of the upper bound. For the lower bound, the dwarf2read module does not handle dynamic lower bounds yet, but once it does, the lower bound should be correctly handled as well [1]. gdb/ChangeLog: * ada-lang.c (ada_discrete_type_high_bound): Resolve the type's dynamic bounds before computing its upper bound. (ada_discrete_type_low_bound): Same as above with the lower bound. [1]: The reason why we do not enhance dwarf2read to handle dynamic lower bounds ahead of this patch is because it unveils some latent issues such as this one.
2014-04-28Enhance dwarfread.c::resolve_dynamic_type to resolve dynamic rangesJoel Brobecker2-46/+80
This change breaks down the resolve_dynamic_bounds function which works only on arrays and its index range types into two functions, one that resolves range types, and one that resolves arrays (using the new routine to resolve the array's index range type). The is_dynamic_type and resolve_dynamic_type function are then re-organized to handle range types as well. One small change worth mentioning is the fact that, now that range types are resolved on their own (rather than in the limited context of array index types), the resolved range types are created from a copy of the dynamic range type, rather than from scratch (first parameter of create_range_type). This allows us to preserve as many original properties in the resolved type as possible (Eg. the type's name). This is preparation work that will help better support dynamic range types for languages that allow the declaration of such types (Eg. Ada). gdb/ChangeLog: * dwarf2read.c (is_dynamic_type): Return true for dynamic range types. Adjust the array handling implementation to take advantage of this change. (resolve_dynamic_range): New function, mostly extracted from resolve_dynamic_bounds. (resolve_dynamic_array): New function, mostly extracted from resolve_dynamic_bounds. (resolve_dynamic_bounds): Delete. (resolve_dynamic_type): Reimplement. Add handling of TYPE_CODE_RANGE types.
2014-04-28Unnecessary XA type handling in ada_varobj_describe_simple_array_childJoel Brobecker2-7/+6
ada-varobj.c::ada_varobj_describe_simple_array_child only ever gets called after all GNAT encodings have been applied to (parent_value, parent_type). So there is no point in redoing it partially by checking for parallel XA types again. gdb/ChangeLog: * ada-varobj.c (ada_varobj_describe_simple_array_child): Remove handling of parallel ___XA types.
2014-04-28remove unnecessary second call to static_unwrap_type in ada_evaluate_subexpJoel Brobecker2-4/+6
In ada-lang.c::ada_evaluate_subexp, case OP_VAR_VALUE, when noside is EVAL_AVOID_SIDE_EFFECTS, the first thing we do is set type as follow: type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol)); Later on in the same block, we make the same call: return value_zero (to_static_fixed_type (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))), not_lval); This patch removes the second call, since it should result in the same type being returned, so no point in making that call again. gdb/ChangeLog: * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Remove unnecessary second call to static_unwrap_type.
2014-04-28[gdbserver] Correctly generate i386-avx512.cYao Qi2-1/+6
The makefile rule i386-avx512.c is to generate i386-avx512.c, but it is written to i386-avx.c by mistake. This patch is to fix this typo. gdb/gdbserver: 2014-04-28 Yao Qi <yao@codesourcery.com> * Makefile.in (i386-avx512.c): Fix the typo of generated file name.
2014-04-27Make "set disassemble-next-line on" can work with DUMMY_FRAME, ↵Hui Zhu2-0/+12
SIGTRAMP_FRAME and ARCH_FRAME When GDB debug DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME, even if "set disassemble-next-line on", it will not output the asm code: (gdb) set disassemble-next-line on (gdb) si <signal handler called> (gdb) <signal handler called> (gdb) <signal handler called> So make this patch make they can work together, it will become: (gdb) si <signal handler called> => 0xffffffff816bfb09 <int_with_check+0>: 65 48 8b 0c 25 c8 c7 00 00 mov %gs:0xc7c8,%rcx (gdb) <signal handler called> => 0xffffffff816bfb12 <int_with_check+9>: 48 81 e9 d8 1f 00 00 sub $0x1fd8,%rcx (gdb) <signal handler called> => 0xffffffff816bfb19 <int_with_check+16>: 8b 51 10 mov 0x10(%rcx),%edx 2014-04-27 Hui Zhu <hui@codesourcery.com> * stack.c (print_frame_info): Call do_gdb_disassembly with DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME.
2014-04-26* guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment.Doug Evans2-1/+5
2014-04-26Compute the function length instead of hard coding itYao Qi2-3/+65
In Dwarf::assemble in dwz.exp, 10 is hard-coded in it, subprogram { {name main} {low_pc main addr} {high_pc "main + 10" addr} } however, the length of main function varies on architectures. The hard-coded 10 here causes dwz.exp fails on some targets, such as nios2. This patch is to add some code to compute the length of function main, which is similar to what we are doing in entry-values.exp. gdb/testsuite: 2014-04-26 Yao Qi <yao@codesourcery.com> * gdb.dwarf2/dwz.exp: Compile main.c to object. Restart GDB and compute the length of function main. Save it in $main_length. (Dwarf::assemble): Use $main_length instead of hard-coded 10. (top-level): Use gdb_compile to compile objects into executable and restart GDB. Remove invocation to prepare_for_testing.
2014-04-25Add missing gdbserver/ChangeLog entry for previous commit.Pedro Alves1-0/+19
2014-04-25 Pedro Alves <palves@redhat.com> PR server/16255 * linux-low.c (linux_attach_fail_reason_string): New function. (linux_attach_lwp): Delete. (linux_attach_lwp_1): Rename to ... (linux_attach_lwp): ... this. Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach): Adjust to call linux_attach_lwp. Call error on failure to attach to the tgid. Call warning when failing to attach to an lwp. * linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as argument. Remove "initial" parameter. Return int instead of void. Don't error or warn here. (linux_attach_fail_reason_string): New declaration. * thread-db.c (attach_thread): Adjust to linux_attach_lwp's interface change. Use linux_attach_fail_reason_string.