* c-lang.c (c_get_string): Ignore the declared size of the object
if a specific length is requested.
testsuite/
* gdb.python/py-value.c: #include stdlib.h, string.h.
(str): New struct.
(main): New local xstr.
* gdb.python/py-value.exp (test_value_in_inferior): Add test to
fetch a value as a string with a length beyond the declared length
of the array.
GDB is able to cache memory accesses requested in target_read_code,
so target_read_code is more efficient than general target_read_memory.
This patch uses target_read_code and its variants to read target
memory in the functions related to i386_skip_prologue. It improves
the performance when doing 'b foo' (foo is a function) in remote
debugging.
Nowadays, when we set a breakpoint on function f1, GDB will fetch the
code in f1 to determine the start of the function body (say skip the
prologue), it requests read from target many times. With this patch
applied, the number of RSP 'm' packets are reduced.
gdb:
2013-12-10 Yao Qi <yao@codesourcery.com>
* corefile.c (read_code): New function.
(read_code_integer): New function.
(read_code_unsigned_integer): New function.
* gdbcore.h (read_code): Declare.
(read_code_integer): Declare.
(read_code_unsigned_integer): Declare.
* i386-tdep.c (i386_follow_jump): Call target_read_code instead
of target_read_memory. Call read_code_unsigned_integer instead
of read_memory_unsigned_integer.
(i386_analyze_struct_return): Likewise.
(i386_skip_probe): Likewise.
(i386_analyze_stack_align): Likewise.
(i386_match_pattern): Likewise.
(i386_skip_noop): Likewise.
(i386_analyze_frame_setup): Likewise.
(i386_analyze_register_saves): Likewise.
(i386_skip_prologue): Likewise.
(i386_skip_main_prologue): Likewise.
(i386_frame_cache_1): Likewise.
This helps with the following issue: Given an Ada program defining
a global variable:
package Pck is
Watch : Integer := 1974;
end Pck;
When printing the address of this variable, GDB also tries to print
the associated symbol name:
(gdb) p watch'address
$1 = (access integer) 0x6139d8 <pck__watch>
^^
||
The problem is that GDB prints the variable's linkage name, instead
of its natural name. This is because the language of the associated
minimal symbol never really gets set.
This patch adds handling for Ada symbols in symbol_find_demangled_name.
After this patch, we now get:
(gdb) p watch'address
$1 = (access integer) 0x6139d8 <pck.watch>
^
|
gdb/ChangeLog:
* symtab.c (symbol_find_demangled_name): Add handling of
Ada symbols.
gdb/testsuite/ChangeLog:
* gdb.ada/int_deref.exp: Add test verifying that we print
the decoded symbol name when printing the address of Ada
symbols.
This adds "exec-run-start-option" in the output of the -list-features
commands, allowing front-ends to easily determine whether -exec-run
supports the --start option.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): add "exec-run-start-option".
* NEWS: Expand the entry documenting the new -exec-run --start
option to mention the corresponding new entry in the output of
"-list-features".
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new
"exec-run-start-option" entry in the output of the "-list-features"
command.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-start.exp: Add test verifying that -list-features
contains "exec-run-start-option".
We observed on Windows 2012 that we were unable to unwind past
exception handlers. For instance, with any Ada program raising
an exception that does not get handled:
% gnatmake -g a -bargs -shared
% gdb a
(gdb) start
(gdb) catch exception unhandled
Catchpoint 2: unhandled Ada exceptions
(gdb) c
Catchpoint 2, unhandled CONSTRAINT_ERROR at <__gnat_unhandled_exception> (
e=0x645ff820 <constraint_error>) at s-excdeb.adb:53
53 s-excdeb.adb: No such file or directory.
At this point, we can already see that something went wrong, since
the frame selected by the debugger corresponds to a runtime function
rather than the function in the user code that caused the exception
to be raised (in our case procedure A).
This is further confirmed by the fact that we are unable to unwind
all the way to procedure A:
(gdb) bt
#0 <__gnat_unhandled_exception> (e=0x645ff820 <constraint_error>)
at s-excdeb.adb:53
#1 0x000000006444e9a3 in <__gnat_notify_unhandled_exception> (excep=0x284d2
+0)
at a-exextr.adb:144
#2 0x00000000645f106a in __gnat_personality_imp ()
from C:\[...]\libgnat-7.3.dll
#3 0x000000006144d1b7 in _GCC_specific_handler (ms_exc=0x242fab0,
this_frame=0x242fe60, ms_orig_context=0x242f5c0, ms_disp=0x242ef70,
gcc_per=0x645f0960 <__gnat_personality_imp>)
at ../../../src/libgcc/unwind-seh.c:289
#4 0x00000000645f1211 in __gnat_personality_seh0 ()
from C:\[...]\libgnat-7.3.dll
#5 0x000007fad3879f4d in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
It turns out that the unwinder has been doing its job flawlessly
up until frame #5. The address in frame #5 is correct, but GDB
is not able to associate it with any symbol or unwind record.
And this is because this address is inside ntdll.dll, and when
we received the LOAD_DLL_DEBUG_EVENT for that DLL, the system
was not able to tell us the name of the library, thus causing us
to silently ignoring the event. Because GDB does not know about
ntdll.dll, it is unable to access the unwind information from it.
And because the function at that address does not use a frame
pointer, the unwinding becomes impossible.
This patch helps recovering ntdll.dll at the end of the "run/attach"
phase, simply by trying to locate that specific DLL again.
In terms of our medium to long term planning, it seems to me that
we should be able to simplify the code by ignoring LOAD_DLL_DEBUG_EVENT
during the startup phase, and modify windows_ensure_ntdll_loaded
to then detect and report all shared libraries after we've finished
inferior creation. But for a change just before 7.7 branch creation,
I thought it was safest to just handle ntdll.dll specifically. This
is less intrusive, and ntdll is the only DLL affected by the problem
I know so far.
gdb/ChangeLog:
* windows-nat.c (handle_load_dll): Add comments.
(windows_ensure_ntdll_loaded): New function.
(do_initial_windows_stuff): Use windows_ensure_ntdll_loaded.
Add FIXME comment.
We added a new proc gdb_produce_source recently, and it can be used
more widely in lib/gdb.exp to generate source file.
gdb/testsuite:
2013-12-08 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (support_complex_tests): Use gdb_produce_source.
(is_elf_target, is_ilp32_target, is_ilp64_target): Likewise.
(is_64_target, is_amd64_regs_target): Likewise.
(skip_altivec_tests, skip_vsx_tests, skip_btrace_tests): Likewise.
Hi,
I see such warning below on one compiler I am using.
cc1: warnings being treated as errors
../../workspace/gdb/stack.c: In function 'frame_info':
../../workspace/gdb/stack.c:1519:20: error: 'caller_pc' may be used uninitialized in this function
Go through the gdb-patches archives and find the "canonical" way to
fix this warning is to initialize the variable.
gdb:
2013-12-08 Yao Qi <yao@codesourcery.com>
* stack.c (frame_info): Initialize variable caller_pc.
These files are source files and have no business being +x. We couldn't
easily fix it in CVS (you need login+write access to the raw rcs files),
but we can fix this w/git.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
These scripts use /bin/ksh, but they're dirt simple and can be used with
/bin/sh, so just change the shebang.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Doing "info frame" in the outermost frame, when that was indicated by
the next frame saying the unwound PC is undefined/not saved, results
in error and incomplete output:
(gdb) bt
#0 thread_function0 (arg=0x0) at threads.c:63
#1 0x00000034cf407d14 in start_thread (arg=0x7ffff7fcb700) at pthread_create.c:309
#2 0x000000323d4f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
(gdb) frame 2
#2 0x000000323d4f168d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
115 call *%rax
(gdb) info frame
Stack level 2, frame at 0x0:
rip = 0x323d4f168d in clone (../sysdeps/unix/sysv/linux/x86_64/clone.S:115); saved rip Register 16 was not saved
(gdb)
Not saved register values are treated as optimized out values
internally throughout. stack.c:frame_info is handing unvailable
values, but not optimized out ones. The patch deletes the
frame_unwind_caller_pc_if_available wrapper function and instead lets
errors propagate to frame_info (it's only user).
As frame_unwind_pc now needs to be able to handle and cache two
different error scenarios, the prev_pc.p variable is replaced with an
enumeration.
(FWIW, I looked into making gdbarch_unwind_pc or a variant return
struct value's instead, but it results in lots of boxing and unboxing
for no real gain -- e.g., the mips and arm implementations need to do
computation on the unboxed PC value. Might as well throw an error on
first attempt to get at invalid contents.)
After the patch, we get:
(gdb) info frame
Stack level 2, frame at 0x0:
rip = 0x323d4f168d in clone (../sysdeps/unix/sysv/linux/x86_64/clone.S:115); saved rip = <not saved>
Outermost frame: outermost
caller of frame at 0x7ffff7fcafc0
source language asm.
Arglist at 0x7ffff7fcafb8, args:
Locals at 0x7ffff7fcafb8, Previous frame's sp is 0x7ffff7fcafc8
(gdb)
A new test is added. It's based off dw2-reg-undefined.exp, and tweaked to
mark the return address (rip) of "stop_frame" as undefined.
Tested on x86_64 Fedora 17.
gdb/
2013-12-06 Pedro Alves <palves@redhat.com>
* frame.c (enum cached_copy_status): New enum.
(struct frame_info) <prev_pc.p>: Change type to enum
cached_copy_status.
(fprint_frame): Handle not saved and unavailable prev_pc values.
(frame_unwind_pc_if_available): Delete and merge contents into ...
(frame_unwind_pc): ... here. Handle OPTIMIZED_OUT_ERROR. Adjust
to use enum cached_copy_status.
(frame_unwind_caller_pc_if_available): Delete.
(create_new_frame): Adjust.
* frame.h (frame_unwind_caller_pc_if_available): Delete
declaration.
* stack.c (frame_info): Use frame_unwind_caller_pc instead of
frame_unwind_caller_pc_if_available, and handle
NOT_AVAILABLE_ERROR and OPTIMIZED_OUT_ERROR errors.
* valprint.c (val_print_optimized_out): Use val_print_not_saved.
(val_print_not_saved): New function.
* valprint.h (val_print_not_saved): Declare.
gdb/testsuite/
2013-12-06 Pedro Alves <palves@redhat.com>
* gdb.dwarf2/dw2-undefined-ret-addr.S: New file.
* gdb.dwarf2/dw2-undefined-ret-addr.c: New file.
* gdb.dwarf2/dw2-undefined-ret-addr.exp: New file.
In order to catch <optimized out> errors like we catch <unavailable>
errors, this adds a new OPTIMIZED_OUT_ERROR error code, and throws it
in various places.
gdb/ChangeLog
2013-12-06 Andrew Burgess <aburgess@broadcom.com>
Pedro Alves <palves@redhat.com>
* exceptions.h (errors): Add OPTIMIZED_OUT_ERROR.
* dwarf2loc.c (write_pieced_value): Throw OPTIMIZED_OUT_ERROR.
* frame.c (frame_unwind_register): Throw OPTIMIZED_OUT_ERROR.
* spu-tdep.c (spu_software_single_step): Throw
OPTIMIZED_OUT_ERROR.
* valops.c (value_assign): Throw OPTIMIZED_OUT_ERROR.
The introductory comment to free_objfile is obsolete.
This patch fixes it by removing all the obsolete bits.
2013-12-06 Tom Tromey <tromey@redhat.com>
* objfiles.c (free_objfile): Update comment.
I happened to notice that nothing uses objfile_to_front.
This patch removes it.
2013-12-06 Tom Tromey <tromey@redhat.com>
* objfiles.h (objfile_to_front): Remove.
* objfiles.c (objfile_to_front): Remove.
This removes an unnecessary declaration from minsyms.c.
2013-12-06 Tom Tromey <tromey@redhat.com>
* minsyms.c (get_symbol_leading_char): Remove unnecessary
declaration.
This improves the packing of struct partial_symtab. I noticed with
pahole that were were a couple of holes. This consolidates the holes
without, I think, affecting readability -- it just moves the "user"
field a bit earlier in the struct. This change saves a small amount
of memory.
2013-12-06 Tom Tromey <tromey@redhat.com>
* psympriv.h (struct partial_symtab) <user>: Move earlier.
This fixes a couple of old "32x64" FIXME comments by using paddress
with current_gdbarch rather than hex_string and a cast to long.
2013-12-06 Tom Tromey <tromey@redhat.com>
* cli/cli-cmds.c (edit_command): Use paddress, not hex_string.
(list_command): Likewise.
This puts the psymtab filename in the filename bcache.
This saves a small amount of memory.
2013-12-06 Tom Tromey <tromey@redhat.com>
* psymtab.c (allocate_psymtab): Put the filename in the filename
bcache.
This makes symtab::dirname const and updates one spot to avoid an
intermediate constless result.
2013-12-06 Tom Tromey <tromey@redhat.com>
* buildsym.c (end_symtab_from_static_block): Use obstack_copy0.
* symtab.h (struct symtab) <dirname>: Now const.
This makes symtab::filename const and removes a newly unnecessary
cast.
2013-12-06 Tom Tromey <tromey@redhat.com>
* symfile.c (allocate_symtab): Remove cast.
* symtab.h (struct symtab) <filename>: Now const.
While looking into the probe API, it seemed to me that there were a
number of methods in sym_probe_fns that were not needed. This patch
removes them.
Specifically, it seems to me that sym_probe_fns ought to be concerned
with the API for constructing the probes. Any method relating to some
aspect of an individual probe can be handled via the probe's own
vtable. That is, the double indirection here doesn't seem useful --
it certainly isn't in fact used, but also I couldn't think of a
potential use.
2013-12-06 Tom Tromey <tromey@redhat.com>
* break-catch-throw.c (fetch_probe_arguments): Use
get_probe_argument_count and evaluate_probe_argument.
* elfread.c (elf_get_probe_argument_count)
(elf_can_evaluate_probe_arguments, elf_evaluate_probe_argument)
(elf_compile_to_ax): Remove.
(elf_probe_fns): Update.
* probe.c (get_probe_argument_count, can_evaluate_probe_arguments)
(evaluate_probe_argument): Call method on probe, not via sym
functions.
* stap-probe.c (compute_probe_arg): Use get_probe_argument_count,
evaluate_probe_argument.
(compile_probe_arg): Use get_probe_argument_count. Call method on
probe, not via sym functions.
* symfile-debug.c (debug_sym_get_probe_argument_count)
(debug_can_evaluate_probe_arguments)
(debug_sym_evaluate_probe_argument, debug_sym_compile_to_ax):
Remove.
(debug_sym_probe_fns): Remove.
* symfile.h (struct sym_probe_fns) <sym_get_probe_argument_count,
can_evaluate_probe_arguments, sym_evaluate_probe_argument,
sym_compile_to_ax>: Remove fields.
In some languages, e.g. fortran, arrays start with index 1
instead 0. This patch changes the MI library to support testing
varobj children of fortran arrays.
2013-11-21 Keven Boell <keven.boell@intel.com>
testsuite/
* lib/mi-support.exp (mi_list_varobj_children_range): Add
call to mi_list_array_varobj_children_with_index.
(mi_list_array_varobj_children_with_index): New function.
Add parameter to specify array start.
* p-exp.y (exp : field_exp name): Do not call mark_struct_expression.
(exp : field_exp name COMPLETE): New rule.
(exp : SIZEOF): Set correct current_type.
(last_was_structop): Remove static variable.
(yylex): Remove saw_structop local variable.
Adapt code to removal of variables above.
With a simple Ada program where I have 3 functions, one just calling
the next, the backtrace is currently broken when GDB is compiled
at -O2:
#0 hello.first () at hello.adb:5
#1 0x0000000100001475 in hello.second () at hello.adb:10
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
It turns out that a recent patch deleted the assignment of variable
this_id, making it an unitialized variable:
* frame-unwind.c (default_frame_unwind_stop_reason): Return
UNWIND_OUTERMOST if the frame's ID is outer_frame_id.
* frame.c (get_prev_frame_1): Remove outer_frame_id check.
The hunk in question starts with:
- /* Check that this frame is not the outermost. If it is, don't try
- to unwind to the prev frame. */
- this_id = get_frame_id (this_frame);
- if (frame_id_eq (this_id, outer_frame_id))
(the code was removed as redundant - but removing the assignment
was in fact not intentional).
There is no other code in this function that sets the variable.
Instead of re-adding the statement in the lone section where it is
actually used, I inlined it, and then got rid of the variable
altogether. This way, and until we start needing this frame ID
in another location within that function, we dont' have to worry
about the variable's validity/lifetime.
gdb/ChangeLog:
* frame.c (get_prev_frame_1): Delete variable "this_id".
Replace its use by a call to get_frame_id.
We've observed in Windows 2012 that ntdll.dll contains some unwind
records with the version field set to 2. This patch adjusts the
decoder to accept records flagged with this version as well.
Version 2 appears to still be largely undocumented at this stage.
However, apart from a mysterious opcode 6, everything else still
seems to remain the same. So this patch also changes the decoder
to ignore those opcodes; before this change, the debugger would
silently stop the decoding, and let the frame unwinder make do
with what it the decoder managed to decode up to that point.
It's unclear at this point what we're losing by not being able to
decode that opcode. But the information does not appear to be critical,
at least as far as call unwinding is concerned.
gdb/ChangeLog:
(from Tristan Gingold <gingold@adacore.com>)
(from Joel Brobecker <brobecker@adacore.com>)
* amd64-windows-tdep.c (amd64_windows_frame_decode_insns):
Accept version 2. Ignore operations using opcode 6.
I wanted to find the docs for "catch load" the other day, and I found
out that this isn't in the index. It seems to me that each command
ought to be in the index for quick reference like this, so this patch
adds an @kindex (chosen because it seems to be what the rest of the
manual does) for each "catch" subcommand.
2013-12-03 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Set Catchpoints): Add @kindex for each command
documented here.
I happened to notice that the gdbserver program doesn't appear in the
top-level "dir" file. This adds an entry for it to the gdb manual.
2013-12-03 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (@direntry): Add menu item for gdbserver.
2013-10-03 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.base/sigall.exp (test_one_sig): gdb identifies SIGLOST as a
SIGPWR in sparc64.
* gdb.base/sigall.c (main): In some targets SIGLOST and SIGPWR
have the same signal number. Handle this situation.
Consider the following code:
type Ptr is access all Integer;
IP : Ptr := new Integer'(123);
IP is the Ada exception of a pointer to an integer. To dereference
the pointer and get its value, the user uses the reserved word "all"
as follow:
(gdb) p ip.all
$1 = 123
Ada being a case-insensitive language, the casing should not matter.
Unfortunately, for the reserved word "all", things don't work. For
instance:
(gdb) p ip.ALL
Type integer is not a structure or union type
This patch fixes the problem.
gdb/ChangeLog:
* ada-lex.l (find_dot_all): Use strncasecmp instead of strncmp.
gdb/testsuite/ChangeLog:
* gdb.ada/dot_all: New testcase.
With a program raising an exception, trying to debug that program
in GDB/MI mode can yield a crash:
% gdb -i=mi foo
(gdb)
-catch-exception -e "Program_Error"
^done,bkptno="2",bkpt={number="2",type="breakpoint",[...]
(gdb)
-exec-continue
^running
*running,thread-id="all"
(gdb)
=library-loaded,id=[...]
&"warning: failed to reevaluate internal exception condition for catchpoint 2: Error in expression, near `'.\n"
zsh: 22956 bus error (core dumped) gdb -q -i=mi foo
The problem is triggered by a problem in the compiler which causes
EXP in the following TRY_CATCH block to change unexpectedly when
parse_exp_1 throws an error :
| TRY_CATCH (e, RETURN_MASK_ERROR)
| {
| exp = parse_exp_1 (&s, bl->address,
| block_for_pc (bl->address), 0);
| }
In ada-lang.c:create_excep_cond_exprs, EXP is initialized to NULL,
and is expected to remain NULL if parse_exp_1 throws. Instead,
its value gets changed to something invalid. This later crashes
the debugger, when trying to evaluate the bogus expression.
This patch works around the issue by simply forcing EXP back to NULL
when an exception was thrown. A comment explaining why, and the sort
of timeline we're looking at for a fix, is also added.
gdb/ChangeLog:
* ada-lang.c (create_excep_cond_exprs): Force EXP to NULL
when parse_exp_1 threw an error. Add comment.
This patch extends a bit the news entry we added which documents
general support of the --language option, to add a small reference
to the associated entry which was also added to the "-list-features"
command output.
gdb/ChangeLog:
* NEWS: Mention "-list-features" in the entry documenting
the support for the "--language" option.
Now that the -info-gdb-mi-command is available, there is no need for
this entry. The entry and associated new commands were added recently
enough that no front-end out there should be depending on it yet.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Remove "ada-exceptions".
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Remove the
documentation of the "ada-exceptions" entry.
... when trying to execute an undefined GDB/MI command. When trying
to execute a GDB/MI command which does not exist, the current error
result record looks like this:
-unsupported
^error,msg="Undefined MI command: unsupported"
The only indication that the command does not exist is the error
message. It would be a little fragile for a consumer to rely solely
on the contents of the error message in order to determine whether
a command exists or not.
This patch improves the situation by adding concept of error
code, starting with one well-defined error code ("undefined-command")
identifying errors due to a non-existant command. Here is the new
output:
-unsupported
^error,msg="Undefined MI command: unsupported",code="undefined-command"
This error code is only displayed when the corresponding error
condition is met. Otherwise, the error record remains unchanged.
For instance:
-symbol-list-lines foo.adb
^error,msg="-symbol-list-lines: Unknown source file name."
For frontends to be able to know whether they can rely on this
variable, a new entry "undefined-command-error-code" has been
added to the "-list-features" command. Another option would be
to always generate an error="..." variable (for the default case,
we could decide for instance that the error code is the empty string).
But it seems more efficient to provide that info in "-list-features"
and then only add the error code when meaningful.
gdb/ChangeLog:
(from Pedro Alves <palves@redhat.com>)
(from Joel Brobecker <brobecker@adacore.com>)
* exceptions.h (enum_errors) <UNDEFINED_COMMAND_ERROR>: New enum.
* mi/mi-parse.c (mi_parse): Throw UNDEFINED_COMMAND_ERROR instead
of a regular error when the GDB/MI command does not exist.
* mi/mi-main.c (mi_cmd_list_features): Add
"undefined-command-error-code".
(mi_print_exception): Print an "undefined-command"
error code if EXCEPTION.ERROR is UNDEFINED_COMMAND_ERROR.
* NEWS: Add entry documenting the new "code" variable in
"^error" result records.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Result Records): Fix the syntax of the
"^error" result record concerning the error message. Document
the error code that may also be part of that result record.
(GDB/MI Miscellaneous Commands): Document the
"undefined-command-error-code" element in the output of
the "-list-features" GDB/MI command.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-undefined-cmd.exp: New testcase.
This patch adds a new GDB/MI command meant for graphical frontends
trying to determine whether a given GDB/MI command exists or not.
Examples:
-info-gdb-mi-command unsupported-command
^done,command={exists="false"}
(gdb)
-info-gdb-mi-command symbol-list-lines
^done,command={exists="true"}
(gdb)
At the moment, this is the only piece of information that this
command returns.
Eventually, and if needed, we can extend it to provide
command-specific pieces of information, such as updates to
the command's syntax since inception. This could become,
for instance:
-info-gdb-mi-command symbol-list-lines
^done,command={exists="true",features=[]}
(gdb)
-info-gdb-mi-command catch-assert
^done,command={exists="true",features=["conditions"]}
In the first case, it would mean that no extra features,
while in the second, it announces that the -catch-assert
command in this version of the debugger supports a feature
called "condition" - exact semantics to be documented with
combined with the rest of the queried command's documentation.
But for now, we start small, and only worry about existance.
And to bootstrap the process, I have added an entry in the
output of the -list-features command as well ("info-gdb-mi-command"),
allowing the graphical frontends to go through the following process:
1. Send -list-features, collect info from there as before;
2. Check if the output contains "info-gdb-mi-command".
If it does, then support for various commands can be
queried though -info-gdb-mi-command. Newer commands
will be expected to always be checked via this new
-info-gdb-mi-command.
gdb/ChangeLog:
* mi/mi-cmds.h (mi_cmd_info_gdb_mi_command): Declare.
* mi/mi-cmd-info.c (mi_cmd_info_gdb_mi_command): New function.
* mi/mi-cmds.c (mi_cmds): Add -info-gdb-mi-command command.
* mi/mi-main.c (mi_cmd_list_features): Add "info-gdb-mi-command"
field to output of "-list-features".
* NEWS: Add entry for new -info-gdb-mi-command.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document
the new -info-gdb-mi-command GDB/MI command. Document
the meaning of "-info-gdb-mi-command" in the output of
-list-features.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-i-cmd.exp: New file.
gdb/
2013-12-02 Doug Evans <dje@google.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* objfiles.c (allocate_objfile): Save original_name as an absolute
path.
* objfiles.h (struct objfile): Expand comment on original_name.
* source.c (openp): Call gdb_abspath.
* utils.c (gdb_abspath): New function.
* utils.h (gdb_abspath): Declare.
gdb/testsuite/
2013-12-02 Doug Evans <dje@google.com>
* gdb.dwarf/dwp-symlink.c: Fake out gdb to not load debug info
at start.
* gdb.dwarf/dwp-symlink.exp: Test trying to load dwp when the binary
has been specified with a relative path and we have chdir'd before
accessing the debug info.
Confirmed that cross building a mingw gdb still works, and also made
sure it was gnulib's sys/stat.h that was defining the values, by
hacking the header with #errors where the macros are defined.
gdb/
2013-12-02 Pedro Alves <palves@redhat.com>
* ctf.c (ctf_start): Use S_IRGRP, S_IXGRP, S_IXOTH
unconditionally.
Remote servers may cut the connection abruptly since they are not
required to reply to a 'k' (Kill) packet sent from GDB.
This patch addresses any issues arising from such scenario, which
leads to a GDB internal error due to an attempt to pop the target more
than once. With the patch, this failure is handled gracefully.
Here's the GDB backtrace Maciej got running the testsuite against
QEMU. Full paths edited out for brevity.
#0 0x55573430 in __kernel_vsyscall ()
#1 0x557a2951 in raise () from /lib32/libc.so.6
#2 0x557a5d82 in abort () from /lib32/libc.so.6
#3 0x0826e2e4 in dump_core ()
at .../gdb/utils.c:635
#4 0x0826e5b6 in internal_vproblem (problem=0x85200c0,
file=0x8416be8 ".../gdb/target.c", line=2861,
fmt=0x84174ac "could not find a target to follow mourn inferior",
ap=0xffa4796c "\f")
at .../gdb/utils.c:804
#5 0x0826e5fb in internal_verror (
file=0x8416be8 ".../gdb/target.c", line=2861,
fmt=0x84174ac "could not find a target to follow mourn inferior",
ap=0xffa4796c "\f")
at .../gdb/utils.c:820
#6 0x0826e633 in internal_error (
file=0x8416be8 ".../gdb/target.c", line=2861,
string=0x84174ac "could not find a target to follow mourn inferior")
at .../gdb/utils.c:830
#7 0x081b4ad0 in target_mourn_inferior ()
at .../gdb/target.c:2861
#8 0x08082283 in remote_kill (ops=0x85245e0)
at .../gdb/remote.c:7840
#9 0x081b06d1 in target_kill ()
at .../gdb/target.c:486
#10 0x081b42f6 in dispose_inferior (inf=0xa501c60, args=0x0)
at .../gdb/target.c:2570
#11 0x08290cfc in iterate_over_inferiors (
callback=0x81b42af <dispose_inferior>, data=0x0)
at .../gdb/inferior.c:396
#12 0x081b435a in target_preopen (from_tty=1)
at .../gdb/target.c:2591
#13 0x0807c2c6 in remote_open_1 (name=0xa5538b6 "localhost:1237", from_tty=1,
target=0x85245e0, extended_p=0)
at .../gdb/remote.c:4292
#14 0x0807b7a8 in remote_open (name=0xa5538b6 "localhost:1237", from_tty=1)
at .../gdb/remote.c:3655
#15 0x080a23d4 in do_cfunc (c=0xa464f30, args=0xa5538b6 "localhost:1237",
from_tty=1)
at .../gdb/cli/cli-decode.c:107
#16 0x080a4c3b in cmd_func (cmd=0xa464f30, args=0xa5538b6 "localhost:1237",
from_tty=1)
at .../gdb/cli/cli-decode.c:1882
#17 0x0826bebf in execute_command (p=0xa5538c3 "7", from_tty=1)
at .../gdb/top.c:467
#18 0x08193f2d in command_handler (command=0xa5538a8 "")
at .../gdb/event-top.c:435
#19 0x08194463 in command_line_handler (
rl=0xa778198 "target remote localhost:1237")
at .../gdb/event-top.c:633
#20 0x082ba92b in rl_callback_read_char ()
at .../readline/callback.c:220
#21 0x08193adf in rl_callback_read_char_wrapper (client_data=0x0)
at .../gdb/event-top.c:164
#22 0x08193e57 in stdin_event_handler (error=0, client_data=0x0)
at .../gdb/event-top.c:375
#23 0x08192f29 in handle_file_event (data=...)
at .../gdb/event-loop.c:768
#24 0x0819266a in process_event ()
at .../gdb/event-loop.c:342
#25 0x08192708 in gdb_do_one_event ()
at .../gdb/event-loop.c:394
#26 0x08192781 in start_event_loop ()
at .../gdb/event-loop.c:431
#27 0x08193b08 in cli_command_loop (data=0x0)
at .../gdb/event-top.c:179
#28 0x0818bc26 in current_interp_command_loop ()
at .../gdb/interps.c:327
#29 0x0818c4e5 in captured_command_loop (data=0x0)
at .../gdb/main.c:267
#30 0x0818a37f in catch_errors (func=0x818c4d0 <captured_command_loop>,
func_args=0x0, errstring=0x8402108 "", mask=RETURN_MASK_ALL)
at .../gdb/exceptions.c:524
#31 0x0818d736 in captured_main (data=0xffa47f10)
at .../gdb/main.c:1067
#32 0x0818a37f in catch_errors (func=0x818c723 <captured_main>,
func_args=0xffa47f10, errstring=0x8402108 "", mask=RETURN_MASK_ALL)
at .../gdb/exceptions.c:524
#33 0x0818d76c in gdb_main (args=0xffa47f10)
at .../gdb/main.c:1076
#34 0x0804dd1b in main (argc=5, argv=0xffa47fd4)
at .../gdb/gdb.c:34
The corresponding gdb.log excerpt:
(gdb) PASS: gdb.base/bitfields.exp: bitfield uniqueness (u9)
cont
Continuing.
Breakpoint 1, break1 () at .../gdb/testsuite/gdb.base/bitfields.c:44
44 }
(gdb) PASS: gdb.base/bitfields.exp: continuing to break1 #9
print flags
$10 = {uc = 0 '\000', s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 1 '\001'}
(gdb) PASS: gdb.base/bitfields.exp: bitfield uniqueness (sc)
delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break break2
Breakpoint 2 at 0x85f8: file .../gdb/testsuite/gdb.base/bitfields.c, line 48.
(gdb) entering gdb_reload
target remote localhost:1235
A program is being debugged already. Kill it? (y or n) y
Remote connection closed
.../gdb/target.c:2861: internal-error: could not find a target to follow mourn inferior
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) ^Ccontinue
Please answer y or n.
.../gdb/target.c:2861: internal-error: could not find a target to follow mourn inferior
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) Resyncing due to internal error.
n
.../gdb/target.c:2861: internal-error: could not find a target to follow mourn inferior
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Command aborted.
(gdb) print/x flags
$11 = {uc = 0x0, s1 = 0x0, u1 = 0x0, s2 = 0x0, u2 = 0x0, s3 = 0x0, u3 = 0x0, s9 = 0x0, u9 = 0x0, sc = 0x0}
(gdb) FAIL: gdb.base/bitfields.exp: bitfield containment #1
cont
The program is not being run.
(gdb) FAIL: gdb.base/bitfields.exp: continuing to break2 (the program is no longer running)
print/x flags
$12 = {uc = 0x0, s1 = 0x0, u1 = 0x0, s2 = 0x0, u2 = 0x0, s3 = 0x0, u3 = 0x0, s9 = 0x0, u9 = 0x0, sc = 0x0}
(gdb) FAIL: gdb.base/bitfields.exp: bitfield containment #2
delete breakpoints
Delete all breakpoints? (y or n) y
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) delete breakpoints
(gdb) info breakpoints
No breakpoints or watchpoints.
(gdb) break break3
Breakpoint 3 at 0x8604: file .../gdb/testsuite/gdb.base/bitfields.c, line 52.
(gdb) entering gdb_reload
target remote localhost:1236
Remote debugging using localhost:1236
Reading symbols from .../lib/ld-linux.so.3...done.
Loaded symbols for .../lib/ld-linux.so.3
0x41001b80 in _start () from .../lib/ld-linux.so.3
(gdb) continue
Continuing.
Breakpoint 3, break3 () at .../gdb/testsuite/gdb.base/bitfields.c:52
52 }
(gdb) print flags
$13 = {uc = 0 '\000', s1 = 0, u1 = 1, s2 = 0, u2 = 3, s3 = 0, u3 = 7, s9 = 0, u9 = 511, sc = 0 '\000'}
(gdb) PASS: gdb.base/bitfields.exp: unsigned bitfield ranges
gdb/
2013-12-02 Pedro Alves <pedro@codesourcery.com>
Maciej W. Rozycki <macro@codesourcery.com>
* remote.c (putpkt_for_catch_errors): Remove function.
(remote_kill): Handle TARGET_CLOSE_ERROR from the kill packet
gracefully.
In remote-notif.c:handle_notification, we have a loop,
for (i = 0; i < ARRAY_SIZE (notifs); i++)
{
nc = notifs[i];
if (strncmp (buf, nc->name, strlen (nc->name)) == 0
&& buf[strlen (nc->name)] == ':')
break;
}
/* We ignore notifications we don't recognize, for compatibility
with newer stubs. */
if (nc == NULL)
return;
If the notification is not in the list 'notifs', the last entry is
used, which is wrong. It should be NULL. This patch fixes it.
gdb:
2013-12-02 Pedro Alves <palves@redhat.com>
PR remote/15974
* remote-notif.c (handle_notification): Return early if no
notification is found.
Not all systems supporting getrlimit also support RLIMIT_NOFILE
(Eg. All LynxOS systems appear to be lacking support for this).
So check its existance before using it.
gdb/ChangeLog:
* common/filestuff.c (fdwalk): Add "defined(RLIMIT_NOFILE)"
preprocessor check.
Simplify handling of auto-loaded objfile scripts.
.debug_gdb_scripts was always intended to handle more than just python,
thus the rightful home for the code that processes it is not in py-foo.c.
This is just a cleanup to move the code to a better place.
This also simplifies the handling of the ${objfile}-${suffix} auto-loaded
scripts. There's no need for each of the the handlers to do is-safe-to-load
checking, or call maybe_add_script. Doing it in the caller removes the
duplication.
* auto-load.h (script_language): New members name, auto_load_enabled.
Add missing comments on struct members.
(auto_load_objfile_script): Delete.
* auto-load.c: #include "cli/cli-cmds.h".
(auto_load_gdb_scripts_enabled): New function.
(script_language_gdb): Update, add new members.
(source_gdb_script_for_objfile): Simplify, auto-load safe-checking
and call to maybe_add_script moved to caller.
(auto_load_objfile_script_1): Auto-load safe-checking and
call to maybe_add_script moved here.
(auto_load_objfile_script): Make static. Early exit if support for
scripting language hasn't been compiled in, or auto-loading has been
disabled.
(source_section_scripts): Argument "source_name" renamed to
"section_name". All uses updated. Replace uses of AUTO_SECTION_NAME
with section_name. Skip loading script if support for scripting
language hasn't been compiled in, or auto-loading has been disabled.
Call language->source_script_for_objfile instead of calling
source_python_script_for_objfile directly.
(load_auto_scripts_for_objfile): Update.
* python/py-auto-load.c: Delete #include "cli/cli-cmds.h".
(gdbpy_load_auto_script_for_objfile): Delete.
(auto_load_python_scripts_enabled): New function.
(script_language_python): Update, add new members.
(gdbpy_script_language_defn): New function.
* python/python.h (gdbpy_load_auto_scripts_for_objfile): Delete.
(gdbpy_script_language_defn): Declare.
* auto-load.c (AUTO_SECTION_NAME): Moved here and renamed from
py-auto-load.c, GDBPY_AUTO_SECTION_NAME.
(source_section_scripts): Moved here from py-auto-load.c.
(auto_load_section_scripts): Ditto.
* python/py-auto-load.c (GDBPY_AUTO_SECTION_NAME): Moved to
auto-load.c, renamed AUTO_SECTION_NAME.
(source_section_scripts, auto_load_section_scripts): Moved to
auto-load.c.
This commit removes the "#include gdb_string.h" from gdbarch.sh, fixing
a small nit caused by Tom's commit
0e9f083f4c.
Checked-in as obvious.
2013-11-29 Sergio Durigan Junior <sergiodj@redhat.com>
* gdbarch.sh: Remove include of "gdb_string.h", replace by
<string.h>.
Unfortunately, UNWIND_NULL_ID is exported to Python as
gdb.FRAME_UNWIND_NULL_ID so we can't really eliminate it.
(I'd assume scripts just check the result of Frame.unwind_stop_reason,
and compare it to gdb.FRAME_UNWIND_NO_REASON. That at most, they'll
pass the result of Frame.unwind_stop_reason to
gdb.frame_stop_reason_string. I'd prefer to just get rid of it, but
because we make an API promise, we get to keep this around for
compatibility, in case a script does refer to gdb.FRAME_UNWIND_NULL_ID
directly.)
gdb/
2013-11-29 Pedro Alves <palves@redhat.com>
* unwind_stop_reasons.def (UNWIND_NULL_ID): Update comment.
gdb/doc/
2013-11-29 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Frames In Python) <gdb.FRAME_UNWIND_NULL_ID>:
Update comment.
The memory management of bp_location->target_info.conditions|tcommands
is currently a little fragile. If the target reports support for
target conditions or commands, and then target side breakpoint support
is disabled, or some error is thrown before remote_add_target_side_XXX
is called, we'll leak these lists. This patch makes us free these
lists when the locations are deleted, and also, just before recreating
the commands|conditions lists.
Tested on x86_64 Fedora 17, native and gdbserver.
gdb/
2013-11-29 Pedro Alves <palves@redhat.com>
* breakpoint.c (build_target_condition_list): Release previous
conditions.
(build_target_command_list): Release previous commands.
(bp_location_dtor): Release target conditions and commands.
* remote.c (remote_add_target_side_condition): Don't release
conditions.
(remote_add_target_side_commands): Don't release commands.
GDB on x86_64-linux is unable to disassemble on core-file target.
$ ./gdb ./testsuite/gdb.base/corefile
(gdb) core-file ./testsuite/gdb.base/corefile.core
(gdb) disassemble main
Dump of assembler code for function main:
0x0000000000400976 <+0>: Cannot access memory at address 0x400976
However, it works if we turn code-cache off.
(gdb) set code-cache off
(gdb) disassemble main,+4
Dump of assembler code from 0x400976 to 0x40097a:
0x0000000000400976 <main+0>: push %rbp
0x0000000000400977 <main+1>: mov %rsp,%rbp
End of assembler dump.
When code-cache is off, GDB will iterate target_ops from top to bottom
and call to_xfer_partial. When current_target is "core", it will call
to_xfer_partial of target "exec", which reads the contents for
disassemble. However, dcache uses TARGET_OBJECT_RAW_MEMORY to read,
but target_xfer_partial doesn't delegate requests to beneath for
TARGET_OBJECT_RAW_MEMORY.
This patch factors out the iteration from top to bottom to a new
function, raw_memory_xfer_partial, and use it for
TARGET_OBJECT_RAW_MEMORY.
Regression tested on x86_64-linux.
gdb:
2013-11-29 Yao Qi <yao@codesourcery.com>
Pedro Alves <palves@redhat.com>
* dcache.c (dcache_read_line): Use current_target.beneath
instead of ¤t_target.
* target.c (memory_xfer_partial_1): Factor code out to ...
(raw_memory_xfer_partial): ... it. New function.
(target_xfer_partial): Call raw_memory_xfer_partial if OBJECT
is TARGET_OBJECT_RAW_MEMORY.
* breakpoint.h (gdbpy_breakpoint_object): Renamed from
breakpoint_object. All uses updated.
* python/python-internal.h (gdbpy_breakpoint_object): Renamed from
breakpoint_object. All uses updated.
* python.c (*): All uses of breakpoint_object updated.
* python.h (*): All uses of breakpoint_object updated.
* python/py-breakpoint.c (*): All uses of breakpoint_object updated.
* python/py-finishbreakpoint.c (*): Ditto.
When printing an entirely optimized out structure/class/union, we
print a single <optimized out> instead of printing <optimized out> for
each field.
This patch makes an entirely unavailable structure/class/union be
likewise displayed with a single "<unavailable>" rather than the whole
object with all fields <unavailable>.
This seems good because this way the user can quickly tell whether the
whole value is unavailable, rather than having to skim all fields.
Consistency with optimized out values also seems to be a good thing to
have.
A few updates to gdb.trace/unavailable.exp where required.
Tested on x86_64 Fedora 17, native gdbserver.
gdb/
2013-11-28 Andrew Burgess <aburgess@broadcom.com>
Pedro Alves <palves@redhat.com>
* valprint.c (value_check_printable): If the value is entirely
unavailable, print a single "<unavailable>" instead of printing
all subfields.
gdb/testsuite/
2013-11-28 Andrew Burgess <aburgess@broadcom.com>
* gdb.trace/unavailable.exp (gdb_collect_args_test): Update
expected results.
(gdb_collect_locals_test): Likewise.
(gdb_collect_globals_test): Likewise.
The stop_reason != UNWIND_NO_REASON doesn't currently have "set debug
frame" output. This patch makes it print the stop_reason enum value
as a string.
gdb/
2013-11-28 Pedro Alves <palves@redhat.com>
* frame.c (get_prev_frame_1) <stop_reason != UNWIND_NO_REASON>:
Add "set debug frame" output.
(frame_stop_reason_symbol_string): New function.
After the previous patch, it should be clear that the
this_frame->unwind->stop_reason check is redundant with the
outer_frame_id check just below. We can now move the frame_id_eq
comparison to the default this_frame->unwind->stop_reason callback.
Tested on x86_64 Fedora 17.
gdb/
2013-11-28 Pedro Alves <palves@redhat.com>
* frame-unwind.c (default_frame_unwind_stop_reason): Return
UNWIND_OUTERMOST if the frame's ID is outer_frame_id.
* frame.c (get_prev_frame_1): Remove outer_frame_id check.
- The UNWIND_NULL_ID check in get_prev_frame_1 used to really be
against null_frame_id, back before we had outer_frame_id. We didn't
have UNWIND_OUTERMOST when outer_frame_id was added, but we do now,
and it's more accurate.
- It used to be necessary to check for the sentinel frame explicitly
because that uses null_frame_id for frame id. Since no other frame
can have that id nowadays (it's asserted by compute_frame_id), we
don't need that explicit check.
Tested on x86_64 Fedora 17.
gdb/
2013-11-28 Pedro Alves <palves@redhat.com>
* frame.c (get_prev_frame_1): If the frame id is outer_frame_id,
set the unwind stop reason to UNWIND_OUTERMOST, not
UNWIND_NULL_ID. Remove explicit check for sentinel frame.
Another spot that missed the previous related text adjustments.
Tested on x86_64 Fedora 17.
gdb/
2013-11-28 Pedro Alves <palves@redhat.com>
* frame.c (frame_unwind_register): Say the register was "not
saved" instead of "optimized out".
This patch adds a test case to test the performance of GDB doing
disassembly.
gdb/testsuite/
2013-11-28 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (with_gdb_prompt): New proc.
* gdb.perf/disassemble.exp: New.
* gdb.perf/disassemble.py: New.
Avoid false positives if the search pattern "lose" is found in path
descriptions in comments generated by the preprocessor.
See <https://sourceware.org/bugzilla/show_bug.cgi?id=16152>.
gdb/
2013-11-27 Steffen Sledz <sledz@dresearch-fe.de>
* configure.ac: Tighten Cygwin detection check.
* configure: Rebuild.
value_of_register_lazy uses the type of REGNUM in FRAME, but given
multi-arch, the arch of FRAME might be different from the previous
frame's arch, and therefore the type of register REGNUM should be
retrieved from the unwound arch. This used to be correct before the
previous change.
Tested on x86_64 Fedora 17.
gdb/
2013-11-27 Pedro Alves <palves@redhat.com>
* frame-unwind.c (frame_unwind_got_optimized): Use the type of the
register in the previous frame's arch.
"set debug frame 1" is printing "<optimized out>" for not saved
registers. That's because the unwinders are returning optimized out
not_lval values instead of optimized out lval_register values. "<not
saved>" is how val_print_optimized_out prints lval_register values.
...
- { frame_unwind_register_value (frame=0,regnum=7(rsp),...) -> <optimized out> }
+ { frame_unwind_register_value (frame=0,regnum=7(rsp),...) -> <not saved> }
...
Tested on x86_64 Fedora 17.
2013-11-27 Pedro Alves <palves@redhat.com>
* frame-unwind.c (frame_unwind_got_optimized): Return
an lval_register value instead of a not_lval value.
If a value is entirely optimized out, then there's nothing for
value_fetch_lazy to fetch. Sequences like:
if (value_lazy (retval))
value_fetch_lazy (retval);
End up allocating the value contents buffer, wasting memory, for no
use.
gdb/ChangeLog
2013-11-26 Andrew Burgess <aburgess@broadcom.com>
* value.c (allocate_optimized_out_value): Mark value as non-lazy.
This reverts da2b2fdf57 and some
follow-up patches. They were incorrect.
2013-11-26 Tom Tromey <tromey@redhat.com>
* dwarf2-frame.c (dwarf2_frame_cache): Revert patch from
2013-11-22.
2013-11-26 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/dw2-unspecified-ret-addr.S: Remove.
* gdb.dwarf2/dw2-unspecified-ret-addr.c: Remove.
* gdb.dwarf2/dw2-unspecified-ret-addr.exp: Remove.
The MPX patch has broken the I386_XSTATE_SIZE macro. For AVX machines,
it ends up returning I386_XSTATE_SSE_SIZE. Where it first reads
I386_XSTATE_AVX_SIZE, it should have read I386_XSTATE_AVX:
#define I386_XSTATE_SIZE(XCR0) \
(((XCR0) & I386_XSTATE_BNDCFG) != 0 ? I386_XSTATE_BNDCFG_SIZE \
: (((XCR0) & I386_XSTATE_BNDREGS) != 0 ? I386_XSTATE_BNDCFG_SIZE \
- : (((XCR0) & I386_XSTATE_AVX_SIZE) != 0 ? I386_XSTATE_AVX_SIZE \
+ : (((XCR0) & I386_XSTATE_AVX) != 0 ? I386_XSTATE_AVX_SIZE \
: I386_XSTATE_SSE_SIZE)))
The patch goes a step further and improves readability of the macro,
by adding a couple other auxiliary macros.
2013-11-26 Walfred Tedeschi <walfred.tedeschi@intel.com>
* i386-xstate.h (I386_XSTATE_MPX): New Macro.
(I386_XSTATE_MPX_MASK): Makes use of I386_XSTATE_MPX.
(HAS_MPX): New macro.
(HAS_AVX): New macro.
(I386_XSTATE_SIZE): Uses HAS_MPX and HAS_AVX.
This patch teaches "disassembly" use code cache mechanism to read
target code.
gdb:
2013-11-24 Yao Qi <yao@codesourcery.com>
* disasm.c (dis_asm_read_memory): Call target_read_code
instead of target_read_memory.
Similar to stack cache, in this patch, we add
TARGET_OBJECT_CODE_MEMORY to read code from target and add a new
option "set code-cache on|off" to optimize code accesses by
using the target memory cache.
In V4:
- Remove "without affecting correctness" from NEWS and doc.
- Replace "ON" with "on" in doc.
- "access" -> "accesses".
In V3:
- Rename functions and variables.
- Update command help, doc and NEWS entry.
- Invalidate cache on option transitions, to align with
the behaviour of "stack-cache". Since cache invalidation is
transparent to users, users don't know option "stack-cache"
transitions cause code cache invalidation.
V2 was reviewed by Doug. There are some changes in V3, so I post it
here.
gdb:
2013-11-24 Yao Qi <yao@codesourcery.com>
* NEWS: Add note on new "set code-cache" option.
* target-dcache.c (code_cache_enabled_1): New variable.
(code_cache_enabled): New variable.
(show_code_cache, set_code_cache): New function.
(code_cache_enabled_p): New function.
(_initialize_target_dcache): Register command.
* target-dcache.h (code_cache_enabled_p): Declare.
* target.c (memory_xfer_partial_1):Handle
TARGET_OBJECT_CODE_MEMORY and code_cache_enabled.
(target_read_code): New function.
* target.h (enum target_object) <TARGET_OBJECT_CODE_MEMORY>:
New.
(target_read_code): Declare.
gdb/doc:
2013-11-24 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Remote Data): Document new
"set/show stack-cache" option.
Hi,
This patch does some renamings on "stack-cache" related functions and
variables.
In the review to "code cache" series v2, we have some discussions on the
name of predicate function 'stack_cache_enabled', and have some options,
1 keep it unchanged, as it is already a predicate clearly,
2 rename it to stack_cache_enabled_p,
3 rename it to enable_stack_cache_p,
I choose #2, because 'stack_cache_enabled' is a predicate, but
it's better to add "_p" suffix to stress this. There are some other
similar patterns used in GDB source, such as unop_user_defined_p
and agent_loaded_p.
Then, I have to rename variable stack_cache_enabled_p to something
else. The option is "stack-cache", so I'd like to name the variable
associated with this command as "stack_cache". Similarly, the commands
associated with this command should be renamed to "set_stack_cache"
and "show_stack_cache" respectively.
gdb:
2013-11-24 Yao Qi <yao@codesourcery.com>
* target-dcache.c (stack_cache_enabled_p_1): Rename to ...
(stack_cache_enabled_1): ... this. New variable.
(stack_cache_enabled_p): Rename to ...
(stack_cache_enabled): ... this. New variable.
(set_stack_cache_enabled_p): Rename to ...
(set_stack_cache): ... this. Update caller.
(show_stack_cache_enabled_p): Rename to ...
(show_stack_cache): ... this. Update caller.
(stack_cache_enabled): Rename to ...
(stack_cache_enabled_p): ... this. Update caller.
(_initialize_target_dcache): Replace "data cache" with
"target memory cache".
* target-dcache.h (stack_cache_enabled): Remove declaration.
(stack_cache_enabled_p): Add declaration.
gdb/doc:
2013-11-24 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Replace "ON" with "on".
(Maintenance Commands): Replace "ON" and "OFF" with "on" and
"off" respectively.
* gdb.python/py-value.exp (test_lazy_strings): Tweak test names.
(test_subscript_regression): Ditto.
(top level): Run test_subscript_regression for c++ with "c++" prefix.
* cli/cli-script.c (multi_line_command_p): New function.
(recurse_read_control_structure, read_command_lines_1): Call it.
(execute_control_command): Consistently have a blank line between
each case.
Hi,
When using command -var-list-children, "displayhint" appears in the result of
each child, shown as the following output.
-var-list-children ss1 ^M
^done,numchild="2",displayhint="pp_ss",children=[child={name="ss1.a",exp="a",numchild="0",type="struct s",thread-id="1",displayhint="pp_s",dynamic="1"},child={name="ss1.b",exp="b",numchild="0",type="struct s",thread-id="1",displayhint="pp_s",dynamic="1"}],has_more="0"
Current doc on command -var-list-children doesn't reflect this. This
patch is to fix it.
gdb/doc:
2013-11-23 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Add the description
of "displayhint" to the table about child results.
PR gdb/16196:
* valprint.c (read_string): Set new variable fetchlen based on
fetchlimit and size. Use it in call to partial_memory_read.
Update comment.
PR gdb/16196:
* valprint.c (read_string): Set new variable fetchlen based on
fetchlimit and size. Use it in call to partial_memory_read.
Update comment.
Pedro asked me to add a comment to dw2-bad-cfi.S explaining the nature
of the badness.
I'm checking this in.
2013-11-22 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/dw2-bad-cfi.S: Update comment.
Debugging PR 16155 further, I found that the DWARF unwinder found the
function in question, but thought it had no registers saved
(fs->regs.num_regs == 0).
It seems to me that if a frame does not specify the return address
column, or if the return address column is explicitly marked as
DWARF2_FRAME_REG_UNSPECIFIED, then we should set the
"undefined_retaddr" flag and let the DWARF unwinder gracefully stop.
This patch implements that idea.
With this patch the backtrace works properly:
(gdb) bt
#0 0x0000007fb7ed485c in nanosleep () from /lib64/libc.so.6
#1 0x0000007fb7ed4508 in sleep () from /lib64/libc.so.6
#2 0x00000000004008bc in thread_function (arg=0x4) at threadapply.c:73
#3 0x0000007fb7fad950 in start_thread () from /lib64/libpthread.so.0
#4 0x0000007fb7f0956c in clone () from /lib64/libc.so.6
2013-11-22 Tom Tromey <tromey@redhat.com>
PR backtrace/16155:
* dwarf2-frame.c (dwarf2_frame_cache): Set undefined_retaddr if
the return address column is unspecified.
2013-11-22 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/dw2-bad-cfi.c: New file.
* gdb.dwarf2/dw2-bad-cfi.exp: New file.
* gdb.dwarf2/dw2-bad-cfi.S: New file.
If value_fetch_lazy loops infinitely while unwrapping lval_register
values, it means we either somehow ended up with two frames with the
same ID in the frame chain, or some code is trying to unwind behind
get_prev_frame's back (e.g., a frame unwind sniffer trying to unwind).
In any case, it should always be an internal error to end up in this
situation.
This patch adds a check and throws an internal error if the same frame
is returned.
2013-11-22 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
PR backtrace/16155
* value.c (value_fetch_lazy): Internal error if
get_frame_register_value returns the same register.
Given we already have the frame id stash, which holds the ids of all
frames in the chain, detecting corrupted stacks with wide stack cycles
with non-consecutive dup frame ids is just as cheap as just detecting
cycles in consecutive frames:
#0 frame_id1
#1 frame_id2
#2 frame_id3
#3 frame_id1
#4 frame_id2
#5 frame_id3
#6 frame_id1
... forever ...
We just need to check whether the stash already knows about a given
frame id instead of comparing the ids of the previous/this frames.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* frame.c (frame_stash_add): Now returns whether a frame with the
same ID was already known.
(compute_frame_id): New function, factored out from get_frame_id.
(get_frame_id): No longer lazilly compute the frame id here.
(get_prev_frame_if_no_cycle): New function. Detects wider stack
cycles.
(get_prev_frame_1): Use it instead of get_prev_frame_raw directly,
and checking for stack cycles here.
The UNWIND_SAME_ID check is done between THIS_FRAME and the next frame
when we go try to unwind the previous frame. But at this point, it's
already too late -- we ended up with two frames with the same ID in
the frame chain. Each frame having its own ID is an invariant assumed
throughout GDB. This patch applies the UNWIND_SAME_ID detection
earlier, right after the previous frame is unwound, discarding the dup
frame if a cycle is detected.
The patch includes a new test that fails before the change. Before
the patch, the test causes an infinite loop in GDB, after the patch,
the UNWIND_SAME_ID logic kicks in and makes the backtrace stop with:
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
The test uses dwarf CFI to emulate a corrupted stack with a cycle. It
has a function with registers marked DW_CFA_same_value (most
importantly RSP/RIP), so that GDB computes the same ID for that frame
and its caller. IOW, something like this:
#0 - frame_id_1
#1 - frame_id_2
#2 - frame_id_3
#3 - frame_id_4
#4 - frame_id_4 <<<< outermost (UNWIND_SAME_ID).
(The test's code is just a copy of dw2-reg-undefined.S /
dw2-reg-undefined.c, adjusted to use DW_CFA_same_value instead of
DW_CFA_undefined, and to mark a different set of registers.)
The infinite loop is here, in value_fetch_lazy:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
get_frame_register_value can return a lazy register value pointing to
the next frame. This means that the register wasn't clobbered by
FRAME; the debugger should therefore retrieve its value from the next
frame.
To be clear, get_frame_register_value unwinds the value in question
from the next frame:
struct value *
get_frame_register_value (struct frame_info *frame, int regnum)
{
return frame_unwind_register_value (frame->next, regnum);
^^^^^^^^^^^
}
In other words, if we get a lazy lval_register, it should have the
frame ID of the _next_ frame, never of FRAME.
At this point in value_fetch_lazy, the whole relevant chunk of the
stack up to frame #4 has already been unwound. The loop always
"unlazies" lval_registers in the "next/innermost" direction, not in
the "prev/unwind further/outermost" direction.
So say we're looking at frame #4. get_frame_register_value in frame
#4 can return a lazy register value of frame #3. So the next
iteration, frame_find_by_id tries to read the register from frame #3.
But, since frame #4 happens to have same id as frame #3,
frame_find_by_id returns frame #4 instead. Rinse, repeat, and we have
an infinite loop.
This is an old latent problem, exposed by the recent addition of the
frame stash. Before we had a stash, frame_find_by_id(frame_id_4)
would walk over all frames starting at the current frame, and would
always find #3 first. The stash happens to return #4 instead:
struct frame_info *
frame_find_by_id (struct frame_id id)
{
struct frame_info *frame, *prev_frame;
...
/* Try using the frame stash first. Finding it there removes the need
to perform the search by looping over all frames, which can be very
CPU-intensive if the number of frames is very high (the loop is O(n)
and get_prev_frame performs a series of checks that are relatively
expensive). This optimization is particularly useful when this function
is called from another function (such as value_fetch_lazy, case
VALUE_LVAL (val) == lval_register) which already loops over all frames,
making the overall behavior O(n^2). */
frame = frame_stash_find (id);
if (frame)
return frame;
for (frame = get_current_frame (); ; frame = prev_frame)
{
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* frame.c (get_prev_frame_1): Do the UNWIND_SAME_ID check between
this frame and the new previous frame, not between this frame and
the next frame.
gdb/testsuite/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* gdb.dwarf2/dw2-dup-frame.S: New file.
* gdb.dwarf2/dw2-dup-frame.c: New file.
* gdb.dwarf2/dw2-dup-frame.exp: New file.
Two rationales, same patch.
TL;DR 1:
dwarf2_frame_cache recursion is evil. dwarf2_frame_cache calls
dwarf2_tailcall_sniffer_first which then recurses into
dwarf2_frame_cache.
TL;DR 2:
An unwinder trying to unwind is evil. dwarf2_frame_sniffer calls
dwarf2_frame_cache which calls dwarf2_tailcall_sniffer_first which
then tries to unwind the PC of the previous frame.
Avoid all that by deferring dwarf2_tailcall_sniffer_first until it's
really necessary.
Rationale 1
===========
A frame sniffer should not try to unwind, because that bypasses all
the validation checks done by get_prev_frame. The UNWIND_SAME_ID
scenario is one such case where GDB is currently broken because (in
part) of this (the next patch adds a test that would fail without
this).
GDB goes into an infinite loop in value_fetch_lazy, here:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
(top-gdb) bt
#0 value_fetch_lazy (val=0x11516d0) at ../../src/gdb/value.c:3510
#1 0x0000000000584bd8 in value_optimized_out (value=0x11516d0) at ../../src/gdb/value.c:1096
#2 0x00000000006fe7a1 in frame_register_unwind (frame=0x1492600, regnum=16, optimizedp=0x7fffffffcdec, unavailablep=0x7fffffffcde8, lvalp=0x7fffffffcdd8, addrp=
0x7fffffffcde0, realnump=0x7fffffffcddc, bufferp=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:940
#3 0x00000000006fea3a in frame_unwind_register (frame=0x1492600, regnum=16, buf=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:990
#4 0x0000000000473b9b in i386_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/i386-tdep.c:1771
#5 0x0000000000601dfa in gdbarch_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/gdbarch.c:2870
#6 0x0000000000693db5 in dwarf2_tailcall_sniffer_first (this_frame=0x1492600, tailcall_cachep=0x14926f0, entry_cfa_sp_offsetp=0x7fffffffcf00)
at ../../src/gdb/dwarf2-frame-tailcall.c:389
#7 0x0000000000690928 in dwarf2_frame_cache (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1245
#8 0x0000000000690f46 in dwarf2_frame_sniffer (self=0x8e4980, this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1423
#9 0x000000000070203b in frame_unwind_find_by_frame (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/frame-unwind.c:112
#10 0x00000000006fd681 in get_frame_id (fi=0x1492600) at ../../src/gdb/frame.c:408
#11 0x00000000007006c2 in get_prev_frame_1 (this_frame=0xdc1860) at ../../src/gdb/frame.c:1826
#12 0x0000000000700b7a in get_prev_frame (this_frame=0xdc1860) at ../../src/gdb/frame.c:2056
#13 0x0000000000514588 in frame_info_to_frame_object (frame=0xdc1860) at ../../src/gdb/python/py-frame.c:322
#14 0x000000000051784c in bootstrap_python_frame_filters (frame=0xdc1860, frame_low=0, frame_high=-1) at ../../src/gdb/python/py-framefilter.c:1396
#15 0x0000000000517a6f in apply_frame_filter (frame=0xdc1860, flags=7, args_type=CLI_SCALAR_VALUES, out=0xed7a90, frame_low=0, frame_high=-1)
at ../../src/gdb/python/py-framefilter.c:1492
#16 0x00000000005e77b0 in backtrace_command_1 (count_exp=0x0, show_locals=0, no_filters=0, from_tty=1) at ../../src/gdb/stack.c:1777
#17 0x00000000005e7c0f in backtrace_command (arg=0x0, from_tty=1) at ../../src/gdb/stack.c:1891
#18 0x00000000004e37a7 in do_cfunc (c=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:107
#19 0x00000000004e683c in cmd_func (cmd=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:1882
#20 0x00000000006f35ed in execute_command (p=0xcc66c2 "", from_tty=1) at ../../src/gdb/top.c:468
#21 0x00000000005f8853 in command_handler (command=0xcc66c0 "bt") at ../../src/gdb/event-top.c:435
#22 0x00000000005f8e12 in command_line_handler (rl=0xfe05f0 "@") at ../../src/gdb/event-top.c:632
#23 0x000000000074d2c6 in rl_callback_read_char () at ../../src/readline/callback.c:220
#24 0x00000000005f8375 in rl_callback_read_char_wrapper (client_data=0x0) at ../../src/gdb/event-top.c:164
#25 0x00000000005f876a in stdin_event_handler (error=0, client_data=0x0) at ../../src/gdb/event-top.c:375
#26 0x00000000005f72fa in handle_file_event (data=...) at ../../src/gdb/event-loop.c:768
#27 0x00000000005f67a3 in process_event () at ../../src/gdb/event-loop.c:342
#28 0x00000000005f686a in gdb_do_one_event () at ../../src/gdb/event-loop.c:406
#29 0x00000000005f68bb in start_event_loop () at ../../src/gdb/event-loop.c:431
#30 0x00000000005f83a7 in cli_command_loop (data=0x0) at ../../src/gdb/event-top.c:179
#31 0x00000000005eeed3 in current_interp_command_loop () at ../../src/gdb/interps.c:327
#32 0x00000000005ef8ff in captured_command_loop (data=0x0) at ../../src/gdb/main.c:267
#33 0x00000000005ed2f6 in catch_errors (func=0x5ef8e4 <captured_command_loop>, func_args=0x0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#34 0x00000000005f0d21 in captured_main (data=0x7fffffffd9e0) at ../../src/gdb/main.c:1067
#35 0x00000000005ed2f6 in catch_errors (func=0x5efb9b <captured_main>, func_args=0x7fffffffd9e0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#36 0x00000000005f0d57 in gdb_main (args=0x7fffffffd9e0) at ../../src/gdb/main.c:1076
#37 0x000000000045bb6a in main (argc=4, argv=0x7fffffffdae8) at ../../src/gdb/gdb.c:34
(top-gdb)
GDB is trying to unwind the PC register of the previous frame (frame
#5 above), starting from the frame being sniffed (the THIS frame).
But the THIS frame's unwinder says the PC of the previous frame is
actually the same as the previous's frame's next frame (which is the
same frame we started with, the THIS frame), therefore it returns an
lval_register lazy value with frame set to THIS frame. And so the
value_fetch_lazy loop never ends.
Rationale 2
===========
As an experiment, I tried making dwarf2-frame.c:read_addr_from_reg use
address_from_register. That caused a bunch of regressions, but it
actually took me a long while to figure out what was going on. Turns
out dwarf2-frame.c:read_addr_from_reg is called while computing the
frame's CFA, from within dwarf2_frame_cache. address_from_register
wants to create a register with frame_id set to the frame being
constructed. To create the frame id, we again call dwarf2_frame_cache,
which given:
static struct dwarf2_frame_cache *
dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
{
...
if (*this_cache)
return *this_cache;
returns an incomplete object to the caller:
static void
dwarf2_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
struct dwarf2_frame_cache *cache =
dwarf2_frame_cache (this_frame, this_cache);
...
(*this_id) = frame_id_build (cache->cfa, get_frame_func (this_frame));
}
As cache->cfa is still 0 (we were trying to compute it!), and
get_frame_id recalls this id from here on, we end up with a broken
frame id in recorded for this frame. Later, when inspecting locals,
the dwarf machinery needs to know the selected frame's base, which
calls get_frame_base:
CORE_ADDR
get_frame_base (struct frame_info *fi)
{
return get_frame_id (fi).stack_addr;
}
which as seen above then returns 0 ...
So I gave up using address_from_register.
But, the pain of investigating this made me want to have GDB itself
assert that recursion never happens here. So I wrote a patch to do
that. But, it triggers on current mainline, because
dwarf2_tailcall_sniffer_first, called from dwarf2_frame_cache, unwinds
the this_frame.
A sniffer shouldn't be trying to unwind, exactly because of this sort
of tricky issue. The patch defers calling
dwarf2_tailcall_sniffer_first until it's really necessary, in
dwarf2_frame_prev_register (thus actually outside the sniffer path).
As this makes the call to dwarf2_frame_sniffer in dwarf2_frame_cache
unnecessary again, the patch removes that too.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* dwarf2-frame.c (struct dwarf2_frame_cache)
<checked_tailcall_bottom, entry_cfa_sp_offset,
entry_cfa_sp_offset_p>: New fields.
(dwarf2_frame_cache): Adjust to use the new cache fields instead
of locals. Don't call dwarf2_tailcall_sniffer_first here.
(dwarf2_frame_prev_register): Call it here, but only once.
Two rationales, same patch.
TL;DR 1:
dwarf2_frame_cache recursion is evil. dwarf2_frame_cache calls
dwarf2_tailcall_sniffer_first which then recurses into
dwarf2_frame_cache.
TL;DR 2:
An unwinder trying to unwind is evil. dwarf2_frame_sniffer calls
dwarf2_frame_cache which calls dwarf2_tailcall_sniffer_first which
then tries to unwind the PC of the previous frame.
Avoid all that by deferring dwarf2_tailcall_sniffer_first until it's
really necessary.
Rationale 1
===========
A frame sniffer should not try to unwind, because that bypasses all
the validation checks done by get_prev_frame. The UNWIND_SAME_ID
scenario is one such case where GDB is currently broken because (in
part) of this (the next patch adds a test that would fail without
this).
GDB goes into an infinite loop in value_fetch_lazy, here:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
(top-gdb) bt
#0 value_fetch_lazy (val=0x11516d0) at ../../src/gdb/value.c:3510
#1 0x0000000000584bd8 in value_optimized_out (value=0x11516d0) at ../../src/gdb/value.c:1096
#2 0x00000000006fe7a1 in frame_register_unwind (frame=0x1492600, regnum=16, optimizedp=0x7fffffffcdec, unavailablep=0x7fffffffcde8, lvalp=0x7fffffffcdd8, addrp=
0x7fffffffcde0, realnump=0x7fffffffcddc, bufferp=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:940
#3 0x00000000006fea3a in frame_unwind_register (frame=0x1492600, regnum=16, buf=0x7fffffffce10 "@\316\377\377\377\177") at ../../src/gdb/frame.c:990
#4 0x0000000000473b9b in i386_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/i386-tdep.c:1771
#5 0x0000000000601dfa in gdbarch_unwind_pc (gdbarch=0xf54660, next_frame=0x1492600) at ../../src/gdb/gdbarch.c:2870
#6 0x0000000000693db5 in dwarf2_tailcall_sniffer_first (this_frame=0x1492600, tailcall_cachep=0x14926f0, entry_cfa_sp_offsetp=0x7fffffffcf00)
at ../../src/gdb/dwarf2-frame-tailcall.c:389
#7 0x0000000000690928 in dwarf2_frame_cache (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1245
#8 0x0000000000690f46 in dwarf2_frame_sniffer (self=0x8e4980, this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/dwarf2-frame.c:1423
#9 0x000000000070203b in frame_unwind_find_by_frame (this_frame=0x1492600, this_cache=0x1492618) at ../../src/gdb/frame-unwind.c:112
#10 0x00000000006fd681 in get_frame_id (fi=0x1492600) at ../../src/gdb/frame.c:408
#11 0x00000000007006c2 in get_prev_frame_1 (this_frame=0xdc1860) at ../../src/gdb/frame.c:1826
#12 0x0000000000700b7a in get_prev_frame (this_frame=0xdc1860) at ../../src/gdb/frame.c:2056
#13 0x0000000000514588 in frame_info_to_frame_object (frame=0xdc1860) at ../../src/gdb/python/py-frame.c:322
#14 0x000000000051784c in bootstrap_python_frame_filters (frame=0xdc1860, frame_low=0, frame_high=-1) at ../../src/gdb/python/py-framefilter.c:1396
#15 0x0000000000517a6f in apply_frame_filter (frame=0xdc1860, flags=7, args_type=CLI_SCALAR_VALUES, out=0xed7a90, frame_low=0, frame_high=-1)
at ../../src/gdb/python/py-framefilter.c:1492
#16 0x00000000005e77b0 in backtrace_command_1 (count_exp=0x0, show_locals=0, no_filters=0, from_tty=1) at ../../src/gdb/stack.c:1777
#17 0x00000000005e7c0f in backtrace_command (arg=0x0, from_tty=1) at ../../src/gdb/stack.c:1891
#18 0x00000000004e37a7 in do_cfunc (c=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:107
#19 0x00000000004e683c in cmd_func (cmd=0xda4fa0, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:1882
#20 0x00000000006f35ed in execute_command (p=0xcc66c2 "", from_tty=1) at ../../src/gdb/top.c:468
#21 0x00000000005f8853 in command_handler (command=0xcc66c0 "bt") at ../../src/gdb/event-top.c:435
#22 0x00000000005f8e12 in command_line_handler (rl=0xfe05f0 "@") at ../../src/gdb/event-top.c:632
#23 0x000000000074d2c6 in rl_callback_read_char () at ../../src/readline/callback.c:220
#24 0x00000000005f8375 in rl_callback_read_char_wrapper (client_data=0x0) at ../../src/gdb/event-top.c:164
#25 0x00000000005f876a in stdin_event_handler (error=0, client_data=0x0) at ../../src/gdb/event-top.c:375
#26 0x00000000005f72fa in handle_file_event (data=...) at ../../src/gdb/event-loop.c:768
#27 0x00000000005f67a3 in process_event () at ../../src/gdb/event-loop.c:342
#28 0x00000000005f686a in gdb_do_one_event () at ../../src/gdb/event-loop.c:406
#29 0x00000000005f68bb in start_event_loop () at ../../src/gdb/event-loop.c:431
#30 0x00000000005f83a7 in cli_command_loop (data=0x0) at ../../src/gdb/event-top.c:179
#31 0x00000000005eeed3 in current_interp_command_loop () at ../../src/gdb/interps.c:327
#32 0x00000000005ef8ff in captured_command_loop (data=0x0) at ../../src/gdb/main.c:267
#33 0x00000000005ed2f6 in catch_errors (func=0x5ef8e4 <captured_command_loop>, func_args=0x0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#34 0x00000000005f0d21 in captured_main (data=0x7fffffffd9e0) at ../../src/gdb/main.c:1067
#35 0x00000000005ed2f6 in catch_errors (func=0x5efb9b <captured_main>, func_args=0x7fffffffd9e0, errstring=0x8b6554 "", mask=RETURN_MASK_ALL)
at ../../src/gdb/exceptions.c:524
#36 0x00000000005f0d57 in gdb_main (args=0x7fffffffd9e0) at ../../src/gdb/main.c:1076
#37 0x000000000045bb6a in main (argc=4, argv=0x7fffffffdae8) at ../../src/gdb/gdb.c:34
(top-gdb)
GDB is trying to unwind the PC register of the previous frame (frame
#5 above), starting from the frame being sniffed (the THIS frame).
But the THIS frame's unwinder says the PC of the previous frame is
actually the same as the previous's frame's next frame (which is the
same frame we started with, the THIS frame), therefore it returns an
lval_register lazy value with frame set to THIS frame. And so the
value_fetch_lazy loop never ends.
Rationale 2
===========
As an experiment, I tried making dwarf2-frame.c:read_addr_from_reg use
address_from_register. That caused a bunch of regressions, but it
actually took me a long while to figure out what was going on. Turns
out dwarf2-frame.c:read_addr_from_reg is called while computing the
frame's CFA, from within dwarf2_frame_cache. address_from_register
wants to create a register with frame_id set to the frame being
constructed. To create the frame id, we again call dwarf2_frame_cache,
which given:
static struct dwarf2_frame_cache *
dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
{
...
if (*this_cache)
return *this_cache;
returns an incomplete object to the caller:
static void
dwarf2_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
struct dwarf2_frame_cache *cache =
dwarf2_frame_cache (this_frame, this_cache);
...
(*this_id) = frame_id_build (cache->cfa, get_frame_func (this_frame));
}
As cache->cfa is still 0 (we were trying to compute it!), and
get_frame_id recalls this id from here on, we end up with a broken
frame id in recorded for this frame. Later, when inspecting locals,
the dwarf machinery needs to know the selected frame's base, which
calls get_frame_base:
CORE_ADDR
get_frame_base (struct frame_info *fi)
{
return get_frame_id (fi).stack_addr;
}
which as seen above then returns 0 ...
So I gave up using address_from_register.
But, the pain of investigating this made me want to have GDB itself
assert that recursion never happens here. So I wrote a patch to do
that. But, it triggers on current mainline, because
dwarf2_tailcall_sniffer_first, called from dwarf2_frame_cache, unwinds
the this_frame.
A sniffer shouldn't be trying to unwind, exactly because of this sort
of tricky issue. The patch defers calling
dwarf2_tailcall_sniffer_first until it's really necessary, in
dwarf2_frame_prev_register (thus actually outside the sniffer path).
As this makes the call to dwarf2_frame_sniffer in dwarf2_frame_cache
unnecessary again, the patch removes that too.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* dwarf2-frame.c (struct dwarf2_frame_cache)
<checked_tailcall_bottom, entry_cfa_sp_offset,
entry_cfa_sp_offset_p>: New fields.
(dwarf2_frame_cache): Adjust to use the new cache fields instead
of locals. Don't call dwarf2_tailcall_sniffer_first here.
(dwarf2_frame_prev_register): Call it here, but only once.
Tested on x86_64 Fedora 17.
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* frame.c (frame_stash_add): Now returns whether a frame with the
same ID was already known.
(compute_frame_id): New function, factored out from get_frame_id.
(get_frame_id): No longer lazilly compute the frame id here.
(get_prev_frame_if_no_cycle): New function. Detects wider stack
cycles.
(get_prev_frame_1): Use it instead of get_prev_frame_raw directly,
and checking for stack cycles here.
The UNWIND_SAME_ID check is done between THIS_FRAME and the next frame
when we go try to unwind the previous frame. But at this point, it's
already too late -- we ended up with two frames with the same ID in
the frame chain. Each frame having its own ID is an invariant assumed
throughout GDB. This patch applies the UNWIND_SAME_ID detection
earlier, right after the previous frame is unwound, discarding the dup
frame if a cycle is detected.
The patch includes a new test that fails before the change. Before
the patch, the test causes an infinite loop in GDB, after the patch,
the UNWIND_SAME_ID logic kicks in and makes the backtrace stop with:
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
The test uses dwarf CFI to emulate a corrupted stack with a cycle. It
has a function with registers marked DW_CFA_same_value (most
importantly RSP/RIP), so that GDB computes the same ID for that frame
and its caller. IOW, something like this:
#0 - frame_id_1
#1 - frame_id_2
#2 - frame_id_3
#3 - frame_id_4
#4 - frame_id_4 <<<< outermost (UNWIND_SAME_ID).
(The test's code is just a copy of dw2-reg-undefined.S /
dw2-reg-undefined.c, adjusted to use DW_CFA_same_value instead of
DW_CFA_undefined, and to mark a different set of registers.)
The infinite loop is here, in value_fetch_lazy:
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
frame = frame_find_by_id (VALUE_FRAME_ID (new_val));
...
new_val = get_frame_register_value (frame, regnum);
}
get_frame_register_value can return a lazy register value pointing to
the next frame. This means that the register wasn't clobbered by
FRAME; the debugger should therefore retrieve its value from the next
frame.
To be clear, get_frame_register_value unwinds the value in question
from the next frame:
struct value *
get_frame_register_value (struct frame_info *frame, int regnum)
{
return frame_unwind_register_value (frame->next, regnum);
^^^^^^^^^^^
}
In other words, if we get a lazy lval_register, it should have the
frame ID of the _next_ frame, never of FRAME.
At this point in value_fetch_lazy, the whole relevant chunk of the
stack up to frame #4 has already been unwound. The loop always
"unlazies" lval_registers in the "next/innermost" direction, not in
the "prev/unwind further/outermost" direction.
So say we're looking at frame #4. get_frame_register_value in frame
#4 can return a lazy register value of frame #3. So the next
iteration, frame_find_by_id tries to read the register from frame #3.
But, since frame #4 happens to have same id as frame #3,
frame_find_by_id returns frame #4 instead. Rinse, repeat, and we have
an infinite loop.
This is an old latent problem, exposed by the recent addition of the
frame stash. Before we had a stash, frame_find_by_id(frame_id_4)
would walk over all frames starting at the current frame, and would
always find #3 first. The stash happens to return #4 instead:
struct frame_info *
frame_find_by_id (struct frame_id id)
{
struct frame_info *frame, *prev_frame;
...
/* Try using the frame stash first. Finding it there removes the need
to perform the search by looping over all frames, which can be very
CPU-intensive if the number of frames is very high (the loop is O(n)
and get_prev_frame performs a series of checks that are relatively
expensive). This optimization is particularly useful when this function
is called from another function (such as value_fetch_lazy, case
VALUE_LVAL (val) == lval_register) which already loops over all frames,
making the overall behavior O(n^2). */
frame = frame_stash_find (id);
if (frame)
return frame;
for (frame = get_current_frame (); ; frame = prev_frame)
{
gdb/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* frame.c (get_prev_frame_1): Do the UNWIND_SAME_ID check between
this frame and the new previous frame, not between this frame and
the next frame.
gdb/testsuite/
2013-11-22 Pedro Alves <palves@redhat.com>
PR 16155
* gdb.dwarf2/dw2-dup-frame.S: New file.
* gdb.dwarf2/dw2-dup-frame.c: New file.
* gdb.dwarf2/dw2-dup-frame.exp: New file.
Hi,
I find "has_more" is not checked when a dynamic varobj is created in
proc mi_create_dynamic_varobj. This patch adds the check to
"has_more".
gdb/testsuite:
2013-11-22 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp (mi_create_dynamic_varobj): Update
comment and add one more argument "has_more".
* gdb.python/py-mi.exp: Callers update.
In gdb.python/py-mi.exp, two varobjs container and nscont are created
when pretty-printing is still not enabled, so they are not dynamic
varobj, IIUC. In this patch, we use mi_create_floating_varobj instead
of mi_create_dynamic_varobj.
gdb/testsuite:
2013-11-22 Yao Qi <yao@codesourcery.com>
* gdb.python/py-mi.exp: Use mi_create_floating_varobj instead
of mi_create_dynamic_varobj.
Hi,
I find "dynamic=1" appear in the result of each child of the output of
-var-list-children,
-var-list-children ss1
^done,numchild="2",children=[child={name="ss1.a",exp="a",numchild="0",type="struct s",thread-id="1",dynamic="1"},child={name="ss1.b",exp="b",numchild="0",type="struct s",thread-id="1",dynamic="1"}],has_more="0"
but the doc doesn't mention this. This patch is to copy the description
of "dynamic=1" here.
gdb/doc:
2013-11-21 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Add attribute 'dynamic'
for the output of command -var-list-children.
Looks "see" is unnecessary before @pxref.
gdb/doc:
2013-11-21 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Remove "see" before
@pxref.
2013-11-20 Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp (maint print objfiles): Consume one line at a
time, and run it through all three milestone regexes.
is_intlike was mostly duplicating is_integral_type, with the exception
of the handling of TYPE_CODE_PTR when parameter PTR_OK is nonzero.
This patches deletes the is_intlike function, using is_integral_type
instead, and adjusting the two locations where this function gets
called.
The code should remain strictly equivalent.
gdb/ChangeLog:
* python/py-value.c (is_intlike): Delete.
(valpy_int): Replace use of CHECK_TYPEDEF and is_intlike
by use of is_integral_type.
(valpy_long): Replace use of CHECK_TYPEDEF and is_intlike
by use of is_integral_type and check for TYPE_CODE_PTR.
I was "lucky" enough that an unrelated patch changed how many symtabs
GDB expands in a plain run to main, and that triggered a latent issue
in this test:
PASS: gdb.base/maint.exp: maint print objfiles: header
PASS: gdb.base/maint.exp: maint print objfiles: psymtabs
FAIL: gdb.base/maint.exp: maint print objfiles: symtabs
The problem is in my case, expect is managing to alway put in the
buffer chunks like this:
Psymtabs:
../../../src/gdb/testsuite/gdb.base/break1.c at 0x1ed2280, ../../../src/gdb/testsuite/gdb.base/break.c at 0x1ed21d0,
Symtabs:
../../../src/gdb/testsuite/gdb.base/break.c at 0x1f044f0, /usr/include/stdio.h at 0x1ed25a0, /usr/include/libio.h at 0x1ed2510, /usr/include/bits/types.h at 0x1ed2480, /usr/lib/gcc/x86_64-redhat-linux/4.7.2/include/stddef.h at 0x1ed23f0,
Object file /usr/lib/debug/lib64/ld-2.15.so.debug: Objfile at 0x1f4bff0, bfd at 0x1f2d940, 0 minsyms
Psymtabs:
bsearch.c at 0x1f65340, ../sysdeps/x86_64/multiarch/init-arch.c at
0x1f65290, ...
Note: Psymtabs:/Symtabs:/Psymtabs:.
So, the loop matches the first Psymtabs in the buffer. Then we're
left with
../../../src/gdb/testsuite/gdb.base/break1.c at 0x1ed2280, ../../../src/gdb/testsuite/gdb.base/break.c at 0x1ed21d0,
Symtabs:
../../../src/gdb/testsuite/gdb.base/break.c at 0x1f044f0, /usr/include/stdio.h at 0x1ed25a0, /usr/include/libio.h at 0x1ed2510, /usr/include/bits/types.h at 0x1ed2480, /usr/lib/gcc/x86_64-redhat-linux/4.7.2/include/stddef.h at 0x1ed23f0,
Object file /usr/lib/debug/lib64/ld-2.15.so.debug: Objfile at 0x1f4bff0, bfd at 0x1f2d940, 0 minsyms
Psymtabs:
bsearch.c at 0x1f65340, ../sysdeps/x86_64/multiarch/init-arch.c at
0x1f65290, ...
In the next iteration, because the psymtabs regex comes first, we
match with the Psymtabs: line, then of course, end up with just
bsearch.c at 0x1f65340, ../sysdeps/x86_64/multiarch/init-arch.c at
0x1f65290, ...
in the buffer. The "Symtabs:" line is lost. expect then reads more
gdb output, and manages to again retrieve the same pattern. Rinse,
repeat, and the test never matches any "Symtab:" line.
We don't know the order the matches lines will appear, so the fix is
to consume one line at a time, and run it through all three milestone
regexes.
gdb/testsuite/
2013-11-20 Pedro Alves <palves@redhat.com>
* gdb.base/maint.exp (maint print objfiles): Consume one line at a
time, and run it through all three milestone regexes.
This fixes the mingw build breakage reported by Pierre.
I found that the gnulib strerror module somehow requires us to pull in
the gethostname module. However, pulling in the gethostname module
makes many things break.
I've sent a bug report to gnulib.
Meanwhile, removing the strerror module should not harm gdb and fixes
the build.
I'm checking this in.
2013-11-20 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Remove
strerror module.
* gnulib/aclocal.m4: Update.
* gnulib/config.in: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/errno.in.h: Remove.
* gnulib/import/intprops.h: Remove.
* gnulib/import/m4/errno_h.m4: Remove.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/strerror.m4: Remove.
* gnulib/import/m4/sys_socket_h.m4: Remove.
* gnulib/import/strerror-override.c: Remove.
* gnulib/import/strerror-override.h: Remove.
* gnulib/import/strerror.c: Remove.
* gnulib/update-gnulib.sh: Update.
Ensure that certain commands (e.g. whatis/ptype) and sizeof intrinsic
have no side effects (variables cannot be altered).
2013-11-20 Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/
* gdb.base/eval-avoid-side-effects.exp: New test.
Boundary length is simpler implemented by means of a pretty
printer. This simplifies users life when examining a bound register.
Changelog:
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* python/lib/gdb/command/bound_register.py: New file.
* gdb/data-directory/Makefile.in: copy bond_register.py to the right path to
be initialized at gdb startup.
testsuite/
* gdb.python/py-pp-maint.exp: Consider new pretty-print added for registers.
Change-Id: Id4f39845e5ece56c370a1fd4343648909f08b731
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Conflicts:
gdb/ChangeLog
2013-06-24 Walfred Tedeschi <walfred.tedeschi@intel.com>
* amd64-linux-nat.c (amd64_linux_gregset32_reg_offset):
Add MPX registers.
(amd64_linux_read_description): Add initialization for MPX and
AVX independently.
* amd64-linux-tdep.c: Includes features/i386/amd64-mpx-linux.c.
(amd64_linux_gregset_reg_offset): Add MPX registers.
(amd64_linux_core_read_description): Add initialization for MPX
registers.
(_initialize_amd64_linux_tdep): Initialize MPX targets.
* amd64-linux-tdep.h (AMD64_LINUX_RAX_REGNUM): Set it to the last
register on the list.
(tdesc_amd64_mpx_linux) Add new target for MPX.
* amd64-tdep.c: Includes features/i386/amd64-mpx.c.
(amd64_mpx_names): MPX register names.
(amd64_init_abi): Add MPX register while initializing the ABI.
(_initialize_amd64_tdep): Initialize MPX targets.
* amd64-tdep.h (amd64_regnum): Add MPX registers.
(AMD64_NUM_REGS): Set number of registers taking MPX into account.
Change-Id: I4a785c181e2fb45e4086650b2f87426caeb2f800
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Conflicts:
gdb/ChangeLog
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* i386-linux-nat.c (GETXSTATEREGS_SUPPLIES): Add MPX
registers on the range of registers to be read from
xsave buffer.
(i386_linux_read_description): Add case for MPX.
* i386-linux-tdep.c: Include features/i386/i386-mpx-linux.c.
(i386_linux_gregset_reg_offset): Add MPX registers.
(i386_linux_core_read_description): Initialize also MPX.
(_initialize_i386_linux_tdep): Add mpx initialization.
* i386-tdep.h (gdbarch_tdep): Add fields bnd0r_regnum, bnd0_regnum,
mpx_register_names.
(i386_regnum): Add MPX registers.
(I386_MPX_NUM_REGS): New macro.
(i386_bnd_regnum_p): New function.
* i386-linux-tdep.h (I386_LINUX_NUM_REGS): Set
number of registers to be the number of BNDSTATUS.
(tdesc_i386_mpx_linux): Add description for MPX Linux registers.
* i386-tdep.c: Include features/i386/i386-mpx.c.
(i386_mpx_names): Add MPX register names array.
(i386_bnd_names): Add bnd pseudo register names array.
(i386_bndr_regnum_p): Lookup register numbers for bnd raw
registers.
(i386_bndr_regnum_p): Lookup register numbers for bnd raw registers.
(386_mpx_ctrl_regnum_p): Lookup register numbers for MPX control
registers.
(i386_bnd_type): New function.
(i386_pseudo_register_type): Use i386_bnd_type for bnd pseudo
register types.
(i386_pseudo_register_read_into_value): Add bnd case.
(i386_pseudo_register_write): Add bnd pseudo registers.
(i386_register_reggroup_p): Add MPX register to the group all.
(i386_validate_tdesc_p): Add MPX to the target description
validation.
(i386_pseudo_register_name): Add bnd pseudo registers.
(i386_gdbarch_init): Add MPX for architecture initialization.
(_initia_initialize_i386_tdep): Add mpx initialization.
* i387-tdep.c (xsave_mpx_offset): New vector for MPX offsets on
XSAVE buffer.
(XSAVE_MPX_ADDR): New macro.
(i387_supply_xsave): Add MPX case.
(i387_collect_xsave): Add MPX case.
* i387-tdep.h (I387_BND0R_REGNUM): New macro.
(I387_BNDCFGU_REGNUM): New macro.
(I387_NUM_MPX_REGS): New macro.
(I387_NUM_BND_REGS): New macro.
(I387_NUM_MPX_CTRL_REGS): New macro.
(I387_MPXEND_REGNUM): New macro.
* common/i386-xstate.h (I386_XSTATE_BNDREGS): New macro.
(I386_XSTATE_BNDCFG): Likewise.
(I386_XSTATE_MPX_MASK): Likewise.
(I386_XSTATE_ALL_MASK): New macro represents flags for all states.
(I386_XSTATE_BNDREGS_SIZE): New macro.
(I386_XSTATE_BNDCFG_SIZE): Likewise.
(I386_XSTATE_SIZE): Adapt for MPX.
(I386_XSTATE_MAX_SIZE): Likewise.
Change-Id: I9ddb7d49434d86fa18eb6b99515203d7c567aefd
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
Conflicts:
gdb/ChangeLog
Bitfields are represented by intervals [start, begin]. It means that for an
interval comprised by only one bit start and end will be equal.
The present condition does not always hold. On the other hand in target-description.c
(tdesc_gdb_type) bitfield is created when "f->type" is null. The routine
maint_print_maint_print_c_tdesc_cmd is modified to follow the same strategy.
2013-11-20 Walfred Tedeschi <walfred.tedeschi@intel.com>
* target-descriptions.c (maint_print_maint_print_c_tdesc_cmd):
Modified logic of creating a bitfield to be in sync with
tdesc_gdb_type.
testsuite/
* gdb.xml/maint_print_struct.xml (bitfield): Added bitfield having
start and end equal 0.
Change-Id: I8c62db049995f0c0c30606d9696b86afe237cbb9
Since as far back as the beginning of the sourceware repository
the ARM port has printed an error "Infinite loop detected" when
the next_pc calculated is the same as the current one, for example
when encountering a branch to the current PC address.
This causes the test gdb.base/random-signal.exp as the error message
is not expected. I have not been able to find a good reason for the
message to be here so remove it and let the test pass.
gdb/ChangeLog:
2013-11-20 Will Newton <will.newton@linaro.org>
* arm-tdep.c (arm_get_next_pc): Remove "Infinite loop detected"
error message.
Hi,
Nowadays, 'target_dcache' is a global variable in GDB, which is not
necessary. It can be a per-address-space variable. In this patch, we
associate target_dcache to address_space.
gdb/doc:
2013-11-20 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Update doc for
per-address-space dcache.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* progspace.h (struct address_space_data): Declare.
* target-dcache.c: Include "progspace.h".
(target_dache): Remove.
(target_dcache_aspace_key): New.
(target_dcache_cleanup): New function.
(target_dcache_init_p): Get data through
target_dcache_aspace_key.
(target_dcache_invalidate): Likewise.
(target_dcache_get): Likewise.
(target_dcache_get_or_init): Likewise.
(_initialize_target_dcache): Initialize
target_dcache_aspace_key.
When I try to describe the cache and its related commands (in a
cache-per-address-space world), I find hard to add, because
existing doc is focused on remote debugging, while data cache is used
regardless of the target. More precisely, GDB cache target data,
instead of remote data.
gdb/doc:
2013-11-20 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Data): Rename menu item.
(Caching Remote Data): Rename to ...
(Caching Target Data): ... it. Update.
After previous patch, 'target_dcache' is initialized lazily. It is
possible that 'target_dcache' is still NULL when GDB writes to memory.
In this case, update to 'target_dcache' can be skipped.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* target.c (memory_xfer_partial_1): Update 'target_dcache' if
it is initialized.
Hi,
In proc mi_child_regexp, \(,thread-id=\"\[0-9\]+\") is appended to
children_exp, while the first '\' is not necessary. This patch
is to remove it. With this patch applied, Emacs can find the right
left paren.
gdb/testsuite:
2013-11-19 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp (mi_child_regexp): Remove unnecessary '\'.
There are some format issues in lib/mi-support.exp, such as using
spaces instead of tab and trailing spaces. This patch is to fix them.
gdb/testsuite:
2013-11-19 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp: Fix format.
Variable 'whatever' is not used at all. This patch is to remove it.
gdb/testsuite:
2013-11-19 Yao Qi <yao@codesourcery.com>
* lib/mi-support.exp (mi_child_regexp): Remove 'whatever'.
(mi_list_varobj_children_range): Likewise.
Hi,
"It's" should be "Its". This patch is to fix it. Committed as
obvious.
gdb:
2013-11-19 Yao Qi <yao@codesourcery.com>
* varobj.c (varobj_get_type): Fix typo.
Consider the following variable:
type Small is range -128 .. 127;
SR : Small := 48;
Trying to get its value as an integer within Python code yields:
(gdb) python sr = gdb.parse_and_eval('sr')
(gdb) python print int(sr)
Traceback (most recent call last):
File "<string>", line 1, in <module>
gdb.error: Cannot convert value to int.
Error while executing Python code.
This is happening because our variable is a range type, and
py-value's is_intlike does not handle TYPE_CODE_RANGE. This
patch fixes this.
gdb/ChangeLog:
* python/py-value.c (is_intlike): Add TYPE_CODE_RANGE handling.
gdb/testsuite/ChangeLog:
* gdb.ada/py_range: New testcase.
The corresponding gdb_dirent.h and gdb_stat.h no longer exist.
We rely on gnulib for those, now.
gdb/ChangeLog:
* contrib/ari/gdb_ari.sh: Remove checks for "dirent.h" and
"stat.h".
This patch is purely mechanical. It removes gdb_stat.h and changes
the code to use sys/stat.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/gdb_stat.h: Remove.
* ada-lang.c: Use sys/stat.h, not gdb_stat.h.
* common/filestuff.c: Use sys/stat.h, not gdb_stat.h.
* common/linux-osdata.c: Use sys/stat.h, not gdb_stat.h.
* corefile.c: Use sys/stat.h, not gdb_stat.h.
* ctf.c: Use sys/stat.h, not gdb_stat.h.
* darwin-nat.c: Use sys/stat.h, not gdb_stat.h.
* dbxread.c: Use sys/stat.h, not gdb_stat.h.
* dwarf2read.c: Use sys/stat.h, not gdb_stat.h.
* exec.c: Use sys/stat.h, not gdb_stat.h.
* gdbserver/linux-low.c: Use sys/stat.h, not gdb_stat.h.
* gdbserver/remote-utils.c: Use sys/stat.h, not gdb_stat.h.
* inf-child.c: Use sys/stat.h, not gdb_stat.h.
* jit.c: Use sys/stat.h, not gdb_stat.h.
* linux-nat.c: Use sys/stat.h, not gdb_stat.h.
* m68klinux-nat.c: Use sys/stat.h, not gdb_stat.h.
* main.c: Use sys/stat.h, not gdb_stat.h.
* mdebugread.c: Use sys/stat.h, not gdb_stat.h.
* mi/mi-cmd-env.c: Use sys/stat.h, not gdb_stat.h.
* nto-tdep.c: Use sys/stat.h, not gdb_stat.h.
* objfiles.c: Use sys/stat.h, not gdb_stat.h.
* procfs.c: Use sys/stat.h, not gdb_stat.h.
* remote-fileio.c: Use sys/stat.h, not gdb_stat.h.
* remote-mips.c: Use sys/stat.h, not gdb_stat.h.
* remote.c: Use sys/stat.h, not gdb_stat.h.
* rs6000-nat.c: Use sys/stat.h, not gdb_stat.h.
* sol-thread.c: Use sys/stat.h, not gdb_stat.h.
* solib-spu.c: Use sys/stat.h, not gdb_stat.h.
* source.c: Use sys/stat.h, not gdb_stat.h.
* symfile.c: Use sys/stat.h, not gdb_stat.h.
* symmisc.c: Use sys/stat.h, not gdb_stat.h.
* symtab.c: Use sys/stat.h, not gdb_stat.h.
* top.c: Use sys/stat.h, not gdb_stat.h.
* xcoffread.c: Use sys/stat.h, not gdb_stat.h.
configure doesn't check for sys/types.h any more, but it still tries
to use the result of the check. This removes that use as well.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Remove check of HAVE_SYS_TYPES_H.
We don't use the result of checking for unistd.h, so this removes the
check.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for unistd.h.
stdlib.h is universal as well, so there is no need to check for it.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for stdlib.h
* defs.h: Include stdlib.h unconditionally.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for stdlib.h.
* gdbreplay.c: Unconditionally include stdlib.h.
gdb already unconditionally includes stddef.h in many places.
I think there is no reason to check for its existence.
Also, Zack Weinberg's header file survey agrees:
http://hacks.owlfolio.org/header-survey/
This patch removes the configure check and the inclusion guards.
It also removes a redundant inclusion that I noticed in defs.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't check for stddef.h.
* defs.h: Unconditionally include stddef.h. Remove duplicate
inclusion.
This removes gdb_dirent.h and updates the code to use dirent.h
instead. It also removes the now-useless configure checks.
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/common.m4 (GDB_AC_COMMON): Don't use AC_HEADER_DIRENT.
* common/gdb_dirent.h: Remove.
* common/filestuff.c: Use dirent.h.
* common/linux-osdata.c: Use dirent.h.
(NAMELEN): Define.
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't use AC_HEADER_DIRENT.
* linux-fork.c: Use dirent.h
* linux-nat.c: Use dirent.h.
* nto-procfs.c: Use dirent.h.
* procfs.c: Use dirent.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't use AC_HEADER_DIRENT.
Now that we are using the gnulib string.h module, we don't need to
check for string.h or strings.h. This removes the last few checks
from the source and from the configure scripts.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* common/common.m4 (GDB_AC_COMMON): Don't check for string.h or
strings.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* server.h: Don't check HAVE_STRING_H.
* gdbreplay.c: Don't check HAVE_STRING_H.
* configure: Rebuild.
This removes gdb_string.h. This patch is purely mechanical. I
created it by running the two commands:
git rm common/gdb_string.h
perl -pi -e's/"gdb_string.h"/<string.h>/;' *.[chyl] */*.[chyl]
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/gdb_string.h: Remove.
* aarch64-tdep.c: Use string.h, not gdb_string.h.
* ada-exp.y: Use string.h, not gdb_string.h.
* ada-lang.c: Use string.h, not gdb_string.h.
* ada-lex.l: Use string.h, not gdb_string.h.
* ada-typeprint.c: Use string.h, not gdb_string.h.
* ada-valprint.c: Use string.h, not gdb_string.h.
* aix-thread.c: Use string.h, not gdb_string.h.
* alpha-linux-tdep.c: Use string.h, not gdb_string.h.
* alpha-mdebug-tdep.c: Use string.h, not gdb_string.h.
* alpha-nat.c: Use string.h, not gdb_string.h.
* alpha-osf1-tdep.c: Use string.h, not gdb_string.h.
* alpha-tdep.c: Use string.h, not gdb_string.h.
* alphanbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64-dicos-tdep.c: Use string.h, not gdb_string.h.
* amd64-linux-nat.c: Use string.h, not gdb_string.h.
* amd64-linux-tdep.c: Use string.h, not gdb_string.h.
* amd64-nat.c: Use string.h, not gdb_string.h.
* amd64-sol2-tdep.c: Use string.h, not gdb_string.h.
* amd64fbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64obsd-tdep.c: Use string.h, not gdb_string.h.
* arch-utils.c: Use string.h, not gdb_string.h.
* arm-linux-nat.c: Use string.h, not gdb_string.h.
* arm-linux-tdep.c: Use string.h, not gdb_string.h.
* arm-tdep.c: Use string.h, not gdb_string.h.
* arm-wince-tdep.c: Use string.h, not gdb_string.h.
* armbsd-tdep.c: Use string.h, not gdb_string.h.
* armnbsd-nat.c: Use string.h, not gdb_string.h.
* armnbsd-tdep.c: Use string.h, not gdb_string.h.
* armobsd-tdep.c: Use string.h, not gdb_string.h.
* avr-tdep.c: Use string.h, not gdb_string.h.
* ax-gdb.c: Use string.h, not gdb_string.h.
* ax-general.c: Use string.h, not gdb_string.h.
* bcache.c: Use string.h, not gdb_string.h.
* bfin-tdep.c: Use string.h, not gdb_string.h.
* breakpoint.c: Use string.h, not gdb_string.h.
* build-id.c: Use string.h, not gdb_string.h.
* buildsym.c: Use string.h, not gdb_string.h.
* c-exp.y: Use string.h, not gdb_string.h.
* c-lang.c: Use string.h, not gdb_string.h.
* c-typeprint.c: Use string.h, not gdb_string.h.
* c-valprint.c: Use string.h, not gdb_string.h.
* charset.c: Use string.h, not gdb_string.h.
* cli-out.c: Use string.h, not gdb_string.h.
* cli/cli-cmds.c: Use string.h, not gdb_string.h.
* cli/cli-decode.c: Use string.h, not gdb_string.h.
* cli/cli-dump.c: Use string.h, not gdb_string.h.
* cli/cli-interp.c: Use string.h, not gdb_string.h.
* cli/cli-logging.c: Use string.h, not gdb_string.h.
* cli/cli-script.c: Use string.h, not gdb_string.h.
* cli/cli-setshow.c: Use string.h, not gdb_string.h.
* cli/cli-utils.c: Use string.h, not gdb_string.h.
* coffread.c: Use string.h, not gdb_string.h.
* common/common-utils.c: Use string.h, not gdb_string.h.
* common/filestuff.c: Use string.h, not gdb_string.h.
* common/linux-procfs.c: Use string.h, not gdb_string.h.
* common/linux-ptrace.c: Use string.h, not gdb_string.h.
* common/signals.c: Use string.h, not gdb_string.h.
* common/vec.h: Use string.h, not gdb_string.h.
* core-regset.c: Use string.h, not gdb_string.h.
* corefile.c: Use string.h, not gdb_string.h.
* corelow.c: Use string.h, not gdb_string.h.
* cp-abi.c: Use string.h, not gdb_string.h.
* cp-support.c: Use string.h, not gdb_string.h.
* cp-valprint.c: Use string.h, not gdb_string.h.
* cris-tdep.c: Use string.h, not gdb_string.h.
* d-lang.c: Use string.h, not gdb_string.h.
* dbxread.c: Use string.h, not gdb_string.h.
* dcache.c: Use string.h, not gdb_string.h.
* demangle.c: Use string.h, not gdb_string.h.
* dicos-tdep.c: Use string.h, not gdb_string.h.
* disasm.c: Use string.h, not gdb_string.h.
* doublest.c: Use string.h, not gdb_string.h.
* dsrec.c: Use string.h, not gdb_string.h.
* dummy-frame.c: Use string.h, not gdb_string.h.
* dwarf2-frame.c: Use string.h, not gdb_string.h.
* dwarf2loc.c: Use string.h, not gdb_string.h.
* dwarf2read.c: Use string.h, not gdb_string.h.
* elfread.c: Use string.h, not gdb_string.h.
* environ.c: Use string.h, not gdb_string.h.
* eval.c: Use string.h, not gdb_string.h.
* event-loop.c: Use string.h, not gdb_string.h.
* exceptions.c: Use string.h, not gdb_string.h.
* exec.c: Use string.h, not gdb_string.h.
* expprint.c: Use string.h, not gdb_string.h.
* f-exp.y: Use string.h, not gdb_string.h.
* f-lang.c: Use string.h, not gdb_string.h.
* f-typeprint.c: Use string.h, not gdb_string.h.
* f-valprint.c: Use string.h, not gdb_string.h.
* fbsd-nat.c: Use string.h, not gdb_string.h.
* findcmd.c: Use string.h, not gdb_string.h.
* findvar.c: Use string.h, not gdb_string.h.
* fork-child.c: Use string.h, not gdb_string.h.
* frame.c: Use string.h, not gdb_string.h.
* frv-linux-tdep.c: Use string.h, not gdb_string.h.
* frv-tdep.c: Use string.h, not gdb_string.h.
* gdb.c: Use string.h, not gdb_string.h.
* gdb_bfd.c: Use string.h, not gdb_string.h.
* gdbarch.c: Use string.h, not gdb_string.h.
* gdbtypes.c: Use string.h, not gdb_string.h.
* gnu-nat.c: Use string.h, not gdb_string.h.
* gnu-v2-abi.c: Use string.h, not gdb_string.h.
* gnu-v3-abi.c: Use string.h, not gdb_string.h.
* go-exp.y: Use string.h, not gdb_string.h.
* go-lang.c: Use string.h, not gdb_string.h.
* go32-nat.c: Use string.h, not gdb_string.h.
* hppa-hpux-tdep.c: Use string.h, not gdb_string.h.
* hppa-linux-nat.c: Use string.h, not gdb_string.h.
* hppanbsd-tdep.c: Use string.h, not gdb_string.h.
* hppaobsd-tdep.c: Use string.h, not gdb_string.h.
* i386-cygwin-tdep.c: Use string.h, not gdb_string.h.
* i386-dicos-tdep.c: Use string.h, not gdb_string.h.
* i386-linux-nat.c: Use string.h, not gdb_string.h.
* i386-linux-tdep.c: Use string.h, not gdb_string.h.
* i386-nto-tdep.c: Use string.h, not gdb_string.h.
* i386-sol2-tdep.c: Use string.h, not gdb_string.h.
* i386-tdep.c: Use string.h, not gdb_string.h.
* i386bsd-tdep.c: Use string.h, not gdb_string.h.
* i386gnu-nat.c: Use string.h, not gdb_string.h.
* i386nbsd-tdep.c: Use string.h, not gdb_string.h.
* i386obsd-tdep.c: Use string.h, not gdb_string.h.
* i387-tdep.c: Use string.h, not gdb_string.h.
* ia64-libunwind-tdep.c: Use string.h, not gdb_string.h.
* ia64-linux-nat.c: Use string.h, not gdb_string.h.
* inf-child.c: Use string.h, not gdb_string.h.
* inf-ptrace.c: Use string.h, not gdb_string.h.
* inf-ttrace.c: Use string.h, not gdb_string.h.
* infcall.c: Use string.h, not gdb_string.h.
* infcmd.c: Use string.h, not gdb_string.h.
* inflow.c: Use string.h, not gdb_string.h.
* infrun.c: Use string.h, not gdb_string.h.
* interps.c: Use string.h, not gdb_string.h.
* iq2000-tdep.c: Use string.h, not gdb_string.h.
* irix5-nat.c: Use string.h, not gdb_string.h.
* jv-exp.y: Use string.h, not gdb_string.h.
* jv-lang.c: Use string.h, not gdb_string.h.
* jv-typeprint.c: Use string.h, not gdb_string.h.
* jv-valprint.c: Use string.h, not gdb_string.h.
* language.c: Use string.h, not gdb_string.h.
* linux-fork.c: Use string.h, not gdb_string.h.
* linux-nat.c: Use string.h, not gdb_string.h.
* lm32-tdep.c: Use string.h, not gdb_string.h.
* m2-exp.y: Use string.h, not gdb_string.h.
* m2-typeprint.c: Use string.h, not gdb_string.h.
* m32c-tdep.c: Use string.h, not gdb_string.h.
* m32r-linux-nat.c: Use string.h, not gdb_string.h.
* m32r-linux-tdep.c: Use string.h, not gdb_string.h.
* m32r-rom.c: Use string.h, not gdb_string.h.
* m32r-tdep.c: Use string.h, not gdb_string.h.
* m68hc11-tdep.c: Use string.h, not gdb_string.h.
* m68k-tdep.c: Use string.h, not gdb_string.h.
* m68kbsd-tdep.c: Use string.h, not gdb_string.h.
* m68klinux-nat.c: Use string.h, not gdb_string.h.
* m68klinux-tdep.c: Use string.h, not gdb_string.h.
* m88k-tdep.c: Use string.h, not gdb_string.h.
* macrocmd.c: Use string.h, not gdb_string.h.
* main.c: Use string.h, not gdb_string.h.
* mdebugread.c: Use string.h, not gdb_string.h.
* mem-break.c: Use string.h, not gdb_string.h.
* memattr.c: Use string.h, not gdb_string.h.
* memory-map.c: Use string.h, not gdb_string.h.
* mep-tdep.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-break.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-disas.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-env.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-stack.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-var.c: Use string.h, not gdb_string.h.
* mi/mi-cmds.c: Use string.h, not gdb_string.h.
* mi/mi-console.c: Use string.h, not gdb_string.h.
* mi/mi-getopt.c: Use string.h, not gdb_string.h.
* mi/mi-interp.c: Use string.h, not gdb_string.h.
* mi/mi-main.c: Use string.h, not gdb_string.h.
* mi/mi-parse.c: Use string.h, not gdb_string.h.
* microblaze-rom.c: Use string.h, not gdb_string.h.
* microblaze-tdep.c: Use string.h, not gdb_string.h.
* mingw-hdep.c: Use string.h, not gdb_string.h.
* minidebug.c: Use string.h, not gdb_string.h.
* minsyms.c: Use string.h, not gdb_string.h.
* mips-irix-tdep.c: Use string.h, not gdb_string.h.
* mips-linux-tdep.c: Use string.h, not gdb_string.h.
* mips-tdep.c: Use string.h, not gdb_string.h.
* mips64obsd-tdep.c: Use string.h, not gdb_string.h.
* mipsnbsd-tdep.c: Use string.h, not gdb_string.h.
* mipsread.c: Use string.h, not gdb_string.h.
* mn10300-linux-tdep.c: Use string.h, not gdb_string.h.
* mn10300-tdep.c: Use string.h, not gdb_string.h.
* monitor.c: Use string.h, not gdb_string.h.
* moxie-tdep.c: Use string.h, not gdb_string.h.
* mt-tdep.c: Use string.h, not gdb_string.h.
* nbsd-tdep.c: Use string.h, not gdb_string.h.
* nios2-linux-tdep.c: Use string.h, not gdb_string.h.
* nto-procfs.c: Use string.h, not gdb_string.h.
* nto-tdep.c: Use string.h, not gdb_string.h.
* objc-lang.c: Use string.h, not gdb_string.h.
* objfiles.c: Use string.h, not gdb_string.h.
* opencl-lang.c: Use string.h, not gdb_string.h.
* osabi.c: Use string.h, not gdb_string.h.
* osdata.c: Use string.h, not gdb_string.h.
* p-exp.y: Use string.h, not gdb_string.h.
* p-lang.c: Use string.h, not gdb_string.h.
* p-typeprint.c: Use string.h, not gdb_string.h.
* parse.c: Use string.h, not gdb_string.h.
* posix-hdep.c: Use string.h, not gdb_string.h.
* ppc-linux-nat.c: Use string.h, not gdb_string.h.
* ppc-sysv-tdep.c: Use string.h, not gdb_string.h.
* ppcfbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcnbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcobsd-tdep.c: Use string.h, not gdb_string.h.
* printcmd.c: Use string.h, not gdb_string.h.
* procfs.c: Use string.h, not gdb_string.h.
* prologue-value.c: Use string.h, not gdb_string.h.
* python/py-auto-load.c: Use string.h, not gdb_string.h.
* python/py-gdb-readline.c: Use string.h, not gdb_string.h.
* ravenscar-thread.c: Use string.h, not gdb_string.h.
* regcache.c: Use string.h, not gdb_string.h.
* registry.c: Use string.h, not gdb_string.h.
* remote-fileio.c: Use string.h, not gdb_string.h.
* remote-m32r-sdi.c: Use string.h, not gdb_string.h.
* remote-mips.c: Use string.h, not gdb_string.h.
* remote-sim.c: Use string.h, not gdb_string.h.
* remote.c: Use string.h, not gdb_string.h.
* reverse.c: Use string.h, not gdb_string.h.
* rs6000-aix-tdep.c: Use string.h, not gdb_string.h.
* ser-base.c: Use string.h, not gdb_string.h.
* ser-go32.c: Use string.h, not gdb_string.h.
* ser-mingw.c: Use string.h, not gdb_string.h.
* ser-pipe.c: Use string.h, not gdb_string.h.
* ser-tcp.c: Use string.h, not gdb_string.h.
* ser-unix.c: Use string.h, not gdb_string.h.
* serial.c: Use string.h, not gdb_string.h.
* sh-tdep.c: Use string.h, not gdb_string.h.
* sh64-tdep.c: Use string.h, not gdb_string.h.
* shnbsd-tdep.c: Use string.h, not gdb_string.h.
* skip.c: Use string.h, not gdb_string.h.
* sol-thread.c: Use string.h, not gdb_string.h.
* solib-dsbt.c: Use string.h, not gdb_string.h.
* solib-frv.c: Use string.h, not gdb_string.h.
* solib-osf.c: Use string.h, not gdb_string.h.
* solib-spu.c: Use string.h, not gdb_string.h.
* solib-target.c: Use string.h, not gdb_string.h.
* solib.c: Use string.h, not gdb_string.h.
* somread.c: Use string.h, not gdb_string.h.
* source.c: Use string.h, not gdb_string.h.
* sparc-nat.c: Use string.h, not gdb_string.h.
* sparc-sol2-tdep.c: Use string.h, not gdb_string.h.
* sparc-tdep.c: Use string.h, not gdb_string.h.
* sparc64-tdep.c: Use string.h, not gdb_string.h.
* sparc64fbsd-tdep.c: Use string.h, not gdb_string.h.
* sparc64nbsd-tdep.c: Use string.h, not gdb_string.h.
* sparcnbsd-tdep.c: Use string.h, not gdb_string.h.
* spu-linux-nat.c: Use string.h, not gdb_string.h.
* spu-multiarch.c: Use string.h, not gdb_string.h.
* spu-tdep.c: Use string.h, not gdb_string.h.
* stabsread.c: Use string.h, not gdb_string.h.
* stack.c: Use string.h, not gdb_string.h.
* std-regs.c: Use string.h, not gdb_string.h.
* symfile.c: Use string.h, not gdb_string.h.
* symmisc.c: Use string.h, not gdb_string.h.
* symtab.c: Use string.h, not gdb_string.h.
* target.c: Use string.h, not gdb_string.h.
* thread.c: Use string.h, not gdb_string.h.
* tilegx-linux-nat.c: Use string.h, not gdb_string.h.
* tilegx-tdep.c: Use string.h, not gdb_string.h.
* top.c: Use string.h, not gdb_string.h.
* tracepoint.c: Use string.h, not gdb_string.h.
* tui/tui-command.c: Use string.h, not gdb_string.h.
* tui/tui-data.c: Use string.h, not gdb_string.h.
* tui/tui-disasm.c: Use string.h, not gdb_string.h.
* tui/tui-file.c: Use string.h, not gdb_string.h.
* tui/tui-layout.c: Use string.h, not gdb_string.h.
* tui/tui-out.c: Use string.h, not gdb_string.h.
* tui/tui-regs.c: Use string.h, not gdb_string.h.
* tui/tui-source.c: Use string.h, not gdb_string.h.
* tui/tui-stack.c: Use string.h, not gdb_string.h.
* tui/tui-win.c: Use string.h, not gdb_string.h.
* tui/tui-windata.c: Use string.h, not gdb_string.h.
* tui/tui-winsource.c: Use string.h, not gdb_string.h.
* typeprint.c: Use string.h, not gdb_string.h.
* ui-file.c: Use string.h, not gdb_string.h.
* ui-out.c: Use string.h, not gdb_string.h.
* user-regs.c: Use string.h, not gdb_string.h.
* utils.c: Use string.h, not gdb_string.h.
* v850-tdep.c: Use string.h, not gdb_string.h.
* valarith.c: Use string.h, not gdb_string.h.
* valops.c: Use string.h, not gdb_string.h.
* valprint.c: Use string.h, not gdb_string.h.
* value.c: Use string.h, not gdb_string.h.
* varobj.c: Use string.h, not gdb_string.h.
* vax-tdep.c: Use string.h, not gdb_string.h.
* vaxnbsd-tdep.c: Use string.h, not gdb_string.h.
* vaxobsd-tdep.c: Use string.h, not gdb_string.h.
* windows-nat.c: Use string.h, not gdb_string.h.
* xcoffread.c: Use string.h, not gdb_string.h.
* xml-support.c: Use string.h, not gdb_string.h.
* xstormy16-tdep.c: Use string.h, not gdb_string.h.
* xtensa-linux-nat.c: Use string.h, not gdb_string.h.
This imports the gnulib strstr and strerror modules. It doesn't make
any other changes to gdb; I found it simpler to work with the branch
if I made the changes more indepdendent than I had previously.
2013-11-18 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add strerror
and strstr.
* gnulib/aclocal.m4: Update.
* gnulib/config.in: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/errno.in.h: New.
* gnulib/import/intprops.h: New.
* gnulib/import/m4/errno_h.m4: New.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/strerror.m4: New.
* gnulib/import/m4/strstr.m4: New.
* gnulib/import/m4/sys_socket_h.m4: New.
* gnulib/import/strerror-override.c: New.
* gnulib/import/strerror-override.h: New.
* gnulib/import/strerror.c: New.
* gnulib/import/strstr.c: New.
While adding modules I found that the current approach of listing all
the modules on one line made it harder to experiment -- any conflicts
from git were a pain to resolve.
This patch splits the list of modules so that there is one module per
line.
2013-11-18 Tom Tromey <tromey@redhat.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Split into
multiple lines.
Later patches in this series will make changes to gdb and gdbserver
configury, necessitating the use of gnulib in gdbreplay. This patch
introduces the dependency early, so that subsequent patches don't
break the build.
2013-11-18 Tom Tromey <tromey@redhat.com>
* Makefile.in (gdbreplay$(EXEEXT)): Depend on and link against
LIBGNU.
2013-11-18 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-tdep.c (sparc_is_annulled_branch_insn): New function.
* sparc-tdep.h: And its prototype.
* sparc64-linux-tdep.c (sparc64_linux_get_longjmp_target): New
function.
(sparc64_linux_init_abi): Register the get_longjmp_target hook.
Since 'struct dwarf_expr_context_funcs::read_addr_from_reg' is now
only used for addresses, we can make it use unpack_pointer. And since
we now have 'struct dwarf_expr_context_funcs'::get_reg_value, there's
no need for speculation about using values here.
Tested on x86_64 Fedora 17.
gdb/
2013-11-18 Pedro Alves <palves@redhat.com>
* dwarf2-frame.c (read_addr_from_reg): Remove stale comment and
use unpack_pointer.
Following the addition of the --language optiton to all GDB/MI
commands, I realized that there was no easy way for front-ends
to figure out whether this features is available or not. So I added
a "language-option" entry to -list-features.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Add "language-options"
to -list-features output.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new
"language-option" entry in the output of the "-list-features"
command.
This is to help make it slightly clearer how this method is expected
to extract data from the given register.
gdb/ChangeLog:
* dwarf2expr.h (struct dwarf_expr_context_funcs)
<read_addr_from_reg>: Renames "read_reg".
* dwarf2-frame.c (read_addr_from_reg): Renames "read_reg".
Adjust comment.
(dwarf2_frame_ctx_funcs, execute_stack_op, dwarf2_frame_cache):
Use read_addr_from_reg in place of read_reg.
* dwarf2expr.c (execute_stack_op): Use read_addr_from_reg
in place of read_reg.
* dwarf2loc.c (dwarf_expr_read_addr_from_reg): Renames
dwarf_expr_read_reg.
(dwarf_expr_ctx_funcs): Replace dwarf_expr_read_reg
with dwarf_expr_read_addr_from_reg.
(needs_frame_read_addr_from_reg): Renames needs_frame_read_reg.
(needs_frame_ctx_funcs): Replace needs_frame_read_reg with
needs_frame_read_addr_from_reg.
In the case where the GNAT runtime was built with full debugging info,
several of the exceptions defined there might have a name contain
the word "global". To make this less likely, this patch renames
the exception name, replacing "Global" by "Global_GDB". It still
keeps the exeption name relatively short, while it is unlikely that
the GNAT runtime has an exception whose name explicitly mentions GDB,
and even less likely that it contains "Global_GDB".
gdb/testsuite/ChangeLog:
* info_exc/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
* info_exc/foo.adb: Adjust to new exception name.
* info_exc.exp: Adjust after exception renaming in const.ads.
Update "info exception global" test to test "info exceptions
global_gdb" instead.
* mi_exc_info/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
* mi_exc_info/foo.adb (Adjust to new exception name.
* mi_exc_info.exp: Adjust after exception renaming in const.ads.
Update "-info-ada-exceptions global" test to test
"-info-ada-exceptions global_gdb" instead.
of inferior output for remote and native sessions.
* gdb.mi/mi-console.exp: Remove obsolete comment.
Check for semihosted inferior output pattern.
(semihosted_string): New function.
If the runtime has full debug info, then the non-standard exceptions
declared in the GNAT runtime will appear in the list of exceptions
printed by GDB ("info exceptions" or "-info-ada-exceptions").
This is valid output, so this patch allows for it.
gdb/testsuite/ChangeLog:
* gdb.ada/info_exc.exp: Allow other global exceptions to be
listed in the output of "info exceptions".
* gdb.ada/mi_exc_info.exp: Allow other global exceptions to be
listed in the output of "-info-ada-exceptions".
Similar to qsort(), the glibc version of memcpy() also declares its
arguments with __attribute__(__nonnull__(...)). If NULL is passed
anyway, upstream GCC's new pass '-fisolate-erroneous-paths' typically
causes a trap in such cases. I've encountered this with GDB in
chain_candidate() when trying to execute the break.exp test case.
gdb/
2013-11-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* dwarf2loc.c (chain_candidate): Prevent invoking memcpy with
NULL.
This patch fixes some spurious failures when the inferior is linked
against the shared version of libgnat by default, as appears to be
the case on many GNU/Linux distributions. When that happens, we have
to start the program in order to ensure that the GNAT runtime is
mapped to memory, in order for us to find the standard exceptions
(defined within the runtime). Otherwise, they will not be shown,
as expected, by the debugger.
gdb/testsuite/ChangeLog:
* gdb.ada/info_exc.exp: Start inferior before starting
the "info exceptions" tests.
* gdb.ada/mi_exc_info.exp: Start inferior before starting
the "-info-ada-exceptions" tests.
This patch fixes PR c++/16117.
gdb has an extension so that users can use expressions like FILE::NAME
to choose a variable of the given name from the given file. The bug
is that this extension takes precedence over ordinary C++ expressions
of the same form. You might think this is merely hypothetical, but
now that C++ headers commonly do not use an extension, it is more
common.
This patch fixes the bug by making two related changes. First, it
changes gdb to prefer the ordinary C++ meaning of a symbol over the
extended meaning. Second, it arranges for single-quoting of the
symbol to indicate a preference for the extension.
Built and regtested on x86-64 Fedora 18.
New test case included.
2013-11-15 Tom Tromey <tromey@redhat.com>
PR c++/16117:
* c-exp.y (lex_one_token): Add "is_quoted_name" argument.
(classify_name): Likewise. Prefer a field of "this" over a
filename.
(classify_inner_name, yylex): Update.
2013-11-15 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Variables): Note gdb rules for ambiguous cases.
Add example.
2013-11-15 Tom Tromey <tromey@redhat.com>
* gdb.cp/includefile: New file.
* gdb.cp/filename.exp: New file.
* gdb.cp/filename.cc: New file.
Consider the following code, compiled at -O2 on ppc-linux:
procedure Increment (Val : in out Float; Msg : String);
The implementation does not really matter in this case). In our example,
this function is being called from a function with Param_1 set to 99.0.
Trying to break inside that function, and running until reaching that
breakpoint yields:
(gdb) b increment
Breakpoint 1 at 0x100014b4: file callee.adb, line 6.
(gdb) run
Starting program: /[...]/foo
Breakpoint 1, callee.increment (val=99.0, val@entry=0.0, msg=...)
at callee.adb:6
6 if Val > 200.0 then
The @entry value for parameter "val" is incorrect, it should be 99.0.
The associated call-site parameter DIE looks like this:
.uleb128 0xc # (DIE (0x115) DW_TAG_GNU_call_site_parameter)
.byte 0x2 # DW_AT_location
.byte 0x90 # DW_OP_regx
.uleb128 0x21
.byte 0x3 # DW_AT_GNU_call_site_value
.byte 0xf5 # DW_OP_GNU_regval_type
.uleb128 0x3f
.uleb128 0x25
The DW_AT_GNU_call_site_value uses a DW_OP_GNU_regval_type
operation, referencing register 0x3f=63, which is $f31,
an 8-byte floating register. In that register, the value is
stored using the usual 8-byte float format:
(gdb) info float
f31 99.0 (raw 0x4058c00000000000)
The current code evaluating DW_OP_GNU_regval_type operations
currently is (dwarf2expr.c:execute_stack_op):
result = (ctx->funcs->read_reg) (ctx->baton, reg);
result_val = value_from_ulongest (address_type, result);
result_val = value_from_contents (type,
value_contents_all (result_val));
What the ctx->funcs->read_reg function does is read the contents
of the register as if it contained an address. The rest of the code
continues that assumption, thinking it's OK to then use that to
create an address/ulongest struct value, which we then re-type
to the type specified by DW_OP_GNU_regval_type.
We're getting 0.0 above because the read_reg implementations
end up treating the contents of the FP register as an integral,
reading only 4 out of the 8 bytes. Being a big-endian target,
we read the high-order ones, which gives us zero.
This patch fixes the problem by introducing a new callback to
read the contents of a register as a given type, and then adjust
the handling of DW_OP_GNU_regval_type to use that new callback.
gdb/ChangeLog:
* dwarf2expr.h (struct dwarf_expr_context_funcs) <read_reg>:
Extend the documentation a bit.
<get_reg_value>: New field.
* dwarf2loc.c (dwarf_expr_get_reg_value)
(needs_frame_get_reg_value): New functions.
(dwarf_expr_ctx_funcs, needs_frame_ctx_funcs): Add "get_reg_value"
callback.
* dwarf2-frame.c (get_reg_value): New function.
(dwarf2_frame_ctx_funcs): Add "get_reg_value" callback.
* dwarf2expr.c (execute_stack_op) <DW_OP_GNU_regval_type>:
Use new callback to compute result_val.
gdb/testsuite/ChangeLog:
* gdb.ada/O2_float_param: New testcase.
ELFv2 needs different plt call stubs to ELFv1, register usage differs
too. When I added these to ld I changed register usage in the ELFv1
stubs as well, simplifying the linker code and (perhaps) future
maintenance. All well and good, but this means gdb needs to cope with
more stub variants. This patch also handles skipping over addis/addi
setting up r2 in ELFv2 global entry code. We want breakpoints to be
set past this point to catch calls via the local entry point.
* ppc64-tdep.c (ppc64_plt_entry_point): Renamed from..
(ppc64_desc_entry_point): ..this. Update comments here and at
call points.
(ppc64_standard_linkage1, ppc64_standard_linkage2,
ppc64_standard_linkage3): Update comments.
(ppc64_standard_linkage4, ppc64_standard_linkage5,
(ppc64_standard_linkage6, ppc64_standard_linkage7): New insn
patterns.
(ppc64_standard_linkage4_target): New function.
(ppc64_skip_trampoline_code): Skip ELFv2 patterns too.
* rs6000-tdep.c (skip_prologue): Skip ELFv2 r2 setup. Correct
nop match. Fix comment wrap.
Pedro pointed out that it is handy for "make check" to print a summary
of the results. This happens in the check-single case and also if you
invoke runtest by hand.
This patch implements the same thing for check-parallel.
2013-11-14 Tom Tromey <tromey@redhat.com>
* Makefile.in (check-parallel): Print summary from gdb.sum.
This patch fixes a buglet in the manual.
It's wrong to say that a method is defined "as" a subclass.
Instead it should say that a method is defined "in" a subclass.
I'm checking this in under the obvious rule.
2013-11-14 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Breakpoints In Python): Replace "as" with "in".
Before all this stop_soon handling, we have code that can end in
keep_going. Particularly, the thread_hop_needed code looked
suspicious considering breakpoint always-inserted mode, though on
closer inspection, it'd take connecting to multiple remote targets
that shared the same address space to trigger that.
Still, I think it's clearer if all this remote connection setup /
attach code is placed early, before any keep_going path could be
reached.
gdb/
2013-11-14 Pedro Alves <palves@redhat.com>
* infrun.c (handle_signal_stop): Move STOP_QUIETLY,
STOP_QUIETLY_REMOTE and 'stop_after_trap' handling earlier.
After the previous patches, we only ever reach the code after the
initial 'switch (ecs->ws.kind)' switch for TARGET_WAITKIND_STOPPED.
We can now factor out all that to its own function.
Unfortunately, stepped_after_stopped_by_watchpoint needed to move to
the ecs. I think that indicates a state machine bug -- no event other
than TARGET_WAITKIND_STOPPED indicates a single-step actually
finished. TARGET_WAITKIND_SYSCALL_XXX, TARGET_WAITKIND_FORK, etc. are
all events that are triggered from the kernel, _within_ a syscall,
IOW, from userspace's perspective, halfway through an instruction
being executed. This might actually matter for the syscall events, as
syscalls can change memory (and thus trigger watchpoints).
gdb/
2013-11-14 Pedro Alves <palves@redhat.com>
* infrun.c (struct execution_control_state)
<stepped_after_stopped_by_watchpoint>: New field.
(get_inferior_stop_soon): New function.
(handle_inferior_event): 'stepped_after_stopped_by_watchpoint' was
moved to struct execution_control_state -- adjust. Use
get_inferior_stop_soon. Split TARGET_WAITKIND_STOPPED handling to
new function.
(handle_signal_stop): New function, factored out from
handle_inferior_event.
After the previous patch, there's actually no breakpoint type that
returns BPSTAT_SIGNAL_HIDE, so we can go back to having
bpstat_explains_signal return a boolean. The signal hiding actually
disappears.
gdb/
2013-11-14 Pedro Alves <palves@redhat.com>
* break-catch-sig.c (signal_catchpoint_explains_signal): Adjust to
return a boolean.
* breakpoint.c (bpstat_explains_signal): Adjust to return a
boolean.
(explains_signal_watchpoint, base_breakpoint_explains_signal):
Adjust to return a boolean.
* breakpoint.h (enum bpstat_signal_value): Delete.
(struct breakpoint_ops) <explains_signal>: New returns a boolean.
(bpstat_explains_signal): Likewise.
* infrun.c (handle_inferior_event) <random signal checks>:
bpstat_explains_signal now returns a boolean - adjust. No longer
consider hiding signals.
Looking at the current random signal checks:
if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
random_signal
= !((bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
GDB_SIGNAL_TRAP)
!= BPSTAT_SIGNAL_NO)
|| stopped_by_watchpoint
|| ecs->event_thread->control.trap_expected
|| (ecs->event_thread->control.step_range_end
&& (ecs->event_thread->control.step_resume_breakpoint
== NULL)));
else
{
enum bpstat_signal_value sval;
sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
ecs->event_thread->suspend.stop_signal);
random_signal = (sval == BPSTAT_SIGNAL_NO);
if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
}
We can observe:
- the stepping checks bit:
...
|| ecs->event_thread->control.trap_expected
|| (ecs->event_thread->control.step_range_end
&& (ecs->event_thread->control.step_resume_breakpoint
== NULL)));
...
is just like currently_stepping:
static int
currently_stepping (struct thread_info *tp)
{
return ((tp->control.step_range_end
&& tp->control.step_resume_breakpoint == NULL)
|| tp->control.trap_expected
|| bpstat_should_step ());
}
except it misses the bpstat_should_step check (***).
It's not really necessary to check bpstat_should_step in the
random signal tests, because software watchpoints always end up in
the bpstat list anyway, which means bpstat_explains_signal with
GDB_SIGNAL_TRAP always returns at least BPSSTAT_SIGNAL_HIDE, but I
think the code is clearer if we reuse currently_stepping.
*** - bpstat_should_step checks to see if there's any software
watchpoint in the breakpoint list, because we need to force the
target to single-step all the way, to evaluate the watchpoint's
value at each step.
- we never hide GDB_SIGNAL_TRAP, even if the bpstat returns
BPSTAT_SIGNAL_HIDE, which is actually the default for all
breakpoints. If we make the default be BPSTAT_SIGNAL_PASS, then
we can merge the two bpstat_explains_signal paths.
gdb/
2013-11-14 Pedro Alves <palves@redhat.com>
* breakpoint.c (bpstat_explains_signal) <Moribund locations>:
Return BPSTAT_SIGNAL_PASS instead of BPSTAT_SIGNAL_HIDE.
(explains_signal_watchpoint): Return BPSTAT_SIGNAL_PASS instead of
BPSTAT_SIGNAL_HIDE.
(base_breakpoint_explains_signal): Return BPSTAT_SIGNAL_PASS
instead of BPSTAT_SIGNAL_HIDE.
* infrun.c (handle_inferior_event): Rework random signal checks.
This goes a step forward in making only TARGET_WAITKIND_STOPPED talk
about signals.
There's no reason for the "catchpoint" TARGET_WAITKIND_XXXs to consult
bpstat about signals -- unlike breakpoints, all these events are
continuable, so we don't need to do a remove-break/step/reinsert-break
-like dance. That means we don't actually need to run them through
process_event_stop_test (for the bpstat_what checks), and can just use
bpstat_causes_stop instead. Note we were already using it in the
TARGET_WAITKIND_(V)FORKED cases.
Then, these "catchpoint" waitkinds don't need to set
ecs->random_signal for anything, because they check it immediately
afterwards (and the value they set is never used again).
gdb/
2013-11-14 Pedro Alves <palves@redhat.com>
* infrun.c (struct execution_control_state): Remove
'random_signal' field.
(handle_syscall_event): Use bpstat_causes_stop instead of
bpstat_explains_signal. Don't set ecs->random_signal.
(handle_inferior_event): New 'random_signal' local.
<TARGET_WAITKIND_FORKED, TARGET_WAITKIND_VFORKED,
TARGET_WAITKIND_EXECD>: Use bpstat_causes_stop instead of
bpstat_explains_signal. Don't set ecs->random_signal.
<TARGET_WAITKIND_STOPPED>: Adjust to use local instead of
ecs->random_signal.
This comment applies to the whole handle_inferior_event flow, top to
bottom. Best move it to the function's intro.
gdb/
2013-11-14 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event): Move comment from the
function's body to the function's description, adjusted.
Of all the TARGET_WAITKIND_XXXs event kinds other than
TARGET_WAITKIND_STOPPED, TARGET_WAITKIND_LOADED is the only kind that
doesn't end in a return, instead falling through to all the
signal/breakpoint/stepping handling code. But it only falls through
in the STOP_QUIETLY_NO_SIGSTOP and STOP_QUIETLY_REMOTE cases, which
means the
/* This is originated from start_remote(), start_inferior() and
shared libraries hook functions. */
if (stop_soon == STOP_QUIETLY || stop_soon == STOP_QUIETLY_REMOTE)
{
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: quietly stopped\n");
stop_stepping (ecs);
return;
}
bit is eventually reached. All tests before that is reached will
always fail. It's simpler to inline the stop_soon checks close to the
TARGET_WAITKIND_LOADED code, which allows removing the fall through.
Tested on x86_64 Fedora 17, but that doesn't exercise this
TARGET_WAITKIND_LOADED.
Also ran gdb.base/solib-disc.exp on Cygwin/gdbserver, which exercises
reconnection while the inferior is stopped at an solib event, but then
again, gdbserver always replies a regular trap on initial connection,
instead of the last event the program had seen:
Sending packet: $?#3f...Packet received: T0505:4ca72800;04:f8a62800;08:62fcc877;thread:d28;
Sending packet: $Hc-1#09...Packet received: E01
Sending packet: $qAttached#8f...Packet received: 0
Packet qAttached (query-attached) is supported
infrun: clear_proceed_status_thread (Thread 3368)
Sending packet: $qOffsets#4b...Packet received:
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 42000 [Thread 3368],
infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x77c8fc62
infrun: quietly stopped
infrun: stop_stepping
So the only way to exercise this would be to hack gdbserver. I didn't
go that far though. I'm reasonably confident this is correct.
gdb/
2013-11-14 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event) <TARGET_WAITKIND_LOADED>:
Handle STOP_QUIETLY_NO_SIGSTOP and STOP_QUIETLY_REMOTE here.
Assert we never fall through out of the TARGET_WAITKIND_LOADED
case.
While digging into a different memory corruption error, I happened to
notice one coming from the linetable code. In a couple of spots, the
wrong termination condition was used in a loop, leading gdb to read
one element past the end of the linetable.
Built and regtested on x86-64 Fedora 18. Also verified using
valgrind. I'm checking this in.
2013-11-14 Tom Tromey <tromey@redhat.com>
* python/py-linetable.c (ltpy_has_line)
(ltpy_get_all_source_lines): Fix loop termination condition.
dw2-case-insensitive.exp: p fuNC_lang fails on arm. The problem occurs
when thumb mode code is generated. On ARM last bit of function pointer
value indicates whether the target function is an ARM (if 0) or Thumb
(if 1) routine. The PC address should refer to actual address in
either case. This patch adds new compile unit and function labels to
code which act as address ranges of compile unit and functions in
debug information. Therefore address ranges will have correct
addresses and not the ones with an incremented least significant bit.
This patch has been tested on x86_64 and arm machines.
gdb/testsuite/ChangeLog:
2013-11-14 Omair Javaid <Omair.Javaid@linaro.org>
* gdb.dwarf2/dw2-case-insensitive-debug.S: Updated compile unit
and function label names.
* gdb.dwarf2/dw2-case-insensitive.c: Created function and
compile unit labels.
Frontend sometimes need to evaluate expressions that are
language-specific. For instance, Eclipse uses the following
expression to determine the size of an address on the target:
-data-evaluate-expression "sizeof (void*)"
Unfortunately, if the main of the program being debugged is not C,
this may not work. For instance, if the main is in Ada, you get...
-data-evaluate-expression "sizeof (void*)"
^error,msg="No definition of \"sizeof\" in current context."
... and apparently decides to stop the debugging session as a result.
The recommendation sent was to specifically set the language to C
before trying to evaluate the expression. Something such as:
1. save current language
2. set language c
3. -data-evaluate-expression "sizeof (void*)"
4. Restore language
This has the same disadvantages as the ones outlined in the "Context
Management" section of the GDB/MI documentation regarding setting
the current thread or the current frame, thus recommending the use of
general command-line switches such as --frame, or --thread instead.
This patch follows the same steps for the language, adding a similar
new command option: --language LANG. Example of use:
-data-evaluate-expression --language c "sizeof (void*)"
^done,value="4"
gdb/ChangeLog:
* mi/mi-parse.h (struct mi_parse) <language>: New field.
* mi/mi-main.c (mi_cmd_execute): Temporarily set language to
PARSE->LANGUAGE during command execution, if set.
* mi/mi-parse.c: Add "language.h" #include.
(mi_parse): Add parsing of "--language" command option.
* NEWS: Add entry mentioning the new "--language" command option.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-language.exp: New file.
gdb/doc/ChangeLog:
* gdb.texinfo (Show): Add xref anchor for "show language" command.
(Context management): Place current subsection text into its own
subsubsection. Add new subsubsection describing the "--language"
command option.
This function provides the exact same functionality as extract_arg,
except that it takes a "const char**" instead of a "char **".
It allows us also to re-implement extract_arg almost as a simple
wrapper around the new function.
gdb/ChangeLog:
Pedro Alves <palves@redhat.com>
Joel Brobecker <brobecker@adacore.com>
* cli/cli-utils.h (extract_arg_const): Add declaration.
* cli/cli-utils.c (extract_arg_const): New function.
(extract_arg): Reimplement using extract_arg_const.
In addition to the fact that language.h depends on a number of struct
types declared in symtab.h, language.h also depends on an enumerated
type (domain_enum). So language.h should #include "symtab.h".
gdb/ChangeLog:
* language.h: Add "symtab.h" #include.
I noticed today that multi-arch-exec.exp was failing in parallel mode.
The bug is that multi-arch-exec.c assumes the non-parallel directory
layout.
This patch fixes the problem using the same "BASEDIR" approach used in
other tests.
Tested both ways on x86-64 Fedora 18.
I'm checking this in.
2013-11-13 Tom Tromey <tromey@redhat.com>
* gdb.multi/multi-arch-exec.exp: Define BASEDIR when compiling.
* gdb.multi/multi-arch-exec.c (main): Use BASEDIR.
Rather than having -list-features report support for the GDB/MI
commands providing access to Ada exception catchpoints with one entry,
and the GDB/MI command providing the list of Ada exceptions with
a second entry, this patch merges it all within one single entry.
This is OK, because all these commands were added within a short
amount of time, and within the same release cycle; and it reduces
a bit the size of the output.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Replace "info-ada-exceptions"
entry with "ada-exceptions".
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Delete
the documentation of "info-ada-exceptions" in the output
of the "-list-features" command. Add the documentation
of the "ada-exception" entry instead.
This patch aims at fixing the following problem, where the user:
. debugs its program
. makes a modification and rebuilds it *without exiting the debugger*
. returns to its debugging session and restarts the inferior
In that situation, the debugger notices that the underlying executable
has changed and that re-reading its symbols is needed. Shortly after
displaying a message informing the user of the situation, GDB crashes:
(gdb) run
[...]
`/[...]/dest' has changed; re-reading symbols.
zsh: 13434922 segmentation fault (core dumped)
The crash occurs while trying to allocate some memory on the bfd_bfd
obstack. But, at some point in time, the whole obstack data gets
corrupted, nullified. So the memory allocation fails trying to call
a function at a NULL address. (side note: when debugging GDB in GDB,
top-gdb reports a SIGILL, while the shell makes it look like it was
a SIGSEGV - the discrepancy is not critical to the investigation
and therefore was not explored)
The corruption occurred because the region where the per_bfd data
got free'ed nearly after it got allocated! This is what happens,
in chronological order (see reread_symbols):
1. GDB notices that the executable has changed, decides to
re-read its symbols.
2. Opens a new bfd, unrefs the old one
3. Calls set_objfile_per_bfd (objfile);
4. Re-initializes the objfile's obstack:
obstack_init (&objfile->objfile_obstack);
I think that the normal behavior for set_objfile_per_bfd would
be to search for already-allocated shared per_bfd data, and
allocate new one if not found. The critical difference between
a platform such as x86_64-linuxe where it works, and ppc-aix,
where it doesn't lies in the fact that bfd-data sharing is not
activated on ppc-aix, and as a result, the per-bfd data gets
allocated on the objfile's obstack instead of in the bfd objalloc:
/* If the object requires gdb to do relocations, we simply fall
back to not sharing data across users. These cases are rare
enough that this seems reasonable. */
if (abfd != NULL && !gdb_bfd_requires_relocations (abfd))
{
storage = bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage));
set_bfd_data (abfd, objfiles_bfd_data, storage);
}
else
storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct objfile_per_bfd_storage);
Allocating that per_bfd storage is of course nearly useless since
we end up free-ing right after in step (4) above. Eventually,
the memory region ends up being re-used, hence the corruption
leading to the crash.
This fix was simply to move the call to set_objfile_per_bfd after
the objfile's obstack re-initialization.
gdb/ChangeLog:
* symfile.c (reread_symbols): Move call to set_objfile_per_bfd
after re-initialization of OBJFILE's obstack.
Upstream GCC's new pass '-fisolate-erroneous-paths' may introduce
traps at places where GCC has determined undefined behavior, e.g. when
passing a NULL pointer to a function that defines this argument as
__attribute__(__nonnull__(...)). In particular this applies to
uniquify_strings(), because it invokes qsort() with NULL when the
'strings' vector is empty. I hit this problem on s390x when trying to
execute "break main" on a C program.
gdb/
2013-11-12 Andreas Arnez <arnez@linux.vnet.ibm.com>
* objc-lang.c (uniquify_strings): Prevent invoking qsort with
NULL.
* dwarf2read.c (read_index_from_section): Update comment.
(struct dw2_symtab_iterator): New member global_seen.
(dw2_symtab_iter_init): Initialize it.
(dw2_symtab_iter_next): Skip duplicate global symbols.
(dw2_expand_symtabs_matching): Ditto.
gdb/doc/ChangeLog:
* gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
(Ada Exceptions): New node.
(GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
Commands" node.
(GDB/MI Ada Exceptions Commands): New node.
(GDB/MI Miscellaneous Commands): Document new "info-ada-exceptions"
field in the output of the "-list-features" command.
* NEWS: Add entry for the new "info exceptions" CLI command,
and for the new "-info-ada-exceptions" GDB/MI command.
This patch implements a new GDB/MI command implementing the equivalent
of the "info exceptions" CLI command. The command syntax is:
-info-ada-exceptions [REGEXP]
Here is an example of usage (slightly formatted by hand to make it
easier to read):
-info-ada-exceptions ions\.a_
^done,ada-exceptions=
{nr_rows="2",nr_cols="2",
hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
{width="1",alignment="-1",col_name="address",colhdr="Address"}],
body=[{name="global_exceptions.a_global_exception",
address="0x0000000000613a80"},
{name="global_exceptions.a_private_exception",
address="0x0000000000613ac0"}]}
Also, in order to allow graphical frontends to easily determine
whether this command is available or not, the output of the
"-list-features" command has been augmented to contain
"info-ada-exceptions".
gdb/Changelog:
* mi/mi-cmds.h (mi_cmd_info_ada_exceptions): Add declaration.
* mi/mi-cmds.c (mi_cmds): Add entry for -info-ada-exceptions
command.
* mi/mi-cmd-info.c: #include "ada-lang.c" and "arch-utils.c".
(mi_cmd_info_ada_exceptions): New function.
* mi/mi-main.c (mi_cmd_list_features): Add "info-ada-exceptions".
gdb/testsuite/ChangeLog:
* gdb.ada/mi_exc_info: New testcase.
This patch adds a new command "info exceptions" whose purpose is to
provide the list of exceptions currently defined in the inferior.
The usage is:
(gdb) info exceptions [REGEXP]
Without argument, the command lists all exceptions. Otherwise,
only those whose name match REGEXP are listed.
For instance:
(gdb) info exceptions
All defined Ada exceptions:
constraint_error: 0x613dc0
program_error: 0x613d40
storage_error: 0x613d00
tasking_error: 0x613cc0
global_exceptions.a_global_exception: 0x613a80
global_exceptions.a_private_exception: 0x613ac0
The name of the command, as well as its output is part of a legacy
I inherited long ago. It's output being parsed by frontends such as
GPS, I cannot easily change it. Same for the command name.
The implementation is mostly self-contained, and is written in a way
that should make it easy to implement the GDB/MI equivalent. The
careful reviewer will notice that the code added in ada-lang.h could
normally be made private inside ada-lang.c. But these will be used
by the GDB/MI implementation. Rather than making those private now,
only to move them later, I've made them public right away.
gdb/ChangeLog:
* ada-lang.h: #include "vec.h".
(struct ada_exc_info): New.
(ada_exc_info): New typedef.
(DEF_VEC_O(ada_exc_info)): New vector.
(ada_exceptions_list): Add declaration.
* ada-lang.c (ada_is_exception_sym)
(ada_is_non_standard_exception_sym, compare_ada_exception_info)
(sort_remove_dups_ada_exceptions_list)
(ada_exc_search_name_matches, ada_add_standard_exceptions)
(ada_add_exceptions_from_frame, ada_add_global_exceptions)
(ada_exceptions_list_1, ada_exceptions_list)
(info_exceptions_command): New function.
(_initialize_ada_language): Add "info exception" command.
gdb/testsuite/ChangeLog:
* gdb.ada/info_exc: New testcase.
When using the GDB/MI commands to insert a catchpoint on a specific
Ada exception, any re-evaluation of that catchpoint (for instance
a re-evaluation performed after a shared library got mapped by the
inferior) fails. For instance, with any Ada program:
(gdb)
-catch-exception -e program_error
^done,bkptno="1",bkpt={[...]}
(gdb)
-exec-run
=thread-group-started,id="i1",pid="28315"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,[...]
&"warning: failed to reevaluate internal exception condition for catchpoint 1: No definition of \"exec\" in current context.\n"
&"warning: failed to reevaluate internal exception condition for catchpoint 1: No definition of \"exec\" in current context.\n"
[...]
The same is true if using an Ada exception catchpoint.
The problem comes from the fact that that we deallocate the strings
given as arguments to create_ada_exception_catchpoint, while the latter
just makes shallow copies of those strings, thus creating dandling
pointers.
This patch fixes the issue by passing freshly allocated strings to
create_ada_exception_catchpoint, while at the same time updating
create_ada_exception_catchpoint's documentation to make it clear
that deallocating the strings is no longer the responsibility of
the caller.
gdb/ChangeLog:
* ada-lang.c (create_ada_exception_catchpoint): Enhance
the documentation of fields "except_string" and "condition".
* mi/mi-cmd-catch.c (mi_cmd_catch_assert): Reallocate
CONDITION on the heap before passing it to
create_ada_exception_catchpoint.
(mi_cmd_catch_exception): Likewise for EXCEPTION_NAME and
CONDITION.
gdb/testsuite/ChangeLog:
* gdb.ada/mi_ex_cond: New testcase.
Tested on x86_64-linux. The "-break-list" test FAILs without
this patch.
An earlier patch removed the check for "syscall" since the results
were not used in the C code. However, the result was used, via the
cache variable, elsewhere in configure.
This patch fixes the problem by checking for "syscall" at the point at
which HAVE_TKILL_SYSCALL is defined.
2013-11-11 Tom Tromey <tromey@redhat.com>
* config.in, configure: Rebuild.
* configure.ac (HAVE_TKILL_SYSCALL): Check for "syscall".
* dwarf2read.c (dwarf2_read_debug): Change to unsigned int.
(create_debug_types_hash_table): Only print debugging messages for
each TU if dwarf2-read >= 2.
(process_queue): Ditto.
(_initialize_dwarf2_read): Make "set debug dwarf2-read" a zuinteger.
Update doc string.
doc/
* gdb.texinfo (Debugging Output): Update text for
"set debug dwarf2-read".
My grepping around showed that HAVE_MULTIPLE_PROC_FDS is only ever
mentioned in a comment in configure.ac. Since the macro is long dead,
let's remove the last mention.
2013-11-08 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Remove mentions of HAVE_MULTIPLE_PROC_FDS.
Now that the configury needed for the "common" and "target"
directories is in common.m4, some code in gdb's configure.ac is
redundant.
I ran this script after making an "ID" file using mkid:
sed -n 's/^.*\(HAVE_[A-Z0-9_]*\).*$/\1/p' config.in |
while read x; do
echo ===== $x
gid $x | egrep -v '^(testsuite|gnulib|common|target|gdbserver)/'
done
This finds all the spots using HAVE_ defines, and, more importantly,
makes it clear which defines aren't used in the main parts of gdb.
From this I came up with this patch to remove all the unused bits.
There are a few that are subtly used -- for example the configure
script sometimes checks internal configure cache variables, meaning
some checks cannot be removed.
2013-11-08 Tom Tromey <tromey@redhat.com>
* configure, config.in: Rebuild.
* configure.ac: Remove unused configury.
m32c-tdep.c is the last user of HAVE_STRING_H in gdb proper. It
really ought to be using gdb_string.h instead, as the rest of gdb
does.
2013-11-08 Tom Tromey <tromey@redhat.com>
* m32c-tdep.c: Use gdb_string.h.
The removal of solib-sunos.c also removed the last user of various
macros defined by configure.
This patch removes the corresponding configure code.
2013-11-08 Tom Tromey <tromey@redhat.com>
* configure, config.in: Rebuild.
* configure.ac: Remove all link.h-related checks.
It has bothered me for a while that files in common/ use macros
defined via autoconf checks, but rely on each configure.ac doing the
proper checks independently.
This patch introduces common/common.m4 which consolidates the checks
assumed by code in common.
The rule I propose is that if something is needed or used by common,
it should be checked for by common.m4. However, if the check is also
needed by gdb or gdbserver, then it should be duplicated there.
Built and regtested on x86-64 Fedora 18 (though this is hardly the
most strenuous case) and using the Fedora 18 mingw cross compilers. I
also examined the config.in diffs to ensure that symbols did not go
missing.
2013-11-08 Tom Tromey <tromey@redhat.com>
* acinclude.m4: Include common.m4.
* common/common.m4: New file.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.
2013-11-08 Tom Tromey <tromey@redhat.com>
* acinclude.m4: Include common.m4, codeset.m4.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.
This patch constifies the target_ops method to_detach.
This is a small cleanup, but also, I think, a bug-prevention fix,
since gdb already acts as if the "args" argument here was const.
In particular, top.c:quit_force calls kill_or_detach via
iterate_over_inferiors. kill_or_detach calls target_detach, passing
the same argument each time. So, if one of these methods was not
const-correct, then kill_or_detach would change its behavior in a
strange way.
I could not build every target I modified in this patch. I've
inspected them all by hand, though. Many targets do not use the
"args" parameter; a couple pass it to atoi; and a few pass it on to
the to_detach method of the target beneath. The only code that
required a real change was in linux-nat.c, and that only needed the
introduction of a temporary variable for const-correctness.
2013-11-08 Tom Tromey <tromey@redhat.com>
* aix-thread.c (aix_thread_detach): Update.
* corelow.c (core_detach): Update.
* darwin-nat.c (darwin_detach): Update.
* dec-thread.c (dec_thread_detach): Update.
* gnu-nat.c (gnu_detach): Update.
* go32-nat.c (go32_detach): Update.
* inf-ptrace.c (inf_ptrace_detach): Update.
* inf-ttrace.c (inf_ttrace_detach): Update.
* linux-fork.c (linux_fork_detach): Update.
* linux-fork.h (linux_fork_detach): Update.
* linux-nat.c (linux_nat_detach): Update. Introduce "tem"
local for const-correctness.
* linux-thread-db.c (thread_db_detach): Update.
* monitor.c (monitor_detach): Update.
* nto-procfs.c (procfs_detach): Update.
* procfs.c (procfs_detach): Update.
* record.c (record_detach): Update.
* record.h (record_detach): Update.
* remote-m32r-sdi.c (m32r_detach): Update.
* remote-mips.c (mips_detach): Update.
* remote-sim.c (gdbsim_detach): Update.
* remote.c (remote_detach_1, remote_detach)
(extended_remote_detach): Update.
* sol-thread.c (sol_thread_detach): Update.
* target.c (target_detach): Make "args" const.
(init_dummy_target): Update.
* target.h (struct target_ops) <to_detach>: Make argument const.
(target_detach): Likewise.
* windows-nat.c (windows_detach): Update.
* python/py-breakpoint.c (bppy_get_temporary): New function.
(bppy_init): New keyword: temporary. Parse it and set breakpoint
to temporary if True.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add temporary breakpoint tests.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Document temporary
option in breakpoint constructor, and add documentation to the
temporary attribute.
This patch does some cleanups, removing some language-related stuff.
Note that mi_cmd_var_info_expression uses varobj_language_string,
which is redundant, because we can get language name from
lang->la_natural_name.
varobj_language_string doesn't have "Ada", which looks like a bug to
me. With this patch applied, this problem doesn't exist, because the
language name is got from the same place (field la_natural_name).
gdb:
2013-11-07 Yao Qi <yao@codesourcery.com>
* mi/mi-cmd-var.c: Include "language.h".
(mi_cmd_var_info_expression): Get language name from
language_defn.
* varobj.c (varobj_language_string): Remove.
(variable_language): Remove declaration.
(languages): Remove.
(varobj_get_language): Change the type of return value.
(variable_language): Remove.
* varobj.h (enum varobj_languages): Remove.
(varobj_language_string): Remove declaration.
(varobj_get_language): Update declaration.
gdb/doc:
2013-11-07 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Update doc about the
output of "-var-info-expression".
Hi,
When I add another name of language, I find field 'la_name' can be
'const char *'. This patch is to constify it.
gdb:
2013-11-07 Yao Qi <yao@codesourcery.com>
* language.c (language_str): Return const char *.
(add_language): Add const to 'language_names'
* language.h (struct language_defn) <la_name>: Add const.
(language_str: Update declaration.
When checking for the presence of the TDB regset, the current code
interprets ENODATA from PTRACE_GETREGSET as an indication that the TDB
regset *could* occur on this system, but the inferior stopped outside
a transaction. However, the Linux kernel actually reports ENODATA
even on systems without the transactional execution facility. Thus
the logic is now changed to check the TE field in the HWCAP as well.
This version also checks the existence of the TDB regset -- just to be
on the safe side when running on TE-enabled hardware with a kernel
that does not offer the TDB regset for some reason.
gdb/
* s390-linux-nat.c (s390_read_description): Consider the TE field
in the HWCAP for determining 'have_regset_tdb'.
gdbserver/
* linux-s390-low.c (HWCAP_S390_TE): New define.
(s390_arch_setup): Consider the TE field in the HWCAP for
determining 'have_regset_tdb'.
When reading objects with corrupt debug information it is possible that
the sibling chain can form a loop, which leads to an infinite loop and
memory exhaustion.
Avoid this situation by disregarding and DW_AT_sibling values that point
to a lower address than the current entry.
gdb/ChangeLog:
2013-11-06 Will Newton <will.newton@linaro.org>
PR gdb/12866
* dwarf2read.c (skip_one_die): Sanity check DW_AT_sibling
values. (read_partial_die): Likewise.
When Bash is started non-interactively, it runs the script pointed by
the BASH_ENV environment variable, not .bashrc. While at it, mention
Z shell in the warning too, and mention non-interactive mode
explicitly.
gdb/doc/
2013-11-06 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Starting) <set/show startup-with-shell>: Mention
non-interactive mode.
(Environment) <shell startup files warning>: Mention
non-interactive mode. Mention .zshenv for Z shell, and talk about
BASH_ENV instead of .bashrc for BASH.
This patch is to add a test case to on the performance of GDB handling
load and unload of shared library.
In V4:
- Handle malloc and dlopen failure,
- Document test parameters.
In V3, there are some changes,
- Adapt to perf test framework changes.
- Measure load and unload separately.
In V2, there are some changes,
- A new proc gdb_produce_source to produce source files. I tried to
move all source file generation code out of solib.exp, but
compilation step still needs to know the generated file names. I
have to hard-code the file names in compilation step, which is not
good to me, so I give up on this moving.
- SOLIB_NUMBER -> SOLIB_COUNT
- New variable SOLIB_DLCLOSE_REVERSED_ORDER to control the order of
iterating a list of shared libs to dlclose them.
- New variable GDB_PERFORMANCE to enable these perf test cases.
- Remove dlsym call in solib.c.
- Update solib.py for the updated framework.
gdb/testsuite/
* lib/gdb.exp (gdb_produce_source): New procedure.
* gdb.perf/solib.c: New.
* gdb.perf/solib.exp: New.
* gdb.perf/solib.py: New.
This patch adds a basic framework to do performance testing for GDB.
perftest.py is about the test case, testresult.py is about test
results, and how are they saved. reporter.py is about how results
are reported (in what format). measure.py is about measuring the
execution of tests by a collection of measurements.
In V5:
- Simplify perftest.exp.
In V4:
- Rename MeasurementCPUTime to MeasurementCpuTime,
- Add 'pass' in empty method,
- Simplify string comparison in perftest.exp.
- Rename GDB_PERFORMANCE to GDB_PERFTEST_MODE and rename
GDB_PERFORMANCE_TIMEOUT to GDB_PERFTEST_TIMEOUT.
In V3, there are some changes,
- Add wall time measurement, cpu time measurement and vmsize
measurement.
- Rename SingleStatisticTestCase to TestCaseWithBasicMeasurements,
which measures cpu time, wall time, and memory (vmsize).
- GDB_PERFORMANCE=run|compile|both to control the mode of perf
testing.
- New GDB_PERFORMANCE_TIMEOUT to specify the timeout.
- Split proc prepare to proc compile and startup.
- Disable GC while doing measurements.
In V2, there are several changes to address Doug and Sanimir's
comments.
- Add copyright header and docstring in perftest/__init__.py
- Remove config.py.
- Fix docstring format.
- Rename classes "SingleVariable" to "SingleStatistic".
- Don't extend gdb.Function in class TestCase. Add a new method run
to run the test case so that we can pass parameters to test.
- Allow to customize whether to warm up and to append test log.
- Move time measurement into test harness. Add a new class
Measurement for a specific measurement and a new class Measure to
measure them for a given test case.
- A new class ResultFactory to create instances of TestResult.
- New file lib/perftest.exp, which is to do some preparations and
cleanups to simplify each *.exp file.
- Skip compilation step if GDB_PERFORMANCE_SKIP_COMPILE is set.
gdb/testsuite/
2013-11-06 Yao Qi <yao@codesourcery.com>
* lib/perftest.exp: New.
* gdb.perf/lib/perftest/__init__.py: New.
* gdb.perf/lib/perftest/measure.py: New.
* gdb.perf/lib/perftest/perftest.py: New.
* gdb.perf/lib/perftest/reporter.py: New.
* gdb.perf/lib/perftest/testresult.py: New.
We add a new dir gdb.perf in testsuite for all performance tests.
However, current 'make check' logic will either run dejagnu in
directory testsuite or iterate all gdb.* directories which has *.exp
files. Both of them will run tests in gdb.perf. We want to achieve:
1) typical 'make check' should not run performance tests. In each perf
test case, GDB_PERFTEST_MODE is checked. If it doesn't exist, return.
2) run perf tests easily. We add a new makefile target 'check-perf'.
gdb:
2013-11-06 Yao Qi <yao@codesourcery.com>
* Makefile.in (check-perf): New target.
gdb/testsuite:
2013-11-06 Yao Qi <yao@codesourcery.com>
* Makefile.in (check-perf): New target.
* configure.ac (AC_OUTPUT): Output Makefile in gdb.perf.
* configure: Re-generated.
* gdb.perf/Makefile.in: New.
This switches "make check" to fully parallel mode.
One primary issue facing full parallelization is the overhead of
"runtest". On my machine, if I "touch gdb.base/empty.exp", making a
new file, and then "time runtest.exp", it takes 0.08 seconds.
Multiply this by the 1008 (in my configuration) tests and you get ~80
seconds. This is the overhead that would theoretically be present if
all tests were run in parallel.
However, the problem isn't nearly as bad as this, for two reasons.
First, you must divide by the number of jobs, assuming perfect
parallelization -- reasonably true for small -j numbers, based on the
results I see.
Second, the current test suite parallelization approach bundles the
tests, largely by directory, but also splitting up gdb.base into two
halves.
I was curious to see how the current bundling played out in practice,
so I ran "make -j1 check RUNTEST='/bin/time runtest'". This invokes
the parallel mode (thus the bundling) and then shows the time taken by
each invocation of runtest.
Then, I ran "/bin/time make -j3 check". (See below about -j2.)
The time for the entire -j3 test run was the same as the time for
"gdb.base1". What this means is that gdb.base1 is currently the
time-limiting run, preventing further parallelization gains.
So, I reason, whatever overhead we see from full parallelization will
only be seen by "-j1" and "-j2".
I then tried a -j2 test run. This does take longer than a -j3 build,
meaning that the gdb.base1 job finishes and then proceeds to other
runtest invocations.
Finally I tried a -j2 test run with the appended patch.
This was 9% slower than the -j2 run without the patch.
I think that is a reasonable slowdown for what is probably a rare
case. I believe this patch will yield faster test results for all -j
values greater than 2. For -j3 on my machine, the test suite is a few
seconds faster; I didn't try any larger -j values.
For -j1, I went ahead and changed the Makefile so that, if no -j
option is given, then the "check-single" mode is used. You can still
use "make -j1 check" to get single-job parallel-mode, though of course
there's no good reason to do so.
This change is likely to speed up the plain "make check" scenario a
little as we will now bypass dg-extract-results.sh.
One drawback of this change is that "make -jN check" is now much more
verbose. I generally only look at the .sum and .log files, but
perhaps this will bother some.
Another interesting question is scalability of the result. The
slowest test, which limits the scalability, took 80.78 seconds. The
mean of the remaining tests is 1.08 seconds. (Note that this is just
a rough estimate, since there are still outliers.)
This means we can run 80.78 / 1.08 =~ 74 tests in the time available.
And, in this data set (slightly older than the above, but materially
the same) there were 948 tests. So, I think the current test suite
should scale ok up to about -j12.
We could improve this number if need be by breaking up the biggest
tests.
2013-11-04 Tom Tromey <tromey@redhat.com>
* Makefile.in (TEST_DIRS): Remove.
(TEST_TARGETS, check-parallel): Rewrite.
(check-gdb.%, BASE1_FILES, BASE2_FILES, check-gdb.base%)
(subdir_do, subdirs): Remove.
(do-check-parallel, check/%): New targets.
(clean): Remove outputs, temp, and cache directories.
(saw_dash_j): New variable.
(CHECK_TARGET): Use it.
(check): Depend on all, site.exp. Rewrite.
(check-single): Remove dependencies.
(slow_tests, all_tests, reordered_tests): New variables.
A couple of Fission tests rely on the current directory layout. This
assumption is not valid in parallel mode.
This patch fixes the problem by removing the relative directory from
the .S files and instead having the tests set debug-file-directory
before opening the main file.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/fission-base.S: Remove "gdb.dwarf/".
* gdb.dwarf2/fission-base.exp: Set debug-file-directory
before loading binfile.
* gdb.dwarf2/fission-loclists.S: Remove "gdb.dwarf/".
* gdb.dwarf2/fission-loclists.exp: Set debug-file-directory
before loading binfile.
A few tests run an inferior that execs some other program. The name
of this exec'd program is compiled in. These tests assume the current
test suite directory layout, but fail in parallel mode.
This patch fixes these tests by letting the .exp files pass in the
directory names at compile time.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/foll-exec.c (main): Use BASEDIR.
* gdb.base/foll-exec.exp: Define BASEDIR during compilation.
* gdb.base/foll-vfork.c (main): Use BASEDIR.
* gdb.base/foll-vfork.exp: Define BASEDIR during compilation.
* gdb.multi/bkpt-multi-exec.c (main): Use BASEDIR.
* gdb.multi/bkpt-multi-exec.exp: Define BASEDIR during compilation.
argv0-symlink.exp doesn't work properly if standard_output_file puts
files into a per-test subdirectory. That's because it assumes that
files appear in $subdir, which is no longer true.
This patch fixes the problem by computing the correct directory at
runtime.
Tested both with and without GDB_PARALLEL on x86-64 Fedora 18.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/argv0-symlink.exp: Compute executable's directory
dynamically.
This introduces a new relative_filename proc to gdb.exp and changes
some tests to use it. This helps make these tests parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/fullname.exp: Use standard_output_file,
relative_filename.
* gdb.base/hashline1.exp: Use standard_testfile,
standard_output_file, relative_filename, clean_restart.
* gdb.base/hashline2.exp: Use standard_testfile,
standard_output_file.
* gdb.base/hashline3.exp: Use standard_testfile,
standard_output_file, relative_filename.
* lib/gdb.exp (relative_filename): New proc.
This updates the fileio test to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/fileio.c (test_open, test_write, test_read)
(test_lseek, test_close, test_stat, test_fstat)
(test_isatty, test_system, test_rename, test_unlink):
Use OUTDIR define.
* gdb.base/fileio.exp: Define OUTDIR during compilation.
Use standard_output_file.
This fixes the "checkpoint" test to use the standard output directory.
This makes the test be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/checkpoint.c (main): Use PI_TXT and COPY1_TXT
defines.
* gdb.base/checkpoint.exp: Define PI_TXT and COPY1_TXT during
compilation. Use prepare_for_testing, standard_output_file.
This makes more changes in gdb.base to make it parallel-safe. I think
the changes in this particular patch are relatively straightforward,
so I've grouped them all together.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/advance.exp: Use standard_testfile and
prepare_for_testing.
* gdb.base/bigcore.exp: Use standard_output_file. "cd" to
appropriate directory when local.
* gdb.base/dump.exp: Use standard_output_file. Update all
"dump" and "restore" filenames.
* gdb.base/interact.exp: Use standard_output_file.
* gdb.base/jit-so.exp: Don't download file when local.
* gdb.base/jit.exp (compile_jit_test): Don't download file
when local.
* gdb.base/list.exp: Use gdb_remote_download.
* gdb.base/maint.exp: Use standard_output_file.
* gdb.base/prelink.exp: Use standard_output_file.
* gdb.base/save-bp.exp: Use standard_output_file.
* gdb.base/sepdebug.exp: Use standard_testfile,
standard_output_file.
(test_different_dir): Don't declare objdir.
* gdb.base/solib-search.exp: Use standard_output_file.
* gdb.base/step-line.exp: Use gdb_remote_download.
* gdb.base/trace-commands.exp: Use standard_output_file.
This fixes gdb.trace to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.trace/mi-traceframe-changed.exp: Pass -DTFILE_DIR
to compilation. Use standard_output_file.
(test_tfind_tfile): Update.
* gdb.trace/tfile.c (write_basic_trace_file)
(write_error_trace_file): Use TFILE_DIR.
* gdb.trace/tfile.exp: Pass -DTFILE_DIR to compilation. Use
standard_output_file.
This fixes gdb.mi to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed):
Use "dwarf2 always-disassemble" for the "maint set" test.
* gdb.mi/mi-file-transfer.exp (test_file_transfer): Use
standard_output_file.
* gdb.mi/mi-logging.exp: Use standard_output_file.
This fixes the gdb.xml tests to be parallel-safe.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.xml/tdesc-arch.exp: Use standard_output_file. Make
downloads conditional on remote host.
(set_arch): Likewise.
* gdb.xml/tdesc-regs.exp: Use gdb_remote_download.
(load_description): Use standard_output_file.
This fixes the gdb.gdb tests to be parallel-safe, by ensuring that the
new "xgdb" file ends up in the standard output directory during the
tests.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.gdb/selftest.exp: Use standard_output_file.
* lib/selftest-support.exp (do_self_tests): Use
standard_output_file.
This fixes up gdb.stabs/weird.exp for parallel testing. This just
means using gdb_remote_download and standard_output_file, so that the
tests end up in the right place.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.stabs/weird.exp: Use gdb_remote_download and
standard_output_file.
This fixes some parallelization thinkos from a while ago. I'm not
sure how the problems ever slipped through. In addition to a thinko
fix in twice.exp, this also finishes fixing it up for parallelization.
2013-11-04 Tom Tromey <tromey@redhat.com>
* gdb.base/gcore-buffer-overflow.exp: Use
standard_output_file, not standard_testfile.
* gdb.base/twice.exp: Use standard_testfile, not
standard_output_file. Use gdb_remote_download.
Currently a proc in gdb.exp toggles the expect (and thus dejagnu)
logging. This is not a super idea, but it is there to avoid putting
some preprocessor output into the log.
In the right circumstances, this can result in the log file being
mysteriously truncated. I think this happens because it doesn't
necessarily write to the correct log file again.
The fix is to use "log_file -info" to save the previous log file.
2013-11-04 Tom Tromey <tromey@redhat.com>
* lib/gdb.exp (get_compiler_info): Use log_file -info and
restore from that.
I noticed a large (100MB) restore took hours to complete. The problem
is memory_xfer_partial repeatedly mallocs and memcpys the entire
100MB buffer for breakpoint shadow handling only to find a small
portion of it is actually written.
The testcase that originally took hours now takes 50 seconds.
gdb/
2013-07-29 Anton Blanchard <anton@samba.org>
* target.c (memory_xfer_partial): Cap write to 4KB.
As discussed on the GDB ML[1], libc probes for longjmp were not being
loaded if a custom <arch>_get_longjmp_target function was not
implemented.
This is trivially fixed by moving the 'if (!gdbarch_get_longjmp_target_p
(gdbarch))' down, just bellow libc probe code and above the per-objfile
cache lookup.
While the condition could also be removed altogether with no
side-effects, it is in fact an optimization to avoid searching for
symbols if the arch doesn't provide support for get_longjmp_target().
This has been tested on PPC and PPC64.
[1] https://sourceware.org/ml/gdb/2013-10/msg00191.html
gdb/
2013-11-01 Tiago Stürmer Daitx <tdaitx@linux.vnet.ibm.com>
* breakpoint.c (create_longjmp_master_breakpoint): Allow libc
probe scan even when the arch provides no get_longjmp_target.
IMO, it doesn't make sense to map random syscall, fork, etc. events to
GDB_SIGNAL_TRAP, and possible have the debuggee see that trap. This
just seems conceptually wrong to me - these aren't real signals a
debuggee would ever see. In fact, when stopped for those events, on
Linux, the debuggee isn't in a signal-stop -- there's no way to
resume-and-deliver-signal at that point, for example. E.g., when
stopped at a fork event:
(gdb) catch fork
Catchpoint 2 (fork)
(gdb) c
Continuing.
Catchpoint 2 (forked process 4570), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb) set debug infrun 1
(gdb) signal SIGTRAP
Continuing with signal SIGTRAP.
infrun: clear_proceed_status_thread (process 4566)
infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0)
infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4566] at 0x323d4ba7c4
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 4566 [process 4566],
infrun: status->kind = exited, status = 0
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_EXITED
[Inferior 1 (process 4566) exited normally]
infrun: stop_stepping
(gdb)
Note the signal went nowhere. It was swallowed.
Resuming with a SIGTRAP from a syscall event does queue the signal,
but doesn't deliver it immediately, like "signal SIGTRAP" from a real
signal would. It's still an artificial SIGTRAP:
(gdb) catch syscall
Catchpoint 2 (any syscall)
(gdb) c
Continuing.
Catchpoint 2 (call to syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb) set debug infrun 1
(gdb) signal SIGTRAP
Continuing with signal SIGTRAP.
infrun: clear_proceed_status_thread (process 4622)
infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0)
infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 4622 [process 4622],
infrun: status->kind = exited syscall
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_SYSCALL_RETURN
infrun: syscall number = '56'
infrun: BPSTAT_WHAT_STOP_NOISY
infrun: stop_stepping
Catchpoint 2 (returned from syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (process 4622)
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0)
infrun: resume (step=0, signal=0), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun: 4622 [process 4622],
infrun: status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x323d4ba7c4
infrun: random signal 5
Program received signal SIGTRAP, Trace/breakpoint trap.
infrun: stop_stepping
0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131
131 pid = ARCH_FORK ();
(gdb)
In all the above, I used 'signal SIGTRAP' to emulate 'handle SIGTRAP
pass'. As described in "keep_going", 'handle SIGTRAP pass' does have
its place:
/* Do not deliver GDB_SIGNAL_TRAP (except when the user
explicitly specifies that such a signal should be delivered
to the target program). Typically, that would occur when a
user is debugging a target monitor on a simulator: the target
monitor sets a breakpoint; the simulator encounters this
breakpoint and halts the simulation handing control to GDB;
GDB, noting that the stop address doesn't map to any known
breakpoint, returns control back to the simulator; the
simulator then delivers the hardware equivalent of a
GDB_SIGNAL_TRAP to the program being debugged. */
... and I've made use of that myself when implementing/debugging
stubs/monitors. But in these cases, treating these events as SIGTRAP
possibly injects signals in the debuggee they'd never see otherwise,
because you need to use ptrace to enable these special events, which
aren't real signals.
There's more. Take this bit of handle_inferior_event, where we
determine whether a real signal (TARGET_WAITKIND_STOPPED) was random
or not:
if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP)
ecs->random_signal
= !((bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
GDB_SIGNAL_TRAP)
!= BPSTAT_SIGNAL_NO)
|| stopped_by_watchpoint
|| ecs->event_thread->control.trap_expected
|| (ecs->event_thread->control.step_range_end
&& (ecs->event_thread->control.step_resume_breakpoint
== NULL)));
else
{
enum bpstat_signal_value sval;
sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
ecs->event_thread->suspend.stop_signal);
ecs->random_signal = (sval == BPSTAT_SIGNAL_NO);
if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP;
}
Note that the
if (sval == BPSTAT_SIGNAL_HIDE)
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP;
bit is only reacheable for signals != GDB_SIGNAL_TRAP. AFAICS, sval
can only be BPSTAT_SIGNAL_HIDE if nothing in the bpstat returns
BPSTAT_SIGNAL_PASS. So that excludes a "catch signal" for the signal
in question in the bpstat. All other catchpoints that aren't based on
breakpoints behind the scenes call process_event_stop_test directly
(don't pass through here) (well, almost all: TARGET_WAITKIND_LOADED
does have a fall through, but only for STOP_QUIETLY or
STOP_QUIETLY_NO_SIGSTOP, which still return before this code is
reached). Catchpoints that are implemented as breakpoints behind the
scenes can only appear in the bpstat if the signal was GDB_SIGNAL_TRAP
(bkpt_breakpoint_hit returns false otherwise). So that leaves a
target reporting a hardware watchpoint hit with a signal other than
GDB_SIGNAL_TRAP. And even then it looks quite wrong to me to
magically convert the signal into a GDB_SIGNAL_TRAP here too -- if the
user has set SIGTRAP to "handle pass", the program will see a trap
that gdb invented, not one the program would ever see without gdb in
the picture.
Tested on x86_64 Fedora 17.
gdb/
2013-10-31 Pedro Alves <palves@redhat.com>
* infrun.c (handle_syscall_event): Don't set or clear stop_signal.
(handle_inferior_event) <TARGET_WAITKIND_FORKED,
TARGET_WAITKIND_VFORKED>: Don't set stop_signal to
GDB_SIGNAL_TRAP, or clear it. Pass GDB_SIGNAL_0 to
bpstat_explains signal, instead of GDB_SIGNAL_TRAP.
<bpstat handling>: If the bpstat chain wants the signal to be
hidden, then set stop_signal to GDB_SIGNAL_0 instead of
GDB_SIGNAL_TRAP.
Correct the patterns in the gdb_test_multiple invocation.
testsuite/
2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.arch/s390-multiarch.exp (test_linux_v2): Add $gdb_prompt to
the patterns in gdb_test_multiple.
As suggested before, rename the S/390-related source files (tdep and nat)
such that "-linux-" occurs in the file name, like with other GNU/Linux
targets. Since no other operating system is currently supported by GDB
on this architecture, this isn't strictly necessary. But the old names
sometimes caused GDB contributors to miss these files when performing a
change that affects all GNU/Linux targets. The latest such incident was
observed here:
https://sourceware.org/ml/gdb-patches/2013-09/msg00619.html
gdb/
2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* s390-tdep.h: Rename to...
* s390-linux-tdep.h: ...here.
* s390-tdep.c: Rename to...
* s390-linux-tdep.c: ...here. Adjust #include.
* s390-nat.c: Rename to...
* s390-linux-nat.c: ...here. Adjust #include.
* config/s390/s390.mh: Rename to...
* config/s390/linux.mh: ...here. Reflect rename s390-nat.o ->
s390-linux-nat.o.
* configure.host: Reflect host rename "s390" -> "linux".
* configure.tgt: Reflect rename s390-tdep.o -> s390-linux-tdep.o.
* Makefile.in (ALL_TARGET_OBS): Likewise.
(HFILES_NO_SRCDIR): Reflect rename s390-tdep.h ->
s390-linux-tdep.h.
(ALLDEPFILES): Reflect rename of .c files.
gdb/
2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* s390-nat.c: Whitespace cleanup.
* s390-tdep.c: Likewise.
* s390-tdep.h: Remove empty line at end of file.
I tried to build gdb on the AIX machine in the GCC compile farm
(gcc111), but it failed in a couple of spots because gdb uses "reg" as
a variable name and the AIX <curses.h> defines "reg" to "register".
I saw that we already had a workaround for this lurking in utils.c, so
I just moved that to gdb_curses.h.
This fixed the problem on AIX and still builds on x86-64 Fedora 18.
2013-10-29 Tom Tromey <tromey@redhat.com>
* utils.c (reg): Move undefinition...
* gdb_curses.h: ... here. Update comment to mention AIX.
These references to ChangeLog-mi are stale.
testsuite/gdb.mi/ChangeLog-mi doesn't exist anymore, since:
...
commit 2dd627049d
Author: Andrew Cagney <cagney@redhat.com>
Date: Sat Jun 23 21:47:09 2001 +0000
Rename gdb.mi/ChangeLog-mi to gdb.mi/ChangeLog. Update everything.
...
commit 48efe7049b
Author: Andrew Cagney <cagney@redhat.com>
Date: Mon Jan 12 15:16:44 2004 +0000
Eliminate the old mi/tui specific ChangeLog files as in ...
Added Files:
mi/ChangeLog-1999-2003 testsuite/gdb.mi/ChangeLog-1999-2003
tui/ChangeLog-1998-2003
Removed Files:
mi/ChangeLog testsuite/gdb.mi/ChangeLog tui/ChangeLog
Tested with 'make check RUNTESTFLAGS="--directory=gdb.mi"' on x86_64 Fedora 17.
gdb/testsuite/
2013-10-29 Pedro Alves <palves@redhat.com>
* gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs
variable setting change-log-default-name to ChangeLog-mi.
https://sourceware.org/ml/gdb-patches/2013-08/msg00171.html
gdb/ChangeLog
* infcmd.c (default_print_one_register_info): Use val_print to
print all values even optimized out or unavailable ones. Don't
try to print a raw form of optimized out or unavailable values.
gdb/testsuite/ChangeLog
* gdb.trace/unavailable.exp (gdb_unavailable_registers_test):
Expect <unavailable> pattern.
This test exercises the commands 'add-symbol-file'
and 'remove-symbol-file'.
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com>
gdb/testsuite
* gdb.base/sym-file-lib.c: New file.
* gdb.base/sym-file-loader.c: New file.
* gdb.base/sym-file-loader.h: New file.
* gdb.base/sym-file-main.c: New file.
* gdb.base/sym-file.exp: New file.
Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com>
gdb/testsuite
* lib/gdb.exp (is_elf_target): New function.
Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
Add the sections of the symbol files that are provided via
'add-symbol-file' to the set of current target sections.
User-added sections are removed upon notification of free_objfile
when their corresponding object file is deleted.
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com>
* exec.h (add_target_sections_of_objfile): New declaration.
* exec.c (add_target_sections_of_objfile): New function.
* symfile.c (add_symbol_file_command): Update current target sections.
(symfile_free_objfile): New function.
(_initialize_symfile): Register observer for free_objfile events.
Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com>
* NEWS: Add description of the remove-symbol-file command.
gdb/doc
* gdb.texinfo (Commands to Specify Files): Add description
of the remove-symbol-file command.
Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
New command for removing symbol files added via
the add-symbol-file command.
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com>
* breakpoint.c (disable_breakpoints_in_freed_objfile): New function.
* objfiles.c (free_objfile): Notify free_objfile.
(is_addr_in_objfile): New function.
* objfiles.h (is_addr_in_objfile): New declaration.
* printcmd.c (clear_dangling_display_expressions): Act upon free_objfile
events instead of solib_unloaded events.
(_initialize_printcmd): Register observer for free_objfile instead
of solib_unloaded notifications.
* solib.c (remove_user_added_objfile): New function.
* symfile.c (remove_symbol_file_command): New command.
(_initialize_symfile): Add remove-symbol-file.
gdb/doc
* observer.texi: New free_objfile event.
Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
In registry.c:registry_clear_data, the registered data is iterated and
invoke each 'free' function with the data passed:
for (registration = data_registry->registrations, i = 0;
i < fields->num_data;
registration = registration->next, i++)
if (fields->data[i] != NULL && registration->data->free != NULL)
adaptor (registration->data->free, container, fields->data[i]);
we can see that data is passed to function 'free' and data is not NULL.
In each usage, we don't have to get the data again through key and
do NULL pointer checking. This patch is to simplify them.
gdb:
2013-10-29 Yao Qi <yao@codesourcery.com>
* auto-load.c (auto_load_pspace_data_cleanup): Get data from
parameter 'arg' instead of from program_space_data.
* objfiles.c (objfiles_pspace_data_cleanup): Likewise.
* solib-darwin.c (darwin_pspace_data_cleanup): Likewise.
* solib-dsbt.c (dsbt_pspace_data_cleanup): Likewise.
* solib-svr4.c (svr4_pspace_data_cleanup): Likewise.
* inflow.c (inflow_inferior_data_cleanup): Get data from
parameter 'arg' instead of inferior_data.
* registry.h: Add comments.
I was reading this, checking the the possible returns, and this
particular path confused a tiny little. Above we do:
if (!stopped_by_watchpoint)
{
...
return 0;
}
so any return after that always return true.
Tested on x86_64 Fedora 17.
gdb/
2013-10-28 Pedro Alves <palves@redhat.com>
* breakpoint.c (watchpoints_triggered)
<!target_stopped_data_address>: Hardcode return 1.
Now that all ecs->random_signal handing is always done before the
'process_event_stop_test' label, we can easily make that a real
function and actually give it a describing comment that somewhat makes
sense.
Reindenting the new function will be handled in a follow up patch.
2013-10-28 Pedro Alves <palves@redhat.com>
* infrun.c (process_event_stop_test): New function, factored out
from handle_inferior_event.
(handle_inferior_event): 'process_event_stop_test' is now a
function instead of a goto label -- adjust.
We only ever call "goto process_event_stop_test;" right after checking
that ecs->random_signal is clear. The code at the
process_event_stop_test label looks like:
/* For the program's own signals, act according to
the signal handling tables. */
if (ecs->random_signal)
{
... random signal handling ...
return;
}
else
{
... the stop tests that actually matter for the goto callers.
}
So this moves the label into the else branch. It'll make converting
process_event_stop_test into a function a bit clearer.
gdb/
2013-10-28 Pedro Alves <palves@redhat.com>
* infrun.c (handle_inferior_event): Move process_event_stop_test
goto label to the else branch of the ecs->random_signal check,
along with FRAME and GDBARCH re-fetching.
I recently added a new ecs->random_signal test after the "switch back to
stepped thread" code, and before the stepping tests. Looking at
making process_event_stop_test a proper function, I realized it'd be
better to keep ecs->random_signal related code together. To do that,
I needed to factor out the "switch back to stepped thread" code to a new
function, and call it in both the "random signal" and "not random
signal" paths.
gdb/
2013-10-28 Pedro Alves <palves@redhat.com>
* infrun.c (switch_back_to_stepped_thread): New function, factored
out from handle_inferior_event.
(handle_inferior_event): Adjust to call
switch_back_to_stepped_thread. Call it also at the tail of the
random signal handling, and return, instead of also handling
random signals just before the stepping tests.
'ecs' is always memset before being passed to handle_inferior_event.
The stop func is only filled in later in the flow. And since "Remove
dead sets/clears of ecs->random signal", nothing ever sets
ecs->random_signal before this part is reached either.
(Also tested with some added assertions in place.)
gdb/
2013-10-28 Pedro Alves <palves@redhat.com>
* infrun.c (clear_stop_func): Delete.
(handle_inferior_event): Don't call clear_stop_func and don't
clear 'ecs->random_signal'.
On 10/25/2013 11:34 AM, Joel Brobecker wrote:
> Also, as a followup, I think it would be beneficial if we renamed
> field "lang" in the varobj_root into "lang_ops". I think it's more
> descriptive, especially since "lang" is used elsewhere with different
> meanings (and types).
Here is the patch to rename 'lang' to 'lang_ops'. Committed as obvious.
gdb:
2013-10-27 Yao Qi <yao@codesourcery.com>
* varobj.c (struct varobj_root) <lang>: Rename to 'lang_ops'.
(varobj_create, varobj_get_path_expr): Update.
(varobj_value_has_mutated, varobj_update): Likewise.
(create_child_with_value, new_root_variable): Likewise.
(number_of_children, name_of_variable): Likewise.
(value_of_child, my_value_of_variable): Likewise.
(varobj_value_is_changeable_p): Likewise.
This is a follow-up series to move language stuff out of varobj.c.
This patch adds a new field la_varobj_ops in struct language_defn so
that each language has varobj-related options. Not every language
supports varobj, and the operations are identical to operations of c
languages.
'struct language_defn' is the ideal place to save all language-related
operations. After this patch, some cleanups can be done in patch 2/2,
which removes language-related stuff completely from varobj.c.
Regression tested on x86_64-linux.
gdb:
2013-10-25 Yao Qi <yao@codesourcery.com>
* language.h (struct lang_varobj_ops): Declare.
(struct language_defn) <la_varobj_ops>: New field.
* ada-lang.c: Include "varobj.h"
(defn ada_language_defn): Initialize field 'la_varobj_ops' by
ada_varobj_ops.
* c-lang.c: Include "varobj.h"
(c_language_defn): Initialize field 'la_varobj_ops' by
c_varobj_ops.
(cplus_language_defn): Initialize field 'la_varobj_ops' by
cplus_varobj_ops.
(asm_language_defn): Initialize field 'la_varobj_ops' by
default_varobj_ops.
(minimal_language_defn): Likewise.
* d-lang.c (d_language_defn): Likewise.
* f-lang.c (f_language_defn): Likewise.
* go-lang.c (go_language_defn): Likewise.
* m2-lang.c (m2_language_defn): Likewise.
* objc-lang.c (objc_language_defn): Likewise.
* opencl-lang.c (opencl_language_defn): Likewise.
* p-lang.c (pascal_language_defn): Likewise.
* language.c (unknown_language_defn): Likewise.
(auto_language_defn): Likewise.
(local_language_defn): Likewise.
* jv-lang.c (java_language_defn): Initialize field
'la_varobj_ops' by java_varobj_ops.
* varobj.c (varobj_create): Update.
* varobj.h (default_varobj_ops): Define macro.