This is just a minor cleanup in advance of some other changes, that
modifies solib-frv.c to use entry_point_address_query. I don't have a
good way to test this but I think it is obviously correct.
2014-01-15 Tom Tromey <tromey@redhat.com>
* solib-frv.c (enable_break): Use entry_point_address_query.
This patch adds a news entry about improvements in record-replay and
reverse debugging support for arm*-linux* targets.
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* NEWS: Add note on improved process record-replay on
arm*-linux* targets.
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (enum arm_record_result): New enum.
(arm_record_unsupported_insn): New function.
(arm_record_coproc_data_proc): Removed.
(thumb2_record_ld_st_multiple): New function.
(thumb2_record_ld_st_dual_ex_tbb): New function.
(thumb2_record_data_proc_sreg_mimm): New function.
(thumb2_record_ps_dest_generic): New function.
(thumb2_record_branch_misc_cntrl): New function.
(thumb2_record_str_single_data): New function.
(thumb2_record_ld_mem_hints): New function.
(thumb2_record_ld_word): New function.
(thumb2_record_lmul_lmla_div): New function.
(thumb2_record_decode_insn_handler): New function.
(decode_insn): Add thumb32 instruction handlers.
This patch fixes thumb push instruction recording by replacing base
register from pc to sp.
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (thumb_record_misc): Update to use sp as base
register for push instruction recording.
This patch corrects the register numbers and removes multiple loops in
recording procedure of instructions involving multiple registers.
gdb/ChangeLog:
2014-01-15 Omair Javaid <omair.javaid@linaro.org>
* arm-tdep.c (thumb_record_misc): Update to correct logical
error while recording ldm, ldmia and pop instructions.
The recent constification of to_detach missed updating the forward
declaration of go32_detach, breaking the build:
../../src/gdb/go32-nat.c:387:1: error: conflicting types for 'go32_detach'
../../src/gdb/go32-nat.c:240:13: note: previous declaration of 'go32_detach' was here
go32_detach is actually defined before it's ever used, making the
forward declaration is unnecessary. So we can just remove it instead
of updating it. While at it, remove all others in the same situation.
Tested by building a djgpp gdb.
gdb/
2014-01-15 Pedro Alves <palves@redhat.com>
* go32-nat.c (go32_open, go32_close, go32_attach, go32_detach)
(go32_resume, go32_fetch_registers, store_register)
(go32_store_registers, go32_prepare_to_store)
(go32_xfer_memory, go32_files_info, go32_kill_inferior)
(go32_create_inferior, go32_can_run, go32_terminal_init)
(go32_terminal_inferior, go32_terminal_ours): Delete forward
declarations.
This introduces async_callback_ftype. This is needed for
make-target-delegates to work properly, as it doesn't implement a real
parser. I think it's also an ok cleanup in its own right.
2014-01-15 Tom Tromey <tromey@redhat.com>
* target.h (async_callback_ftype): New typedef.
(struct target_ops) <to_async>: Use it.
This last patch removes "partial" from the names of
expand_partial_symbol_names and map_partial_symbol_filenames.
It also renames expand_partial_symbol_names to match the
struct quick_symbol_functions "method" that it wraps:
expand_symtabs_matching.
This patch also adds two parameters to expand_symtabs_matching
so that it can fully wrap the underlying quick_symbol_functions method.
This makes it usable in more places.
I thought of having a cover function that still had the same
signature as the old expand_partial_symbol_names function,
but I couldn't think of a good name, and it wasn't clear it was
worth it anyway.
* symfile.h (expand_symtabs_matching): Renamed from
expand_partial_symbol_names. Update prototype.
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
* symfile.c (expand_symtabs_matching): Renamed from
expand_partial_symbol_names. New args file_matcher, kind.
Rename arg fun to symbol_matcher.
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
* ada-lang.c (ada_complete_symbol_matcher): Renamed from
ada_expand_partial_symbol_name.
(ada_make_symbol_completion_list): Update to call
expand_symtabs_matching.
(ada_add_global_exceptions): Call expand_symtabs_matching.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update to
call map_symbol_filenames.
* symtab.c (sources_info): Update to call map_symbol_filenames.
(search_symbols): Call expand_symtabs_matching.
(symbol_completion_matcher): Renamed from expand_partial_symbol_name.
(default_make_symbol_completion_list_break_on): Update to call
expand_symtabs_matching.
(make_source_files_completion_list): Update to call
map_symbol_filenames.
This patch adds two typedefs:
expand_symtabs_file_matcher_ftype
expand_symtabs_symbol_matcher_ftype
It also renames the NAME_MATCHER argument in expand_symtabs_matching.
The function is named expand_symtabs_matching and it takes a name_matcher
argument. Name of what? The symtab? A symbol?
I made it SYMBOL_MATCHER to make it clearer.
* symfile.h (expand_symtabs_file_matcher_ftype): New typedef.
(expand_symtabs_symbol_matcher_ftype): New typedef.
(quick_symbol_functions.expand_symtabs_matching): Update to use.
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
* symfile.c (expand_partial_symbol_names): Update to use
expand_symtabs_symbol_matcher_ftype.
* dwarf2read.c (dw2_expand_symtabs_matching): Update to use
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
Arg name_matcher renamed to symbol_matcher.
* psymtab.c (recursively_search_psymtabs): Update to use
expand_symtabs_symbol_matcher_ftype. Arg name_matcher renamed to
sym_matcher.
(expand_symtabs_matching_via_partial): Update to use
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
Arg name_matcher renamed to symbol_matcher.
This is the first of a set of three patches to cleanup psymtab.c a bit.
Basically, these two functions do not belong in psymtab.c:
expand_partial_symbol_names, map_partial_symbol_filenames,
and "partial" does not belong in the function name.
This first patch moves them to a better location.
The second patch adds some typedefs for function parameters to
quick_symbol_functions.expand_symtabs_matching.
The third patch removes "partial" from the function names
and uses them in more places.
* psymtab.c (expand_partial_symbol_names): Delete, moved to symfile.c.
(map_partial_symbol_filenames): Ditto.
* psymtab.h (expand_partial_symbol_names): Delete, moved to symfile.h.
(map_partial_symbol_filenames): Ditto.
* symfile.c (expand_partial_symbol_names): Moved here from psymtab.c.
(map_partial_symbol_filenames): Ditto.
* symfile.h (expand_partial_symbol_names): Moved here from psymtab.h.
(map_partial_symbol_filenames): Ditto.
* symtab.c: Delete #include "psymtab.h".
RECORD_IS_USED and record_full_open look at current_target.to_stratum
to determine whether a record target is in use. This is wrong because
arch_stratum is greater than record_stratum, so if an arch_stratum
target is pushed, RECORD_IS_USED and record_full_open will miss it.
To fix this, we can use the existing find_record_target instead, which
looks up for a record stratum target across the target stack. Since
that means exporting find_record_target in record.h, RECORD_IS_USED
ends up redundant, so the patch eliminates it.
That exercise then reveals other issues:
- adjust_pc_after_break is gating record_full_... calls based on
RECORD_IS_USED. But, record_full_ calls shouldn't be made when
recording with the record-btrace target. So this adds a new
record_full_is_used predicate to be used in that spot.
- record_full_open says "Process record target already running", even
if the recording target is record-btrace ("process record" is the
original complete name of the record-full target). record_btrace_open
only says "The process is already being recorded." and does not
suggest "record stop", like record-full does. The patch factors out
and merges that error to a new record_preopen function that all record
targets call in their open routine.
Tested on x86_64 Fedora 17.
gdb/
2014-01-14 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* infrun.c (use_displaced_stepping): Use find_record_target
instead of RECORD_IS_USED.
(adjust_pc_after_break): Use record_full_is_used instead of
RECORD_IS_USED.
* record-btrace.c (record_btrace_open): Call record_preopen
instead of checking RECORD_IS_USED.
* record-full.c (record_full_shortname)
(record_full_core_shortname): New globals.
(record_full_is_used): New function.
(find_full_open): Call record_preopen instead of checking
RECORD_IS_USED.
(init_record_full_ops): Set the target's shortname to
record_full_shortname.
(init_record_full_core_ops): Set the target's shortname to
record_full_core_shortname.
* record-full.h (record_full_is_used): Declare.
* record.c (find_record_target): Make extern.
(record_preopen): New function.
* record.h (RECORD_IS_USED): Delete macro.
(find_record_target, record_preopen): Declare functions.
This patch changes the type of 'len' from LONGEST to ULONGEST. 'len'
is the argument of gdbarch methods core_xfer_shared_libraries and
core_xfer_shared_libraries_aix.
gdb:
2014-01-14 Yao Qi <yao@codesourcery.com>
* gdbarch.sh (core_xfer_shared_libraries): Change its argument
'len''s type to ULONGEST.
(core_xfer_shared_libraries_aix): Likewise.
* gdbarch.c, gdbarch.h: Reenerated.
* i386-cygwin-tdep.c (windows_core_xfer_shared_libraries):
Change type of 'len' to ULONGEST.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
Hi,
We can use target_xfer_partial_ftype here for
rs6000_xfer_shared_libraries declaration.
gdb:
2014-01-14 Yao Qi <yao@codesourcery.com>
* rs6000-nat.c (rs6000_xfer_shared_libraries): Use
target_xfer_partial_ftype.
PR python/15464
PR python/16113
* valops.c (value_struct_elt_bitpos): New function
* py-type.c (convert_field): Set 'name' attribute of a gdb.Field
object to 'None' if the field name is an empty string ("").
* python/py-value.c (valpy_getitem): Use 'bitpos' and 'type'
attribute to look for a field when 'name' is 'None'.
(get_field_type): New function
testsuite/
* gdb.python/py-type.c: Enhance test case.
* gdb.python/py-value-cc.cc: Likewise
* gdb.python/py-type.exp: Add new tests.
* gdb.python/py-value-cc.exp: Likewise
deprecated_core_resize_section_table is declared but never defined.
This patch removes the stale declaration.
2014-01-13 Tom Tromey <tromey@redhat.com>
* gdbcore.h (deprecated_core_resize_section_table): Remove.
deprecated_flush_hook is declared in defs.h but never defined.
This patch removes the stale declaration.
2014-01-13 Tom Tromey <tromey@redhat.com>
* defs.h (deprecated_flush_hook): Remove.
gdb/
2014-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
PR threads/16216
* linux-thread-db.c (try_thread_db_load): Add parameter
check_auto_load_safe. Move here the file_is_auto_load_safe call.
(try_thread_db_load_from_pdir_1): Move it there from here.
(try_thread_db_load_from_sdir): Update caller.
(try_thread_db_load_from_dir): Move it there from here.
The rules for generating the output register files look like:
amd64.c : $(srcdir)/../regformats/i386/amd64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64.dat amd64.c
According to this rule, if regdat.sh is newer than amd64.c, then
regdat.sh shall be invoked on amd64.dat. According to regdat.sh, if the
script determines that the output file amd64.c has not changed, then it
will not overwrite the existing output file. This means that a
subsequent invocation of make will trigger the above rule again as
regdat.sh will be perpetually newer than amd64.c.
This then shows up in the make output like so:
/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-linux.dat amd64-linux.c
amd64-linux.c unchanged.
/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c
amd64-avx-linux.c unchanged.
...
To fix this pathological behavior, it suffices to have regdat.sh
unconditionally rewrite the output register file.
On my machine, which has a regdat.sh file that is newer than some of the
input register files, this change speeds up every invocation of make
under gdb/ by about 5 seconds.
Tries to compile each header in isolation, thus ensuring headers are
self-contained.
Defaults to checking all $HFILES_NO_SRCDIR headers.
Do:
make check-headers CHECK_HEADERS="header.h list.h"
to check specific headers.
gdb/
2014-01-13 Pedro Alves <palves@redhat.com>
* Makefile.in (CHECK_HEADERS): New variable.
(check-headers:): New rule.
This removes deprecated_set_hook. Insight was the last user of this
hook, but I recently checked in a patch to have it use the
command_param_changed observer instead.
2014-01-13 Tom Tromey <tromey@redhat.com>
* cli/cli-setshow.c (do_set_command): Update.
* defs.h (deprecated_set_hook): Remove.
* top.c (deprecated_set_hook): Remove.
This PC guessing can't work when the PC is a pseudo-register.
Pseudo-register values don't end up stored in the regcache, they're
always recomputed. And, it's actually wrong to try to write a
pseudo-register with regcache_raw_supply. Skip it and add a comment.
gdb/
2014-01-13 Pedro Alves <palves@redhat.com>
* tracepoint.c (tfile_fetch_registers): Don't infer the PC from
the tracepoint if the PC is a pseudo-register.
This removes XCALLOC and replaces it either with XCNEWVEC, or, if the
number of elements being requested was 1, with XCNEW.
2014-01-13 Tom Tromey <tromey@redhat.com>
* defs.h (XCALLOC): Remove.
* bcache.c (bcache_xmalloc): Use XCNEW, not XCALLOC.
(print_bcache_statistics): Use XCNEWVEC, not XCALLOC.
* dwarf2loc.c (allocate_piece_closure): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_symfile_segments): Likewise.
* gdbtypes.c (copy_type_recursive): Likewise.
* i386-tdep.c (i386_gdbarch_init): Use XCNEW, not XCALLOC.
* jit.c (jit_frame_sniffer): Use XCNEWVEC, not XCALLOC.
* minsyms.c (prim_record_minimal_symbol_full): Use XCNEW, not
XCALLOC.
* mt-tdep.c (mt_gdbarch_init): Likewise.
* opencl-lang.c (allocate_lval_closure): Use XCNEWVEC, not
XCALLOC.
* psymtab.c (psymbol_compare): Use XCNEW, not XCALLOC.
* regcache.c (regcache_xmalloc_1): Use XCNEWVEC, not XCALLOC.
* registry.c (registry_alloc_data): Likewise.
* rs6000-tdep.c (rs6000_gdbarch_init): Use XCNEW, not XCALLOC.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* serial.c (serial_fdopen_ops): Likewise.
* solib-aix.c (solib_aix_get_section_offsets): Use XCNEWVEC, not
XCALLOC.
* spu-tdep.c (spu_gdbarch_init): Use XCNEW, not XCALLOC.
* symfile.c (default_symfile_segments): Use XCNEW and XCNEWVEC,
not XCALLOC.
This patch reorganizes code on gdb/i386-tdep.c's SystemTap SDT probe
support functions. Before it, the code to parse special operands on x86
lived in a single, big function. This patch creates 2 new functions
that makes the code more organized and removes a few indentation levels
(which is always good IMO).
I haven't modified anything logical in the functions, i.e., there's still
one latent bug on i386_stap_parse_special_token_triplet now. I will soon
post a patch to fix this, and to also improve the readability of the two
new functions.
2014-01-12 Sergio Durigan Junior <sergiodj@redhat.com>
* i386-tdep.c (i386_stap_parse_special_token_triplet): New
function, with code from i386_stap_parse_special_token.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
(i386_stap_parse_special_token): Move code to the two functions
above; simplify it.
Although we can tell upfront whether a remote target supports target
side commands, we can only tell whether the target supports that in
combination with a given breakpoint kind (software, hardware,
watchpoints, etc.) when we go and try to insert such a breakpoint kind
the first time. It's not desirable to make remote_insert_breakpoint
simply return -1 in this case, because if the breakpoint was set in a
shared library, insert_bp_location will assume that the breakpoint
insertion failed because the library wasn't mapped in.
insert_bp_location already handles errors/exceptions thrown from the
target_insert_xxx methods, exactly so the backend can tell the user
the detailed reason the insertion of hw breakpoints failed. But, in
the case of software breakpoints, it discards the detailed error
message.
So the patch makes insert_bp_location use the error's message for SW
breakpoints too, and, introduces a NOT_SUPPORTED_ERROR error code so
that insert_bp_location doesn't confuse the error for failure due to a
shared library disappearing.
The result is:
(gdb) c
Warning:
Cannot insert breakpoint 2: Target doesn't support breakpoints that have target side commands.
2014-01-09 Pedro Alves <palves@redhat.com>
Hui Zhu <hui@codesourcery.com>
PR gdb/16101
* breakpoint.c (insert_bp_location): Rename hw_bp_err_string to
bp_err_string. Don't mark the location shlib_disabled if the
error thrown wasn't a generic or memory error. Catch errors
thrown while inserting breakpoints in overlayed code. Output
error message of software breakpoints.
* remote.c (remote_insert_breakpoint): If this breakpoint has
target-side commands but this stub doesn't support Z0 packets,
throw NOT_SUPPORTED_ERROR error.
* exceptions.h (enum errors) <NOT_SUPPORTED_ERROR>: New error.
* target.h (target_insert_breakpoint): Extend comment.
(target_insert_hw_breakpoint): Add comment.
Currently, when GDB connects in all-stop mode, GDBserver always
responds to the status packet with a GDB_SIGNAL_TRAP, even if the
program is actually stopped for some other signal.
(gdb) tar rem ...
...
(gdb) c
Program received signal SIGUSR1, User defined signal 1.
(gdb) disconnect
(gdb) tar rem ...
(gdb) c
(Or a GDB crash instead of an explicit disconnect.)
This results in the program losing that signal on that last continue,
because gdb will tell the target to resume with no signal (to suppress
the GDB_SIGNAL_TRAP, due to 'handle SISGTRAP nopass'), and that will
actually suppress the real signal the program had stopped for
(SIGUSR1). To fix that, I think we should make GDBserver report the
real signal the thread had stopped for in response to the status
packet:
@item ?
@cindex @samp{?} packet
Indicate the reason the target halted. The reply is the same as for
step and continue.
But, that raises the question -- which thread are we reporting the
status for? Due to how the RSP in all-stop works, we can only report
one status. The status packet's response is a stop reply packet, so
it includes the thread identifier, so it's not a problem packet-wise.
However, GDBserver is currently always reporting the status for first
thread in the thread list, even though that may well not be the thread
that got the signal that caused the program to stop. So the next
logical step would be to report the status for the
last_ptid/last_status thread (the last event reported to gdb), if it's
still around; and if not, fallback to some other thread.
There's an issue on the GDB side with that, though...
GDB currently always adds the thread reported in response to the
status query as the first thread in its list. That means that if we
start with e.g.,
(gdb) info threads
3 Thread 1003 ...
* 2 Thread 1002 ...
1 Thread 1001 ...
And reconnect:
(gdb) disconnect
(gdb) tar rem ...
We end up with:
(gdb) info threads
3 Thread 1003 ...
2 Thread 1001 ...
* 1 Thread 1002 ...
Not a real big issue, but it's reasonably fixable, by having GDB
fetch/sync the thread list before fetching the status/'?', and then
using the status to select the right thread as current on the GDB
side. Holes in the thread numbers are squashed before/after
reconnection (e.g., 2,3,5 becomes 1,2,3), but the order is preserved,
which I think is both good, and good enough.
However (yes, there's more...), the previous GDB that was connected
might have had gdbserver running in non-stop mode, or could have left
gdbserver doing disconnected tracing (which also forces non-stop), and
if the new gdb/connection is in all-stop mode, we can end up with more
than one thread with a signal to report back to gdb. As we can only
report one thread/status (in the all-stop RSP variant; the non-stop
variant doesn't have this issue), we get to do what we do at every
other place we have this situation -- leave events we can't report
right now as pending, so that the next resume picks them up.
Note all this ammounts to a QoI change, within the existing framework.
There's really no RSP change here.
The only user visible change (other than that the signal is program is
stopped at isn't lost / is passed to the program), is in "info
program", that now can show the signal the program stopped for. Of
course, the next resume will respect the pass/nopass setting for the
signal in question. It'd be reasonable to have the initial connection
tell the user the program was stopped with a signal, similar to when
we load a core to debug, but I'm leaving that out for a future change.
I think we'll need to either change how handle_inferior_event & co
handle stop_soon, or maybe bypass them completely (like
fork-child.c:startup_inferior) for that.
Tested on x86_64 Fedora 17.
gdb/gdbserver/
2014-01-08 Pedro Alves <palves@redhat.com>
* gdbthread.h (struct thread_info) <status_pending_p>: New field.
* server.c (visit_actioned_threads, handle_pending_status): New
function.
(handle_v_cont): Factor out parts to ...
(resume): ... this new function. If in all-stop, and a thread
being resumed has a pending status, report it without actually
resuming.
(myresume): Adjust to use the new 'resume' function.
(clear_pending_status_callback, set_pending_status_callback)
(find_status_pending_thread_callback): New functions.
(handle_status): Handle the case of multiple threads having
interesting statuses to report. Report threads' real last signal
instead of always reporting GDB_SIGNAL_TRAP. Look for a thread
with an interesting thread to report the status for, instead of
always reporting the status of the first thread.
gdb/
2014-01-08 Pedro Alves <palves@redhat.com>
* remote.c (remote_add_thread): Add threads silently if starting
up.
(remote_notice_new_inferior): If in all-stop, and starting up,
don't call notice_new_inferior.
(get_current_thread): New function, factored out from ...
(add_current_inferior_and_thread): ... this. Adjust.
(remote_start_remote) <all-stop>: Fetch the thread list. If we
found any thread, then select the remote's current thread as GDB's
current thread too.
gdb/testsuite/
2014-01-08 Pedro Alves <palves@redhat.com>
* gdb.threads/reconnect-signal.c: New file.
* gdb.threads/reconnect-signal.exp: New file.
Now that the GDB 7.7 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 7.7 branch created (79301218fa):
* version.in: Bump version to 7.7.50.DATE-cvs.
This patch fixes these errors below:
../../binutils-gdb/gdb/spu-linux-nat.c: In function ‘spu_symbol_file_add_from_memory’:
../../binutils-gdb/gdb/spu-linux-nat.c:368:3: error: pointer targets in passing argument 2 of ‘spu_proc_xfer_spu’ differ in signedness [-Werror=pointer-sign]
../../binutils-gdb/gdb/spu-linux-nat.c:232:1: note: expected ‘gdb_byte *’ but argument is of type ‘char *’
../../binutils-gdb/gdb/spu-linux-nat.c: In function ‘spu_xfer_partial’:
../../binutils-gdb/gdb/spu-linux-nat.c:598:7: error: pointer targets in passing argument 1 of ‘strtoulst’ differ in signedness [-Werror=pointer-sign]
In file included from ../../binutils-gdb/gdb/defs.h:769:0,
from ../../binutils-gdb/gdb/spu-linux-nat.c:21:
../../binutils-gdb/gdb/utils.h:43:15: note: expected ‘const char *’ but argument is of type ‘gdb_byte *’
gdb:
2014-01-08 Yao Qi <yao@codesourcery.com>
* spu-linux-nat.c (spu_symbol_file_add_from_memory): Change
type of 'id' to gdb_byte. Cast 'id' to 'const char *'.
(spu_xfer_partial): Cast 'buf' to 'const char *'.
This patch fixes the following build error:
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 2 of ‘symbol_file_add_from_bfd’ makes pointer from integer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected ‘const char *’ but argument is of type ‘int’
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 3 of ‘symbol_file_add_from_bfd’ makes integer from pointer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected ‘int’ but argument is of type ‘void *’
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 5 of ‘symbol_file_add_from_bfd’ makes integer from pointer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected ‘int’ but argument is of type ‘void *’
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: too few arguments to function ‘symbol_file_add_from_bfd’
Argument 'name' was added to function symbol_file_add_from_bfd by this patch
[patchv4 4/5] Keep objfile original filename
https://sourceware.org/ml/gdb-patches/2013-09/msg00683.html
but caller of symbol_file_add_from_bfd in spu-linux-nat.c wasn't updated.
This patch fixes the build error.
gdb:
2014-01-08 Yao Qi <yao@codesourcery.com>
* spu-linux-nat.c (spu_symbol_file_add_from_memory): Pass
return value of bfd_get_filename to symbol_file_add_from_bfd.
* coff-pe-read.c (struct read_pe_section_data): Add index field.
(add_pe_exported_sym): Use SECTION_DATA->INDEX for call
to prim_record_mininal_symbol_and_info.
(add_pe_forwarded_sym): Use known section number of forwarded symbol
in call to prim_record_minimal_symbol_and_info.
(read_pe_exported_syms): Set index field of section_data.
gdb/ChangeLog:
2014-01-07 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* source.c (add_path): Fix check for duplicated paths in the previously
included paths.
gdb/testsuite/ChangeLog:
2014-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/source-dir.exp: New file.
This patch fixes this build error below:
../../binutils-gdb/gdb/spu-linux-nat.c:616:1: error: no previous prototype for ‘_initialize_spu_nat’ [-Werror=missing-prototypes]
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* spu-linux-nat.c (_initialize_spu_nat): Declare.
Consider the following types:
type Time_T is record
Secs : Integer;
end record;
Before : Time_T := (Secs => 1384395743);
In this example, we assume that type Time_T is the number of seconds
since Epoch, and so added a Python pretty-printer, to print this
type in a more human-friendly way. For instance:
(gdb) print before
$1 = Thu Nov 14 02:22:23 2013 (1384395743)
However, we've noticed that things stop working when this type is
embedded inside another record, and we try to print that record.
For instance, with the following declarations:
type Composite is record
Id : Integer;
T : Time_T;
end record;
Afternoon : Composite := (Id => 1, T => (Secs => 1384395865));
(gdb) print afternoon
$2 = (id => 1, t => (secs => 1384395865))
We expected instead:
(gdb) print afternoon
$2 = (id => 1, t => Thu Nov 14 02:24:25 2013 (1384395865))
This patch fixes the problem by making sure that we try to print
each field via a call to val_print, rather than calling ada_val_print
directly. We need to go through val_print, as the val_print
handles all language-independent features such as calling the
pretty-printer, knowing that ada_val_print will get called eventually
if actual Ada-specific printing is required (which should be the
most common scenario).
And because val_print takes the language as parameter, we enhanced
the print_field_values and print_variant_part to also take a language.
As a bonus, this allows us to remove a couple of references to
current_language.
gdb/ChangeLog:
* ada-valprint.c (print_field_values): Add "language" parameter.
Update calls to print_field_values and print_variant_part.
Pass new parameter "language" in call to val_print instead
of "current_language". Replace call to ada_val_print by call
to val_print.
(print_variant_part): Add "language" parameter.
(ada_val_print_struct_union): Update call to print_field_values.
gdb/testsuite/ChangeLog:
* gdb.ada/pp-rec-component.exp, gdb.ada/pp-rec-component.py,
gdb.ada/pp-rec-component/foo.adb, gdb.ada/pp-rec-component/pck.adb,
gdb.ada/pp-rec-component/pck.ads: New files.
ada_print_floating declares a char buffer with a size that we're hoping
to always be large enough to hold any string representation of a float
value. But that's not really necessary, and also forces us to create
a small wrapper (ui_memcpy) to perform the extraction from a temporary
stream into this buffer. This patches fixes both issues by relying on
ui_file_xstrdup. This forces us to make a few adjustments that are
minor in nature, as we now need to defer the cleanup to the end of
the function.
gdb/ChangeLog:
* ada-valprint.c (ui_memcpy): Delete.
(ada_print_floating): Update documentation. Add empty line
between between function documentation and implementation.
Delete variable "buffer". Use ui_file_xstrdup in place of
ui_file_put. Minor adjustments following this change.
This patch creates a new function called "ada_val_print_string"
whose code is directly extracted out of ada_val_print_array.
The extracted code is then replaced by a call to this new function,
followed by a "return". The return avoids the need for an "else"
branch, with the associated block nesting. The latter is not really
terrible in this case, but it seems more readable this way.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_string): New function,
extracted from ada_val_print_array.
(ada_val_print_array): Replace extracted code by call
to ada_val_print_string followed by a return. Move
"else" branch to the function's top block.
This patch moves ada_val_print_array to group it with the other
ada_val_print_* function which are being called by ada_val_print_1.
Since this function is in the same situation, it is more logical
to move it within that group.
It also rationalizes the function's prototype to match the prototype
of the other ada_val_print_* routines.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_array): Move implementation
down. Rename parameter "offset" and "val" into "offset_aligned"
and "original_value" respectively. Add parameter "offset".
The logic as currently implemented in this function was a little
difficult to follow, due to the nested of if/else conditions,
but most of the time, the "else" block was very simple. So this
patch re-organizes the code to use fewer levels of nesting by
using return statements, and writing the code as a sequence of
"if something simple, then handle it and return" blocks.
While touching this code, this patch changes the cryptic "???"
printed when trying to print a reference pointing to an undefined
type. This should only ever happen if the debugging information
was corrupted or improperly read. But in case that happens, we now
print "<ref to undefined type>" instead. This is more in line
with how we print other conditions such as optimized out pieces,
or synthetic pointers.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_ref): Rewrite by mostly
re-organizing the code. Change the "???" message printed
when target type is a TYPE_CODE_UNDEF into
"<ref to undefined type>".
The function print_record is a fairly small and straightforward
function which is only called from one location. So this patch
inlines the code at the point of call.
One small advantage is that the context of use of this patch has
now become such that we can assume that TYPE is not a typedef,
nor an enum. So thhe call to ada_check_typedef is unnecessary,
and this patch removes it.
gdb/ChangeLog:
* ada-valprint.c (print_record): Delete, implementation inlined...
(ada_val_print_struct_union): ... here. Remove call to
ada_check_typedef in inlined implementation.
The idea of this patch is that it's hard to have a global view of
ada_val_print_1 because its body spans over too many lines. Also,
each individual "case" block within the giant "switch" can be hard
to isolate if spanning over multiple pages as well.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_gnat_array): New function,
extracted from ada_val_print_1;
(ada_val_print_ptr, ada_val_print_num, ada_val_print_enum)
(ada_val_print_flt, ada_val_print_struct_union)
(ada_val_print_ref): Likewise.
(ada_val_print_1): Delete variables i and elttype.
Replace extracted-out code by call to corresponding
new functions.
I am not sure why this function was called in the first place, but
it disrupts the printing flow when in GDB/MI mode, ending the current
console stream output, and starting a new one. It's not clear whether,
with the code as currently written, the problem is actually visible
or only latent. But, it becomes visible when we replace one of the
"return" statements in the "switch" block just above by a "break"
statement (this is something I'd like to do, and what made me realize
the problem). With the gdb_flush call (after having replaced the
"return" statement as explained above), we get:
% gdb -q -i=mi ada_prg
(gdb)
print 1
&"print 1\n"
!! -> ~"$1 = 1"
!! -> ~"\n"
^done
With the gdb_flush call removed, we now get the entire output into
a single stream.
(gdb)
print 1
&"print 1\n"
~"$1 = 1"
~"\n"
^done
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_1): Remove call to gdb_flush.
This is to standardize a little bit how printing is done, and in
particular make sure that everyone goes through val_print when
printing sub-objects. This helps making sure that standard features
handled by val_print get activated when expected.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_1): Replace calls to
ada_val_print_1 by calls to val_print.
This is to help calling val_print. We would like to be more systematic
in calling val_print when printing, because it allows us to make sure
we take advantage of the standard features such as pretty-printing
which are handled by val_print.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_1): Add parameter "language".
Update calls to self accordingly. Replace calls to c_val_print
by calls to val_print.
Advance function declarations add to the maintenance cost, since
any update to the function prototype needs to be made twice.
For static functions, this is not necessary, and this patch
reorders the function so as to reduce the use of such advanche
declarations.
gdb/ChangeLog:
* ada-valprint.c (print_record): Delete declaration.
(adjust_type_signedness, ada_val_print_1): Likewise.
(ada_val_print): Move function implementation down.
(print_variant_part, print_field_values, print_record):
Move function implementation up.
Consider the following declarations:
typedef long our_time_t;
our_time_t current_time = 1384395743;
The purpose of this patch is to allow the use of a pretty-printer
for variables of type our_time_t. Normally, pretty-printing sniffers
use the tag name in order to determine which, if any, pretty-printer
should be used. But in the case above, the tag name is not set, since
it does not apply to integral types.
This patch extends the gdb.Type list of attributes to also include
the name of the type, thus allowing the sniffer to match against
that name. With that change, I was able to write a pretty-printer
which displays our variable as follow:
(gdb) print current_time
$1 = Thu Nov 14 02:22:23 2013 (1384395743)
gdb/ChangeLog:
* python/py-type.c (typy_get_name): New function.
(type_object_getset): Add entry for attribute "name".
* NEWS: Add entry mentioning this new attribute.
gdb/doc/ChangeLog:
* gdb.texinfo (Types In Python): Document new attribute Types.name.
gdb/testsuite:
* gdb.python/py-pp-integral.c: New file.
* gdb.python/py-pp-integral.py: New file.
* gdb.python/py-pp-integral.exp: New file.
Tested on x86_64-linux.
This patch removes the if statement and the comments together.
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (set_exceptions_cmd): Remove an empty body 'if'
statement.
This patch fixes the following error.
../../../git/gdb/gnu-nat.c: In function 'info_port_rights':
../../../git/gdb/gnu-nat.c:3083:11: error: passing argument 1 of 'parse_to_comma_and_eval' from incompatible pointer type [-Werror]
In file included from ../../../git/gdb/breakpoint.h:23:0,
from ../../../git/gdb/inferior.h:37,
from ../../../git/gdb/gnu-nat.c:55:
../../../git/gdb/value.h:763:22: note: expected 'const char **' but argument is of type 'char **'
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (info_port_rights): Add qualifier const to
argument args.
This patch fixes the following error:
../../../git/gdb/gnu-nat.c: In function 'trace_me':
../../../git/gdb/gnu-nat.c:2106:8: error: old-style function definition [-Werror=old-style-definition]
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (trace_me): Use 'void' for empty argument list.
inf_tid_to_proc is not defined at all. This patch is to remove its
declaration.
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (inf_tid_to_proc): Remove declaration.
This patch fixes this error below by declaring _initialize_gnu_nat.
../../../git/gdb/gnu-nat.c:3447:1: error: no previous prototype for '_initialize_gnu_nat' [-Werror=missing-prototypes]
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (_initialize_gnu_nat): Declare.
This patch changes the return type of gdbarch_byte_order and
gdbarch_byte_order_for_code, from 'int' to 'enum bfd_endian'.
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gdbarch.sh (byte_order, byte_order_for_code): Change type to
'enum bfd_endian'.
(struct gdbarch_info) <byte_order>: Change type to
'enum bfd_endian'.
<byte_order_for_code>: Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
This removes the last uses of the obsolete CONST macro from the tree.
I'm checking this in. Tested by rebuilding.
2014-01-06 Tom Tromey <tromey@redhat.com>
* doublest.c (convert_doublest_to_floatformat): Use const, not
CONST.
* somread.c (som_symtab_read): Likewise.
gdb/ChangeLog:
* top.c (print_gdb_version): Set copyright year to 2014.
gdb/gdbserver/ChangeLog:
* gdbserver.c (gdbserver_version): Set copyright year to 2014.
* gdbreplay.c (gdbreplay_version): Likewise.
Continuing my series of fixes on the SystemTap SDT support for the
ARM/AArch64 architectures, this patch now extends how ARM's SDT specific
parser handles literal numbers (immediates).
Currently, it only accepts "#" as the prefix. However, according to
"info '(as) ARM-Chars'", expressions can also have "$" and nothing as a
prefix. This patch extends the parser to accept those options.
2013-12-28 Sergio Durigan Junior <sergiodj@redhat.com>
* arm-linux-tdep.c (arm_stap_is_single_operand): Accept "$" as a
literal prefix. Also accept no prefix at all.
(arm_stap_parse_special_token): Likewise.
(arm_linux_init_abi): Likewise.
This commit implements the needed bits for SystemTap SDT probe support
on AArch64 architectures.
First, I started by looking at AArch64 assembly specification and
filling the necessary options on gdbarch's stap machinery in order to
make the generic asm parser (implemented in stap-probe.c) recognize
AArch64's asm.
After my last patch for the SystemTap SDT API, which extends it in order
to accept multiple prefixes and suffixes, this patch became simpler. I
also followed Marcus suggestion and did not shared code between 32- and
64-bit ARM.
Tom asked me in a previous message how I did my tests. I believe I
replied that, but just in case: I ran the tests on
gdb.base/stap-probe.exp by hand. I also managed to run the tests on
real hardware, and they pass without regressions.
2013-12-28 Sergio Durigan Junior <sergiodj@redhat.com>
PR tdep/15653
* NEWS: Mention SystemTap SDT probe support for AArch64 GNU/Linux.
* aarch64-linux-tdep.c: Include necessary headers for parsing of
SystemTap SDT probes.
(aarch64_stap_is_single_operand): New function.
(aarch64_stap_parse_special_token): Likewise.
(aarch64_linux_init_abi): Declare SystemTap SDT probe argument
prefixes and suffixes. Initialize gdbarch with them.
This patch does some basic cleanups on the SystemTap SDT probes API. It
removes spurious newlines, brackets, reindents some code, and do
explicit checks for NULL, NUL, and 0 where applicable.
2013-12-23 Sergio Durigan JUnior <sergiodj@redhat.com>
* stap-probe.c (struct stap_probe) <args_parsed>: Add comment.
(stap_is_generic_prefix): Delete extra brackets. Reindent.
(stap_parse_register_operand): Remove spurious newlines. Simplify
code to parse special token.
(stap_parse_argument_conditionally): Add gdb_assert.
(stap_parse_argument_1): Likewise. Explicitly check for NULL and
NUL.
(stap_parse_probe_arguments): Likewise.
(handle_stap_probe): Likewise. Reindent code.
(get_stap_base_address): Explicitly check for NULL.
(stap_get_probes): Likewise. Reindent code.
(stap_relocate): Explicitly check for 0.
(stap_gen_info_probes_table_values): Likewise.
PREFIX_ADDR isn't a prefix to opcode. This patch masks out PREFIX_ADDR
when adding prefix to opcode.
PR gdb/16305
* i386-tdep.c (i386_process_record): Mask out PREFIX_ADDR when
adding prefix to opcode.
64-bit mode doesn't use 16-bit address. We should always check SIB byte
for address in 64-bit mode.
PR gdb/16304
* i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit
address in 64-bit mode.
When there is ADDR32 prefix in 64-bit mode, we should zero-extend
address from 32-bit to 64-bit.
PR gdb/16304
* i386-tdep.c (i386_record_lea_modrm_addr): Zero-extend 32-bit
address to 64-bit in 64-bit mode.
X32 Linux system calls are diffferent from amd64 Linux system calls in
system call numbers as well as parameter types/values. This patch adds
amd64_x32_linux_record_tdep and amd64_x32_syscall for x32.
PR gdb/16304
* amd64-linux-tdep.c (amd64_canonicalize_syscall): Handle x32
system calls.
(amd64_x32_linux_record_tdep): New.
(amd64_linux_syscall_record_common): New function.
(amd64_linux_syscall_record): Call
amd64_linux_syscall_record_common with amd64_linux_record_tdep.
(amd64_x32_linux_syscall_record): Call
amd64_linux_syscall_record_common with
amd64_x32_linux_record_tdep.
(amd64_linux_init_abi_common): Move amd64_linux_record_tdep
initialization and tdep->i386_syscall_record setup to ...
(amd64_linux_init_abi): Here.
(amd64_x32_linux_init_abi): Initialize
amd64_x32_linux_record_tdep. Set tdep->i386_syscall_record to
amd64_x32_linux_syscall_record.
* amd64-linux-tdep.h (amd64_x32_syscall): New enum.
This patch extends the current generic parser for SystemTap SDT probe
arguments. It can be almost considered a cleanup, but the main point of
it is actually to allow the generic parser to accept multiple prefixes
and suffixes for the its operands (i.e., integers, register names, and
register indirection).
I have chosen to implement this as a list of const strings, and declare
this list as "static" inside each target's method used to initialize
gdbarch.
This patch is actually a preparation for an upcoming patch for ARM,
which implements the support for multiple integer prefixes (as defined
by ARM's asm spec). And AArch64 will also need this, for the same
reason.
This patch was regtested on all architectures that it touches (i.e.,
i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found.
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
* amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (stap_integer_prefix, stap_integer_suffix)
(stap_register_prefix, stap_register_suffix)
(stap_register_indirection_prefix)
(stap_register_indirection_suffix): Declare as "const char *const
*" instead of "const char *". Adjust printing function. Rename
all of the variables to the plural.
(pstring_list): New function.
* i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe
argument prefixes and suffixes. Initialize gdbarch with them.
* ia64-linux-tdep.c (ia64_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* stap-probe.c (stap_is_generic_prefix): New function.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Remove unecessary declarations for
variables holding prefix and suffix information. Use the new
functions listed above for checking for prefixes and suffixes.
(stap_parse_single_operand): Likewise.
Code rationale
==============
by: Gabriel Krisman Bertazi
This is a fix for bug 16297. The problem occurs when the user attempts
to catch any syscall 0 (such as syscall read on Linux/x86_64). GDB was
not able to catch the syscall and was missing the breakpoint.
Now, breakpoint_hit_catch_syscall returns immediately when it finds the
correct syscall number, avoiding a following check for the end of the
search vector, that returns a no hit if the syscall number was zero.
Testcase rationale
==================
by: Sergio Durigan Junior
This testcase is a little difficult to write. By doing a quick
inspection at the Linux source, one can see that, in many targets, the
syscall number 0 is restart_syscall, which is forbidden to be called
from userspace. Therefore, on many targets, there's just no way to test
this safely.
My decision was to take the simpler route and just adds the "read"
syscall on the default test. Its number on x86_64 is zero, which is
"good enough" since many people here do their tests on x86_64 anyway and
it is a popular architecture.
However, there was another little gotcha. When using "read" passing 0
as the third parameter (i.e., asking it to read 0 bytes), current libc
implementations could choose not to effectively call the syscall.
Therefore, the best solution was to create a temporary pipe, write 1
byte into it, and then read this byte from it.
gdb/ChangeLog
2013-12-19 Gabriel Krisman Bertazi <gabriel@krisman.be>
PR breakpoints/16297
* breakpoint.c (breakpoint_hit_catch_syscall): Return immediately
when expected syscall is hit.
gdb/testsuite/ChangeLog
2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/16297
* gdb.base/catch-syscall.c (read_syscall, pipe_syscall)
(write_syscall): New variables.
(main): Create a pipe, write 1 byte in it, and read 1 byte from
it.
* gdb.base/catch-syscall.exp (all_syscalls): Include "pipe,
"write" and "read" syscalls.
(fill_all_syscalls_numbers): Improve the way to obtain syscalls
numbers.
Now that struct serial_ops is const everywhere, we can easily turn the
instances into globals. This patch implements this idea.
On the one hand I think this is nicer since it makes a bit more data
readonly and slightly reduces allocations. On the other hand it
reduces readability somewhat.
If the readability is a concern to anyone I was thinking I could write
a macro that conditionally uses GCC's designated initializer
extension.
Tested by rebuilding on x86-64 Fedora 18, both natively and using the
mingw cross tools.
2013-12-19 Tom Tromey <tromey@redhat.com>
* ser-unix.c (hardwire_ops): New global.
(_initialize_ser_hardwire): Use it.
* ser-tcp.c (tcp_ops): New global.
(_initialize_ser_tcp): Use it.
* ser-pipe.c (pipe_ops): New global.
(_initialize_ser_pipe): Use it.
* ser-mingw.c (hardwire_ops, tty_ops, pipe_ops, tcp_ops): New
globals.
(_initialize_ser_windows): Use them.
I noticed that the serial_ops vtable is not const, but really it ought
to be.
This patch constifies it, removing the only mutable field in the
process.
Tested by rebuilding on x86-64 Fedora 18, both natively and using the
mingw cross tools.
2013-12-19 Tom Tromey <tromey@redhat.com>
* serial.c (serial_ops_p): New typedef.
(serial_ops_list): Now a VEC.
(serial_interface_lookup): Return const. Use VEC_iterate.
(serial_add_interface): Make parameter const.
(serial_open): Update.
(serial_fdopen_ops): Make 'ops' const.
(serial_pipe): Update.
* ser-tcp.c (_initialize_ser_tcp): Update.
* ser-pipe.c (_initialize_ser_pipe): Update.
* ser-unix.c (_initialize_ser_hardwire): Update.
* ser-mingw.c (_initialize_ser_windows): Update.
* ser-go32.c (dos_ops): Now const. Update.
* serial.h (struct serial) <ops>: Now const.
(struct serial_ops) <next>: Remove.
(serial_add_interface): Make parameter const.
* aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Set
iov.iov_len with the real length in use.
gdb/gdbserver/
* linux-aarch64-low.c (aarch64_linux_set_debug_regs): Set
iov.iov_len with the real length in use.
This patch adds a typedef target_xfer_partial_ftype. When we change
the signature of xfer_partial functions (for example, adding a new
parameter), we don't have to modify all of their declarations.
This patch also updates the type of parameters of target_xfer_partial
from "void *" to "gdb_byte *".
gdb:
2013-12-18 Yao Qi <yao@codesourcery.com>
* target.h (target_xfer_partial_ftype): New typedef.
(target_xfer_partial): Update declaration.
* auxv.h (memory_xfer_auxv): Likewise.
* ia64-hpux-nat.c (super_xfer_partial): Likewise.
* ia64-linux-nat.c (super_xfer_partial): Likewise.
* linux-nat.c (super_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-full.c (record_full_beneath_to_xfer_partial):
(tmp_to_xfer_partial): Likewise.
* sparc-nat.c (inf_ptrace_xfer_partial): Likewise.
* target.c (default_xfer_partial): Likewise.
(current_xfer_partial): Likewise.
(target_xfer_partial): Change parameter type to 'gdb_byte *'.
I notice that two lines of a recent changelog entry are not prefixed
with tab. They are prefixed with a space and a tab. This patch
is to remove the space.
gdb:
2013-12-18 Yao Qi <yao@codesourcery.com>
* ChangeLog: Fix the format of one entry.
Like when stepping, the current stack frame location is expected to be
printed as result of tfind command, if that results in moving to a
different function. In tfind_1 we see:
if (from_tty
&& (has_stack_frames () || traceframe_number >= 0))
{
enum print_what print_what;
/* NOTE: in imitation of the step command, try to determine
whether we have made a transition from one function to
another. If so, we'll print the "stack frame" (ie. the new
function and it's arguments) -- otherwise we'll just show the
new source line. */
if (frame_id_eq (old_frame_id,
get_frame_id (get_current_frame ())))
print_what = SRC_LINE;
else
print_what = SRC_AND_LOC;
print_stack_frame (get_selected_frame (NULL), 1, print_what, 1);
do_displays ();
}
However, when we haven't collected any registers in the tracepoint
(collect $regs), that doesn't actually work:
(gdb) tstart
(gdb) info tracepoints
Num Type Disp Enb Address What
1 tracepoint keep y 0x080483b7 in func0
at ../.././../git/gdb/testsuite/gdb.trace/circ.c:28
collect testload
installed on target
2 tracepoint keep y 0x080483bc in func1
at ../.././../git/gdb/testsuite/gdb.trace/circ.c:32
collect testload
installed on target
(gdb) c
Continuing.
Breakpoint 3, end () at ../.././../git/gdb/testsuite/gdb.trace/circ.c:72
72 }
(gdb) tstop
(gdb) tfind start
Found trace frame 0, tracepoint 1
#0 func0 () at ../.././../git/gdb/testsuite/gdb.trace/circ.c:28
28 }
(gdb) tfind
Found trace frame 1, tracepoint 2
32 }
(gdb)
When we don't have info about the stack available
(UNWIND_UNAVAILABLE), frames end up with outer_frame_id as frame ID.
And in the scenario above, the issue is that both frames before and
after the second tfind (the frames for func0 an func1) have the same
id (outer_frame_id), so the frame_id_eq check returns false, even
though the frames were of different functions. GDB knows that,
because the PC is inferred from the tracepoint's address, even if no
registers were collected.
To fix this, this patch adds support for frame ids with a valid code
address, but <unavailable> stack address, and then makes the unwinders
use that instead of the catch-all outer_frame_id for such frames. The
frame_id_eq check in tfind_1 then automatically does the right thing
as expected.
I tested with --directory=gdb.trace/ , before/after the patch, and
compared the resulting gdb.logs, then adjusted the tests to expect the
extra output that came out. Turns out that was only circ.exp, the
original test that actually brought this issue to light.
Tested on x86_64 Fedora 17, native and gdbserver.
gdb/
2013-12-17 Pedro Alves <palves@redhat.com>
* frame.h (enum frame_id_stack_status): New enum.
(struct frame_id) <stack_addr>: Adjust comment.
<stack_addr_p>: Delete field, replaced with ...
<stack_status>: ... this new field.
(frame_id_build_unavailable_stack): Declare.
* frame.c (frame_addr_hash, fprint_field, outer_frame_id)
(frame_id_build_special): Adjust.
(frame_id_build_unavailable_stack): New function.
(frame_id_build, frame_id_build_wild): Adjust.
(frame_id_p, frame_id_eq, frame_id_inner): Adjust to take into
account frames with unavailable stack.
* amd64-tdep.c (amd64_frame_this_id)
(amd64_sigtramp_frame_this_id, amd64_epilogue_frame_this_id): Use
frame_id_build_unavailable_stack.
* dwarf2-frame.c (dwarf2_frame_this_id): Likewise.
* i386-tdep.c (i386_frame_this_id, i386_epilogue_frame_this_id)
(i386_sigtramp_frame_this_id): Likewise.
gdb/testsuite/
2013-12-17 Pedro Alves <palves@redhat.com>
* gdb.trace/circ.exp: Expect frame info to be printed when
switching between frames with unavailable stack, but different
functions.
https://sourceware.org/ml/gdb-patches/2013-12/msg00144.html
The vector of unavailable parts of a value is currently byte based. Given
that we can model a value down to the bit level, we can potentially loose
information with the current implementation. After this patch we model the
unavailable information in bits.
gdb/ChangeLog
* dwarf2loc.c (read_pieced_value): Mark bits, not bytes
unavailable, use correct bit length.
* value.c (struct value): Extend comment on unavailable to
indicate that it is bit based.
(value_bits_available): New function.
(value_bytes_available): Call value_bits_available.
(value_entirely_available): Check against the bit length, not byte
length.
(mark_value_bits_unavailable): New function.
(mark_value_bytes_unavailable): Move contents to
mark_value_bits_unavailable, call to same.
(memcmp_with_bit_offsets): New function.
(value_available_contents_bits_eq): New function, takes the
functionality from value_available_contents_eq but uses
memcmp_with_bit_offsets now, and is bit not byte based.
(value_available_contents_eq): Move implementation into
value_available_contents_bits_eq, call to same.
(value_contents_copy_raw): Work on bits, not bytes.
(unpack_value_bits_as_long_1): Check availability in bits, not
bytes.
* value.h (value_bits_available): Declare new function.
(mark_value_bits_unavailable): Declare new function.
gdb/testsuite/ChangeLog
* gdb.trace/unavailable-dwarf-piece.c: New file.
* gdb.trace/unavailable-dwarf-piece.exp: New file.
Like on GNU/Linux (linux-thread-db.c), the Solaris solaris-threads
target (handles libthread_db.so) shouldn't be pushed when remote
debugging.
This uses the same predicate used by linux-thread-db.c.
gdb/
2013-12-16 Pedro Alves <palves@redhat.com>
PR 16329
* sol-thread.c (check_for_thread_db): If the target can't run or
isn't a core, return without pushing.
This reverts commit 07293be448, as it
causes an unintended change of behavior with GDB/MI's =library-loaded
events: The host-name="<path>" part of the event is now showing the
target-side path instead of the host-side path.
This revert affects Darwin and AIX systems, however, where the BFD
is either artificial or icomplete, leading to the outputt of
"info shared" not containing the information we'd like. For instance,
on Darwin, we would see:
(top-gdb) info shared
From To Syms Read Shared Object Library
0x00007fff8d060de4 0x00007fff8d09ce1f Yes (*) i386:x86-64
0x00007fff8af08b10 0x00007fff8b1c6f73 Yes (*) i386:x86-64
To compensate for that, we overwrite the filename of the associated bfd.
gdb/ChangeLog:
Revert the following commit:
* solib.c (solib_map_sections): Remove code overwriting
SO->SO_NAME with the bfd's filename.
Make the following changes required after the revert above:
* solib-aix.c (solib_aix_bfd_open): Set the filename of the
returned bfd to a copy of the synthetic pathname.
* solib-darwin.c (darwin_bfd_open): Set the filename of the
returned bfd to a copy of PATHNAME.
This function has the following code:
elt_type = type;
for (i = n; i > 1; i--)
elt_type = TYPE_TARGET_TYPE (type);
For multi-dimension arrays, the code above tries to find the array
type corresponding to the dimension we're trying to inspect.
The problem is that, past the second dimension, the loop does
nothing other than repeat the first iteration. There is a little
thinko where it got the TYPE_TARGET_TYPE of TYPE instead of ELT_TYPE!
To my surprise, I was unable to produce an Ada exemple that demonstrated
the problem. That's because the examples I created all trigger a parallel
___XA type which we then use in place of the ELT_TYPE in order to
determine the bounds - see the code that immediately follows our
loop above:
index_type_desc = ada_find_parallel_type (type, "___XA");
ada_fixup_array_indexes_type (index_type_desc);
if (index_type_desc != NULL)
[...]
So, in order to avoid depending on an Ada example where the compiler
can potentially decide one way or the other, I decided to use an
artificial example, written in C. With ...
int multi[1][2][3];
... forcing the language to Ada, and trying to print the 'last,
we get:
(gdb) p multi'last(1)
$1 = 0
(gdb) p multi'last(2)
$2 = 1
(gdb) p multi'last(3)
$3 = 1 <<<--- This should be 2!
Additionally, I noticed that a couple of check_typedef's were missing.
This patch adds them. And since the variable in question only gets
used within an "else" block, I moved the variable declaration and
use inside that block - making it clear what the scope of the variable
is.
gdb/ChangeLog:
* ada-lang.c (ada_array_bound_from_type): Move the declaration
and assignment of variable "elt_type" inside the else block
where it is used. Add two missing check_typedef calls.
Fix bug where we got TYPE's TYPE_TARGET_TYPE, where in fact
we really wanted to get ELT_TYPE's TYPE_TARGET_TYPE.
gdb/testsuite/ChangeLog:
* gdb.ada/arraydim: New testcase.
PR python/16113
* NEWS (Python Scripting): Add entry for the new feature and the
new attribute of gdb.Field objects.
* python/py-type.c (gdbpy_is_field): New function
(convert_field): Add 'parent_type' attribute to gdb.Field
objects.
* python/py-value.c (valpy_getitem): Allow subscript value to be
a gdb.Field object.
(value_has_field): New function
(get_field_flag): New function
* python/python-internal.h (gdbpy_is_field): Add declaration.
testsuite/
* gdb.python/py-value-cc.cc: Improve test case.
* gdb.python/py-value-cc.exp: Add new tests to test usage of
gdb.Field objects as subscripts on gdb.Value objects.
doc/
* gdb.texinfo (Values From Inferior): Add a note about using
gdb.Field objects as subscripts on gdb.Value objects.
(Types In Python): Add description about the new attribute
"parent_type" of gdb.Field objects.
I have a case that could use an exception for "unsupported feature".
I found UNSUPPORTED_ERROR, but looking deeper, I think as is, reusing
it for other things would be fragile. E.g., if the Python script
sourced by source_script_from_stream triggers any other missing
functionality that would result in UNSUPPORTED_ERROR being propagated
out to source_script_from_stream, that would confuse the error for
Python not being built into GDB.
This patch thus redoes things a little. Instead of using an exception
for the "No Python" scenario, check whether Python is configured in
before actually trying to source the file. It adds a new function
instead of using #ifdef HAVE_PYTHON directly, as that is better at
avoiding bitrot, as both Python and !Python paths are visible to the
compiler this way.
Tested on Fedora 17, with and without Python.
gdb/
2013-12-12 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (source_script_from_stream) Use have_python
instead of catching UNSUPPORTED_ERROR.
* exceptions.h (UNSUPPORTED_ERROR): Delete.
* python/python.c (source_python_script) [!HAVE_PYTHON]: Internal
error if called.
* python/python.h (have_python): New static inline function.
This patch sanitizes the access to gdbarch made by various functions of
the SDT probe API. Before this patch, gdbarch was being accessed via
the probe's objfile; however, this proved to cause a bug on 32-bit ARM
targets because during the parsing of the probe's arguments the code
needed to access some pseudo-registers of the architecture, and this
information is not fully correct on the objfile's gdbarch.
Basically, the approach taken was to instead pass the current/selected
frame to the parsing and evaluation functions, so that they can extract
the gdbarch directly from the frame. It solved the ARM bug reported
above, and also contributed to make the API cleaner.
Tested on x86_64 and 32-bit ARM.
2013-12-11 Sergio Durigan Junior <sergiodj@redhat.com>
* break-catch-throw.c (fetch_probe_arguments): Pass selected frame
to get_probe_argument_count and evaluate_probe_argument.
* probe.c (get_probe_argument_count): Adjust declaration to accept
frame. Pass frame to probe_ops's get_probe_argument_count.
(evaluate_probe_argument): Likewise, for evaluate_probe_argument.
(probe_safe_evaluate_at_pc): Pass frame to
get_probe_argument_count and evaluate_probe_argument.
* probe.h (struct probe_ops) <get_probe_argument_count,
evaluate_probe_argument>: Adjust declarations to accept frame.
(get_probe_argument_count, evaluate_probe_argument): Likewise.
* solib-svr4.c (solib_event_probe_action): Get current frame.
Pass it to get_probe_argument_count.
(svr4_handle_solib_event): Get current frame. Pass it to
get_probe_argument_count and evaluate_probe_argument.
* stap-probe.c (stap_parse_probe_arguments): Adjust declaration to
accept gdbarch. Do not obtain it from the probe's objfile.
(stap_get_probe_argument_count): Adjust declaration to accept
frame. Obtain gdbarch from the frame. Call generic
can_evaluate_probe_arguments. Pass gdbarch to
stap_parse_probe_arguments.
(stap_get_arg): Adjust declaration to accept gdbarch. Pass it to
stap_parse_probe_arguments.
(stap_evaluate_probe_argument): Adjust declaration to accept
frame. Obtain gdbarch from the frame. Pass gdbarch to
stap_get_arg.
(stap_compile_to_ax): Pass agent_expr's gdbarch to stap_get_arg.
(compute_probe_arg): Obtain gdbarch from frame. Pass frame to
get_probe_argument_count and evaluate_probe_argument.
* 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.
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.
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.
* 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.
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.