Age | Commit message (Collapse) | Author | Files | Lines |
|
2017-10-06 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/
* gdb.mi/mi-threads-interrupt.exp: Skip test if nointerrupts.
|
|
This patch moves aarch64-insn.o to arch/aarch64-insn.o. Then, all
arch/*.c are built to arch/*.o, so we don't need a Makefile rule to build
*.o from arch/*.c. This patch removes it too.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_64_TARGET_OBS): Replace aarch64-insn.o with
arch/aarch64-insn.o.
Remove one rule.
* configure.tgt: Replace aarch64-insn.o with arch/aarch64-insn.o.
|
|
It is tested by building GDB for some targets, arm-elf, arm-netbsd,
arm-linux, and aarch64-linux.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_TARGET_OBS): Replace arm.o, arm-get-next-pcs.o,
and arm-linux.o with arch/arm.o, arch/arm-get-next-pcs.o and
arch/arm-linux.o respectively.
* configure.tgt: Likewise.
|
|
This patch changes the build that arch/i386.c is built to arch/i386.o,
instead of i386.o.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (ALL_TARGET_OBS): Rename i386.o to arch/i386.o.
* configure.tgt (i386_tobjs): Replace i386.o with arch/i386.o.
|
|
With F23's mingw gcc 5.3.0, I'm seeing:
i686-w64-mingw32-g++ -x c++ -std=gnu++11 -g3 -O0 -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../../src/gdb/../zlib -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I../../src/gdb/gnulib/import -Ibuild-gnulib/import -I/home/pedro/src/expat/install-win32//include -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wno-format -Werror -c -o windows-nat.o -MT windows-nat.o -MMD -MP -MF ./.deps/windows-nat.o.Tpo ../../src/gdb/windows-nat.c
../../src/gdb/windows-nat.c: In function 'void windows_create_inferior(target_ops*, const char*, const string&, char**, int)':
../../src/gdb/windows-nat.c:2476:7: error: 'replace' is not a member of 'std'
std::replace (expanded_infcwd.begin (), expanded_infcwd.end (),
^
gdb/Changelog:
2017-10-06 Pedro Alves <palves@redhat.com>
* windows-nat.c: Include <algorithm>.
|
|
I see a build error when building GDB under msys+mingw gcc 32bit:
g++ -x c++ -std=gnu++11 -g -O2 -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wno-format -Werror -DGDBSERVER -c -o win32-low.o -MT win32-low.o -MMD -MP -MF .deps/win32-low.Tpo ../../../binutils-gdb/gdb/gdbserver/win32-low.c
../../../binutils-gdb/gdb/gdbserver/win32-low.c: In function 'BOOL create_process(const char*, char*, DWORD, PROCESS_INFORMATION*)':
../../../binutils-gdb/gdb/gdbserver/win32-low.c:566:48: error: 'get_inferior_cwd' was not declared in this scope
const char *inferior_cwd = get_inferior_cwd ();
^
make[4]: *** [win32-low.o] Error 1
It can be fixed by simply including the right header file.
gdb/gdbserver/ChangeLog:
2017-10-06 Yuanhui Zhang <asmwarrior@gmail.com>
* win32-low.c: Include "common-inferior.h".
|
|
Nowadays, there are much duplications in configure.tgt to update
gdb_target_obs, some cpu specific object files are added to gdb_target_obs
to some different target triplets of the same cpu. The same problem
exists for os specific object files too. It is fragile to update them,
and build with all targets enabled doesn't find the problem.
This patch splits the gdb_target_obs update to three steps, cpu steps, os
steps, and the rest.
I tested this patch by build gdb for each different target triplets
respectively,
aarch64-elf aarch64-rtems aarch64-freebsd aarch64-linux alpha-elf
alpha-linux alpha-netbsd alpha-openbsd arm-elf arm-wince-pe arm-linux
arm-netbsd arm-symbianelf avr cris-elf frv-elf h8300-elf i386-elf
i386-darwin i386-dicos i386-freebsd i386-netbsdelf i386-openbsd
i386-nto i386-solaris i386-linux i386-gnu i386-cygwin i386-mingw32
i386-go32 ia64-linux-gnu ia64-vms lm32-elf m32c-elf m32r-elf m32r-linux
m68hc11-elf m68k-elf m68k-linux m68k-netbsd m68k-openbsd m88k-openbsd
mep-elf microblaze-xilinx-elf microblaze-linux-gnu mips-elf moxie-elf
ms1-elf nios2-elf nios2-linux-gnu hppa-elf hppa-linux hppa-netbsd
hppa-openbsd powerpc-eabi powerpc-freebsd powerpc-netbsd powerpc-openbsd
powerpc-linux powerpc-lynx178 rl78-elf rx-elf s390-linux-gnu score-elf
sh-elf sh-linux sh-openbsd sh64-elf sh64-linux sh64-openbsd sparc64-linux
sparc-linux sparc-freebsd sparc64-freebsd sparc-netbsd sparc64-netbsd
sparc-openbsd sparc64-openbsd spu-elf tic6x-elf tic6x-uclinux v850-elf
vax-netbsd vax-openbsd x86_64-linux-gnu x86_64-darwin x86_64-dicos
x86_64-elf x86_64-freebsd x86_64-mingw32 x86_64-netbsd x86_64-openbsd
x86_64-rtems xstormy16-elf xtensa-elf xtensa-linux
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* configure.tgt (i386_tobjs): New variable.
(amd64_tobjs): New variable.
Set $cpu_obs and $os_obs.
|
|
Nowadays, GDB build tree is almost flat, but source tree isn't. We
have arch/ nat/ target/ common/ cli/ mi/ tui/ python/ guile/ directories.
We need to some rules in Makefile for source files in different source
directories, like,
# Rules for compiling .c files in the various source subdirectories.
%.o: ${srcdir}/arch/%.c
$(COMPILE) $<
$(POSTCOMPILE)
%.o: ${srcdir}/nat/%.c
$(COMPILE) $<
$(POSTCOMPILE)
so we should take care of some special case that files' base name is the
same, like,
# Specify an explicit rule for gdb/common/agent.c, to avoid a clash with the
# object file generate by gdb/agent.c.
common-agent.o: $(srcdir)/common/agent.c
$(COMPILE) $(srcdir)/common/agent.c
$(POSTCOMPILE)
As we add more and more files in different directories, it becomes tricky
to name files, because we need take this into account.
This patch takes the first step toward "Replicate src dir in build dir",
that is, we create arch/ directory in buildtree, and put amd64.o there
as an example. Dependency tracking is updated for files with directory
name. Currently, when we build amd64.o,
"-c -o amd64.o -MT amd64.o -MMD -MP -MF .deps/amd64.Tpo"
with this patch applied, it becomes,
"-c -o arch/amd64.o -MT arch/amd64.o -MMD -MP -MF arch/.deps/amd64.o.Tpo"
"make clean" removes the object files, and "make distclean" removes .deps
additionally. configure file create .deps directory in each of
CONFIG_SRC_SUBDIR, and pass it to Makefile.in, so that "make clean" and
"make distclean" can remove stuffs there.
If people agree with this change, I'll add more directories to
CONFIG_SRC_SUBDIR.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (CONFIG_SRC_SUBDIR): New.
(ALL_64_TARGET_OBS): Replace amd64.o with arch/amd64.o.
(clean): Remove object files and dependency files.
(distclean): Remove the directory.
* configure.ac: Invoke AC_CONFIG_COMMANDS.
* configure: Re-generated.
* configure.tgt: Replace amd64.o with arch/amd64.o.
|
|
gdb/ChangeLog:
2017-10-05 Jose E. Marchesi <jose.marchesi@oracle.com>
PR build/22188
* arm-tdep.c (arm_decode_misc_memhint_neon): Fix decoding of CPS
and SETEND.
|
|
Commit 5cd63fda035d ("Fix "Remote 'g' packet reply is too long"
problems with multiple inferiors") caused a number of regressions on
native GNU/Linux, all related to follow-fork support. E.g.:
src/gdb/target.c:3141: internal-error: gdbarch* default_thread_architecture(target_ops*, ptid_t): Assertion `inf != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
Resyncing due to internal error.
FAIL: gdb.base/catch-signal-fork.exp: got SIGHUP after fork (GDB internal error)
This commit fixes it.
gdb/ChangeLog:
2017-10-05 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_child_follow_fork): When following the parent
and detaching the child, consult the parent thread's architecture
instead of the child's.
|
|
The ax.h header file contains a use of DOUBLEST in the type "union agent_val".
However, that type is never used anywhere, so it can be simply removed.
gdb/ChangeLog:
2017-10-05 Ulrich Weigand <uweigand@de.ibm.com>
* ax.h: Do not include "doublest.h".
(union agent_val): Remove.
|
|
This cleans up a number of interfaces in dfp.c / dfp.h. Specifically:
- The decimal_from_string / decimal_to_string routines are C++-ified
to operate on std::string instead of character buffers. In the
decimal_from_string, the boolean return value now actually is bool
instead of an int.
- The decimal_from_integral and decimal_from_doublest routines take
an struct value as input. This is not really appropriate at the low
level the DFP routines sit, so this replaced them with new routines
decimal_from_longest / decimal_from_ulongest / decimal_from_doublest
that operate on contents instead.
- To mirror the decimal_from_[u]longest, a new decimal_to_longest
routine is added as well, which can be used in unpack_long to
avoid an unnecessary conversion via DOUBLEST.
Note that the decimal_from_longest / decimal_from_ulongest routines
are actually more powerful than decimal_from_integral: the old routine
would only accept integer *types* of at most four bytes size, while
the new routines accept all integer *values* that fit in an [u]int32_t,
no matter which type they came from. The DFP tests are updated to
allow for this larger range of integers that can be converted.
gdb/ChangeLog:
2017-10-05 Ulrich Weigand <uweigand@de.ibm.com>
* dfp.h (MAX_DECIMAL_STRING): Move to dfp.c.
(decimal_to_string): Return std::string object.
(decimal_from_string): Accept std::string object. Return bool.
(decimal_from_integral, decimal_from_doublest): Remove.
(decimal_from_longest): Add prototype.
(decimal_from_ulongest): Likewise.
(decimal_to_longest): Likewise.
(decimal_from_doublest): Likewise.
* dfp.c: Do not include "gdbtypes.h" or "value.h".
(MAX_DECIMAL_STRING): Move here.
(decimal_to_string): Return std::string object.
(decimal_from_string): Accept std::string object. Return bool.
(decimal_from_integral): Remove, replace by ...
(decimal_from_longest, decimal_from_ulongest): ... these new functions.
(decimal_to_longest): New function.
(decimal_from_floating): Remove, replace by ...
(decimal_from_doublest): ... this new function.
(decimal_to_doublest): Update to new decimal_to_string interface.
* value.c (unpack_long): Use decimal_to_longest.
* valops.c (value_cast): Use decimal_from_doublest instead of
decimal_from_floating. Use decimal_from_[u]longest isntead of
decimal_from_integral.
* valarith.c (value_args_as_decimal): Likewise.
* valprint.c (print_decimal_floating): Update to new
decimal_to_string interface.
* printcmd.c (printf_decfloat): Likewise.
* c-exp.y (parse_number): Update to new decimal_from_string interface.
gdb/testsuite/ChangeLog:
2017-10-05 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.base/dfp-exprs.exp: Update tests to larger range of supported
integer-to-dfp conversion.
* gdb.base/dfp-test.exp: Likewise.
|
|
As a first small step to getting rid of doublest.h, this patch removes the
include of "floatformat.h" in "doublest.h". This is actually not needed
for the file itself. A few source files now need to include "floatformat.h"
directly, since they got it indirectly via "doublest.h" and still need it.
In reviewing which files need it, I found a number of files that include
"floatformat.h" directly without actually needing it at all. Similarly,
a number of files include "doublest.h" without needing it. I've also
removed those unnecessary include statements.
gdb/ChangeLog:
2017-10-05 Ulrich Weigand <uweigand@de.ibm.com>
* doublest.h: Do not include "floatformat.h". Remove stale comments.
* gdbtypes.c: Include "floatformat.h".
* value.c: Likewise.
* m68k-tdep.c: Likewise.
* findvar.c: Do not include "floatformat.h".
* amd64-darwin-tdep.c: Likewise.
* arm-linux-tdep.c: Likewise.
* i386-darwin-tdep.c: Likewise.
* i387-tdep.c: Likewise.
* m68k-linux-tdep.c: Likewise.
* mep-tdep.c: Likewise.
* mips-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* s390-linux-tdep.c: Likewise.
* sparc-obsd-tdep.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* vax-tdep.c: Likewise.
* xstormy16-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.
* top.c: Do not include "doublest.h".
* aarch64-tdep.c: Likewise.
* alpha-tdep.c: Likewise.
* arm-linux-tdep.c: Likewise.
* m68k-linux-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* xstormy16-tdep.c: Likewise.
|
|
The N32 signal frame uses an identical layout to N64, so reuse the N64
handler. The N32 signal trampoline does use one different instruction
relative to N64, so a separate tramp_frame is required.
gdb/ChangeLog:
* mips-fbsd-tdep.c (MIPS_INST_ADDIU_A0_SP_N32): Define.
(mipsn32_fbsd_sigframe): Define.
(mips_fbsd_init_abi): Install mipsn32_fbsd_sigframe unwinder
for FreeBSD/mipsn32.
|
|
FreeBSD recently added two additional ELF auxiliary vectors. FreeBSD's
AT_HWCAP uses a different number compared to AT_HWCAP on Linux as the
numerical value was already in use for a different vector on FreeBSD.
include/ChangeLog:
* elf/common.h (AT_FREEBSD_EHDRFLAGS, AT_FREEBSD_HWCAP): Define.
gdb/ChangeLog:
* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_EHDRFLAGS and
AT_HWCAP.
|
|
Also refer to global maintainers for branch release approval.
|
|
When debugging two inferiors (or more) against gdbserver, and the
inferiors have different architectures, such as e.g., on x86_64
GNU/Linux and one inferior is 64-bit while the other is 32-bit, then
GDB can get confused with the different architectures in a couple
spots.
In both cases I ran into, GDB incorrectly ended up using the
architecture of whatever happens to be the selected inferior instead
of the architecture of some other given inferior:
#1 - When parsing the expedited registers in stop replies.
#2 - In the default implementation of the target_thread_architecture
target method.
These resulted in instances of the infamous "Remote 'g' packet reply
is too long" error. For example, with the test added in this commit,
we get:
~~~
Continuing.
Remote 'g' packet reply is too long (expected 440 bytes, got 816 bytes): ad064000000000000[snip]
(gdb) FAIL: gdb.multi/multi-arch.exp: inf1 event with inf2 selected: continue to hello_loop
c
Continuing.
Truncated register 50 in remote 'g' packet
(gdb) PASS: gdb.multi/multi-arch.exp: inf2 event with inf1 selected: c
~~~
This commit fixes that.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* remote.c (get_remote_arch_state): New 'gdbarch' parameter. Use
it instead of target_gdbarch.
(get_remote_state, get_remote_packet_size): Adjust
get_remote_arch_state calls, passing down target_gdbarch
explicitly.
(packet_reg_from_regnum, packet_reg_from_pnum): New parameter
'gdbarch' and use it instead of target_gdbarch.
(get_memory_packet_size): Adjust get_remote_arch_state calls,
passing down target_gdbarch explicitly.
(struct stop_reply) <arch>: New field.
(remote_parse_stop_reply): Use the stopped thread's architecture,
not the current inferior's. Save the architecture in the
stop_reply.
(process_stop_reply): Use the stop reply's architecture.
(process_g_packet, remote_fetch_registers)
(remote_prepare_to_store, store_registers_using_G)
(remote_store_registers): Adjust get_remote_arch_state calls,
using the regcache's architecture.
(remote_get_trace_status): Adjust get_remote_arch_state calls,
passing down target_gdbarch explicitly.
* spu-multiarch.c (spu_thread_architecture): Defer to the target
beneath instead of calling target_gdbarch.
* target.c (default_thread_architecture): Use the specified
inferior's architecture, instead of the current inferior's
architecture (via target_gdbarch).
gdb/testsuite/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* gdb.multi/hangout.c: Include <unistd.h>.
(hangout_loop): New function.
(main): Call alarm. Call hangout_loop in a loop.
* gdb.multi/hello.c: Include <unistd.h>.
(hello_loop): New function.
(main): Call alarm. Call hangout_loop in a loop.
* gdb.multi/multi-arch.exp: Test running to a breakpoint one
inferior with the other selected.
|
|
A following patch will change the default target_thread_architecture
method, like this:
struct gdbarch *
default_thread_architecture (struct target_ops *ops, ptid_t ptid)
{
- return target_gdbarch ();
+ inferior *inf = find_inferior_ptid (ptid);
+ gdb_assert (inf != NULL);
+ return inf->gdbarch;
}
This is because target_gdbarch is really just
current_inferior()->gdbarch, and it's wrong to return that
architecture when the inferior of the passed in PTID is NOT the
current inferior -- the inferior for PTID may be running a different
architecture. E.g., a mix of 64-bit and 32-bit inferiors in the same
debug session.
Doing that change above however exposes a problem in "maint print
registers", caught be the testsuite:
-PASS: gdb.base/maint.exp: maint print registers
+FAIL: gdb.base/maint.exp: maint print registers (GDB internal error)
...
gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
The call stack looks like this:
#0 0x000000000068b707 in internal_error(char const*, int, char const*, ...) (file=0xa9b958 "gdb/inferior.c", line=309, fmt=0xa9b8e0 "%s: Assertion `%s' failed.") at gdb/common/errors.c:54
#1 0x00000000006e1c40 in find_inferior_pid(int) (pid=0) at gdb/inferior.c:309
#2 0x00000000006e1c8d in find_inferior_ptid(ptid_t) (ptid=...) at gdb/inferior.c:323
#3 0x00000000007c18dc in default_thread_architecture(target_ops*, ptid_t) (ops=0xf86d60 <dummy_target>, ptid=...)
at gdb/target.c:3134
#4 0x00000000007b5414 in delegate_thread_architecture(target_ops*, ptid_t) (self=0xf86d60 <dummy_target>, arg1=...)
at gdb/target-delegates.c:2527
#5 0x00000000007647b3 in get_thread_regcache(ptid_t) (ptid=...) at gdb/regcache.c:466
#6 0x00000000007647ff in get_current_regcache() () at gdb/regcache.c:475
#7 0x0000000000767495 in regcache_print(char const*, regcache_dump_what) (args=0x0, what_to_dump=regcache_dump_none)
at gdb/regcache.c:1599
#8 0x0000000000767550 in maintenance_print_registers(char const*, int) (args=0x0, from_tty=1)
at gdb/regcache.c:1613
I.e., the test does "maint print registers" while the inferior is not
running yet. This is expected to work, and there's already a hack in
get_thread_arch_regcache to make it work.
Instead of pilling on hacks in the internal of regcache and
target_ops, this commit moves the null_ptid special casing to where it
belongs -- higher up in the call chain in the implementation of "maint
print registers" & co directly.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* regcache.c (get_thread_arch_regcache): Remove null_ptid special
case.
(regcache_print): Handle !target_has_registers here instead.
|
|
A following patch will remove this hack from within regcache's
implementation:
struct regcache *
get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch)
{
struct address_space *aspace;
/* For the benefit of "maint print registers" & co when debugging an
executable, allow dumping the regcache even when there is no
thread selected (target_thread_address_space internal-errors if
no address space is found). Note that normal user commands will
fail higher up on the call stack due to no
target_has_registers. */
aspace = (ptid_equal (null_ptid, ptid)
? NULL
: target_thread_address_space (ptid));
i.e., it'll no longer be possible to try to build a regcache for
null_ptid. That change alone would regress the gdbarch self tests
though, causing this:
(gdb) maintenance selftest
[...]
Running selftest register_to_value.
src/gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.gdb/unittest.exp: maintenance selftest (GDB internal error)
The problem is that the way the mocking environment for those unit
tests is written is a bit fragile: it creates a special purpose
regcache (and sentinel's frame), using whatever is the current
inferior_ptid (usually null_ptid), and assumes get_current_regcache
will find that in the regcache::current_regcache list.
This commit changes the way the mock environment is created. It
eliminates the special regcache and frame and instead creates a fuller
mock environment, with a custom mock target_ops, and then a mock
inferior and thread "running" on that target.
If there's already a running target when you type "maint selftest",
then we error out, instead of pushing a new target on top of the
existing one (and thus killing the debug session). This results in:
(gdb) maint selftest
(...)
Self test failed: arch i386: target already pushed
Self test failed: arch i386:x86-64: target already pushed
Self test failed: arch i386:x64-32: target already pushed
Self test failed: arch i8086: target already pushed
Self test failed: arch i386:intel: target already pushed
Self test failed: arch i386:x86-64:intel: target already pushed
Self test failed: arch i386:x64-32:intel: target already pushed
Self test failed: arch i386:nacl: target already pushed
Self test failed: arch i386:x86-64:nacl: target already pushed
Self test failed: arch i386:x64-32:nacl: target already pushed
Self test failed: self-test failed at /home/pedro/gdb/mygit/src/gdb/selftest-arch.c:86
(...)
Ran 19 unit tests, 1 failed
I think that's OK, because self tests are really meant to be run from
a clean state right after GDB is started. I'm adding that erroring
out just as safe measure just in case someone types "maint selftest"
on the command line while already debugging something (as I've done
it).
(In my multi-target branch, where this patch originated from, we don't
actually need to error out, because there each inferior has its own
target stack).
Also, note that the current code was doing:
current_inferior()->gdbarch = gdbarch;
without taking care to restore the previous gdbarch. This means that
GDB's state was being left inconsistent after running the self tests,
further supporting the point that there's probably not much
expectation that mixing "maint selftests" and regular debugging in the
same GDB invocation really works. This patch fixes that, regardless.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* frame.c (create_test_frame): Delete.
* frame.h (create_test_frame): Delete.
* gdbarch-selftests.c: Include gdbthread.h and target.h.
(class regcache_test): Delete.
(test_target_has_registers, test_target_has_stack)
(test_target_has_memory, test_target_prepare_to_store)
(test_target_store_registers): New functions.
(test_target_ops): New class.
(register_to_value_test): Error out if there's already a
process_stratum (or higher) target pushed. Create a fuller mock
environment, with mock target_ops, inferior, address space, thread
and inferior_ptid.
* progspace.c (struct address_space): Move to ...
* progspace.h (struct address_space): ... here.
* regcache.h (regcache::~regcache, regcache::raw_write)
[GDB_SELF_TEST]: No longer virtual.
|
|
New in v3:
- Replace use_gdb_stub with can_spawn_for_attach.
- Call kill_wait_spawned_process on spawn_ids.
Commit
Use std::set in mi-main.c
52f9abe4c739f42cc5f80b2629276493ac6306f9
changed the logic of the "-list-thread-groups --available" by mistake
when a pid is passed. It prints all the processes except the one
specified by the given pid. The correct behavior is to only print the
process corresponding to that pid. this patch fixes that and adds a test.
gdb/ChangeLog:
* mi/mi-main.c (list_available_thread_groups): Reverse filter logic.
gdb/testsuite/ChangeLog:
* gdb.mi/list-thread-groups-available.exp: New file.
* gdb.mi/list-thread-groups-available.c: New file.
|
|
I tried building GDB with TRY/CATCH mapped to raw C++ try/catch (by
defining GDB_XCPT to GDB_XCPT_RAW_TRY in
gdb/common/common-exceptions.h), and that caught a case of code
written between try and catch. This commit fixes it.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Move code
out of 'between TRY and CATCH'.
|
|
(Adding missing ChangeLog entry)
While we still have cleanups (i.e., make_cleanup & co), we must be
sure to add END_CATCH at the end of a TRY/CATCH/END_CATCH construct.
However, it's currently too easy to miss adding the END_CATCH, because
the code compiles anyway without it. I realized this when I noticed
that another patch I was working on missed several adding END_CATCH in
several new TRY/CATCH uses.
This commit fixes that by making TRY open a new scope that is only
closed by END_CATCH. This way, if you forget to add the END_CATCH,
then compilation fails due to the unbalanced curly braces.
This caught a couple places where we were missing END_CATCH in current
master, also fixed by the patch.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (complete_command): Add missing END_CATCH.
* common/common-exceptions.h (TRY): Open an outermost scope.
Expand intro comment.
(CATCH): Reindent.
(END_CATCH): Close the outermost scope.
* completer.c (complete_line_internal): Add missing END_CATCH.
|
|
While we still have cleanups (i.e., make_cleanup & co), we must be
sure to add END_CATCH at the end of a TRY/CATCH/END_CATCH construct.
However, it's currently too easy to miss adding the END_CATCH, because
the code compiles anyway without it. I realized this when I noticed
that another patch I was working on missed several adding END_CATCH in
several new TRY/CATCH uses.
This commit fixes that by making TRY open a new scope that is only
closed by END_CATCH. This way, if you forget to add the END_CATCH,
then compilation fails due to the unbalanced curly braces.
This caught a couple places where we were missing END_CATCH in current
master, also fixed by the patch.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (complete_command): Add missing END_CATCH.
* common/common-exceptions.h (TRY): Open an outermost scope.
Expand intro comment.
(CATCH): Reindent.
(END_CATCH): Close the outermost scope.
* completer.c (complete_line_internal): Add missing END_CATCH.
|
|
This is the "natural" extension necessary for the "set cwd" command
(and the whole "set the inferior's cwd" logic) to work on gdbserver.
The idea here is to have a new remote packet, QSetWorkingDir (name
adopted from LLDB's extension to the RSP, as can be seen at
<https://raw.githubusercontent.com/llvm-mirror/lldb/master/docs/lldb-gdb-remote.txt>),
which sends an hex-encoded string representing the working directory
that the remote inferior will use. There is a slight difference from
the packet proposed by LLDB: GDB's version will accept empty
arguments, meaning that the user wants to clear the previously set
working directory for the inferior (i.e., "set cwd" without arguments
on GDB).
For UNIX-like targets this feature is already implemented on
nat/fork-inferior.c, and all gdbserver has to do is to basically
implement "set_inferior_cwd" and call it whenever such packet arrives.
For other targets, like Windows, it is possible to use the existing
"get_inferior_cwd" function and do the necessary steps to make sure
that the inferior will use the specified working directory.
Aside from that, the patch consists basically of updates to the
testcase (making it available on remote targets) and the
documentation.
No regressions found.
gdb/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* NEWS (Changes since GDB 8.0): Add entry about new
'set-cwd-on-gdbserver' feature.
(New remote packets): Add entry for QSetWorkingDir.
* common/common-inferior.h (set_inferior_cwd): New prototype.
* infcmd.c (set_inferior_cwd): Remove "static".
(show_cwd_command): Expand text to include remote debugging.
* remote.c: Add PACKET_QSetWorkingDir.
(remote_protocol_features) <QSetWorkingDir>: New entry for
PACKET_QSetWorkingDir.
(extended_remote_set_inferior_cwd): New function.
(extended_remote_create_inferior): Call
"extended_remote_set_inferior_cwd".
(_initialize_remote): Call "add_packet_config_cmd" for
QSetWorkingDir.
gdb/gdbserver/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* inferiors.c (set_inferior_cwd): New function.
* server.c (handle_general_set): Handle QSetWorkingDir packet.
(handle_query): Inform that QSetWorkingDir is supported.
* win32-low.c (create_process): Pass the inferior's cwd to
CreateProcess.
gdb/testsuite/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/set-cwd.exp: Make it available on
native-extended-gdbserver.
gdb/doc/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.texinfo (Starting your Program) <The working directory.>:
Mention remote debugging.
(Working Directory) <Your Program's Working Directory>:
Likewise.
(Connecting) <Remote Packet>: Add "set-working-dir"
and "QSetWorkingDir" to the table.
(Remote Protocol) <QSetWorkingDir>: New item, explaining the
packet.
|
|
This commit adds new "set/show cwd" commands, which are used to
set/show the current working directory of the inferior that will be
started.
The idea here is that "set cwd" will become the de facto way of
setting the inferior's cwd. Currently, the user can use "cd" for
that, but there are side effects: with "cd", GDB also switches to
another directory, and that can impact the loading of scripts and
other files. With "set cwd", we separate the logic into a new
command.
To maintain backward compatibility, if the user issues a "cd" command
but doesn't use "set cwd", then the inferior's cwd will still be
changed according to what the user specified. However, "set cwd" has
precedence over "cd", so it can always be used to override it.
"set cwd" works in the following way:
- If the user sets the inferior's cwd by using "set cwd", then this
directory is saved into current_inferior ()->cwd and is used when
the inferior is started (see below).
- If the user doesn't set the inferior's cwd by using "set cwd", but
rather use the "cd" command as before, then this directory is
inherited by the inferior because GDB will have chdir'd into it.
On Unix-like hosts, the way the directory is changed before the
inferior execution is by expanding the user set directory before the
fork, and then "chdir" after the call to fork/vfork on
"fork_inferior", but before the actual execution. On Windows, the
inferior cwd set by the user is passed directly to the CreateProcess
call, which takes care of the actual chdir for us.
This way, we'll make sure that GDB's cwd is not affected by the user
set cwd.
gdb/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* NEWS (New commands): Mention "set/show cwd".
* cli/cli-cmds.c (_initialize_cli_cmds): Mention "set cwd" on
"cd" command's help text.
* common/common-inferior.h (get_inferior_cwd): New prototype.
* infcmd.c (inferior_cwd_scratch): New global variable.
(set_inferior_cwd): New function.
(get_inferior_cwd): Likewise.
(set_cwd_command): Likewise.
(show_cwd_command): Likewise.
(_initialize_infcmd): Add "set/show cwd" commands.
* inferior.h (class inferior) <cwd>: New field.
* nat/fork-inferior.c: Include "gdb_tilde_expand.h".
(fork_inferior): Change inferior's cwd before its execution.
* windows-nat.c (windows_create_inferior): Pass inferior's cwd
to CreateProcess.
gdb/gdbserver/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* inferiors.c (current_inferior_cwd): New global variable.
(get_inferior_cwd): New function.
* inferiors.h (struct process_info) <cwd>: New field.
gdb/doc/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.texinfo (Starting your Program) <The working directory.>:
Mention new "set cwd" command.
(Working Directory) <Your Program's Working Directory>:
Rephrase to explain that "set cwd" exists and is the default
way to change the inferior's cwd.
gdb/testsuite/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/set-cwd.c: New file.
* gdb.base/set-cwd.exp: Likewise.
|
|
Currently, whenever we want to handle paths provided by the user and
perform tilde expansion on GDB, we rely on "tilde_expand", which comes
from readline. This was enough for our use cases so far, but the
situation will change when we start dealing with paths on gdbserver as
well, which is what the next patches implement.
Unfortunately it is not possible to use "tilde_expand" in this case
because gdbserver doesn't use readline. For that reason I decided to
implement a new "gdb_tilde_expand" function, which is basically a
wrapper for "glob" and its GNU extension, GLOB_TILDE_CHECK. With the
import of the "glob" module from gnulib, we're sure that "glob" always
supports this extension.
gdb/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (SFILES): Add gdb_tilde_expand.c.
(HFILES_NO_SRCDIR): Add gdb_tilde_expand.h.
(COMMON_OBS): Add gdb_tilde_expand.o.
* common/gdb_tilde_expand.c: New file.
* common/gdb_tilde_expand.h: Likewise.
gdb/gdbserver/ChangeLog:
2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (SFILES): Add $(srcdir)/common/gdb_tilde_expand.c.
(OBS): Add gdb_tilde_expand.o.
|
|
Remove a duplicate `struct objfile' declaration mistakenly added with
commit 3e29f34a4eef ("MIPS: Keep the ISA bit in compressed code
addresses").
gdb/
* gdbarch.sh (objfile): Remove duplicate declaration.
* gdbarch.h: Regenerate.
|
|
I made a mistake earlier and used string_printf where I should have used
string_vprintf.
I'm checking this in as obvious.
2017-10-03 Tom Tromey <tom@tromey.com>
* utils.c (internal_vproblem): Use string_vprintf.
|
|
This removes a cleanup by using std::string in info_symbol_command.
2017-10-03 Tom Tromey <tom@tromey.com>
* printcmd.c (info_symbol_command): Use std::string.
|
|
This removes a cleanup by using std::string in
gdb_safe_append_history.
2017-10-03 Tom Tromey <tom@tromey.com>
* top.c (gdb_safe_append_history): Use std::string.
|
|
This removes new_ui and delete_ui in favor of ordinary 'new' and
'delete', and then removes make_delete_ui_cleanup in favor of
std::unique_ptr.
2017-10-03 Tom Tromey <tom@tromey.com>
* event-top.c (stdin_event_handler): Update.
* main.c (captured_main_1): Update.
* top.h (make_delete_ui_cleanup): Remove.
(struct ui): Add constructor and destructor.
(new_ui, delete_ui): Remove.
* top.c (make_delete_ui_cleanup): Remove.
(new_ui_command): Use std::unique_ptr.
(delete_ui_cleanup): Remove.
(ui::ui): Rename from new_ui. Update.
(free_ui): Remove.
(ui::~ui): Rename from delete_ui. Update.
|
|
This changes load_progress to use gdb::byte_vector, removing a
cleanup.
2017-10-03 Tom Tromey <tom@tromey.com>
* symfile.c (load_progress): Use gdb::byte_vector.
|
|
This removes some unused cleanup declarations.
2017-10-03 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (mi_cmd_trace_frame_collected): Remove unused
declaration.
* printcmd.c (x_command): Remove unused declaration.
* symfile.c (symbol_file_command): Remove unused declaration.
|
|
This converts internal_vproblem and defaulted_query to use
std::string.
2017-10-03 Tom Tromey <tom@tromey.com>
* utils.c (internal_vproblem): Use std::string.
(defaulted_query): Likewise.
|
|
This removes set_batch_flag_and_make_cleanup_restore_page_info and
make_cleanup_restore_page_info in favor of a new RAII class. This
then allows for the removal of make_cleanup_restore_uinteger and
make_cleanup_restore_integer
ChangeLog
2017-10-03 Tom Tromey <tom@tromey.com>
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Update.
* top.c (execute_command_to_string): Update.
* utils.c (make_cleanup_restore_page_info): Remove.
(do_restore_page_info_cleanup): Remove.
(set_batch_flag_and_restore_page_info):
New.
(make_cleanup_restore_page_info): Remove.
(set_batch_flag_and_make_cleanup_restore_page_info): Remove.
(~set_batch_flag_and_restore_page_info): New
(make_cleanup_restore_uinteger): Remove.
(make_cleanup_restore_integer): Remove.
(struct restore_integer_closure): Remove.
(restore_integer): Remove.
* utils.h (struct set_batch_flag_and_restore_page_info): New
class.
(set_batch_flag_and_make_cleanup_restore_page_info): Remove.
(make_cleanup_restore_page_info): Remove.
(make_cleanup_restore_uinteger) Remove.
(make_cleanup_restore_integer) Remove.
|
|
This changes record_full_gdb_operation_disable_set to return a
scoped_restore rather than a cleanup, and fixes all the users.
ChangeLog
2017-10-03 Tom Tromey <tom@tromey.com>
* record-full.h (record_full_gdb_operation_disable_set): Return
scoped_restore_tmpl<int>.
* infrun.c (adjust_pc_after_break): Update.
(handle_signal_stop): Update.
* record-full.c (record_full_gdb_operation_disable_set): Return
scoped_restore_tmpl<int>.
(record_full_wait_1, record_full_insert_breakpoint)
(record_full_remove_breakpoint, record_full_save)
(record_full_goto_insn): Update.
|
|
Printing a string slice ("&str") in Rust would print until the
terminating \0; but that is incorrect because a slice has a length.
This fixes &str printing, and arranges to preserve the type name when
slicing a slice, so that printing a slice of an "&str" works as well.
This is PR rust/22236.
2017-10-02 Tom Tromey <tom@tromey.com>
PR rust/22236:
* rust-lang.c (rust_val_print_str): New function.
(val_print_struct): Call it.
(rust_subscript): Preserve name of slice type.
2017-10-02 Tom Tromey <tom@tromey.com>
PR rust/22236:
* gdb.rust/simple.rs (main): New variable "fslice".
* gdb.rust/simple.exp: Add slice tests. Update string tests.
|
|
Something like "ptype &x[..]" (where "x" was a slice) would crash gdb.
rust_subscript wasn't handling slicing in the EVAL_AVOID_SIDE_EFFECTS
case.
2017-10-02 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_subscript): Handle slices in
EVAL_AVOID_SIDE_EFFECTS case.
2017-10-02 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Test ptype of a slice.
|
|
rust_slice_type_p was not recognizing &str as a slice type, so indexing
into (or making a slice of) a slice was not working.
2017-10-02 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_slice_type_p): Recognize &str as a slice type.
2017-10-02 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Test index of slice.
|
|
I noticed that one function in rust-lang.h was not declared using
"extern". In the interested of uniformity, this patch adds it.
Tested by rebuilding.
2017-10-02 Tom Tromey <tom@tromey.com>
* rust-lang.h (rust_slice_type): Add "extern".
|
|
G++ 4.8 trips on:
In file included from /opt/gcc-4.8/include/c++/4.8.5/algorithm:62:0,
from ../../src/gdb/ada-lang.c:65:
/opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<ada_exc_info*, std::vector<ada_exc_info> >; _Tp = ada_exc_info]’:
/opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:2283:70: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<ada_exc_info*, std::vector<ada_exc_info> >]’
/opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:2315:54: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<ada_exc_info*, std::vector<ada_exc_info> >; _Size = long int]’
/opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:5461:36: required from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<ada_exc_info*, std::vector<ada_exc_info> >]’
../../src/gdb/ada-lang.c:13153:61: required from here
/opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h:2245:19: error: passing ‘const ada_exc_info’ as ‘this’ argument of ‘bool ada_exc_info::operator<(const ada_exc_info&)’ discards qualifiers [-fpermissive]
while (__pivot < *__last)
^
Seems to be a libstdc++ bug meanwhile fixed by:
https://gcc.gnu.org/ml/libstdc++/2012-04/msg00074.
In any case, there's no reason these methods can't be const.
gdb/ChangeLog:
2017-10-02 Tom Tromey <tom@tromey.com>
Pedro Alves <palves@redhat.com>
* ada-lang.h (ada_exc_info::operator<): Make const.
(ada_exc_info::operator==): Make const.
* ada-lang.c (ada_exc_info::operator<, ada_exc_info::operator==):
Make const.
|
|
In gdbserver, target descriptions need to be initialized by calling
init_target_desc. Because i386_create_target_description is shared with
GDB, it doesn't do that, the callers must take care of it. These two
platforms currently don't.
I am not able to build them, so I couldn't test.
gdb/gdbserver/ChangeLog:
* lynx-i386-low.c (lynx_i386_arch_setup): Call init_target_desc.
* nto-x86-low.c (nto_x86_arch_setup): Likewise.
|
|
This changes read_memory_robust to return a std::vector, allowing the
removal of free_memory_read_result_vector and associated cleanups.
This patch also changes the functions it touches to be a bit more
robust with regards to deallocation; it's perhaps possible that
read_memory_robust could have leaked in some situations.
This patch is based on my earlier series to remove some MI cleanups.
Regression tested by the buildbot.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* target.c (read_whatever_is_readable): Change type of "result".
Update.
(free_memory_read_result_vector): Remove.
(read_memory_robust): Change return type. Update.
* mi/mi-main.c (mi_cmd_data_read_memory_bytes): Update. Use
bin2hex, std::string.
* target.h (memory_read_result_s): Remove typedef.
(free_memory_read_result_vector): Remove.
(read_memory_robust): Return std::vector.
|
|
Change captured_mi_execute_command to use a scoped_restore, removing a
cleanup. The old code copied the current token, but I don't believe
that is necessary.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (captured_mi_execute_command): Use scope_restore.
|
|
Change ada_exceptions_list to return a std::vector and fix up the
users. This allows removing a cleanup in MI.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Update.
* ada-lang.h (struct ada_exc_info): Remove typedef. Declare
operator< and operator==.
(ada_exceptions_list): Return a std::vector.
* ada-lang.c (ada_exc_info::operator<): Rename from
compare_ada_exception_info.
(ada_exc_info::operator==): New.
(sort_remove_dups_ada_exceptions_list): Change type of
"exceptions".
(ada_add_standard_exceptions, ada_add_exceptions_from_frame)
(ada_add_global_exceptions): Likewise.
(ada_exceptions_list_1): Return a std::vector.
(ada_exceptions_list): Likewise.
|
|
Change a couple of spots in mi-main.c to use std::set. This
simplifies the code and removes some cleanups.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (struct print_one_inferior_data) <inferiors>: Now a
'std::set *'.
(print_one_inferior): Update.
(free_vector_of_ints): Remove.
(list_available_thread_groups): Change "ids" to std::set.
(mi_cmd_list_thread_groups): Update.
(struct collect_cores_data) <core>: Now a std::set.
(collect_cores): Update.
(unique): Remove.
(print_one_inferior): Update.
|
|
Change a couple of spots in mi-main.c to use std::string, and change
one place to use field_fmt. This removes some cleanups.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (mi_execute_cli_command): Use std::string.
(mi_execute_async_cli_command): Likewise.
(mi_cmd_trace_frame_collected): Use field_fmt.
|
|
This changes mi_cmd_data_write_memory_bytes to use gdb::byte_vector,
removing some cleanups.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (mi_cmd_data_write_memory_bytes): Use
gdb::byte_vector.
|
|
There was a leftover cleanup declaration in mi_parse. Remove it.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mi/mi-parse.c (mi_parse): Remove unused declaration.
|
|
This string copy in mi_cmd_disassemble seems not to be needed, so
don't do it.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Don't copy "oarg".
|