Age | Commit message (Collapse) | Author | Files | Lines |
|
This commit is the result of running the gdb/copyright.py script,
which automated the update of the copyright year range for all
source files managed by the GDB project to be updated to include
year 2023.
|
|
Currently, every internal_error call must be passed __FILE__/__LINE__
explicitly, like:
internal_error (__FILE__, __LINE__, "foo %d", var);
The need to pass in explicit __FILE__/__LINE__ is there probably
because the function predates widespread and portable variadic macros
availability. We can use variadic macros nowadays, and in fact, we
already use them in several places, including the related
gdb_assert_not_reached.
So this patch renames the internal_error function to something else,
and then reimplements internal_error as a variadic macro that expands
__FILE__/__LINE__ itself.
The result is that we now should call internal_error like so:
internal_error ("foo %d", var);
Likewise for internal_warning.
The patch adjusts all calls sites. 99% of the adjustments were done
with a perl/sed script.
The non-mechanical changes are in gdbsupport/errors.h,
gdbsupport/gdb_assert.h, and gdb/gdbarch.py.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
|
|
This changes target_pid_to_exec_file and target_ops::pid_to_exec_file
to return a "const char *". I couldn't build many of these targets,
but did examine the code by hand -- also, as this only affects the
return type, it's normally pretty safe. This brings gdb and gdbserver
a bit closer, and allows for the removal of a const_cast as well.
|
|
I'm trying to switch these functions to use std::string instead of char
arrays, as much as possible. Some callers benefit from it (can avoid
doing a copy of the result), while others suffer (have to make one more
copy).
Change-Id: I793aab17baaef8345488f4c40b9094e2695425bc
|
|
This patch removes gdb's dbx mode. Regression tested on x86-64 Fedora
34.
|
|
Now that filtered and unfiltered output can be treated identically, we
can unify the printf family of functions. This is done under the name
"gdb_printf". Most of this patch was written by script.
|
|
Now that filtered and unfiltered output can be treated identically, we
can unify the puts family of functions. This is done under the name
"gdb_puts". Most of this patch was written by script.
|
|
This changes all existing calls to wrap_here to call the method on the
appropriate ui_file instead. The choice of ui_file is determined by
context.
|
|
I think it only really makes sense to call wrap_here with an argument
consisting solely of spaces. Given this, it seemed better to me that
the argument be an int, rather than a string. This patch is the
result. Much of it was written by a script.
|
|
This moves the gdb_argv class to a new header in gdbsupport.
|
|
Many otherwise ordinary commands choose to use unfiltered output
rather than filtered. I don't think there's any reason for this, so
this changes many such commands to use filtered output instead.
Note that complete_command is not touched due to a comment there
explaining why unfiltered output is believed to be used.
|
|
This commit brings all the changes made by running gdb/copyright.py
as per GDB's Start of New Year Procedure.
For the avoidance of doubt, all changes in this commits were
performed by the script.
|
|
I happened to notice that one "show" callback was printing to
gdb_stdout rather than to the passed-in ui_file parameter. I went
through all such callbacks and fixed them to consistently use the
ui_file.
Regression tested on x86-64 Fedora 34.
|
|
With trying to load a non-executable file into gdb, we run into PR26880:
...
$ gdb -q -batch test.c
"0x7ffc87bfc8d0s": not in executable format: \
file format not recognized
...
The problem is caused by using %ps in combination with the error function
(note that confusingly, it does work in combination with the warning
function).
Fix this by using plain "%s" instead.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-08-22 Tom de Vries <tdevries@suse.de>
PR gdb/26880
* gdb/exec.c (exec_file_attach): Use %s instead of %ps in call to
error function.
gdb/testsuite/ChangeLog:
2021-08-22 Tom de Vries <tdevries@suse.de>
PR gdb/26880
* gdb.base/non-executable.exp: New file.
|
|
In the context of ROCm-gdb [1], the ROCm target sits on top of the
linux-nat target. when a process forks, it needs to carry over some
data from the forking inferior to the fork child inferior. Ideally, the
ROCm target would implement the follow_fork target_ops method, but there
are some small problems. This patch fixes these, which helps the ROCm
target, but also makes things more consistent and a bit nicer in
general, I believe.
The main problem is: when follow-fork-mode is "parent",
target_follow_fork is called with the parent as the current inferior.
When it's "child", target_follow_fork is called with the child as the
current inferior. This means that target_follow_fork is sometimes
called on the parent's target stack and sometimes on the child's target
stack.
The parent's target stack may contain targets above the process target,
such as the ROCm target. So if follow-fork-child is "parent", the ROCm
target would get notified of the fork and do whatever is needed. But
the child's target stack, at that moment, only contains the exec and
process target copied over from the parent. The child's target stack is
set up by follow_fork_inferior, before calling target_follow_fork. In
that case, the ROCm target wouldn't get notified of the fork.
For consistency, I think it would be good to always call
target_follow_fork on the parent inferior's target stack. I think it
makes sense as a way to indicate "this inferior has called fork, do
whatever is needed". The desired outcome of the fork (whether an
inferior is created for the child, do we need to detach from the child)
can be indicated by passed parameter.
I therefore propose these changes:
- make follow_fork_inferior always call target_follow_fork with the
parent as the current inferior. That lets all targets present on the
parent's target stack do some fork-related handling and push
themselves on the fork child's target stack if needed.
For this purpose, pass the child inferior down to target_follow_fork
and follow_fork implementations. This is nullptr if no inferior is
created for the child, because we want to detach from it.
- as a result, in follow_fork_inferior, detach from the parent inferior
(if needed) only after the target_follow_fork call. This is needed
because we want to call target_follow_fork before the parent's
target stack is torn down.
- hand over to the targets in the parent's target stack (including the
process target) the responsibility to push themselves, if needed, to
the child's target stack. Also hand over the responsibility to the
process target, at the same time, to create the child's initial
thread (just like we do for follow_exec).
- pass the child inferior to exec_on_vfork, so we don't need to swap
the current inferior between parent and child. Nothing in
exec_on_vfork depends on the current inferior, after this change.
Although this could perhaps be replaced with just having the exec
target implement follow_fork and push itself in the child's target
stack, like the process target does... We would just need to make
sure the process target calls beneath()->follow_fork(...). I'm not
sure about this one.
gdb/ChangeLog:
* target.h (struct target_ops) <follow_fork>: Add inferior*
parameter.
(target_follow_fork): Likewise.
* target.c (default_follow_fork): Likewise.
(target_follow_fork): Likewise.
* fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Likewise.
(fbsd_nat_target::follow_fork): Likewise, and call
inf_ptrace_target::follow_fork.
* linux-nat.h (class linux_nat_target) <follow_fork>: Likewise.
* linux-nat.c (linux_nat_target::follow_fork): Likewise, and
call inf_ptrace_target::follow_fork.
* obsd-nat.h (obsd_nat_target) <follow_fork>: Likewise.
* obsd-nat.c (obsd_nat_target::follow_fork): Likewise, and call
inf_ptrace_target::follow_fork.
* remote.c (class remote_target) <follow_fork>: Likewise.
(remote_target::follow_fork): Likewise, and call
process_stratum_target::follow_fork.
* process-stratum-target.h (class process_stratum_target)
<follow_fork>: New.
* process-stratum-target.c
(process_stratum_target::follow_fork): New.
* target-delegates.c: Re-generate.
[1] https://github.com/ROCm-Developer-Tools/ROCgdb
Change-Id: I460bd0af850f0485e8aed4b24c6d8262a4c69929
|
|
I noticed that exception_print_same is only used in a single spot, and
it seemed to be better as an operator!= method attached to
gdb_exception.
Regression tested on x86-64 Fedora 34.
|
|
Convert these three macros to methods of obj_section. The problem fixed
by the following patch is caused by an out of bound access of the
objfile::section_offsets vector. Since this is deep in macros, we don't
get a clear backtrace and it's difficult to debug. Changing that to
methods means we can step in them and break on them.
Because their implementation requires knowing about struct objfile, move
struct obj_section below struct objfile in objfiles.h.
The obj_section_offset was used in one place as an lvalue to set
offsets, in machoread.c. Replace that with a set_offset method.
Add the objfile::section_offset and objfile::set_section_offset methods
to improve encapsulation (reduce other objects poking into struct
objfile's internals).
gdb/ChangeLog:
* objfiles.h (struct obj_section): Move down.
<offset, set_offset, addr, endaddr>: New.
(obj_section_offset, obj_section_addr, obj_section_endaddr),
replace all users to use obj_section methods.
(struct objfile) <section_offset, set_section_offset>: New.
Change-Id: I97e8fcae93ab2353fbdadcb4a5ec10d7949a7334
|
|
The current_top_target function is a hidden dependency on the current
inferior. Since I'd like to slowly move towards reducing our dependency
on the global current state, remove this function and make callers use
current_inferior ()->top_target ()
There is no expected change in behavior, but this one step towards
making those callers use the inferior from their context, rather than
refer to the global current inferior.
gdb/ChangeLog:
* target.h (current_top_target): Remove, make callers use the
current inferior instead.
* target.c (current_top_target): Remove.
Change-Id: Iccd457036f84466cdaa3865aa3f9339a24ea001d
|
|
Same as the previous patch, but for the push_target functions.
The implementation of the move variant is moved to a new overload of
inferior::push_target.
gdb/ChangeLog:
* target.h (push_target): Remove, update callers to use
inferior::push_target.
* target.c (push_target): Remove.
* inferior.h (class inferior) <push_target>: New overload.
Change-Id: I5a95496666278b8f3965e5e8aecb76f54a97c185
|
|
unpush_target unpushes the passed-in target from the current inferior's
target stack. Calling it is therefore an implicit dependency on the
current global inferior. Remove that function and make the callers use
the inferior::unpush_target method directly. This sometimes allows
using the inferior from the context rather than the global current
inferior.
target_unpusher::operator() now needs to be implemented in target.c,
otherwise target.h and inferior.h both need to include each other, and
that wouldn't work.
gdb/ChangeLog:
* target.h (unpush_target): Remove, update all callers
to use `inferior::unpush_target` instead.
(struct target_unpusher) <operator()>: Just declare.
* target.c (unpush_target): Remove.
(target_unpusher::operator()): New.
Change-Id: Ia5172dfb3f373e0a75b991885b50322ca2142a8c
|
|
The 'section' command uses a fixed size buffer into which a section
name is copied. This commit replaces this with a use of std::string
so we can now display very long section names.
The expected results of one test need to be updated.
gdb/ChangeLog:
* exec.c (set_section_command): Move variable declarations into
the function body, and use std::string instead of a fixed size
buffer.
gdb/testsuite/ChangeLog:
* gdb.base/sect-cmd.exp: Update expected results.
|
|
The only target that implements target_ops::get_section_table in a
meaningful way is exec_target. This target calls back into the
program space to return the current global section_table.
The global section table is populated whenever the user provides GDB
with an executable, or when a symbol file is loaded, e.g. when a
dynamic library is loaded, or when the user does add-symbol-file.
I recently ran into a situation where a user, debugging a remote
target, was not supplying GDB with a main executable at all. Instead
the user attached to the target then did add-symbol-file, and then
proceeded to debug the target.
This works fine, but it was noticed that even when
trust-readonly-sections was on GDB was still accessing the target to
get the contents of readonly sections.
The problem is that by not providing an executable there was no
exec_target in the target stack, and so when GDB calls the
target_ops::get_section_table function GDB ends up in
dummy_target::get_section_table, which just returns NULL.
What I want is that even when GDB doesn't have an exec_target in the
target stack, a call to target_ops::get_section_table will still
return the section_table from the current program space.
When considering how to achieve this my first though was, why is the
request for the section table going via the target stack at all? The
set of sections loaded is a property of the program space, not the
target. This is, after all, why the data is being stored in the
program space.
So I initially tried changing target_get_section_table so that,
instead of calling into the target it just returns
current_program_space->target_sections ().
This would be fine except for one issue, target_bfd (from
bfd-target.c). This code is used from solib-svr4.c to create a
temporary target_ops structure that implements two functions
target_bfd::xfer_partial and target_bfd::get_section_table.
The purpose behind the code is to enable two targets, ppc64 and frv to
decode function descriptors from the dynamic linker, based on the
non-relocated addresses from within the dynamic linker bfd object.
Both of the implemented functions in target_bfd rely on the target_bfd
object holding a section table, and the ppc64 target requires that the
target_bfd implement ::get_section_table.
The frv target doesn't require ::get_section_table, instead it
requires the ::xfer_partial. We could in theory change the ppc64
target to use the same approach as frv, however, this would be a bad
idea. I believe that the frv target approach is broken. I'll
explain:
The frv target calls get_target_memory_unsigned to read the function
descriptor. The address being read is the non-relocated address read
from the dynamic linker in solib-srv4.c:enable_break. Calling
get_target_memory_unsigned eventually ends up in target_xfer_partial
with an object type of TARGET_OBJECT_RAW_MEMORY. This will then call
memory_xfer_check_region. I believe that it is quite possible that a
the non-relocated addresses pulled from the dynamic linker could be in
a memory region that is not readable, while the relocated addresses
are in a readable memory region. If this was ever the case for the
frv target then GDB would reject the attempt to read the non-relocated
function pointer.
In contrast the ppc64 target calls target_section_by_addr, which calls
target_get_section_table, which then calls the ::get_section_table
function on the target.
Thus, when reflecting on target_bfd we see two functions,
::xfer_partial and ::get_section_table. The former is required by the
frv target, but that target is (I think) potentially broken. While
the latter is required by the ppc64 target, but this forces
::get_section_table to exist as a target_ops member function.
So my original plan, have target_get_section_table NOT call a
target_ops member function appears to be flawed.
My next idea was to remove exec_target::get_section_table, and instead
move the implementation into dummy_target::get_section_table.
Currently the dummy_target implementation always returns NULL
indicating no section table, but plenty of other dummy_target member
functions do more than just return null values.
So now, dummy_target::get_section_table returns the section table from
the current program space. This allows target_bfd to remain
unchanged, so ppc64 and frv should not be affected.
Making this change removes the requirement for the user to provide an
executable, GDB can now always access the section_table, as the
dummy_target always exists in the target stack.
Finally, there's a test that the target_section table is not empty in
the case where the user does add-symbol-file without providing an
executable.
gdb/ChangeLog:
* exec.c (exec_target::get_section_table): Delete member function.
(section_table_read_available_memory): Use current_top_target, not
just the exec_ops target.
* target-delegates.c: Regenerate.
* target.c (default_get_section_table): New function.
* target.h (target_ops::get_section_table): Change default
behaviour to call default_get_section_table.
(default_get_section_table): Declare.
|
|
Following on from earlier commits which made access to the
target_sections table more 'const', this commit makes the table
private within the program_space class and provides member functions
to access the table.
Ideally I would have liked for the new target_sections member
function (on program_space) to return a 'const' reference to the table
within the program_space. Unfortunately, there are two places in
solib-*.c, where code outside of the program_space class modifies the
target_sections table, and so to support this we need to return a
non-const reference.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* exec.c (exec_target::close): Call new clear_target_sections
function.
(program_space::add_target_sections): Update name of member
variable.
(program_space::foreach_target_section): New function.
(program_space::add_target_sections): Update name of member
variable.
(program_space::remove_target_sections): Likewise.
(exec_one_fork): Use new target_sections member function.
(exec_target::get_section_table): Likewise.
(exec_target::files_info): Likewise.
(set_section_command): Use new foreach_target_section member
function.
(exec_set_section_address): Likewise.
(exec_target::has_memory): Use new target_sections member
function.
* progspace.h (program_space::clear_target_sections): New member
function.
(program_space::target_sections): Rename member variable to
m_target_sections, replace with a new member function.
(program_space::foreach_target_section): Declare new member
function.
(program_space::m_target_sections): New member variable.
* solib-dsbt.c (scan_dyntag): Use new member function.
* solib-svr4.c (scan_dyntag): Likewise.
|
|
The code to access the target section table can be made more const, so
lets do that. There should be no user visible changes after this
commit.
gdb/ChangeLog:
* gdb/bfd-target.c (class target_bfd) <get_section_table>: Make
return type const.
* gdb/exec.c (struct exec_target) <get_section_table>: Likewise.
(section_table_read_available_memory): Make local const.
(exec_target::xfer_partial): Make local const.
(print_section_info): Make parameter const.
* gdb/exec.h (print_section_info): Likewise.
* gdb/ppc64-tdep.c (ppc64_convert_from_func_ptr_addr): Make local
const.
* gdb/record-btrace.c (record_btrace_target::xfer_partial):
Likewise.
* gdb/remote.c (remote_target::remote_xfer_live_readonly_partial):
Likewise.
* gdb/s390-tdep.c (s390_load): Likewise.
* gdb/solib-dsbt.c (scan_dyntag): Likewise.
* gdb/solib-svr4.c (scan_dyntag): Likewise.
* gdb/target-debug.h (target_debug_print_target_section_table_p):
Rename to...
(target_debug_print_const_target_section_table_p): ...this.
* gdb/target-delegates.c: Regenerate.
* gdb/target.c (target_get_section_table): Make return type const.
(target_section_by_addr): Likewise. Also make some locals const.
(memory_xfer_partial_1): Make some locals const.
* gdb/target.h (struct target_ops) <get_section_table>: Make
return type const.
(target_section_by_addr): Likewise.
(target_get_section_table): Likewise.
|
|
This commits the result of running gdb/copyright.py as per our Start
of New Year procedure...
gdb/ChangeLog
Update copyright year range in copyright header of all GDB files.
|
|
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
|
|
Now that we've removed the macros and moved various functions to be
methods on program_space (removing uses of current_program_space),
it's clear that exec_target::close can operate on program spaces
without changing the current program space.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* exec.c (exec_target::close): Don't change current program
space.
|
|
This changes add_target_sections_of_objfile to be a method on
program_space. It is renamed to be another overload of
add_target_sections, because they are semantically equivalent in a
sense.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* symfile.c (add_symbol_file_command): Update.
* exec.c (program_space::add_target_sections): Rename.
* symfile-mem.c (symbol_file_add_from_memory): Update.
* progspace.h (struct program_space) <add_target_sections>:
Declare new overload.
* exec.h (add_target_sections_of_objfile): Don't declare.
|
|
This changes add_target_sections to be a method on program_space.
Like the earlier change to remove_target_sections, this makes sense
because this function is manipulating data that is stored on the
program space.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* solib.c (solib_map_sections): Update.
* exec.c (program_space::add_target_sections): Now a method.
(exec_file_attach): Update.
* exec.h (add_target_sections): Don't declare.
* progspace.h (struct program_space) <add_target_sections>:
Declare.
|
|
This changes remove_target_sections to be a method on program_space.
This makes sense because this function manipulates data that is
attached to the program space.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* progspace.h (struct program_space) <remove_target_sections>:
Declare.
* exec.c (program_space::remove_target_sections): Now a method.
* exec.h (remove_target_sections): Don't declare.
|
|
This changes program_space::ebfd to a gdb_bfd_ref_ptr, removing some
manual management.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* exec.c (exec_file_attach): Update.
* progspace.c (program_space::exec_close): Update.
* progspace.h (struct program_space) <ebfd>: Now a
gdb_bfd_ref_ptr.
<set_exec_bfd>: Change argument type.
<exec_bfd>: Update.
|
|
This removes the exec_bfd macro, in favor of new accessors on
program_space. In one spot the accessor can't be used; but this is
still a big improvement over the macro, IMO.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* windows-tdep.c (windows_solib_create_inferior_hook): Update.
* symfile.c (reread_symbols): Update.
* symfile-mem.c (add_symbol_file_from_memory_command)
(add_vsyscall_page): Update.
* source-cache.c (source_cache::get_plain_source_lines): Update.
* solib-svr4.c (find_program_interpreter, elf_locate_base)
(svr4_current_sos_direct, svr4_exec_displacement)
(svr4_relocate_main_executable): Update.
(svr4_iterate_over_objfiles_in_search_order): Update.
* solib-frv.c (enable_break2, enable_break): Update.
* solib-dsbt.c (lm_base, enable_break): Update.
* solib-darwin.c (find_program_interpreter)
(darwin_solib_create_inferior_hook): Update.
* sol-thread.c (rw_common, ps_pdmodel): Update.
* rs6000-nat.c (rs6000_nat_target::create_inferior): Update.
* remote.c (compare_sections_command)
(remote_target::trace_set_readonly_regions): Update.
* remote-sim.c (get_sim_inferior_data)
(gdbsim_target::create_inferior, gdbsim_target::create_inferior): Update.
(gdbsim_target_open, gdbsim_target::files_info): Update.
* exec.h (exec_bfd): Remove macro.
* progspace.c (initialize_progspace): Update.
* proc-service.c (ps_addr_to_core_addr, core_addr_to_ps_addr):
Update.
* nto-procfs.c (nto_procfs_target::post_attach)
(nto_procfs_target::create_inferior): Update.
* maint.c (maintenance_info_sections): Update.
* linux-thread-db.c (thread_db_target::get_thread_local_address):
Update.
* infcmd.c (post_create_inferior): Update.
* gcore.c (default_gcore_arch, default_gcore_target): Update.
(objfile_find_memory_regions): Update.
* exec.c (validate_exec_file, exec_file_attach)
(exec_read_partial_read_only, print_section_info): Update.
* corelow.c (core_target_open): Update.
* corefile.c (reopen_exec_file, validate_files): Update.
* arm-tdep.c (gdb_print_insn_arm): Update.
* arch-utils.c (gdbarch_update_p, default_print_insn): Update.
* progspace.h (struct program_space) <exec_bfd, set_exec_bfd>: New
methods.
|
|
This removes the current_target_sections macro, replacing it with uses
of the appropriate member from current_program_space.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* progspace.h (current_target_sections): Remove macro.
* solib-svr4.c (scan_dyntag): Update.
* solib-dsbt.c (scan_dyntag): Update.
* exec.c (exec_target::close): Update.
(add_target_sections, add_target_sections_of_objfile)
(remove_target_sections, exec_target::get_section_table)
(exec_target::files_info, set_section_command)
(exec_set_section_address, exec_target::has_memory)
(exec_target::has_memory): Update.
|
|
This removes the exec_bfd_mtime define, in favor of directly using the
appropriate member of the current program space.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* source-cache.c (source_cache::get_plain_source_lines): Use
current_program_space.
* corefile.c (reopen_exec_file): Use current_program_space.
* exec.c (exec_file_attach): Use current_program_space.
* exec.h (exec_bfd_mtime): Remove.
|
|
exec_close uses the current program space, so it seemed cleaner to
change it to be a method on program_space. This patch makes this
change.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* progspace.c (program_space::exec_close): New method, from
exec_close in exec.c.
* exec.c (exec_close): Move to progspace.c.
(exec_target::close, exec_file_attach): Update.
* progspace.h (struct program_space) <exec_close>: Declare
method.
|
|
This removes the exec_filename macro, replacing it with uses of the
member of current_program_space. This also renames that member, and
changes it to be a unique pointer.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* progspace.h (struct program_space) <exec_filename>: Rename from
pspace_exec_filename. Now a unique_xmalloc_ptr.
* inferior.c (print_selected_inferior): Update.
(print_inferior): Update.
* mi/mi-main.c (print_one_inferior): Update.
* exec.h (exec_filename): Remove macro.
* corefile.c (get_exec_file): Update.
* exec.c (exec_close): Update.
(exec_file_attach): Update.
* progspace.c (clone_program_space): Update.
(print_program_space): Update.
|
|
This adds a constructor to target_section, simplifying the code that
creates instances of this.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* target-section.h (struct target_section): Add constructor.
* exec.c (build_section_table, add_target_sections_of_objfile):
Update.
* corelow.c (core_target::build_file_mappings): Update.
|
|
Since we converted gdbarch_make_corefile_notes to returning a
gdb::unique_xmalloc_ptr, I figured it would make sense to converted
target_ops::make_corefile_notes as well.
The only implementation of that is in procfs.c, and it should ideally be
re-written as a gdbarch method (see comment in write_gcore_file_1), but
in the mean time I guess it doesn't hurt to throw some unique pointer at
it.
I tested that it builds on Solaris 11 (gcc compile farm machine gcc211),
but I am not able to test it, because I can't get GDB to start a
process (I'll look at that separately).
gdb/ChangeLog:
* target.h (struct target_ops) <make_corefile_notes>:
Change return type to unique pointer.
* target.c (dummy_make_corefile_notes): Likewise.
* exec.c (struct exec_target) <make_corefile_notes>:
Likewise.
(exec_target::make_corefile_notes): Likewise.
* procfs.c (class procfs_target) <make_corefile_notes>:
Likewise.
(procfs_do_thread_registers): Adjust to unique pointer.
(struct procfs_corefile_thread_data): Add constructor.
<note_data>: Change type to unique pointer.
(procfs_corefile_thread_callback): Adjust to unique pointer.
(procfs_target::make_corefile_notes): Change return type to
unique pointer.
* target-delegates.c: Re-generate.
* gcore.c (write_gcore_file_1): Adjust.
* target-debug.h (target_debug_print_gdb_unique_xmalloc_ptr_char):
New.
Change-Id: I768fb17ac0f7adc67d2fe95e952c784fe0ac37ab
|
|
Because target_section_table only holds a vector, and because it is
used in an "open" way, this patch makes it just be an alias for the
std::vector specialization. This makes the code less wordy. If we do
ever want to add more specialized behavior to this type, it's simple
enough to convert it back to a struct with the few needed methods
implied by this change.
gdb/ChangeLog
2020-10-12 Tom Tromey <tom@tromey.com>
* target.h (struct target_ops) <get_section_table>: Update.
(target_get_section_table): Update.
* target.c (target_get_section_table, target_section_by_addr)
(memory_xfer_partial_1): Update.
* target-section.h (target_section_table): Now an alias.
* target-delegates.c: Rebuild.
* target-debug.h (target_debug_print_target_section_table_p):
Rename from target_debug_print_struct_target_section_table_p.
* symfile.c (build_section_addr_info_from_section_table): Update.
* solib.c (solib_map_sections, solib_contains_address_p): Update.
* solib-svr4.c (scan_dyntag): Update.
* solib-dsbt.c (scan_dyntag): Update.
* remote.c (remote_target::remote_xfer_live_readonly_partial):
Update.
* record-full.c (record_full_core_target::xfer_partial): Update.
* progspace.h (struct program_space) <target_sections>: Update.
* exec.h (print_section_info): Update.
* exec.c (exec_target::close, build_section_table)
(add_target_sections, add_target_sections_of_objfile)
(remove_target_sections, exec_on_vfork)
(section_table_available_memory)
(section_table_xfer_memory_partial)
(exec_target::get_section_table, exec_target::xfer_partial)
(print_section_info, set_section_command)
(exec_set_section_address, exec_target::has_memory): Update.
* corelow.c (core_target::build_file_mappings)
(core_target::xfer_partial, core_target::info_proc_mappings)
(core_target::info_proc_mappings): Update.
* bfd-target.c (class target_bfd): Update
|
|
The call to clear_section_table in ~program_space is now clearly not
needed -- the section table will clear itself. This patch removes
this call and then inlines the one remaining call to
clear_section_table.
gdb/ChangeLog
2020-10-12 Tom Tromey <tom@tromey.com>
* progspace.c (program_space::~program_space): Don't call
clear_section_table.
* exec.h (clear_section_table): Don't declare.
* exec.c (exec_target::close): Update.
(clear_section_table): Remove.
|
|
Now that target_section_table uses std::vector,
add_target_sections_of_objfile does not need to loop twice. This
patch simplifies this code to have just a single loop. Also, the
passed-in objfile can never be NULL, so this changes this function to
assert that.
gdb/ChangeLog
2020-10-12 Tom Tromey <tom@tromey.com>
* exec.c (add_target_sections_of_objfile): Simplify.
|
|
I noticed that build_section_table cannot fail. This patch changes it
to return a target_section_table and then removes the dead code.
gdb/ChangeLog
2020-10-12 Tom Tromey <tom@tromey.com>
* solib.c (solib_map_sections): Update.
* record-full.c (record_full_core_open_1): Update.
* exec.h (build_section_table): Return a target_section_table.
* exec.c (exec_file_attach): Update.
(build_section_table): Return a target_section_table.
* corelow.c (core_target::core_target): Update.
* bfd-target.c (target_bfd::target_bfd): Update.
|
|
This changes target_section_table to wrap a std::vector. This
simplifies some code, and also enables the simplifications coming in
the subsequent patches.
Note that for solib, I chose to have it use a pointer to a
target_section_table. This is more convoluted than would be ideal,
but I didn't want to convert solib to new/delete as a prerequisite for
this series.
gdb/ChangeLog
2020-10-12 Tom Tromey <tom@tromey.com>
* target.c (target_section_by_addr, memory_xfer_partial_1):
Update.
* target-section.h (struct target_section_table): Use
std::vector.
* symfile.h (build_section_addr_info_from_section_table): Take a
target_section_table.
* symfile.c (build_section_addr_info_from_section_table): Take a
target_section_table.
* solist.h (struct so_list) <sections>: Change type.
<sections_end>: Remove.
* solib.c (solib_map_sections, clear_so, solib_read_symbols)
(solib_contains_address_p): Update.
* solib-svr4.c (scan_dyntag): Update.
* solib-dsbt.c (scan_dyntag): Update.
* remote.c (remote_target::remote_xfer_live_readonly_partial):
Update.
* record-full.c (record_full_core_start, record_full_core_end):
Remove.
(record_full_core_sections): New global.
(record_full_core_open_1, record_full_core_target::xfer_partial):
Update.
* exec.h (build_section_table, section_table_xfer_memory_partial)
(add_target_sections): Take a target_section_table.
* exec.c (exec_file_attach, clear_section_table): Update.
(resize_section_table): Remove.
(build_section_table, add_target_sections): Take a
target_section_table.
(add_target_sections_of_objfile, remove_target_sections)
(exec_on_vfork): Update.
(section_table_available_memory): Take a target_section_table.
(section_table_read_available_memory): Update.
(section_table_xfer_memory_partial): Take a target_section_table.
(print_section_info, set_section_command)
(exec_set_section_address, exec_target::has_memory): Update.
* corelow.c (class core_target) <m_core_section_table,
m_core_file_mappings>: Remove braces.
<~core_target>: Remove.
(core_target::core_target): Update.
(core_target::~core_target): Remove.
(core_target::build_file_mappings)
(core_target::xfer_memory_via_mappings)
(core_target::xfer_partial, core_target::info_proc_mappings):
Update.
* bfd-target.c (target_bfd::xfer_partial): Update.
(target_bfd::target_bfd): Update.
(target_bfd::~target_bfd): Remove.
|
|
This removes the object-like macro target_has_execution, replacing it
with a function call. target_has_execution_current is also now
handled by this function.
gdb/ChangeLog
2020-09-28 Tom Tromey <tom@tromey.com>
* inferior.h (class inferior) <has_execution>: Update.
* windows-tdep.c (windows_solib_create_inferior_hook): Update.
* valops.c (find_function_in_inferior)
(value_allocate_space_in_inferior): Update.
* top.c (kill_or_detach): Update.
* target.c (target_preopen, set_target_permissions): Update.
(target_has_execution_current): Remove.
* sparc64-tdep.c (adi_examine_command, adi_assign_command):
Update.
* solib.c (update_solib_list, reload_shared_libraries): Update.
* solib-svr4.c (svr4_solib_create_inferior_hook): Update.
* solib-dsbt.c (enable_break): Update.
* score-tdep.c (score7_fetch_inst): Update.
* rs6000-nat.c (rs6000_nat_target::xfer_shared_libraries):
Update.
* remote.c (remote_target::start_remote)
(remote_target::remote_check_symbols, remote_target::open_1)
(remote_target::remote_detach_1, remote_target::verify_memory)
(remote_target::xfer_partial, remote_target::read_description)
(remote_target::get_min_fast_tracepoint_insn_len): Update.
* record-full.c (record_full_open_1): Update.
* record-btrace.c (record_btrace_target_open): Update.
* objc-lang.c (lookup_objc_class, lookup_child_selector)
(value_nsstring): Update.
* linux-thread-db.c (add_thread_db_info)
(thread_db_find_new_threads_silently, check_thread_db_callback)
(try_thread_db_load_1, record_thread): Update.
* linux-tdep.c (linux_info_proc, linux_vsyscall_range_raw):
Update.
* linux-fork.c (checkpoint_command): Update.
* infrun.c (set_non_stop, set_observer_mode)
(check_multi_target_resumption, for_each_just_stopped_thread)
(maybe_remove_breakpoints, normal_stop)
(class infcall_suspend_state): Update.
* infcmd.c (ERROR_NO_INFERIOR, kill_if_already_running)
(info_program_command, attach_command): Update.
* infcall.c (call_function_by_hand_dummy): Update.
* inf-loop.c (inferior_event_handler): Update.
* gcore.c (gcore_command, derive_heap_segment): Update.
* exec.c (exec_file_command): Update.
* eval.c (evaluate_subexp): Update.
* compile/compile.c (compile_to_object): Update.
* cli/cli-dump.c (restore_command): Update.
* breakpoint.c (update_watchpoint)
(update_inserted_breakpoint_locations)
(insert_breakpoint_locations, get_bpstat_thread): Update.
* target.h (target_has_execution): Remove macro.
(target_has_execution_current): Don't declare.
(target_has_execution): Rename from target_has_execution_1. Add
argument default.
|
|
This changes build_section_table to avoid bfd_map_over_sections, in
favor of iteration. In this situation it seemed simple to just remove
the helper function entirely.
gdb/ChangeLog
2020-09-19 Tom Tromey <tom@tromey.com>
* exec.c (add_to_section_table): Remove.
(build_section_table): Use foreach.
|
|
This patch is motivated by the need to be able to select sections
that section_table_xfer_memory_partial should consider for memory
transfers. I'll use this facility in the next patch in this series.
section_table_xfer_memory_partial() can currently be passed a section
name which may be used to make name-based selections. This is similar
to what I want to do, except that I want to be able to consider
section flags instead of the name.
I'm replacing the section name parameter with a predicate that,
when passed a pointer to a target_section struct, will return
true if that section should be further considered, or false which
indicates that it shouldn't.
I've converted the one existing use where a non-NULL section
name is passed to section_table_xfer_memory_partial(). Instead
of passing the section name, it now looks like this:
auto match_cb = [=] (const struct target_section *s)
{
return (strcmp (section_name, s->the_bfd_section->name) == 0);
};
return section_table_xfer_memory_partial (readbuf, writebuf,
memaddr, len, xfered_len,
table->sections,
table->sections_end,
match_cb);
The other callers all passed NULL; they've been simplified somewhat
in that they no longer need to pass NULL.
gdb/ChangeLog:
* exec.h (section_table_xfer_memory): Revise declaration,
replacing section name parameter with an optional callback
predicate.
* exec.c (section_table_xfer_memory): Likewise.
* bfd-target.c, exec.c, target.c, corelow.c: Adjust all callers
of section_table_xfer_memory.
|
|
It was deemed better to explicitly mention in help and doc that build IDs
are used for comparison, and that symbols are loaded when asking to
load the exec-file.
This is V2, fixing 2 typos and replacing 'If the user asks to load'
by 'If the user confirms loading', as suggested by Pedro.
gdb/ChangeLog
2020-07-11 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* exec.c (_initialize_exec): Update exec-file-mismatch help.
gdb/doc/ChangeLog
2020-07-11 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Attach): Update exec-file-mismatch doc.
|
|
As explained in https://sourceware.org/bugzilla/show_bug.cgi?id=25475,
when the currently loaded file has no debug symbol,
symbol_file_add_with_addrs does not ask a confirmation to the user
before loading the new symbol file. The behaviour is not consistent
when symbol_file_add_with_addrs is called due to exec-file-mismatch "ask"
setting.
The PR discusses several solutions/approaches.
The preferred approach (suggested by Joel) is to ensure that GDB always asks
a confirmation when it loads a new symbol file due to exec-file-mismatch,
using a new SYMFILE add-flag.
I tested this manually. If OK, we can remove the bypass introduced by Tom
in 6b9374f1, in order to always answer to the 'load' question.
gdb/ChangeLog
2020-06-24 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* symfile-add-flags.h: New flag SYMFILE_ALWAYS_CONFIRM.
* exec.c (validate_exec_file): If from_tty, set both
SYMFILE_VERBOSE (== from_tty) and SYMFILE_ALWAYS_CONFIRM.
* symfile.c (symbol_file_add_with_addrs): if always_confirm
and from_tty, unconditionally ask a confirmation.
|
|
check
Following the implementation of exec-file-mismatch based on build-id,
an attach to a process that runs a modified exec-file was triggering
the exec-file-mismatch handling, giving a warning such as:
warning: Mismatch between current exec-file /bd/home/philippe/gdb/git/build_termours/gdb/testsuite/outputs/gdb.base/attach/attach
and automatically determined exec-file /bd/home/philippe/gdb/git/build_termours/gdb/testsuite/outputs/gdb.base/attach/attach
exec-file-mismatch handling is currently "ask"
as the build-ids differ when an exec-file is recompiled.
This patch ensures that the exec-file-mismatch check is done with an up to date
build-id. With this, exec-file-mismatch check will only trigger when the
PID file really differs from the (build-id refreshed) current exec-file.
Note that the additional check does not (yet) reload the symbols if
the exec-file is changed: this reload will happen later if needed.
gdb/ChangeLog
2020-06-21 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* exec.c (validate_exec_file): Ensure the build-id is up to
date by calling reopen_exec_file (that checks file timestamp
to decide to re-read the file).
gdb/testsuite/ChangeLog
2020-06-21 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/attach.exp: Test priority of 'exec-file' changed
over 'exec-file-mismatch'.
* gdb.base/attach.c: Mark should_exit volatile.
* gdb.base/attach2.c: Likewise. Add a comment explaining
why the sleep cannot be big.
* gdb.base/attach3.c: New file.
|
|
Fixes this testsuite fail on Windows:
FAIL: gdb.base/bad-file.exp: directory
If both tries to open the file fail (without and with ".exe"), use the
errno value of the first try.
gdb/ChangeLog:
2020-05-27 Hannes Domani <ssbssa@yahoo.de>
* exec.c (exec_file_attach): Use errno value of first openp failure.
|