The file and line handling in complaints.c wasn't used once
internal_complaint was removed. This patch removes all the related
code.
gdb/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* complaints.c (struct complain) <file, line>: Remove.
(find_complaint): Remove file, line parameters.
(complaint_internal): Update.
vcomplaint now has a single caller, so merge it with that caller.
gdb/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* complaints.c (vcomplaint): Remove.
(complaint_internal) Merge in contents of vcomplaint.
Now that there's only a single reason for a complaint to be emitted,
this removes "struct explanation" and changes vcomplaint to emit the
desired messages directly.
gdb/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* complaints.c (struct complaints) <explanation>: Remove.
(symfile_explanations): Remove.
(symfile_complaint_book): Update.
(vcomplaint): Update.
(struct explanation): Remove.
After the previous patch, the "noisy" parameter to clear_complaints is
no longer used, so this patch removes it.
gdb/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* complaints.c (clear_complaints): Remove "noisy" parameter.
* complaints.h (clear_complaints): Update.
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.
gdb/testsuite/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* gdb.gdb/complaints.exp (test_empty_complaints): Update.
I couldn't find a way to get complaints to use a couple of cases, and
the difference between the actual printed output for these cases was
minimal anyway. So, this patch removes a couple of constants from
complaint_series, plus the associated code.
gdb/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* complaints.c (enum complaint_series): Remove FIRST_MESSAGE,
SUBSEQUENT_MESSAGE.
(vcomplaint, clear_complaints): Update.
(symfile_explanations): Remove some messages.
gdb/testsuite/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* gdb.gdb/complaints.exp (test_serial_complaints): Remove.
(test_short_complaints): Update.
I happened to notice that gdb has both complaint_internal and
internal_complaint. The latter is unused, so this patch removes it.
gdb/ChangeLog
2018-05-23 Tom Tromey <tom@tromey.com>
* complaints.c (internal_complaint): Remove.
* complaints.h (internal_complaint): Remove.
Currently, the function used by gdbserver to parse integers from
received File I/O commands will detect overflow and fail for any value
over 0xfffffff. Among other things, this has the effect of limiting
the file offsets for reading or writing to about 268MB which can be
insufficient for particularly large libraries.
This change allows the parsing of integers up to the true maximum
positive value of 0x7fffffff, increasing the file size limit to about
2GB.
gdb/gdbserver/ChangeLog:
2018-05-23 Erik Kurzinger <ekurzinger@nvidia.com>
PR server/23198
* hostio.c (require_int): Do not report overflow for integers
between 0xfffffff and 0x7fffffff.
This fixes gdb.base/remote.exp regressions caused by the previous
commit to the testcase, when tested with
--target_board=native-extended-gdbserver. For example:
...
show remote memory-write-packet-size
The memory-write-packet-size is 0 (default). Packets are limited to 16383 bytes.
(gdb) FAIL: gdb.base/remote.exp: write-packet default
...
With that board, GDB connects to GDBserver at gdb_start time, so GDB
is showing the actual remote/gdbserver packet size limits.
Fix it using the usual "disconnect" pattern. While at it, there's no
need to start GDB before compiling the testcase.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* gdb.base/remote.exp: Only gdb_start after compiling the
testcase. Issue "disconnect" before testing "set remote" command
defaults. Issue clean_restart before running to main.
Make `i' defined within `i387_collect_xsave' unsigned, removing a
`-Werror=strict-overflow' compilation error:
.../gdb/i387-tdep.c: In function 'void i387_collect_xsave(const regcache*, int, void*, int)':
.../gdb/i387-tdep.c:1348:1: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Werror=strict-overflow]
i387_collect_xsave (const struct regcache *regcache, int regnum,
^
cc1plus: all warnings being treated as errors
Makefile:1610: recipe for target 'i387-tdep.o' failed
make: *** [i387-tdep.o] Error 1
seen with GCC 5.4.0, a commit 8ee22052f6 ("gdb/x86: Handle kernels
using compact xsave format") regression. While `regnum' can be -1 on
entry to the function, to mean all registers, `i' is only used with
non-negative register numbers.
gdb/
* i387-tdep.c (i387_collect_xsave): Make `i' unsigned.
Fix an issue with `gdbserver' on big-endian n64 MIPS targets, where
$dspctl is 32-bit while the `ptrace' transfer data type is 64-bit.
Such register data is held in the low order 32 bits of the 64-bit data
quantity exchanged with the buffer used by `fetch_register' and
`store_register', however `supply_register' and `collect_register'
access the same data as a 32-bit quantity. Consequently the register is
presented and written as all-zeros held in the most-significant part of
the big-endian 64-bit data quantity represented in the buffer:
(gdb) info registers
zero at v0 v1
R0 0000000000000000 0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4 00000001200212b0 0000000000000000 0000000000000021 000000012001a260
a4 a5 a6 a7
R8 000000012001a260 0000000000000004 800000010c60c000 fffffffffffffff8
t0 t1 t2 t3
R12 0000000000000000 000000fff7edab68 0000000000000001 0000000000000000
s0 s1 s2 s3
R16 000000fff7ee2068 0000000120008b80 0000000000000000 0000000000000000
s4 s5 s6 s7
R20 000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24 0000000000000000 00000001200027c0 0000000000000000 0000000000000000
gp sp s8 ra
R28 00000001200212b0 000000ffffffc850 000000ffffffc850 0000000120005ee8
status lo hi badvaddr
0000000000109cf3 0000000000943efe 000000000000000e 000000012001a008
cause pc
0000000000800024 0000000120005ee8
fcsr fir hi1 lo1
0e800000 00f30000 0000000000000000 0101010101010101
hi2 lo2 hi3 lo3
0202020202020202 0303030303030303 0404040404040404 0505050505050505
dspctl restart
00000000 0000000000000000
(gdb)
Correct this problem then by using the `mips_supply_register'
`mips_collect_register' accessors for 32-bit registers where the
`ptrace' data type is 64-bit. These accessors already operate on 32-bit
data quantities held in 64-bit containers:
(gdb) info registers
zero at v0 v1
R0 0000000000000000 0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4 00000001200212b0 0000000000000000 0000000000000021 000000012001a260
a4 a5 a6 a7
R8 000000012001a260 0000000000000004 800000010d82e900 fffffffffffffff8
t0 t1 t2 t3
R12 0000000000000000 000000fff7edab68 0000000000000001 0000000000000000
s0 s1 s2 s3
R16 000000fff7ee2068 0000000120008b80 0000000000000000 0000000000000000
s4 s5 s6 s7
R20 000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24 0000000000000000 00000001200027c0 0000000000000000 0000000000000000
gp sp s8 ra
R28 00000001200212b0 000000ffffffc850 000000ffffffc850 0000000120005ee8
status lo hi badvaddr
0000000000109cf3 0000000000943efe 000000000000000e 000000012001a008
cause pc
0000000000800024 0000000120005ee8
fcsr fir hi1 lo1
0e800000 00f30000 0000000000000000 0101010101010101
hi2 lo2 hi3 lo3
0202020202020202 0303030303030303 0404040404040404 0505050505050505
dspctl restart
55aa33cc 0000000000000000
(gdb)
gdb/gdbserver/
* linux-mips-low.c [HAVE_PTRACE_GETREGS] (mips_collect_register)
(mips_supply_register): Move outside HAVE_PTRACE_GETREGS.
(mips_collect_ptrace_register, mips_supply_ptrace_register): New
functions.
(the_low_target): Wire them.
'struct remote_state' today contains per-connection state, however
there's only a single global instance of that type. In order to
support multiple connections, we must have one such object per
connection.
Thus this patch eliminates the 'remote_state' global in favor of
having a remote_state instance per remote_target instance.
The get_remote_state free function is eliminated as well, by making it
a remote_target method instead.
The patch then fixes the fallout by making all free functions that
refer to get_remote_state() directly or indirectly be methods of
remote_target too.
Likewise, remote-fileio.c and remote-notif.c routines are
parameterized with a remote_target pointer too, so they can call into
the right remote_target instance.
References to the global 'get_remote_state ()->remote_desc' to tell
whether the remote target is open (!= nullptr) must be replaced with
something else:
- Command implementations use a new get_current_remote_target free
function.
- remote_target::open_1 checks the exception type instead.
Finally, remote_target and extended_remote_target are made
heap-allocated targets. As with the earlier core target patches, it
still won't be possible to have more than one remote_target instance
in practice, but this puts us closer.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote-fileio.c (remote_fileio_reply, remote_fileio_ioerror)
(remote_fileio_badfd, remote_fileio_return_errno)
(remote_fileio_return_success, remote_fileio_func_open)
(remote_fileio_func_open, remote_fileio_func_close)
(remote_fileio_func_read, remote_fileio_func_write)
(remote_fileio_func_lseek, remote_fileio_func_rename)
(remote_fileio_func_unlink, remote_fileio_func_stat)
(remote_fileio_func_fstat, remote_fileio_func_gettimeofday)
(remote_fileio_func_isatty, remote_fileio_func_system): Add
remote_target parameter.
(remote_fio_func_map) <func>: Add remote_target parameter.
(do_remote_fileio_request, remote_fileio_request):
* remote-fileio.h (remote_fileio_request):
* remote-notif.c (remote_notif_ack, remote_notif_parse, ): Add
remote_target parameter.
(remote_notif_process, handle_notification): Adjust to pass down
the remote.
(remote_notif_state_allocate): Add remote_target parameter. Save
it.
* remote-notif.h (struct remote_target): Forward declare.
(struct notif_client) <parse, ack, can_get_pending_events>: Add
remote_target parameter.
(struct remote_notif_state) <remote>: New field.
(remote_notif_ack, remote_notif_parse): Add remote_target
parameter.
(remote_notif_state_allocate, remote_notif_state_allocate): Add
remote_target parameter.
* remote.c (OPAQUETHREADBYTES, threadref, gdb_ext_thread_info)
(threads_listing_context, rmt_thread_action, protocol_feature)
(packet_reg, stop_reply, stop_reply_p, enum packet_support)
(packet_result, struct threads_listing_context, remote_state):
Move definitions and declarations higher up.
(remote_target) <~remote_target>: Declare.
(remote_download_command_source, remote_file_put, remote_file_get)
(remote_file_delete, remote_hostio_pread, remote_hostio_pwrite)
(remote_hostio_pread_vFile, remote_hostio_send_command)
(remote_hostio_set_filesystem, remote_hostio_open)
(remote_hostio_close, remote_hostio_unlink, remote_state)
(get_remote_state, get_remote_packet_size, get_memory_packet_size)
(get_memory_write_packet_size, get_memory_read_packet_size)
(append_pending_thread_resumptions, remote_detach_1)
(append_resumption, remote_resume_with_vcont)
(add_current_inferior_and_thread, wait_ns, wait_as)
(process_stop_reply, remote_notice_new_inferior)
(process_initial_stop_replies, remote_add_thread)
(btrace_sync_conf, remote_btrace_maybe_reopen)
(remove_new_fork_children, kill_new_fork_children)
(discard_pending_stop_replies, stop_reply_queue_length)
(check_pending_events_prevent_wildcard_vcont)
(discard_pending_stop_replies_in_queue, stop_reply)
(remote_notif_remove_queued_reply, stop_reply *queued_stop_reply)
(peek_stop_reply, remote_parse_stop_reply, remote_stop_ns)
(remote_interrupt_as, remote_interrupt_ns)
(remote_get_noisy_reply, remote_query_attached)
(remote_add_inferior, remote_current_thread, get_current_thread)
(set_thread, set_general_thread, set_continue_thread)
(set_general_process, write_ptid)
(remote_unpack_thread_info_response, remote_get_threadinfo)
(parse_threadlist_response, remote_get_threadlist)
(remote_threadlist_iterator, remote_get_threads_with_ql)
(remote_get_threads_with_qxfer)
(remote_get_threads_with_qthreadinfo, extended_remote_restart)
(get_offsets, remote_check_symbols, remote_supported_packet)
(remote_query_supported, remote_packet_size)
(remote_serial_quit_handler, remote_detach_pid)
(remote_vcont_probe, remote_resume_with_hc)
(send_interrupt_sequence, interrupt_query)
(remote_notif_get_pending_events, fetch_register_using_p)
(send_g_packet, process_g_packet, fetch_registers_using_g)
(store_register_using_P, store_registers_using_G)
(set_remote_traceframe, check_binary_download)
(remote_write_bytes_aux, remote_write_bytes, remote_read_bytes_1)
(remote_xfer_live_readonly_partial, remote_read_bytes)
(remote_send_printf, remote_flash_write, readchar)
(remote_serial_write, putpkt, putpkt_binary, skip_frame)
(read_frame, getpkt, getpkt_or_notif_sane_1, getpkt_sane)
(getpkt_or_notif_sane, remote_vkill, remote_kill_k)
(extended_remote_disable_randomization, extended_remote_run)
(send_environment_packet, extended_remote_environment_support)
(extended_remote_set_inferior_cwd, remote_write_qxfer)
(remote_read_qxfer, push_stop_reply, vcont_r_supported)
(packet_command): Now methods of ...
(remote_target): ... this class.
(m_remote_state) <remote_target>: New field.
(struct remote_state) <stop_reply_queue,
remote_async_inferior_event_token, wait_forever_enabled_p>: New
fields.
(remote_state::remote_state): Allocate stop_reply_queue.
(remote_state): Delete global.
(get_remote_state_raw): Delete.
(remote_target::get_remote_state): Allocate m_remote_state on
demand.
(get_current_remote_target): New.
(remote_ops, extended_remote_ops): Delete.
(wait_forever_enabled_p, remote_async_inferior_event_token):
Delete, moved to struct remote_state.
(remote_target::close): Delete self. Destruction bits split to
...
(remote_target::~remote_target): ... this.
(show_memory_packet_size): Adjust to use
get_current_remote_target.
(struct protocol_feature) <func>: Add remote_target parameter.
All callers adjusted.
(curr_quit_handler_target): New.
(remote_serial_quit_handler): Reimplement.
(remote_target::open_1): Adjust to use get_current_remote_target.
Heap-allocate remote_target/extended_remote_target instances.
(vcont_builder::vcont_builder): Add remote_target parameter, and
save it in m_remote. All callers adjusted.
(vcont_builder::m_remote): New field.
(vcont_builder::restart, vcont_builder::flush)
(vcont_builder::push_action): Use it.
(remote_target::commit_resume): Use it.
(struct queue_iter_param) <remote>: New field.
(remote_target::remove_new_fork_children): Fill in 'remote' field.
(check_pending_event_prevents_wildcard_vcont_callback_data): New.
(check_pending_event_prevents_wildcard_vcont_callback)
(remote_target::check_pending_events_prevent_wildcard_vcont)
(remote_target::discard_pending_stop_replies)
(remote_target::discard_pending_stop_replies_in_queue)
(remote_target::remote_notif_remove_queued_reply): Fill in
'remote' field.
(remote_notif_get_pending_events): New.
(remote_target::readchar, remote_target::remote_serial_write):
Save/restore curr_quit_handler_target.
(putpkt): New.
(kill_new_fork_children): Fill in 'remote' field.
(packet_command): Use get_current_remote_target, defer to
remote_target method of same name.
(scoped_remote_fd::scoped_remote_fd): Add 'remote_target'
parameter, and save it in m_remote. All callers adjusted.
(scoped_remote_fd::release): Use m_remote.
(scoped_remote_fd::m_remote): New field.
(remote_file_put, remote_file_get, remote_file_delete): Use
get_current_remote_target, defer to remote_target method of same
name.
(remote_btrace_reset): Add remote_state paremeter. Update all
callers.
(remote_async_inferior_event_handler). Pass down 'data'.
(remote_new_objfile): Use get_current_remote_target.
(remote_target::vcont_r_supported): New.
(set_range_stepping): Use get_current_remote_target and
remote_target::vcont_r_supported.
(_initialize_remote): Don't allocate 'remote_state' and
'stop_reply_queue' globals.
* remote.h (struct remote_target): Forward declare.
(getpkt, putpkt, remote_notif_get_pending_events): Add
'remote_target' parameter.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (vcont_builder): Now a class. Make all data members
private.
(vcont_builder) <vcont_builder, restart, flush, push_action>:
Declare methods.
(vcont_builder_restart): Rename to ...
(vcont_builder::restart): ... this.
(vcont_builder_flush): Rename to ...
(vcont_builder::flush): ... this.
(vcont_builder_push_action): Rename to ...
(vcont_builder::push_action): ... this.
(remote_target::commit_resume): Adjust.
Currently "show remote memory-write-packet-size" says that the packet
size is limited to whatever is stored in the remote_state global, even
if not connected to a target.
When we get to support multiple instances of remote targets, there
won't be a remote_state global anymore, so that must be replaced by
something else.
Since it doesn't make sense to print the limit of the packet size of a
non-existing connection, this patch makes us say that the limit will
be further reduced when we connect.
The text is taken from the command's online help, which says:
"The actual limit is further reduced dependent on the target."
Note that a value of "0" is special, as per "help set remote
memory-write-packet-size":
~~~
Specify the number of bytes in a packet or 0 (zero) for the
default packet size.
~~~
I've tweaked "show remote memory-write-packet-size" to include
"(default)" in the output in that case, like this:
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 0 (default). The actual limit will be further reduced dependent on the target.
While working on this, I noticed that an explicit "set remote
write-packet-size 0" does not makes GDB go back to the exact same
state as the default state when GDB starts up:
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 0. [...]
^^
(gdb) set remote memory-write-packet-size 0
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 16384. [...]
^^^^^
The "16384" number comes from DEFAULT_MAX_MEMORY_PACKET_SIZE.
This happens because git commit a5c0808e22 ("gdb: remove packet size
limit") at
<https://sourceware.org/ml/gdb-patches/2015-08/msg00743.html>, added
this:
/* So that the query shows the correct value. */
if (size <= 0)
size = DEFAULT_MAX_MEMORY_PACKET_SIZE;
to set_memory_packet_size, but despite what the comment suggests, that
also has the side-effect of recording DEFAULT_MAX_MEMORY_PACKET_SIZE
in config->size.
Finally, DEFAULT_MAX_MEMORY_PACKET_SIZE only makes sense for "set
remote memory-write-packet-size fixed", so I've renamed it
accordingly, to make it a little bit clearer.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (DEFAULT_MAX_MEMORY_PACKET_SIZE): Rename to ...
(DEFAULT_MAX_MEMORY_PACKET_SIZE_FIXED): ... this.
(get_fixed_memory_packet_size): New.
(get_memory_packet_size): Use it.
(set_memory_packet_size): Don't override the config size with
DEFAULT_MAX_MEMORY_PACKET_SIZE.
(show_memory_packet_size): Use get_fixed_memory_packet_size.
Don't refer to get_memory_packet_size if not connected to a remote
target. Show "(default)" if configured size is 0.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* gdb.base/remote.exp: Adjust expected output of "show remote
memory-write-packet-size". Add tests for "set remote
memory-write-packet-size 0" and "set remote
memory-write-packet-size fixed/limit".
This helps because discard_pending_stop_replies will later become a
method of remote_target. Otherwise, when we have multiple instances
of remote_target, we'd have to make discard_pending_stop_replies find
the inferior's target_ops, and upcast it to remote_target (if indeed a
remote) to find the pending stop replies queue to clear.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (remote_target::mourn_inferior): Move
discard_pending_stop_replies call here from ...
(_initialize_remote): ... here.
The set_general_process call in compare_sections_command isn't
actually needed. remote_target::verify_memory and
remote_target::xfer_partial already handle making sure the remote is
pointing at the right process or thread.
Getting this out of the way helps a bit with further elimination of
the remote_state global, because we have to handle the case of a user
invoking the command even if not connect to a remote target.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (compare_section_command): Remove set_general_process
call.
The previous patch made the map store pointers to remote_arch_state
instead of objects directly, simply because struct remote_arch_state
is still incomplete where struct remote_state is declared. This patch
thus moves the remote_arch_state declaration higher up in the file,
and makes the map store remote_arch_state objects directly instead of
pointers to objects.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (struct packet_reg, struct remote_arch_state):
Move higher up in the file.
(remote_state) <m_arch_states>: Store remote_arch_state values
instead of remote_arch_state pointers.
(remote_state::get_remote_arch_state): Adjust.
Currently, we associate gdbarch-related remote protocol state on a
per-gdbarch data object. Things like the size of the g/G packet, and
the max remote packet size. If we'll support being connected to
different remote servers at the same time, then we need to cope with
each having their own packet sizes, even if they are each debugging
programs of the same architecture. I.e., a single instance of
remote_arch_state per arch is not sufficient.
This patch moves the remote_arch_state object to a map of
gdbarch-to-remote_arch_state saved in the remote_state structure.
Usually there will only be one entry in the map, though we may see
more with stubs that support multi-process and/or archs with multiple
ABIs (e.g, one remote_arch_state for 64-bit inferiors and another for
32-bit inferiors).
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c: Include <unordered_map>.
(remote_state): Now a class.
(remote_state) <get_remote_arch_state>: Declare method.
<get_remote_arch_state>: New field.
(remote_arch_state) <remote_arch_state>: Declare ctor.
<regs>: Now a unique_ptr.
(remote_gdbarch_data_handle): Delete.
(get_remote_arch_state): Delete.
(remote_state::get_remote_arch_state): New.
(get_remote_state): Adjust to call remote_state's
get_remote_arch_state method.
(init_remote_state): Delete, bits factored out to ...
(remote_arch_state::remote_arch_state): ... this new method.
(get_remote_packet_size, get_memory_packet_size)
(process_g_packet, remote_target::fetch_registers)
(remote_target::prepare_to_store, store_registers_using_G)
(remote_target::store_registers, remote_target::get_trace_status):
Adjust to call remote_state's method.
(_initialize_remote): Remove reference to
remote_gdbarch_data_handle.
The idea here is eliminate the get_remote_state calls from within
readahead_cache_invalidate, readahead_cache_invalidate_fd,
remote_hostio_pread_from_cache by making those functions be class
methods instead. Later on we'll have one readahead_cache instance per
remote connection, and this change makes that easier.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (struct readahead_cache) <invalidate, invalidate_fd,
pread>: New method declarations.
(remote_target::open_1): Adjust.
(readahead_cache_invalidate): Rename to ...
(readahead_cache::invalidate): ... this, and adjust to be a class
method.
(readahead_cache_invalidate_fd): Rename to ...
(readahead_cache::invalidate_fd): ... this, and adjust to be a
class method.
(remote_hostio_pwrite): Adjust.
(remote_hostio_pread_from_cache): Rename to ...
(readahead_cache::pread): ... this, and adjust to be a class
method.
(remote_hostio_close): Adjust.
A bit of C++ification. Also plugs a few leaks, since currently
nothing is freeing a few fields of remote_state. They're now freed in
the added destructor.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
(struct vCont_action_support): Use bool and initialize all fields.
(struct readahead_cache): Initialize all fields.
(remote_state): Use bool and initialize all fields.
(remote_state::remote_state, remote_state::~remote_state): New.
(new_remote_state): Delete.
(_initialize_remote): Use new to allocate remote_state.
Factor out cp_ident_is_alpha/cp_ident_is_alnum out of
gdb/cp-name-parser.y and use it in the C/C++ expression parser too.
New test included.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
張俊芝 <zjz@zjz.name>
PR gdb/22973
* c-exp.y: Include "c-support.h".
(parse_number, c_parse_escape, lex_one_token): Use TOLOWER instead
of tolower. Use c_ident_is_alpha to scan names.
* c-lang.c: Include "c-support.h".
(convert_ucn, convert_octal, convert_hex, convert_escape): Use
ISXDIGIT instead of isxdigit and ISDIGIT instead of isdigit.
* c-support.h: New file, with bits factored out from ...
* cp-name-parser.y: ... this file.
Include "c-support.h".
(cp_ident_is_alpha, cp_ident_is_alnum): Deleted, moved to
c-support.h and renamed.
(symbol_end, yylex): Adjust.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
PR gdb/22973
* gdb.base/utf8-identifiers.c: New file.
* gdb.base/utf8-identifiers.exp: New file.
Currently the ppc linux core file target doesn't return target
descriptions with the lager FPSCR introduced in isa205.
This patch changes the core file target so that the auxv is read from
the core file to determine the size of FPSCR, so that the appropriate
target description is selected.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* arch/ppc-linux-common.c (ppc_linux_has_isa205): Change the
parameter type to CORE_ADDR.
* arch/ppc-linux-common.h (ppc_linux_has_isa205): Change the
parameter type in declaration to CORE_ADDR.
* ppc-linux-tdep.c (ppc_linux_core_read_description): Call
target_auxv_search to get AT_HWCAP and use the result to get the
target description.
* ppc-linux-nat.c (ppc_linux_get_hwcap): Change the return type
to CORE_ADDR. Remove the cast of the return value to unsigned
long. Fix error predicate of target_auxv_search.
(ppc_linux_nat_target::read_description): Change the type of the
hwcap variable to CORE_ADDR.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* gdb.arch/powerpc-fpscr-gcore.exp: New file.
Previously, decimal floating point pseudoregisters were always included
in the target if it had a floating point unit.
This patch changes this to only include them if the target description
indicates that they are present, i.e. if the FPSCR register has more
than 32 bits.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Assign 1 to have_dfp only
if the size of fpscr is larger than 32 bits.
The functions used by the VSX regset to collect and supply registers
from core files where incorrect. This patch changes the regset to use
the standard regset collect/supply functions to fix this. The native
target is also changed to use the same regset.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* ppc-linux-tdep.c (ppc_linux_vsxregset): New function.
(ppc32_linux_vsxregmap): New global.
(ppc32_linux_vsxregset): Initialize with ppc32_linux_vsxregmap,
regcache_supply_regset, and regcache_collect_regset.
* ppc-linux-tdep.h (ppc_linux_vsxregset): Declare.
* ppc-linux-nat.c (supply_vsxregset, fill_vsxregset): Remove.
(fetch_vsx_register, store_vsx_register): Remove.
(fetch_vsx_registers): Add regno parameter. Get regset using
ppc_linux_vsxregset. Use regset to supply registers.
(store_vsx_registers): Add regno parameter. Get regset using
ppc_linux_vsxregset. Use regset to collect registers.
(fetch_register): Call fetch_vsx_registers instead of
fetch_vsx_register.
(store_register): Call store_vsx_registers instead of
store_vsx_register.
(fetch_ppc_registers): Call fetch_vsx_registers with -1 for the
new regno parameter.
(store_ppc_registers): Call store_vsx_registers with -1 for the
new regno parameter.
* rs6000-tdep.c (ppc_vsx_support_p, ppc_supply_vsxreget)
(ppc_collect_vsxregset): Remove.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* gdb.arch/powerpc-vsx-gcore.exp: New file.
The 4-byte VSCR register is found inside a 16-byte field in the regset
returned by ptrace and in core files. The position of VSCR depends on
the endianess of the target, which was previously assumed to be
big-endian for the purpose of getting VSCR. This patch removes this
assumption to fix access to VSCR in little-endian mode.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* ppc-tdep.h (struct ppc_reg_offsets): Remove vector register
offset fields.
* ppc-fbsd-tdep.c (ppc32_fbsd_reg_offsets): Remove initializers
for vector register offset fields.
(ppc64_fbsd_reg_offsets): Likewise.
* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Remove assignment
to vector register offset fields.
* ppc-obsd-tdep.c (_initialize_ppcnbsd_tdep): Remove assignment
to vector register offset fields.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Remove assignment to
vector register offset fields.
* rs6000-aix-tdep.c (rs6000_aix32_reg_offsets): Remove
initializers for vector register offset fields.
(rs6000_aix64_reg_offsets): Likewise.
* rs6000-tdep.c (ppc_vrreg_offset): Remove.
(ppc_supply_vrregset): Remove.
(ppc_collect_vrregset): Remove.
* ppc-linux-tdep.c (ppc_linux_collect_vrregset): New function.
(ppc_linux_vrregset) : New function.
(ppc32_le_linux_vrregmap, ppc32_be_linux_vrregmap)
(ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): New globals.
(ppc32_linux_vrregset): Remove.
(ppc_linux_iterate_over_regset_sections): Call ppc_linux_vrregset
and use result instead of ppc32_linux_vrregset.
(ppc32_linux_reg_offsets): Remove initializers for vector register
offset fields.
(ppc64_linux_reg_offsets): Likewise.
* ppc-linux-tdep.h (ppc_linux_vrregset): New declaration.
* ppc-linux-nat.c: Include regset.h.
(gdb_vrregset_t): Adjust comment to account for little-endian
mode.
(supply_vrregset, fill_vrregset): Remove.
(fetch_altivec_register, store_altivec_register): Remove.
(fetch_altivec_registers): Add regno parameter. Get regset using
ppc_linux_vrregset. Use regset to supply registers.
(store_altivec_registers): Add regno parameter. Get regset using
ppc_linux_vrregset. Use regset to collect registers.
(fetch_register): Call fetch_altivec_registers instead of
fetch_altivec_register.
(store_register): Call store_altivec_registers instead of
store_altivec_register.
(fetch_ppc_registers): Call fetch_altivec_registers with -1 for
the new regno parameter.
(store_ppc_registers): Call store_altivec_registers with -1 for
the new regno parameter.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (ppc_fill_vrregset): Add vscr_offset variable.
Set vscr_offset to 0 in little-endian mode and 12 in big-endian
mode. Call collect_register_by_name with vscr using
vscr_offset. Zero-pad vscr and vrsave fields in collector buffer.
(ppc_store_vrregset): Add and set vscr_offset variable as in
ppc_fill_vrregset. Call supply_register_by_name with vscr using
vscr_offset.
This patch defines constants for the sizes of the two vector
regsets (vector-scalar registers and regular vector registers).
The native, gdbserver and core file targets are changed to use these
constants.
The Linux ptrace calls return (or read) a smaller regset than the one
found in core files for vector registers, because ptrace uses a single
4-byte quantity for vrsave at the end of the regset, while the
core-file regset uses a full 16-byte field for vrsave. For simplicity,
the larger size is used in both cases, and so a buffer with 12 unused
additional bytes is passed to ptrace in the native target.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_VRREGSET)
(PPC_LINUX_SIZEOF_VSXREGSET): Define.
* ppc-linux-nat.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
(gdb_vrregset_t): Change array type size to
PPC_LINUX_SIZEOF_VRREGSET.
(gdb_vsxregset_t): Change array type size to
PPC_LINUX_SIZEOF_VSXREGSET.
* ppc-linux-tdep.c (ppc_linux_iterate_over_regset_sections):
Change integer literals to PPC_LINUX_SIZEOF_VRREGSET and
PPC_LINUX_SIZEOF_VSXREGSET.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
(ppc_arch_setup): Change SIZEOF_VRREGS and SIZEOF_VSXREGS to
PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET.
Currently the linux-ppc-low.c fill/store functions for extended
regsets check whether they should execute by using the global hwcap
variable.
This patch explicitly sets the regset sizes to zero when needed to
disable them instead, so that the fill/store functions are not called
in the first place by regsets_fetch_inferior_registers in linux-low.c.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (ppc_fill_vsxregset): Remove ppc_hwcap check.
(ppc_store_vsxregset): Likewise.
(ppc_fill_vrregset): Likewise.
(ppc_store_vrregset): Likewise.
(ppc_fill_evrregset): Likewise.
(ppc_store_evrregset): Likewise.
(ppc_regsets): Set VSX/VR/EVR regset sizes to 0.
(ppc_arch_setup): Iterate through ppc_regsets and set sizes when
needed.
This patch moves the native target wordsize getter for ppc linux to
nat/ so that it can be used to simplify ppc_arch_setup in
gdbserver. The ptrace call used to get MSR for this is ultimately the
same as before, but it is no longer necessary to create a temporary
regcache to call fetch_inferior_registers.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* configure.nat <linux powerpc>: Add ppc-linux.o to NATDEPFILES.
* ppc-linux-nat.c (ppc_linux_target_wordsize): Move to
nat/ppc-linux.c.
(ppc_linux_nat_target::auxv_parse): Get thread id tid. Call
ppc_linux_target_wordsize with tid.
(ppc_linux_nat_target::read_description): Call ppc_linux_target
wordsize with tid.
* nat/ppc-linux.c: Include nat/gdb_ptrace.h.
(ppc64_64bit_inferior_p): Add static and inline specifiers.
(ppc_linux_target_wordsize): Move here from ppc-linux-nat.c. Add
tid parameter. Remove static specifier.
* nat/ppc-linux.h (ppc64_64bit_inferior_p): Remove declaration.
(ppc_linux_target_wordsize): New declaration.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (ppc_arch_setup): Remove code for getting the
wordsize of the inferior. Call ppc_linux_target_wordsize.
Share target description declarations and selection among ppc linux
native targets, core files, gdbserver and IPA.
To avoid complicated define guards, gdbserver and IPA now have
declarations for all descriptions, including 64-bit generated
descriptions when compiled in 32-bit mode. These have always been
linked into the gdbserver and IPA binaries. Because they might be
uninitialized, the selection function checks that the selected
description is initialized.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* arch/ppc-linux-common.c: New file.
* arch/ppc-linux-common.h: New file.
* arch/ppc-linux-tdesc.h: New file.
* configure.tgt (powerpc*-*-linux*): Add arch/ppc-linux-common.o.
* Makefile.in (ALL_TARGET_OBS): Add arch/ppc-linux-common.o.
(HFILES_NO_SRCDIR): Add arch/ppc-linux-common.h and
arch/ppc-linux-tdesc.h.
* ppc-linux-nat.c: Include arch/ppc-linux-common.h and
arch/ppc-linux-tdesc.h.
(ppc_linux_nat_target::read_description): Remove target
description matching code. Fill a ppc_linux_features struct and
call ppc_linux_match_description with it. Move comment about ISA
2.05 to ppc-linux-common.c.
* ppc-linux-tdep.c: Include arch/ppc-linux-common.h and
arch/ppc-linux-tdesc.h.
(ppc_linux_core_read_description): Remove target description
matching code. Fill a ppc_linux_features struct and call
ppc_linux_match_description with it.
* ppc-linux-tdep.h (tdesc_powerpc_32l, tdesc_powerpc_64l)
(tdesc_powerpc_altivec32l, tdesc_powerpc_altivec64l)
(tdesc_powerpc_cell32l, tdesc_powerpc_cell64l)
(tdesc_powerpc_vsx32l, tdesc_powerpc_vsx64l)
(tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_64l)
(tdesc_powerpc_isa205_altivec32l, tdesc_powerpc_isa205_altivec64l)
(tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_isa205_vsx64l)
(tdesc_powerpc_e500l): Remove.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* configure.srv (srv_tgtobj): Add arch/ppc-linux-common.o.
* Makefile.in (SFILES): Add arch/ppc-linux-common.c.
* linux-ppc-tdesc.h: Rename to linux-ppc-tdesc-init.h.
* linux-ppc-tdesc-init.h (tdesc_powerpc_32l, tdesc_powerpc_64l)
(tdesc_powerpc_altivec32l, tdesc_powerpc_altivec64l)
(tdesc_powerpc_cell32l, tdesc_powerpc_cell64l)
(tdesc_powerpc_vsx32l, tdesc_powerpc_vsx64l)
(tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_64l)
(tdesc_powerpc_isa205_altivec32l, tdesc_powerpc_isa205_altivec64l)
(tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_isa205_vsx64l)
(tdesc_powerpc_e500l): Remove.
* linux-ppc-ipa.c: Include arch/ppc-linux-tdesc.h and
linux-ppc-tdesc-init.h. Don't include linux-ppc-tdesc.h.
* linux-ppc-low.c: Include arch/ppc-linux-common.h,
arch/ppc-linux-tdesc.h, and linux-ppc-tdesc-init.h. Don't include
linux-ppc-tdesc.h.
(ppc_arch_setup): Remove target description matching code. Fill a
ppc_linux_features struct and call ppc_linux_match_description
with it.
Trying to insert a catchpoint on all Ada assertions now triggers
the following internal warning regardless of the situation. For
instance, not even debugging any program:
(gdb) catch assert
/[...]/gdb/common/cleanups.c:264: internal-warning:
restore_my_cleanups has found a stale cleanup
This is due to a small bug in the following C++-ification commit:
commit bc18fbb575
Author: Tom Tromey <tom@tromey.com>
Date: Fri May 18 15:58:50 2018 -0600
Subject: Change ada_catchpoint::excep_string to be a std::string
The stale cleanup in question is the following one in top.c:execute_command:
cleanup_if_error = make_bpstat_clear_actions_cleanup ();
This cleanup is expected to be discarded if there are no exception.
There were no GDB exception; however, a C++ exception was triggered,
because we passed NULL as the excep_string argument when calling
create_ada_exception_catchpoint, which is a reference to a const
string. So we get a C++ exception during the std::string constructor,
which propagates up, causing the cleanup to unexpectedly remain
in the cleanup chain.
This patch fixes the immediate issue of the incorrect call to
create_ada_exception_catchpoint.
gdb/ChangeLog:
* ada-lang.c (catch_assert_command): Pass empty string instead
of NULL for excep_string argument.
Tested on x86_64-linux, fixes the following failures:
* catch_assert_if.exp: insert catchpoint on failed assertions with condition
* catch_ex.exp: insert catchpoint on failed assertions
This also fixes about a dozen UNRESOLVED tests that are a consequence
of the two tests above failing and crashing GDB.
The last patch was enough to cure the testcase, but not the original
object file. This patch does the same for hppa as is done for ppc64,
simply test for the section belonging to a group. I've also
restricted stubs to load, alloc, code sections.
PR 23207
* elf32-hppa.c (hppa_get_stub_entry): Return NULL when link_sec
is NULL.
(elf32_hppa_size_stubs): Only create stubs for load, alloc, code
sections.
(final_link_relocate): Revert last change.
We don't create PLT call stubs for anything in non-alloc sections,
so it doesn't pay to go looking for them. The problem is that
non-alloc sections aren't processed by group_sections and thus don't
get a link_sec set up for them.
PR 23207
* elf32-hppa.c (final_link_relocate): Don't look for plt call
stubs in non-alloc sections.
All sections in a section group should be marked with SHF_GROUP. But
some tools generate broken objects without SHF_GROUP. This patch fixes
them up for objcopy and strip.
PR binutils/23199
* elf.c (setup_group): Mark section in a section group with
SHF_GROUP.
On the MIPS target DSP ASE registers can only be accessed with the
PTRACE_PEEKUSR and PTRACE_POKEUSR `ptrace' requests. With the n32 ABI
these requests only pass 32-bit data quantities, which are narrower than
the width of DSP accumulator registers, which are 64-bit.
Generic code is prepared to transfer registers wider than the `ptrace'
data type by offsetting into the USR address space, by the data width
transferred. That however does not work with the MIPS target, because
of how the API has been defined, where USR register addresses are
actually indices rather than offsets. Consequently given address `a'
using `a + 4' accesses the fourth next register rather than the upper
half of the original register.
With native debugging this causes clobbered register contents, as well
as access failures as locations beyond the available USR space are
addressed:
(gdb) info registers
zero at v0 v1
R0 0000000000000000 0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4 0000000010019158 0000000000000000 0000000000000011 0000000010019160
a4 a5 a6 a7
R8 0000000010019160 fffffffffff00000 fffffffffffffff8 0000000000000000
t0 t1 t2 t3
R12 0000000010019150 0000000000000001 0000000000000001 000000000000000f
s0 s1 s2 s3
R16 0000000077ee6f20 0000000010007bb0 0000000000000000 0000000000000000
s4 s5 s6 s7
R20 000000000052e668 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24 0000000000000001 0000000010019010 0000000000000000 0000000000000000
gp sp s8 ra
R28 0000000010020280 000000007fff4c10 000000007fff4c10 0000000010004f48
status lo hi badvaddr
0000000000109cf3 0000000000943efe 000000000000000e 000000001001900c
cause pc
0000000000800024 0000000010004f48
fcsr fir hi1 lo1
0e800000 00f30000 0000000004040404 0101010105050505
hi2 lo2 hi3 lo3
0202020255aa33cc Couldn't read register (#75): Input/output error.
(gdb)
With `gdbserver' this makes debugging impossible due to a fatal failure:
(gdb) target remote :2346
Remote debugging using :2346
Reading symbols from .../sysroot/mips-r2-hard/lib32/ld.so.1...done.
0x77fc3d50 in __start () from .../sysroot/mips-r2-hard/lib32/ld.so.1
(gdb) continue
Continuing.
warning: Remote failure reply: E01
Remote communication error. Target disconnected.: Connection reset by peer.
(gdb)
Correct the problem by marking any register in the MIPS backend whose
width exceeds the width of the `ptrace' data type unavailable for the
purpose of PTRACE_PEEKUSR and PTRACE_POKEUSR requests:
(gdb) info registers
zero at v0 v1
R0 0000000000000000 0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4 0000000010019158 0000000000000000 0000000000000011 0000000010019160
a4 a5 a6 a7
R8 0000000010019160 fffffffffff00000 fffffffffffffff8 0000000000000000
t0 t1 t2 t3
R12 0000000010019150 0000000000000001 0000000000000001 000000000000000f
s0 s1 s2 s3
R16 0000000077ee6f20 0000000010007bb0 0000000000000000 0000000000000000
s4 s5 s6 s7
R20 000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24 0000000000000001 0000000010019010 0000000000000000 0000000000000000
gp sp s8 ra
R28 0000000010020280 000000007fff4be0 000000007fff4be0 0000000010004f48
status lo hi badvaddr
0000000000109cf3 0000000000943efe 000000000000000e 000000001001900c
cause pc
0000000000800024 0000000010004f48
fcsr fir hi1 lo1
0e800000 00f30000 <unavailable> <unavailable>
hi2 lo2 hi3 lo3
<unavailable> <unavailable> <unavailable> <unavailable>
dspctl restart
55aa33cc 0000000000000000
(gdb)
as there is no way to access full contents of these registers with the
limited API available anyway.
This obviously does not affect general-purpose registers (which use the
PTRACE_GETREGS and PTRACE_SETREGS requests for access) or floating-point
general registers (which use PTRACE_GETFPREGS and PTRACE_SETFPREGS).
And $dspctl, being 32-bit, remains accessible too, which is important
for BPOSGE32 branch decoding in single-stepping.
For DSP accumulator access with the n32 ABI a new `ptrace' API is required
on the kernel side.
gdb/
* mips-linux-nat.c (mips64_linux_register_addr): Return -1 if
the width of the requested register exceeds the width of the
`ptrace' data type.
gdb/gdbserver/
* linux-mips-low.c (mips_cannot_fetch_register): Return 1 if the
width of the requested register exceeds the width of the
`ptrace' data type.
(mips_cannot_store_register): Likewise.
Consistently supply hardwired $zero as a zeroed register, correcting
issues with the PTRACE_GETREGS path that currently copies the value of
$restart into $zero as illustrated by this program:
$ cat read.c
int
main (void)
{
char buf[1024];
ssize_t size;
size = read (0, buf, sizeof (buf));
return size;
}
$
and this corresponding debug session:
(gdb) break main
Breakpoint 1 at 0x120000970: file read.c, line 9.
(gdb) target remote :2346
Remote debugging using :2346
Reading symbols from .../sysroot/mips-r2-hard/lib64/ld.so.1...done.
0x000000fff7fca5a0 in __start ()
from .../sysroot/mips-r2-hard/lib64/ld.so.1
(gdb) continue
Continuing.
Breakpoint 1, main () at read.c:9
9 size = read (0, buf, sizeof (buf));
(gdb) info registers
zero at v0 v1
R0 0000000000000000 0000000000000001 000000fff7ffe710 0000000000000000
a0 a1 a2 a3
R4 0000000000000001 000000ffffffeb88 000000ffffffeb98 0000000000000000
a4 a5 a6 a7
R8 000000fff7fc8800 000000fff7fc38f0 000000ffffffeb80 2f2f2f2f2f2f2f2f
t0 t1 t2 t3
R12 0000000000000437 0000000000000002 000000fff7ffd000 0000000120000a00
s0 s1 s2 s3
R16 000000fff7fc7068 0000000120000b90 0000000000000000 0000000000000000
s4 s5 s6 s7
R20 0000000000521d88 0000000000522608 0000000000000000 0000000000000000
t8 t9 k0 k1
R24 0000000000000000 0000000120000970 0000000000000000 0000000000000000
gp sp s8 ra
R28 000000fff7fc8800 000000ffffffea50 0000000000000000 000000fff7e4088c
status lo hi badvaddr
0000000000109cf3 0000000000005ea5 0000000000000211 000000fff7eadf00
cause pc
0000000000800024 0000000120000970
fcsr fir restart
00000000 00f30000 0000000000000000
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x000000fff7f084ac in __GI___libc_read (fd=0, buf=0xffffffe640, nbytes=1024)
at ../sysdeps/unix/sysv/linux/read.c:27
27 return SYSCALL_CANCEL (read, fd, buf, nbytes);
(gdb) info registers
zero at v0 v1
R0 0000000000001388 0000000000000001 0000000000000200 000000fff7ffe710
a0 a1 a2 a3
R4 0000000000000000 000000ffffffe640 0000000000000400 0000000000000001
a4 a5 a6 a7
R8 000000fff7fc8800 000000fff7fc38f0 000000ffffffeb80 2f2f2f2f2f2f2f2f
t0 t1 t2 t3
R12 00000000000005e3 0000000000000002 000000fff7ffd000 000000012000099c
s0 s1 s2 s3
R16 000000fff7fc7068 0000000120000b90 0000000000000000 0000000000000000
s4 s5 s6 s7
R20 0000000000521d88 0000000000522608 0000000000000000 0000000000000000
t8 t9 k0 k1
R24 0000000000000000 000000fff7f2da20 0000000000000000 0000000000000000
gp sp s8 ra
R28 000000fff7fc8800 000000ffffffe600 0000000000000000 000000012000099c
status lo hi badvaddr
0000000000109cf3 00000000000001e6 00000000000000be 000000fff7f08470
cause pc
0000000000800020 000000fff7f084ac
fcsr fir restart
00000000 00f30000 0000000000001388
(gdb)
and with the PTRACE_PEEKUSR path that does not supply this register at
all, causing issues analogous to ones addressed for the native MIPS
backend with commit 4e6ff0e1b8 ("MIPS/Linux/native: Supply $zero for
the !PTRACE_GETREGS case"):
(gdb) info registers
zero at v0 v1
R0 <unavailable> 0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4 00000001200212b0 0000000000000000 0000000000000021 000000012001a260
a4 a5 a6 a7
R8 000000012001a260 0000000000000004 800000010cab1680 fffffffffffffff8
t0 t1 t2 t3
R12 0000000000000000 000000fff7edab68 0000000000000001 0000000000000000
s0 s1 s2 s3
R16 000000fff7ee2068 0000000120008b80 0000000000000000 0000000000000000
s4 s5 s6 s7
R20 000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24 0000000000000000 00000001200027c0 0000000000000000 0000000000000000
gp sp s8 ra
R28 00000001200212b0 000000ffffffc880 000000ffffffc880 0000000120005ee8
status lo hi badvaddr
<unavailable> 0000000000943efe 000000000000000e 000000012001a008
cause pc
0000000000800024 0000000120005ee8
fcsr fir restart
0e800000 00f30000 0000000000000000
(gdb)
and (under certain circumstances):
(gdb) next
Register 0 is not available
(gdb)
The problem with PTRACE_GETREGS happens because `mips_store_gregset'
supplies the contents of register slot #0, occupied by $restart, to
$zero. The problem with PTRACE_PEEKUSR happens because for $zero
`mips_cannot_fetch_register' returns one, and no alternative way to
supply that register has been defined.
Correct `mips_store_gregset' then for the PTRACE_GETREGS case and add
`mips_fetch_register' for the PTRACE_PEEKUSR case.
gdb/gdbserver/
* linux-mips-low.c (mips_fetch_register): New function. Update
preceding comment.
(mips_store_gregset): Supply 0 rather than $restart for $zero.
(the_low_target): Wire `mips_fetch_register'.
I happened to notice that output_command_const still exists, but is
not needed any more -- commands are always const-correct now. This
patch removes this leftover.
2018-05-21 Tom Tromey <tom@tromey.com>
* printcmd.c (output_command): Remove.
(output_command_const): Rename to output_command.
* valprint.h (output_command): Rename from output_command_const.
* tracepoint.c (trace_dump_actions): Call output_command.
This changes ada_catchpoint::excep_string to be a std::string and then
fixes up all t he users.
This found a memory leak in catch_ada_exception_command_split, where
"cond" was copied but never freed.
I changed the type of the "cond_string" argument to
catch_ada_exception_command_split to follow the rule that out
parameters should be pointers and not references.
This patch enables the removal of some cleanups and also the function
ada_get_next_arg.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-catch.c (mi_cmd_catch_assert)
(mi_cmd_catch_exception, mi_cmd_catch_handlers): Update.
* ada-lang.h (create_ada_exception_catchpoint): Update.
* ada-lang.c (struct ada_catchpoint) <excep_string>: Now a
std::string.
(create_excep_cond_exprs, ~ada_catchpoint)
(should_stop_exception, print_one_exception)
(print_mention_exception, print_recreate_exception): Update.
(ada_get_next_arg): Remove.
(catch_ada_exception_command_split): Use std::string. Change type
of "excep_string", "cond_string".
(catch_ada_exception_command): Update.
(create_ada_exception_catchpoint): Change type of excep_string.
(ada_exception_sal): Remove excep_string parameter.
(~ada_catchpoint): Remove.
ada_collect_symbol_completion_matches installs a null_cleanup but not
any other cleanups. This patch removes it.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_collect_symbol_completion_matches): Remove
cleanup.
This removes a cleanup from ada-lang.c by having
ada_exception_message_1 return a unique_xmalloc_ptr.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_exception_message_1, ada_exception_message):
Return unique_xmalloc_ptr.
(print_it_exception): Update.
This changes trace_dump_actions to use std::string, removing a
cleanup.
Tested by the buildbot.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* tracepoint.c (trace_dump_actions): Use std::string.
This removes a cleanup from reread_symbols by using std::string. This
fixes a memory leak, because this cleanup is ordinarily discarded, not
run.
Tested by the buildbot.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Use std::string for original_name.
This changes dwarf2_read_debug_names to use std::unique_ptr from the
outset. This simplifies the code that installs the resulting map into
dwarf2_per_objfile.
Tested by the buildbot.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_read_debug_names): Use std::unique_ptr.
(mapped_index_base): Use DISABLE_COPY_AND_ASSIGN. Default
constructor.
I realized after pushing that I made a copy-pasto, I had:
# define HAVE_IS_TRIVIALLY_COPYABLE 1
instead of
# define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1
with the consequence that IsMallocable was always std::true_type (and
was therefore not enforcing anything). Fixing that mistake triggered a
build failure:
/home/simark/src/binutils-gdb/gdb/objfiles.c:150:12: required from here
/home/simark/src/binutils-gdb/gdb/common/poison.h:228:3: error: static assertion failed: Trying to use XOBNEW with a non-POD data type.
I am not sure why I did not see this when I originally wrote the patch
(but I saw and fixed other failures). In any case, I swapped XOBNEW
with obstack_new to get rid of it.
Regtested on the buildbot.
gdb/ChangeLog:
* common/traits.h (HAVE_IS_TRIVIALLY_COPYABLE): Rename the wrong
instance to...
(HAVE_IS_TRIVIALLY_CONSTRUCTIBLE): ... this.
* objfiles.c (get_objfile_bfd_data): Allocate
objfile_per_bfd_storage with obstack_new when allocating on
obstack.
Since XOBNEW/XOBNEWVEC/OBSTACK_ZALLOC are now poisoned to prevent using
them with non-trivially-constructible objects, it is worth using them
over plain obstack_alloc. This patch changes the locations I could find
where we can do that change easily.
gdb/ChangeLog:
* ada-lang.c (cache_symbol): Use XOBNEW and/or XOBNEWVEC and/or
OBSTACK_ZALLOC.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
* mdebugread.c (mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(parse_symbol): Likewise.
(parse_partial_symbols): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_psymtab): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* objfiles.c (get_objfile_bfd_data): Likewise.
(objfile_register_static_link): Likewise.
* psymtab.c (allocate_psymtab): Likewise.
* stabsread.c (read_member_functions): Likewise.
* xcoffread.c (xcoff_end_psymtab): Likewise.