Age | Commit message (Collapse) | Author | Files | Lines |
|
Pedro pointed out that some Rust tests were failing after the recent
enum change. I was able to reproduce this even with the most current
Rust compiler -- no test was failing, but rather the gdb internal
error was causing an "untested" result, which I didn't notice.
The internal error is caused by a bad assertion in
alloc_discriminant_info. This happened because, in an earlier version
of the patch, the discriminant could only appear at index 0. However,
it can now appear anywhere. This patch fixes the assertion in the
obvious way, and adds a second assertion to ensure that the
discriminant is also correct.
Fixing this revealed a real failure, which was caused by using the
wrong base name when computing the name of a univariant enum's sole
member. This is also fixed here.
Tested by running the gdb.rust tests with rustc 1.23 and
double-checking the summary:
# of expected passes 276
Note that if you try this yourself, it is still possible to get an
"untested" result from traits.exp if your Rust compiler is old enough.
2018-03-01 Tom Tromey <tom@tromey.com>
* dwarf2read.c (alloc_discriminant_info): Fix default_index
assertion. Add assertion for discriminant_index.
(quirk_rust_enum): Use correct base type name in univariant case.
|
|
These flags are returned as an int by get_call_history_modifiers, and
get cast back to record_print_flags in the btrace code. Instead, we can
make the arguments of that type from start to end.
gdb/ChangeLog:
* record.c (get_call_history_modifiers): Return a
record_print_flags.
(cmd_record_call_history): Adjust.
* record-btrace.c (record_btrace_call_history): Adjust.
(record_btrace_call_history_range): Adjust.
(record_btrace_call_history_from): Adjust.
* target-debug.h (target_debug_print_record_print_flags): New.
* target-delegates.c: Re-generate.
* target.c (target_call_history): Change flags type.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.
* target.h (struct target_ops) <target_call_history>: Likewise.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.
|
|
By removing the supports_btrace gdbserver target method we relied on GDB
trying to enable branch tracing and failing on the attempt.
For targets that do not provide the btrace methods, however, an initial
request from GDB for the branch trace configuration to detect whether
gdbserver is already recording resulted in a protocol error.
Have the btrace target methods throw a "Target does not suppor branch
tracing" error and be prepared to handle exceptions in all functions that
call btrace target methods. We therefore turn the target_* macros into
static inline functions.
Also remove the additional btrace target method checks that resulted in
the above protocol error.
Thanks to Maciej W. Rozycki <macro@mips.com> for reporting this.
gdbserver/
* target.h (target_enable_btrace, target_disable_btrace)
(target_read_btrace, target_read_btrace_conf): Turn macro into
inline function. Throw error if target method is not defined.
* server.c (handle_qxfer_btrace, handle_qxfer_btrace_conf): Remove
check for btrace target method. Be prepared to handle exceptions
from btrace target methods.
|
|
I forgot to address Pedro's comment about my last patch and change the
order of the message printed when getcwd returns NULL on gdbserver.
This obvious commit does it.
gdb/gdbserver/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* server.c (captured_main): Change order of error message printed
when the current working directory cannot be found.
|
|
Simon mentioned on IRC that, after the startup-with-shell feature has
been implemented on gdbserver, it is not possible to specify a
filename-only binary, like:
$ gdbserver :1234 a.out
/bin/bash: line 0: exec: a.out: not found
During startup program exited with code 127.
Exiting
This happens on systems where the current directory "." is not listed
in the PATH environment variable. Although including "." in the PATH
variable is a possible workaround, this can be considered a regression
because before startup-with-shell it was possible to use only the
filename (due to reason that gdbserver used "exec*" directly).
The idea of the patch is to verify if the program path provided by the
user (or by the remote protocol) contains a directory separator
character. If it doesn't, it means we're dealing with a filename-only
binary, so we call "gdb_abspath" to properly expand it and transform
it into a full path. Otherwise, we leave the program path untouched.
This mimicks the behaviour seen on GDB (look at "openp" and
"attach_inferior", for example).
I am also submitting a testcase which exercises the scenario described
above. This test requires gdbserver to be executed in a different CWD
than the original, so I also created a helper function, "with_cwd" (on
testsuite/lib/gdb.exp), which takes care of cd'ing into and out of the
specified dir.
Built and regtested on BuildBot, without regressions.
gdb/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
Simon Marchi <simon.marchi@polymtl.ca>
* common/common-utils.c: Include "sys/stat.h".
(is_regular_file): Move here from "source.c"; change return
type to "bool".
* common/common-utils.h (is_regular_file): New prototype.
* common/pathstuff.c (contains_dir_separator): New function.
* common/pathstuff.h (contains_dir_separator): New prototype.
* source.c: Don't include "sys/stat.h".
(is_regular_file): Move to "common/common-utils.c".
gdb/gdbserver/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* server.c: Include "filenames.h" and "pathstuff.h".
(program_name): Delete variable.
(program_path): New anonymous class.
(get_exec_wrapper): Use "program_path" instead of
"program_name".
(handle_v_run): Likewise.
(captured_main): Likewise.
(process_serial_event): Likewise.
gdb/testsuite/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.server/abspath.exp: New file.
* lib/gdb.exp (with_cwd): New procedure.
|
|
This commit moves the path manipulation routines found on utils.c to a
new common/pathstuff.c, and updates the Makefile.in's accordingly.
The routines moved are "gdb_realpath", "gdb_realpath_keepfile" and
"gdb_abspath".
This will be needed because gdbserver will have to call "gdb_abspath"
on my next patch, which implements a way to expand the path of the
inferior provided by the user in order to allow specifying just the
binary name when starting gdbserver, like:
$ gdbserver :1234 a.out
With the recent addition of the startup-with-shell feature on
gdbserver, this scenario doesn't work anymore if the user doesn't have
the current directory listed in the PATH variable.
I had to do a minor adjustment on "gdb_abspath" because we don't have
access to "tilde_expand" on gdbserver, so now the function is using
"gdb_tilde_expand" instead. Otherwise, the code is the same.
Regression tested on the BuildBot, without regressions.
gdb/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (COMMON_SFILES): Add "common/pathstuff.c".
(HFILES_NO_SRCDIR): Add "common/pathstuff.h".
* auto-load.c: Include "common/pathstuff.h".
* common/common-def.h (current_directory): Move here.
* common/gdb_tilde_expand.c (gdb_tilde_expand_up): New
function.
* common/gdb_tilde_expand.h (gdb_tilde_expand_up): New
prototype.
* common/pathstuff.c: New file.
* common/pathstuff.h: New file.
* compile/compile.c: Include "common/pathstuff.h".
* defs.h (current_directory): Move to "common/common-defs.h".
* dwarf2read.c: Include "common/pathstuff.h".
* exec.c: Likewise.
* guile/scm-safe-call.c: Likewise.
* linux-thread-db.c: Likewise.
* main.c: Likewise.
* nto-tdep.c: Likewise.
* objfiles.c: Likewise.
* source.c: Likewise.
* symtab.c: Likewise.
* utils.c: Include "common/pathstuff.h".
(gdb_realpath): Move to "common/pathstuff.c".
(gdb_realpath_keepfile): Likewise.
(gdb_abspath): Likewise.
* utils.h (gdb_realpath): Move to "common/pathstuff.h".
(gdb_realpath_keepfile): Likewise.
(gdb_abspath): Likewise.
gdb/gdbserver/ChangeLog:
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (SFILES): Add "$(srcdir)/common/pathstuff.c".
(OBJS): Add "pathstuff.o".
* server.c (current_directory): New global variable.
(captured_main): Initialize "current_directory".
|
|
In patch
Add test for load command
3275ef477498e0500d7ea440f1bc51787acf4610
I removed gdb_is_target_remote_prompt, but did not realize it was used
in mi_is_target_remote. This makes the gdb.mi/mi-nonstop.exp crash, for
example:
ERROR: (DejaGnu) proc "gdb_is_target_remote_prompt {[(]gdb[)]
}" does not exist.
The error code is TCL LOOKUP COMMAND gdb_is_target_remote_prompt
The info on the error is:
invalid command name "gdb_is_target_remote_prompt"
while executing
"::tcl_unknown gdb_is_target_remote_prompt {[(]gdb[)]
}"
("uplevel" body line 1)
invoked from within
"uplevel 1 ::tcl_unknown $args"
This patch restores it.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_is_target_1): Add prompt_regexp parameter and
use it.
(gdb_is_target_remote_prompt): New proc.
(gdb_is_target_remote): Use gdb_is_target_remote_prompt.
(gdb_is_target_native): Pass prompt parameter to
gdb_is_target_1.
|
|
When multiple threads within a process wish to report STOPPED events
from wait(), the kernel picks one thread event as the thread event to
report. The chosen thread event is retrieved via PT_LWPINFO by
passing the process ID as the request pid. If multiple events are
pending, then the subsequent wait() after resuming a process will
report another STOPPED event after resuming the process to handle the
next thread event and so on.
A single thread event is cleared as a side effect of resuming the
process with PT_CONTINUE, PT_STEP, etc. In older kernels, however,
the request pid was used to select which thread's event was cleared
rather than always clearing the event that was just reported. To
avoid clearing the event of the wrong LWP, always pass the process ID
instead of an LWP ID to PT_CONTINUE or PT_SYSCALL.
In the case of stepping, the process ID cannot be used with PT_STEP
since it would step the thread that reported an event which may not be
the thread indicated by PTID. For stepping, use PT_SETSTEP to enable
stepping on the desired thread before resuming the process via
PT_CONTINUE instead of using PT_STEP.
This manifested as a failure in the
gdb.threads/continue-pending-status.exp test. Specifically, if thread
2 reported a breakpoint and the test thus switched to thread 3 before
continuing, thread 3's event (if any) was discarded and thread 2's
breakpoint remained pending and was reported a second time as a
duplicate event. As a result, the PC was decremented twice for the
same breakpoint resulting in an illegal instruction fault on x86.
gdb/ChangeLog:
* fbsd-nat.c (fbsd_resume): Use PT_SETSTEP for stepping and a
wildcard process pid for super_resume for kernels with a
specific bug.
|
|
This patch adds argument compilation documentation, expanding on the
already existing comments, giving a more thorough explanation of
the source of the arguments used in the final argument string.
gdb/ChangeLog:
* compile/compile.c (get_args): Add additional comments
explaining function.
|
|
This changes target_write_memory_blocks to use std::vector, rather
than VEC. This allows the removal of some cleanups.
This version incorporates the additions that Simon made.
Regression tested by the buildbot.
ChangeLog
2018-02-27 Simon Marchi <simon.marchi@polymtl.ca>
Tom Tromey <tom@tromey.com>
* target.h (memory_write_request_s): Remove typedef. Don't define
VEC.
(target_write_memory_blocks): Change argument to std::vector.
(struct memory_write_request): Add constructor.
* target-memory.c (compare_block_starting_address): Return bool.
Change argument types.
(claim_memory): Change arguments to use std::vector.
(split_regular_and_flash_blocks, blocks_to_erase)
(compute_garbled_blocks): Likewise.
(cleanup_request_data, cleanup_write_requests_vector): Remove.
(target_write_memory_blocks): Change argument to std::vector.
* symfile.c (struct load_section_data): Add constructor and
destructor. Use std::vector for "requests".
(struct load_progress_data): Add initializers.
(load_section_callback): Update. Use "new".
(clear_memory_write_data): Remove.
(generic_load): Update.
|
|
gdb/
* arch/aarch64.h: Use common/tdesc.h.
|
|
There doesn't seem to by any test for the load command. I suggest to
add this test, so that we can have a minimum of confidence we don't
break it completely while refactoring the code that implements it.
gdb/testsuite/ChangeLog:
* gdb.base/load-command.c: New file.
* gdb.base/load-command.exp: New file.
* lib/gdb.exp (gdb_is_target_remote_prompt): Rename to...
(gdb_is_target_1): ...this, and generalize for other targets
than just remote.
(gdb_is_target_remote): Use gdb_is_target_1.
(gdb_is_target_native): use gdb_is_target_1.
|
|
Select `bfd_mach_mips4000', which corresponds to the MIPS III ISA, the
earlies with 64-bit support, whenever a 32-bit BFD architecture has been
chosen to use with a 64-bit ABI. The situation can happen in a few
cases:
1. When the user has used `set architecture' or `set mips abi' commands
to override automatic selection and then starts a debug session by
requesting to run, attach or connect to a target.
2. In native debugging when reattaching to a previously debugged process
where the program to be debugged has been since discarded, as
observed with:
FAIL: gdb.base/attach.exp: attach2, with no file (GDB internal error)
in n32 and n64 regression testing.
3. In remote debugging with a non-XML debug stub when discarding the
program to be debugged while connected to the remote target, as
observed with:
FAIL: gdb.base/break-unload-file.exp: cmdline: always-inserted on: break: file (GDB internal error)
in n32 and n64 regression testing.
In the latter two cases the ABI, quite rightfully, is retained while the
program to be debugged is discarded. This is because in that case the
ABI previously determined is carried over along with `gdbarch' in use,
which is retained. The BFD architecture is however discarded and the
default then applies, because it is not attached to `gdbarch'.
In all these cases we trip with an internal error message as follows:
.../gdb/mips-tdep.c:766: internal-error: bad register size
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
This is a bug, please report it. For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
coming from `mips_pseudo_register_read', because the raw register width
inferred from the BFD architecture turns out to be 4 for the general
registers while the cooked register width inferred from the ABI in
effect is 8.
We do not hit this internal error in remote debugging with an XML debug
stub, because in that case raw register width information is passed by
the stub along with the XML target description.
Ultimately I think we ought to make the BFD architecture sticky like the
ABI, however in the interim this simple fix will do, removing the error
across all three cases. The case where the user has used `set mips abi'
or `set architecture' commands has to be handled anyway, and although a
more sophisticated solution could be envisaged, such as reporting an
error with the respective `set' command, I think this is too much of a
corner case to bother.
gdb/
* mips-tdep.c (mips_gdbarch_init): Don't use a 32-bit BFD
architecture with a 64-bit ABI.
|
|
Move ABI determination code ahead of target description loading so that
architecture information can be adjusted according to the ABI selected,
and then used in OS dependent register information initialization needed
for target description processing. No functional change.
gdb/
* gdb/mips-tdep.c (mips_gdbarch_init): Reorder ABI determination
ahead of target description loading.
|
|
This changes frame_filter_flags to use DEF_ENUM_FLAGS_TYPE, and
updates all the uses. It also changes the enum constants to use <<,
as suggested by Sergio.
ChangeLog
2018-02-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Update.
* python/python-internal.h (gdbpy_apply_frame_filter): Change type
of "flags".
* python/py-framefilter.c (py_print_frame)
(gdbpy_apply_frame_filter): Change type of "flags".
* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): Change type
of "flags".
(mi_cmd_stack_list_frames, mi_cmd_stack_list_locals)
(mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Update.
* extension.h (enum frame_filter_flag): Rename from
frame_filter_flags.
(frame_filter_flags): Define using DEF_ENUM_FLAGS_TYPE.
(apply_ext_lang_frame_filter): Change type of "flags".
* extension.c (apply_ext_lang_frame_filter): Change type of
"flags".
* extension-priv.h (struct extension_language_ops)
<apply_frame_filter>: Change type of "flags".
|
|
PR python/16497 notes that using "bt" with a positive argument prints
the wrong number of frames when a frame filter is in use. Also, in this
case, the non-frame-filter path will print a message about "More stack
frames" when there are more; but this is not done in the frame-filter
case.
The first problem is that backtrace_command_1 passes the wrong value
to apply_ext_lang_frame_filter -- that function takes the final
frame's number as an argument, but backtrace_command_1 passes the
count, which is off by one.
The solution to the second problem is to have the C stack-printing
code stop at the correct number of frames and then print the message.
Tested using the buildbot.
ChangeLog
2018-02-26 Tom Tromey <tom@tromey.com>
PR python/16497:
* stack.c (backtrace_command_1): Set PRINT_MORE_FRAMES flag. Fix
off-by-one in py_end computation.
* python/py-framefilter.c (gdbpy_apply_frame_filter): Handle
PRINT_MORE_FRAMES.
* extension.h (enum frame_filter_flags) <PRINT_MORE_FRAMES>: New
constant.
2018-02-26 Tom Tromey <tom@tromey.com>
PR python/16497:
* gdb.python/py-framefilter.exp: Update test.
|
|
This changes dwarf2read to understand DW_TAG_variant_part and
DW_TAG_variant.
Note that DW_AT_discr_list is not handled. I did not need this for
Rust. I imagine this should not be too hard to add later, should
someone need it. Meanwhile I have gdb emit a complaint if it is seen.
There is a lurking issue concerning the placement of the discriminant
in the DWARF. For Rust, I ended up following the letter of the
standard and having the discriminant be a child of the
DW_TAG_variant_part. However, GCC's Ada support does not do this.
Pierre-Marie filed this with the DWARF committee:
http://dwarfstd.org/ShowIssue.php?issue=180123.1
However as that is read-only, if you have comments you might consider
adding them to the GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83935
Finally, there is a DWARF extension lurking in here. In Rust, a
univariant enum will not have a discriminant. However, in order to
unify the representation of all data-carrying enums, I've made LLVM
(and my forthcoming rustc patch) emit a univariant enum using a
DW_TAG_variant with a single variant part and without DW_AT_discr.
The lack of this DW_AT_discr is the extension. I will submit an issue
on dwarfstd.org about this.
2018-02-26 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct variant_field): New.
(struct nextfield) <variant>: New field.
(dwarf2_add_field): Handle DW_TAG_variant_part.
(dwarf2_attach_fields_to_type): Attach a discriminant_info to a
discriminated union.
(read_structure_type): Handle DW_TAG_variant_part.
(handle_struct_member_die): New function, extracted from
process_structure_scope. Handle DW_TAG_variant.
(process_structure_scope): Handle discriminated unions. Call
handle_struct_member_die.
2018-02-26 Tom Tromey <tom@tromey.com>
* gdb.dwarf2/variant.c: New file.
* gdb.dwarf2/variant.exp: New file.
|
|
A Rust enum is, essentially, a discriminated union. Currently the
Rust language support handles Rust enums locally, in rust-lang.c.
However, because I am changing the Rust compiler to use
DW_TAG_variant* to represent enums, it seemed better to have a single
internal representation for Rust enums in gdb.
This patch implements this idea by moving the current Rust enum
handling code to dwarf2read. This allows the simplification of some
parts of rust-lang.c as well.
2018-02-26 Tom Tromey <tom@tromey.com>
* rust-lang.h (rust_last_path_segment): Declare.
* rust-lang.c (rust_last_path_segment): Now public. Change
contract.
(struct disr_info): Remove.
(RUST_ENUM_PREFIX, RUST_ENCODED_ENUM_REAL)
(RUST_ENCODED_ENUM_HIDDEN, rust_union_is_untagged)
(rust_get_disr_info, rust_tuple_variant_type_p): Remove.
(rust_enum_p, rust_enum_variant): New function.
(rust_underscore_fields): Remove "offset" parameter.
(rust_print_enum): New function.
(rust_val_print) <TYPE_CODE_UNION>: Remove enum code.
<TYPE_CODE_STRUCT>: Call rust_print_enum when appropriate.
(rust_print_struct_def): Add "for_rust_enum" parameter. Handle
enums.
(rust_internal_print_type): New function, from rust_print_type.
Remove enum code.
(rust_print_type): Call rust_internal_print_type.
(rust_evaluate_subexp) <STRUCTOP_ANONYMOUS, STRUCTOP_STRUCT>:
Update enum handling.
* dwarf2read.c (struct dwarf2_cu) <rust_unions>: New field.
(rust_fully_qualify, alloc_discriminant_info, quirk_rust_enum)
(rust_union_quirks): New functions.
(process_full_comp_unit, process_full_type_unit): Call
rust_union_quirks.
(process_structure_scope): Update rust_unions if necessary.
2018-02-26 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Accept more possible results in enum test.
|
|
This adds some initial support for variant parts to gdbtypes.h. A
variant part is represented as a union. The union has a flag
indicating that it has a discriminant, and information about the
discriminant is attached using the dynamic property system.
2018-02-26 Tom Tromey <tom@tromey.com>
* value.h (value_union_variant): Declare.
* valops.c (value_union_variant): New function.
* gdbtypes.h (TYPE_FLAG_DISCRIMINATED_UNION): New macro.
(struct discriminant_info): New.
(enum dynamic_prop_node_kind) <DYN_PROP_DISCRIMINATED>: New
enumerator.
(struct main_type) <flag_discriminated_union>: New field.
|
|
unpack_bits_as_long is documented as sign-extending its result when
the type is signed. However, it was only doing sign-extension in the
case where the field was a bitfield -- that is, not when the "bitsize"
parameter was 0, indicating the size should be taken from the type.
Also, unpack_bits_as_long was incorrectly computing the shift for
big-endian architectures for the non-bitfield case.
This patch fixes these bugs in a straightforward way. A new selftest
is included.
2018-02-26 Tom Tromey <tom@tromey.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/unpack-selftests.c.
* unittests/unpack-selftests.c: New file.
* value.c (unpack_bits_as_long): Fix bugs in non-bitfield cases.
|
|
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <read>: New method.
(read_partial_die): Remove the declaration.
(load_partial_dies): Update.
(partial_die_info::partial_die_info):
(read_partial_die): Change it to partial_die_info::read.
|
|
fixup_partial_die can be a partial_die_info method fixup.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <fixup>: New method.
(fixup_partial_die): Remove declaration.
(scan_partial_symbols): Update.
(partial_die_parent_scope): Likewise.
(partial_die_full_name): Likewise.
(fixup_partial_die): Change it to partial_die_info::fixup.
|
|
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Update the declaration.
(load_partial_dies): Caller update.
(read_partial_die): Remove one argument abbrev_len.
|
|
This patch is to class-fy partial_die_info. Two things special here,
- disable assignment operator, but keep copy ctor, which is used in
load_partial_dies,
- have a private ctor which is only used by dwarf2_cu::find_partial_die,
I don't want other code use it, so make it private,
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info): Add ctor, delete
assignment operator.
(load_partial_dies): Use ctor and copy ctor.
(read_partial_die): Update.
(dwarf2_cu::find_partial_die): Use ctor.
|
|
This patch changes find_partial_die_in_comp_unit to a dwarf2_cu method
find_partial_die.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct dwarf2_cu) <find_partial_die>: New method.
(find_partial_die_in_comp_unit): Change it to
dwarf2_cu::find_partial_die.
(find_partial_die): Update.
|
|
'abbrev' won't be NULL, so don't check it.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Remove the code checking abbrev
is NULL.
|
|
load_partial_dies has a "while (1)" loop to visit each die, and create
partial_die_info if needed in each iteration, like this,
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
while (1)
{
if (foo1) continue;
if (foo2) continue;
read_partial_die (, , part_die, ,);
....
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
};
the code was written in a way that spaces are allocated on necessary on
cu->comp_unit_obstack. I want to class-fy partial_die_info, but
partial_die_info ctor can't follow XOBNEW immediately, so this patch
rewrite this loop to:
while (1)
{
if (foo1) continue;
if (foo2) continue;
struct partial_die_info pdi;
read_partial_die (, , &pdi, ,);
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
memcpy (part_die, &pdi, sizeof (pdi));
};
we create a local variable pdi, if we need it, call XOBNEW, and copy.
This also reduce one XOBNEW call. I measured the number of XOBNEW call in
load_partial_dies when gdb reads dwarf2read.o, without this patch, it is
18827, and with this patch, it is 18826.
gdb:
2018-026-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (load_partial_dies): Move the location of XOBNEW.
|
|
gdb/
* arch/amd64.h: Use common/tdesc.h.
* arch/i386.c: Likewise.
* arch/i386.h: Likewise.
* arch/tic6x.c: Likewise.
* arch/tdesc.h: Move file from here...
* common/tdesc.h: ...to here.
* features/aarch64-core.c: Regenerate.
* features/aarch64-fpu.c: Regenerate.
* features/i386/32bit-avx.c: Regenerate.
* features/i386/32bit-avx512.c: Regenerate.
* features/i386/32bit-core.c: Regenerate.
* features/i386/32bit-linux.c: Regenerate.
* features/i386/32bit-mpx.c: Regenerate.
* features/i386/32bit-pkeys.c: Regenerate.
* features/i386/32bit-sse.c: Regenerate.
* features/i386/64bit-avx.c: Regenerate.
* features/i386/64bit-avx512.c: Regenerate.
* features/i386/64bit-core.c: Regenerate.
* features/i386/64bit-linux.c: Regenerate.
* features/i386/64bit-mpx.c: Regenerate.
* features/i386/64bit-pkeys.c: Regenerate.
* features/i386/64bit-segments.c: Regenerate.
* features/i386/64bit-sse.c: Regenerate.
* features/i386/x32-core.c: Regenerate.
* features/tic6x-c6xp.c: Regenerate.
* features/tic6x-core.c: Regenerate.
* features/tic6x-gp.c: Regenerate.
* target-descriptions.c: Use common/tdesc.h.
* target-descriptions.h: Likewise.
gdbserver/
* tdesc.c: Use common/tdesc.h.
* tdesc.h: Likewise.
|
|
I noticed some failures of some buildbot slaves, e.g.:
FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = 1) // wrong nested type enum definition: enum S10::E10 {S10::A10, S10::B10, S10::C10};
The issue is that they have an older gcc (not c++11 by default?) that
doesn't emit the enum underlying type information. When the
enum type is printed by ptype, it looks like this:
enum S10::E10 {S10::A10, S10::B10, S10::C10};
instead of this on older gccs:
enum S10::E10 : unsigned int {S10::A10, S10::B10, S10::C10};
The regex that matches this is in cp_test_ptype_class, and is
enum $nested_name (: (unsigned )?int)? \{
If the "unsigned int" portion is not present, then it requires the
string to have two spaces between the enum name and opening bracket.
The fix is simply to move the trailing space inside the ? group.
gdb/testsuite/ChangeLog:
* lib/cp-support.exp (cp_test_ptype_class): Move space inside
parentheses.
|
|
This removes most (but not all) cleanups from linux-thread-db.c.
std::string and std::vector are used in place of manual memory
management.
The remaining cleanup in linux-thread-db.c uses
make_cleanup_free_char_ptr_vec, which requires a somewhat bigger
change.
Regression tested by the buildbot.
ChangeLog
2018-02-24 Tom Tromey <tom@tromey.com>
* linux-thread-db.c (try_thread_db_load_from_pdir_1)
(try_thread_db_load_from_dir, thread_db_load_search): Use
std::string.
(info_auto_load_libthread_db_compare): Return bool. Change
argument types.
(info_auto_load_libthread_db): Use std::vector, std::string.
Remove cleanups.
|
|
This changes the gdbarch fast_tracepoint_valid_at method to use a
std::string as its out parameter, and then updates all the uses. This
allows removing a cleanup from breakpoint.c.
Regression tested by the buildbot.
ChangeLog
2018-02-24 Tom Tromey <tom@tromey.com>
* i386-tdep.c (i386_fast_tracepoint_valid_at): "msg" now a
std::string.
* gdbarch.sh (fast_tracepoint_valid_at): Change "msg" to a
std::string*.
* gdbarch.c: Rebuild.
* gdbarch.h: Rebuild.
* breakpoint.c (check_fast_tracepoint_sals): Use std::string.
* arch-utils.h (default_fast_tracepoint_valid_at): Update.
* arch-utils.c (default_fast_tracepoint_valid_at): "msg" now a
std::string*.
|
|
Fix a commit 883fd55ab104 ("Record nested types") issue:
ERROR: tcl error sourcing .../gdb/testsuite/gdb.cp/nested-types.exp.
ERROR: can't read "actual_linejj": no such variable
while executing
"append txt " definition: $actual_linejj""
(procedure "cp_test_ptype_class" line 324)
invoked from within
"cp_test_ptype_class $name "ptype $name (limit = $limit)" $key $name $children" (procedure "test_nested_limit" line 28)
invoked from within
"test_nested_limit -1 false"
(file ".../gdb/testsuite/gdb.cp/nested-types.exp" line 310)
invoked from within
"source .../gdb/testsuite/gdb.cp/nested-types.exp"
("uplevel" body line 1)
invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.cp/nested-types.exp"
invoked from within
"catch "uplevel #0 source $test_file_name""
testcase .../gdb/testsuite/gdb.cp/nested-types.exp completed in 9 seconds
caused by $actual_line having been accidentally referred to as
$actual_linejj in one place.
gdb/testsuite/
* lib/cp-support.exp (cp_test_ptype_class): Fix a typo in the
name of a variable: $actual_linejj -> $actual_line.
|
|
Does anybody have an opinion about this? It would be nice to unbreak
the "default" build with clang (i.e. without passing special -Wno-error=
flags).
Here's a version rebased on today's master.
From 47d28075117fa2ddb93584ec50881e33777a85e5 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Sat, 30 Dec 2017 22:48:18 -0500
Subject: [PATCH] dwarf: Make sect_offset 64-bits
Compiling with Clang 6 shows these errors:
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26610:43: error: result of comparison of constant 4294967296 with expression of type 'typename std::underlying_type<sect_offset>::type' (a
ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (to_underlying (per_cu.sect_off) >= (static_cast<uint64_t> (1) << 32))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26618:43: error: result of comparison of constant 4294967296 with expression of type 'typename std::underlying_type<sect_offset>::type' (a
ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (to_underlying (per_cu.sect_off) >= (static_cast<uint64_t> (1) << 32))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The code in question checks if there is any offset exceeding 32 bits,
and therefore if we need to use the 64-bit DWARF format when writing the
.debug_names section. The type we use currently to represent section
offsets is an unsigned int (32-bits), which means a value of this type
will never exceed 32 bits, hence the errors above.
There are many signs that we want to support 64-bits DWARF (although I
haven't tested), such as:
- We correctly read initial length fields (read_initial_length)
- We take that into account when reading offsets (read_offset_1)
- The check_dwarf64_offsets function
However, I don't see how it can work if sect_offset is a 32-bits type.
Every time we record a section offset, we risk truncating the value.
And if a file uses the 64-bit DWARF format, it's most likely because
there are such offset values that overflow 32 bits.
Because of this, I think the way forward is to change sect_offset to be
a uint64_t. It will be able to represent any offset, regardless of the
bitness of the DWARF info.
This patch was regtested on the buildbot.
gdb/ChangeLog:
* gdbtypes.h (sect_offset): Change type to uint64_t.
(sect_offset_str): New function.
* dwarf2read.c (create_addrmap_from_aranges): Use
sect_offset_str.
(error_check_comp_unit_head): Likewise.
(create_debug_type_hash_table): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_cutu_and_read_dies): Likewise.
(init_cutu_and_read_dies_no_follow): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(partial_die_parent_scope): Likewise.
(peek_die_abbrev): Likewise.
(process_queue): Likewise.
(dwarf2_physname): Likewise.
(read_namespace_alias): Likewise.
(read_import_statement): Likewise.
(create_dwo_cu_reader): Likewise.
(create_cus_hash_table): Likewise.
(lookup_dwo_cutu): Likewise.
(inherit_abstract_dies): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_common_block): Likewise.
(read_module_type): Likewise.
(read_typedef): Likewise.
(read_subrange_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(read_str_index): Likewise.
(dwarf2_string_attr): Likewise.
(build_error_marker_type): Likewise.
(lookup_die_type): Likewise.
(dump_die_shallow): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(follow_die_sig): Likewise.
(get_signatured_type): Likewise.
(get_DW_AT_signature_type): Likewise.
(dwarf2_find_containing_comp_unit): Likewise.
(set_die_type): Likewise.
|
|
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-i386-address.exp: Fix a typo.
|
|
This fixes a build breakage on FreeBSD hosts.
gdb/ChangeLog:
* arch/aarch64.c: Include "common-defs.h".
* arch/amd64.c: Likewise.
* arch/i386.c: Likewise.
|
|
This removes a cleanup from parse_expression_for_completion, by
changing various expression-completion functions to use
gdb::unique_xmalloc_ptry rather than explicit malloc+free.
Regression tested by the buildbot.
gdb/ChangeLog
2018-02-21 Tom Tromey <tom@tromey.com>
* value.h: (extract_field_op): Update.
* eval.c (extract_field_op): Return a const char *.
* expression.h (parse_expression_for_completion): Update.
* completer.c (complete_expression): Update.
(add_struct_fields): Make fieldname const.
* parse.c (expout_completion_name): Now a unique_xmalloc_ptr.
(mark_completion_tag, parse_exp_in_context_1): Update.
(parse_expression_for_completion): Change "name" to
unique_xmalloc_ptr*.
|
|
This removes a cleanup from call_function_by_hand_dummy, replacing
manual allocation with std::vector.
Regression tested by the buildbot.
gdb/ChangeLog
2018-02-21 Tom Tromey <tom@tromey.com>
* infcall.c (call_function_by_hand_dummy): Use std::vector.
|
|
We can pass readable_regcache to gdbarch method read_pc where it is
allowed to do read from regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* avr-tdep.c (avr_read_pc): Change parameter type to
readable_regcache.
* gdbarch.sh (read_pc): Likewise.
* gdbarch.c: Re-generated.
* gdbarch.h: Re-generated.
* hppa-tdep.c (hppa_read_pc): Change parameter type to
readable_regcache.
* ia64-tdep.c (ia64_read_pc): Likewise.
* mips-tdep.c (mips_read_pc): Likewise.
* spu-tdep.c (spu_read_pc): Likewise.
|
|
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* Makefile.in (COMMON_SFILES): Add regcache-dump.c
* regcache-dump.c: New file.
* regcache.c: Move register_dump to regcache-dump.c.
(maintenance_print_registers): Likewise.
(maintenance_print_raw_registers): Likewise.
(maintenance_print_cooked_registers): Likewise.
(maintenance_print_register_groups): Likewise.
(maintenance_print_remote_registers): Likewise.
(_initialize_regcache): Likewise.
* regcache.h (register_dump): Moved from regcache.c.
|
|
Now, m_readonly_p is always false, so we can remove it, and regcache no
longer includes pseudo registers. Some regcache methods are lift up to
its parent class, like reg_buffer or detached_regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::regcache): Update.
(regcache::invalidate): Move it to detached_regcache::invalidate.
(get_thread_arch_aspace_regcache): Update.
(regcache::raw_update): Update.
(regcache::cooked_read): Remove some code.
(regcache::cooked_read_value): Likewise.
(regcache::raw_write): Remove assert on m_readonly_p.
(regcache::raw_supply_integer): Move it to
detached_regcache::raw_supply_integer.
(regcache::raw_supply_zeroed): Likewise.
* regcache.h (detached_regcache) <raw_supply_integer>: New
declaration.
<raw_supply_zeroed, invalidate>: Likewise.
(regcache) <raw_supply_integer, raw_supply_zeroed>: Removed.
<invalidate>: Likewise.
<m_readonly_p>: Removed.
|
|
Nowadays, we create a readonly regcache in get_return_value, and pass it
to gdbarch_return_value to get the return value. In theory, we can pass a
readable_regcache instance and get the return value, because we don't need
to modify the regcache. Unfortunately, gdbarch_return_value is designed
to multiplex regcache, according to READBUF and WRITEBUF.
# If READBUF is not NULL, extract the return value and save it in this
# buffer.
#
# If WRITEBUF is not NULL, it contains a return value which will be
# stored into the appropriate register.
In fact, gdbarch_return_value should be split to three functions, 1) only
return return_value_convention, 2) pass regcache_readonly and readbuf, 3)
pass regcache and writebuf. These changes are out of the scope of this
patch series, so I pass regcache to gdbarch_return_value even for read,
and trust each gdbarch backend doesn't modify regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* infcmd.c (get_return_value): Let stop_regs point to
get_current_regcache.
* regcache.c (regcache::regcache): Remove.
(register_dump_reg_buffer): New class.
(regcache_print): Adjust.
* regcache.h (regcache): Remove constructors.
|
|
Nowadays, we need to dump registers contents from "readwrite" regcache and
"readonly" regcache,
if (target_has_registers)
get_current_regcache ()->dump (out, what_to_dump);
else
{
/* For the benefit of "maint print registers" & co when
debugging an executable, allow dumping a regcache even when
there is no thread selected / no registers. */
regcache dummy_regs (target_gdbarch ());
dummy_regs.dump (out, what_to_dump);
}
since we'll have two different types/classes for "readwrite" regcache and
"readonly" regcache, we have to move dump method to their parent class,
reg_buffer. However, the functionality of "dump" looks unnecessary to
reg_buffer (because some dump modes like regcache_dump_none,
regcache_dump_remote and regcache_dump_groups don't need reg_buffer at
all, they need gdbarch to do the dump), so I decide to move "dump" into a
separate classes, and each sub-class is about each mode of dump.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (class register_dump): New class.
(register_dump_regcache, register_dump_none): New class.
(register_dump_remote, register_dump_groups): New class.
(regcache_print): Update.
* regcache.h (regcache_dump_what): Move it to regcache.c.
(regcache) <dump>: Remove.
|
|
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
|
|
This patch adds a new class (type) for readonly regcache, which is
created via regcache::save. readonly_detached_regcache inherits
readable_regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* dummy-frame.c (dummy_frame_cache) <prev_regcache>: Use
readonly_detached_regcache.
(dummy_frame_prev_register): Use regcache->cooked_read.
* frame.c (frame_save_as_regcache): Change return type.
(frame_pop): Update.
* frame.h (frame_save_as_regcache): Update declaration.
* inferior.h (get_infcall_suspend_state_regcache): Update
declaration.
* infrun.c (infcall_suspend_state) <registers>: use
readonly_detached_regcache.
(save_infcall_suspend_state): Don't use regcache_dup.
(get_infcall_suspend_state_regcache): Change return type.
* linux-fork.c (struct fork_info) <savedregs>: Change to
readonly_detached_regcache.
<pc>: New field.
(fork_save_infrun_state): Don't use regcache_dup.
(info_checkpoints_command): Adjust.
* mi/mi-main.c (register_changed_p): Update declaration.
(mi_cmd_data_list_changed_registers): Use
readonly_detached_regcache.
(register_changed_p): Change parameter type to
readonly_detached_regcache.
* ppc-linux-tdep.c (ppu2spu_cache) <regcache>: Use
readonly_detached_regcache.
(ppu2spu_sniffer): Construct a new readonly_detached_regcache.
* regcache.c (readonly_detached_regcache::readonly_detached_regcache):
New.
(regcache::save): Move it to reg_buffer.
(regcache::restore): Change parameter type.
(regcache_dup): Remove.
* regcache.h (reg_buffer) <save>: New method.
(readonly_detached_regcache): New class.
* spu-tdep.c (spu2ppu_cache) <regcache>: Use
readonly_detached_regcache.
(spu2ppu_sniffer): Construct a new readonly_detached_regcache.
|
|
... instead we start to use regcache methods save and restore. It is
quite straightforward to replace regcache_save with regcache->save.
regcache_cpy has some asserts, some of them not necessary, like
gdb_assert (src != dst);
because we already assert !m_readonly_p and src->m_readonly_p, so
src isn't dst. Some of the asserts are moved to ::restore.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* frame.c (frame_save_as_regcache): Use regcache method save.
(frame_pop): Use regcache method restore.
* infrun.c (restore_infcall_suspend_state): Likewise.
* linux-fork.c (fork_load_infrun_state): Likewise.
* ppc-linux-tdep.c (ppu2spu_sniffer): User regcache method
save.
* regcache.c (regcache_save): Remove.
(regcache::restore): More asserts.
(regcache_cpy): Remove.
* regcache.h (regcache_save): Remove the declaration.
(regcache::restore): Move from private to public.
Remove the friend declaration of regcache_cpy.
(regcache_cpy): Remove declaration.
|
|
pseudo_register_read and pseudo_register_read_value
pseudo registers are either from raw registers or memory, so
gdbarch methods pseudo_register_read and pseudo_register_read_value
should have regcache object which only have read methods. In other
words, we should disallow writing to regcache in these two gdbarch
methods. In order to apply this restriction, this patch adds a new
class readable_regcache, derived from reg_buffer, and it only has
raw_read and cooked_read methods. regcache is derived from
readable_regcache. This patch also passes readable_regcache instead of
regcache to gdbarch methods pseudo_register_read and
pseudo_register_read_value.
This patch moves raw_read* and cooked_read* methods to readable_regcache,
which is straightforward. One thing not straightforward is that I split
regcache::xfer_part to readable_regcache::read_part and regcache::write_part,
because readable_regcache can only have methods to read.
readable_regcache is an abstract base class, and it has a pure virtual
function raw_update, because I don't want readable_regcache know where
these raw registers are from. They can be from either the target
(readwrite regcache) or the regcache itself (readonly regcache).
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_pseudo_register_read_value): Change
parameter type to 'readable_regcache *'.
* amd64-tdep.c (amd64_pseudo_register_read_value): Likewise.
* arm-tdep.c (arm_neon_quad_read): Likewise.
(arm_pseudo_read): Likewise.
* avr-tdep.c (avr_pseudo_register_read): Likewise.
* bfin-tdep.c (bfin_pseudo_register_read): Likewise.
* frv-tdep.c (frv_pseudo_register_read): Likewise.
* gdbarch.c: Re-generated.
* gdbarch.h: Re-generated.
* gdbarch.sh (pseudo_register_read): Change parameter type to
'readable_regcache *'.
(pseudo_register_read_value): Likewise.
* h8300-tdep.c (pseudo_from_raw_register): Likewise.
(h8300_pseudo_register_read): Likewise.
* hppa-tdep.c (hppa_pseudo_register_read): Likewise.
* i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise.
(i386_pseudo_register_read_into_value): Likewise.
(i386_pseudo_register_read_value): Likewise.
* i386-tdep.h (i386_pseudo_register_read_into_value): Update
declaration.
* ia64-tdep.c (ia64_pseudo_register_read): Likewise.
* m32c-tdep.c (m32c_raw_read): Likewise.
(m32c_read_flg): Likewise.
(m32c_banked_register): Likewise.
(m32c_banked_read): Likewise.
(m32c_sb_read): Likewise.
(m32c_part_read): Likewise.
(m32c_cat_read): Likewise.
(m32c_r3r2r1r0_read): Likewise.
(m32c_pseudo_register_read): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise.
* mep-tdep.c (mep_pseudo_cr32_read): Likewise.
(mep_pseudo_cr64_read): Likewise.
(mep_pseudo_register_read): Likewise.
* mips-tdep.c (mips_pseudo_register_read): Likewise.
* msp430-tdep.c (msp430_pseudo_register_read): Likewise.
* nds32-tdep.c (nds32_pseudo_register_read): Likewise.
* regcache.c (regcache::raw_read): Move it to readable_regcache.
(regcache::cooked_read): Likewise.
(regcache::cooked_read_value): Likewise.
(regcache_cooked_read_signed):
(regcache::cooked_read): Likewise.
* regcache.h (readable_regcache): New class.
(regcache): Inherit readable_regcache. Move some methods to
readable_regcache.
* rl78-tdep.c (rl78_pseudo_register_read): Change
parameter type to 'readable_regcache *'.
* rs6000-tdep.c (do_regcache_raw_read): Remove.
(e500_pseudo_register_read): Change parameter type to
'readable_regcache *'.
(dfp_pseudo_register_read): Likewise.
(vsx_pseudo_register_read): Likewise.
(efpr_pseudo_register_read): Likewise.
* s390-tdep.c (s390_pseudo_register_read): Likewise.
* sh-tdep.c (sh_pseudo_register_read): Likewise.
* sh64-tdep.c (pseudo_register_read_portions): Likewise.
(sh64_pseudo_register_read): Likewise.
* sparc-tdep.c (sparc32_pseudo_register_read): Likewise.
* sparc64-tdep.c (sparc64_pseudo_register_read): Likewise.
* spu-tdep.c (spu_pseudo_register_read_spu): Likewise.
(spu_pseudo_register_read): Likewise.
* xtensa-tdep.c (xtensa_register_read_masked): Likewise.
(xtensa_pseudo_register_read): Likewise.
|
|
This patch adds a new class reg_buffer, and regcache inherits it. Class
reg_buffer is a very simple class, which has the buffer for register
contents and status only. It doesn't have any methods to set contents and
status, and it is expected that its children classes can inherit it and
add different access methods.
Another reason I keep class reg_buffer so simple is that I think
reg_buffer can be even reused in other classes which need to record the
registers contents and status, like frame cache for example.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::regcache): Call reg_buffer ctor.
(regcache::arch): Move it to reg_buffer::arch.
(regcache::register_buffer): Likewise.
(regcache::assert_regnum): Likewise.
(regcache::num_raw_registers): Likewise.
* regcache.h (reg_buffer): New class.
(regcache): Inherit reg_buffer.
|
|
Fixes:
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:385:34: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf_filtered (gdb_stdout, format, args);
^~~~~~
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:394:34: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf_filtered (gdb_stdout, format, ap);
^~~~~~
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:402:34: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf_filtered (gdb_stderr, format, ap);
^~~~~~
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:413:11: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
verror (format, args);
^~~~~~
4 errors generated.
gdb/ChangeLog:
* remote-sim.c (gdb_os_printf_filtered, gdb_os_vprintf_filtered,
gdb_os_evprintf_filtered, gdb_os_error): Add ATTRIBUTE_PRINTF.
|
|
Older versions of MinGW do not support mkstemp causing:
gdb/unittests/scoped_fd-selftests.c:37:29: error: \
'mkstemp' was not declared in this scope
int fd = mkstemp (filename);
^
gdb/unittests/scoped_fd-selftests.c: In function 'void
selftests::scoped_fd::test_release()':
gdb/unittests/scoped_fd-selftests.c:56:29: error: \
'mkstemp' was not declared in this scope
int fd = mkstemp (filename);
^
Import mkstemp from gnulib.
gdb/
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add mkstemp.
* gnulib/aclocal.m4: Regenerated.
* gnulib/config.in: Regenerated.
* gnulib/configure: Regenerated.
* gnulib/import/Makefile.am: Regenerated.
* gnulib/import/Makefile.in: Regenerated.
* gnulib/import/m4/gnulib-cache.m4: Regenerated.
* gnulib/import/m4/gnulib-comp.m4: Regenerated.
* gnulib/import/m4/mkstemp.m4: Imported.
* gnulib/import/m4/secure_getenv.m4: Imported.
* gnulib/import/m4/tempname.m4: Imported.
* gnulib/import/mkstemp.c: Imported.
* gnulib/import/secure_getenv.c: Imported.
* gnulib/import/tempname.c: Imported.
* gnulib/import/tempname.h: Imported.
|
|
In gdb.btrace/buffer-size.exp we explicitly ask for the BTS recording format.
This may lead to spurious fails on systems where PT is being used by some other
process at the same time.
Set both PT and BTS buffer sizes to 1 and check that whatever recording format
is used will use a 4KB buffer.
testsuite/
* gdb.btrace/buffer-size.exp: Do not force BTS.
|