Commit Graph

109193 Commits

Author SHA1 Message Date
Tom Tromey
cfeab26e4d Deprecate dbx mode
GDB has a dbx emulation mode that adds a few aliases and helper
commands.  This mode is barely documented and is very superficial
besides.  I suspect it is rarely used, and I would like to propose
deprecating it for GDB 12, and then removing it in GDB 13.
2022-03-07 10:43:42 -07:00
Pedro Alves
3db1354160 Remove unnecessary inferior lookup in infrun:handle_one
infrun.c:handle_one calls find_inferior_ptid unnecessarily, since we
already have a thread pointer handy, and the thread has a pointer to
the inferior.  This commit removes the unnecessary lookup.

Change-Id: I2ae18601dd75346c6c91068e9a4f9a6484fb3339
2022-03-07 16:28:57 +00:00
Tom Tromey
aacf24b4db Fix bug in ada_print_floating
ada_print_floating rewrites a floating-point string representation to
conform to Ada syntax.  However, if you managed to get a floating
point error, you might see:

    (gdb) print whatever
    $2 = <invalid float valu.0e>

What's happening here is that ada_print_floating doesn't recognize
this error case, and proceeds to modify the error text.

This patch fixes this problem.
2022-03-07 08:27:38 -07:00
Tom Tromey
63fc2437de Implement real literal extension for Ada
Sometimes it is convenient to be able to specify the exact bits of a
floating-point literal.  For example, you may want to set a
floating-point register to a denormalized value, or to a particular
NaN.

In C, you can do this by combining the "{}" cast with an array
literal, like:

    (gdb) p {double}{0x576488BDD2AE9FFE}
    $1 = 9.8765449999999996e+112

This patch adds a somewhat similar idea to Ada.  It extends the lexer
to allow "l" and "f" suffixes in a based literal.  The "f" indicates a
floating-point literal, and the "l"s control the size of the
floating-point type.

Note that this differs from Ada's based real literals.  I believe
those can also be used to control the bits of a floating-point value,
but they are a bit more cumbersome to use (simplest is binary but
that's also very lengthy).  Also, these aren't implemented in GDB.

I chose not to allow this extension to work with based integer
literals with exponents.  That didn't seem very useful.
2022-03-07 08:27:38 -07:00
Tom Tromey
c9bfa277e9 Fix Ada integer literals with exponents
While working on another patch, I noticed that Ada integer literals
with exponents did not work.  For example, with one form you get an
error:

    (gdb) print 8e2
    Invalid digit `e' in based literal

And with another form you get an incorrect value:

    (gdb) print 16#8#e2
    $2 = 8

This patch fixes the bugs and adds tests.
2022-03-07 08:25:11 -07:00
Tom Tromey
47a39c6e18 Fix gdb.ada/arrayptr.exp results
PR ada/28115 points out that gdb.ada/arrayptr.exp works with GNAT 12,
but fails with minimal encodings in earlier versions.

This patch updates the test to try to report the results correctly.  I
tried this with the Fedora 34 system gcc (GCC 11) and with a GCC 12
built from git trunk sometime relatively recently.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28115
2022-03-07 07:57:09 -07:00
Tom Tromey
315e4ebb4b Handle non-ASCII identifiers in Ada
Ada allows non-ASCII identifiers, and GNAT supports several such
encodings.  This patch adds the corresponding support to gdb.

GNAT encodes non-ASCII characters using special symbol names.

For character sets like Latin-1, where all characters are a single
byte, it uses a "U" followed by the hex for the character.  So, for
example, thorn would be encoded as "Ufe" (0xFE being lower case
thorn).

For wider characters, despite what the manual says (it claims
Shift-JIS and EUC can be used), in practice recent versions only
support Unicode.  Here, characters in the base plane are represented
using "Wxxxx" and characters outside the base plane using
"WWxxxxxxxx".

GNAT has some further quirks here.  Ada is case-insensitive, and GNAT
emits symbols that have been case-folded.  For characters in ASCII,
and for all characters in non-Unicode character sets, lower case is
used.  For Unicode, however, characters that fit in a single byte are
converted to lower case, but all others are converted to upper case.

Furthermore, there is a bug in GNAT where two symbols that differ only
in the case of "Y WITH DIAERESIS" (and potentially others, I did not
check exhaustively) can be used in one program.  I chose to omit
handling this case from gdb, on the theory that it is hard to figure
out the logic, and anyway if the bug is ever fixed, we'll regret
having a heuristic.

This patch introduces a new "ada source-charset" setting.  It defaults
to Latin-1, as that is GNAT's default.  This setting controls how "U"
characters are decoded -- W/WW are always handled as UTF-32.

The ada_tag_name_from_tsd change is needed because this function will
read memory from the inferior and interpret it -- and this caused an
encoding failure on PPC when running a test that tries to read
uninitialized memory.

This patch implements its own UTF-32-based case folder.  This avoids
host platform quirks, and is relatively simple.  A short Python
program to generate the case-folding table is included.  It simply
relies on whatever version of Unicode is used by the host Python,
which seems basically acceptable.

Test cases for UTF-8, Latin-1, and Latin-3 are included.  This
exercises most of the new code paths, aside from Y WITH DIAERESIS as
noted above.
2022-03-07 07:52:59 -07:00
Tom Tromey
ee3d464915 Define HOST_UTF32 in charset.h
rust-parse.c has a #define for the host-specific UTF-32 charset name.
A later patch needs the same thing, so this patch moves the definition
to charset.h for easier reuse.
2022-03-07 07:52:59 -07:00
Tom Tromey
c8b76e1ec3 Let phex and phex_nz handle sizeof_l==1
Currently, neither phex nor phex_nz handle sizeof_l==1 -- they let
this case fall through to the default case.  However, a subsequent
patch in this series needs this case to work correctly.

I looked at all calls to these functions that pass a 1 for the
sizeof_l parameter.  The only such case seems to be correct with this
change.
2022-03-07 07:52:59 -07:00
Tom Tromey
36f5ca535d Don't pre-size result string in ada_decode
Currently, ada_decode pre-sizes the output string, filling it with 'X'
characters.  However, it's a bit simpler and more flexible to let
std::string do the work here, and simply append characters to the
string as we go.  This turns out to be useful for a subsequent patch.
2022-03-07 07:52:59 -07:00
Tom Tromey
a320f135dd Simplify a regular expression in ada-lex.l
ada-lex.l uses "%option case-insensitive", so there is no need for
regular expressions to match upper case.
2022-03-07 07:52:59 -07:00
GDB Administrator
0daa5af85a Automatic date update in version.in 2022-03-07 00:00:11 +00:00
Maciej W. Rozycki
d17e797f5c MIPS/opcodes: Fix alias annotation for branch instructions
Correct issues with INSN2_ALIAS annotation for branch instructions:

- regular MIPS BEQZ/L and BNEZ/L assembly instructions are idioms for
  BEQ/L and BNE/L respectively with the `rs' operand equal to $0,

- microMIPS 32-bit BEQZ and BNEZ assembly instructions are idioms for
  BEQ and BNE respectively with the `rt' operand equal to $0,

- regular MIPS BAL assembly instruction is an idiom for architecture
  levels of up to the MIPSr5 ISA and a machine instruction on its own
  from the MIPSr6 ISA up.

Add missing annotation to BEQZ/L and BNEZ/L accordingly then and add a
new entry for BAL for the MIPSr6 ISA, correcting a disassembly bug:

$ mips-linux-gnu-objdump -m mips:isa64r6 -M no-aliases -d bal.o

bal.o:     file format elf32-tradlittlemips

Disassembly of section .text:

00000000 <foo>:
   0:	04110000 	0x4110000
	...
$

Add test cases accordingly.

Parts for regular MIPS BEQZ/L and BNEZ/L instructions from Sagar Patel.

2022-03-06  Maciej W. Rozycki  <macro@orcam.me.uk>

	binutils/
	* testsuite/binutils-all/mips/mips1-branch-alias.d: New test.
	* testsuite/binutils-all/mips/mips1-branch-noalias.d: New test.
	* testsuite/binutils-all/mips/mips2-branch-alias.d: New test.
	* testsuite/binutils-all/mips/mips2-branch-noalias.d: New test.
	* testsuite/binutils-all/mips/mips32r6-branch-alias.d: New test.
	* testsuite/binutils-all/mips/mips32r6-branch-noalias.d: New
	test.
	* testsuite/binutils-all/mips/micromips-branch-alias.d: New
	test.
	* testsuite/binutils-all/mips/micromips-branch-noalias.d: New
	test.
	* testsuite/binutils-all/mips/mips-branch-alias.s: New test
	source.
	* testsuite/binutils-all/mips/micromips-branch-alias.s: New test
	source.
	* testsuite/binutils-all/mips/mips.exp: Run the new tests.

2022-03-06  Sagar Patel  <sagarmp@cs.unc.edu>
	    Maciej W. Rozycki  <macro@orcam.me.uk>

	opcodes/
	* mips-opc.c (mips_builtin_opcodes): Fix INSN2_ALIAS annotation
	for "bal", "beqz", "beqzl", "bnez" and "bnezl" instructions.
	* micromips-opc.c (micromips_opcodes): Likewise for "beqz" and
	"bnez" instructions.
2022-03-06 18:30:58 +00:00
Tom Tromey
13835d88dc Use function view when iterating over block symbols
This changes iterate_over_block_local_vars and
iterate_over_block_arg_vars to take a gdb::function_view rather than a
function pointer and a user-data.  In one spot, this allows us to
remove a helper structure and helper function.  In another spot, this
looked more complicated, so I changed the helper function to be an
"operator()" -- also a simplification, just not as big.
2022-03-06 10:50:42 -07:00
Tom Tromey
abed5aa88a Simplify hppa-tdep.c use of objfile_key
I happened to notice a couple of unnecessary casts in hppa-tdep.c, and
then I saw that the use of objfile_key could be simplified -- removing
some code and using the default deleter rather than noop_deleter.

Tested by rebuilding.  Let me know what you think.
2022-03-06 10:20:31 -07:00
Simon Marchi
5f8ab46bc6 gdb: constify parameter of value_copy
In a following patch, I have a const value I want to copy using a
value_copy.  However, value_copy takes a non-const source value, at the
moment.  Change the paramter to be const,

If the source value is not lazy, we currently call
value_contents_all_raw, which calls allocate_value_contents, to get a
view on the contents.  They both take a non-const value, that's a
problem.  My first attempt at solving it was to add a const version of
value_contents_all_raw, make allocate_value_contents take a const value,
and either:

 - make value::contents mutable
 - make allocate_value_contents cast away the const

The idea being that allocating the value contents buffer does modify the
value at the bit level, but logically that doesn't change its state.

That was getting a bit complicated, so what I ended up doing is make
value_copy not call value_contents_all_raw.  We know at this point that
the value is not lazy, so value::contents must have been allocate
already.

Change-Id: I3741ab362bce14315f712ec24064ccc17e3578d4
2022-03-06 11:33:23 -05:00
Simon Marchi
7055fa96fc gdb: remove internalvar_funcs::destroy
No kind of internal var uses it remove it.  This makes the transition to
using a variant easier, since we don't need to think about where this
should be called (in a destructor or not), if it can throw, etc.

Change-Id: Iebbc867d1ce6716480450d9790410d6684cbe4dd
2022-03-06 11:32:25 -05:00
GDB Administrator
7a1550fcec Automatic date update in version.in 2022-03-06 00:00:25 +00:00
GDB Administrator
7c28e7424d Automatic date update in version.in 2022-03-05 00:00:25 +00:00
Tom Tromey
c836575a6f Mark vDSO as not a file
The vDSO objfile is not a real file, so mark it as such.  I noticed
this because, when playing with debuginfod, I saw:

Downloading 0.01 MB separate debug info for /tmp/system-supplied DSO at 0x7ffff7fc9000

That "/tmp" is wrong -- it's just gdb's cwd.  This patch corrects the
problem, resulting in:

Downloading 0.01 MB separate debug info for system-supplied DSO at 0x7ffff7fc9000

Regression tested on x86-64 Fedora 34.
2022-03-04 12:35:33 -07:00
Simon Marchi
84a9f19530 binutils/readelf: fix indentation in process_dynamic_section
Clangd shows a warning about misleading indentation in this file, fix
it.

binutils/ChangeLog:

	* readelf.c (process_dynamic_section): Fix indentation.

Change-Id: I43a7f4f4c75dd080af614222b980526f5debf297
2022-03-04 10:57:14 -05:00
Christina Schimpe
e8db803129 gdb: Use a typedef's scoped type name to identify local typedefs
GDB prints the wrong type for typedefs in case there is another typedef
available for the same raw type (gdb/16040).  The reason is that the
current hashmap based substitution mechanism always compares the target
type of a typedef and not its scoped name.

The original output of GDB for a program like

~~~~
namespace ns
{
  typedef double scoped_double;
}

typedef double global_double;

class TypedefHolder
{
public:
  double a;
  ns::scoped_double b;
  global_double c;

private:
  typedef double class_double;
  class_double d;

  double method1(ns::scoped_double) { return 24.0; }
  double method2(global_double) { return 24.0; }
};

int main()
{
  TypedefHolder th;
  return 0;
}
~~~~

is
~~~~

(gdb) b 27
Breakpoint 1 at 0x1131: file TypedefHolder.cc, line 27.
(gdb) r
Starting program: /tmp/typedefholder

Breakpoint 1, main () at TypedefHolder.cc:27
27	  return 0;
(gdb) ptype th
type = class TypedefHolder {
  public:
    class_double a;
    class_double b;
    class_double c;
  private:
    class_double d;

    class_double method1(class_double);
    class_double method2(class_double);

    typedef double class_double;
}
~~~~

Basically all attributes of a class which have the raw type "double" are
substituted by "class_double".

With the patch the output is the following

~~~~
type = class TypedefHolder {
  public:
    double a;
    ns::scoped_double b;
    global_double c;
  private:
    class_double d;

    double method1(ns::scoped_double);
    double method2(global_double);

    typedef double class_double;
}
~~~~
2022-03-04 16:42:30 +01:00
Jan Beulich
7919e5667c RISC-V: make .insn actually work for 64-bit insns
Presently in this case, due to an undefined behavior shift, at least
with x86 cross builds I'm observing:

Error: value conflicts with instruction length `8,0x0000003f'

Eliminate the UB and extend the respective testcase.
2022-03-04 13:37:59 +01:00
Jan Beulich
6a778a2100 x86: drop redundant x86-64-code16-2 test
The code16-2 test is already meaningless enough as a gas test, identical
to this one, and is run uniformly for all ELF targets anyway.
2022-03-04 13:37:30 +01:00
GDB Administrator
98040b9ebb Automatic date update in version.in 2022-03-04 00:00:19 +00:00
Roland McGrath
26caf9aca8 Fix typo in last change. 2022-03-03 13:06:50 -08:00
Roland McGrath
8674f082e3 Avoid conflict with gnulib open/close macros.
On some systems, the gnulib configuration will decide to define open
and/or close as macros to replace the POSIX C functions.  This
interferes with using those names in C++ class or namespace scopes.

gdbsupport/
	* event-pipe.cc (event_pipe::open): Renamed to ...
	(event_pipe::open_pipe): ... this.
	(event_pipe::close): Renamed to ...
	(event_pipe::close_pipe): ... this.
	* event-pipe.h (class event_pipe): Updated.
gdb/
	* inf-ptrace.h (async_file_open, async_file_close): Updated.
gdbserver/
	* gdbserver/linux-low.cc (linux_process_target::async): Likewise.
2022-03-03 11:21:36 -08:00
Alan Modra
db120fb808 Adjust ld ctf test for 32-bit targets
powerpc-linux, and I suspect other 32-bit targets, report "aligned at
0x4" for this test.

	* testsuite/ld-ctf/nonrepresentable.d: Accept any alignment.
2022-03-04 00:28:07 +10:30
Luis Machado
c2b167b3d6 Update my e-mail address in the MAINTAINERS file
Update the information accordingly.
2022-03-03 09:57:47 +00:00
Tiezhu Yang
cb1a6dda0d gdb: testsuite: fix failed testcases in gdb.base/gdb-caching-proc.exp
When execute the following command:

  make check-gdb TESTS="gdb.base/gdb-caching-proc.exp"

we can see there exist some failed testcases:

  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 0: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 1: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 2: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 3: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 4: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 5: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 6: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 7: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 8: can spawn for attach (got interactive prompt)
  FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 9: can spawn for attach (got interactive prompt)

here are the detailed messages in gdb/testsuite/gdb.log:

  attach 873776
  A program is being debugged already.  Kill it? (y or n) n
  Not killed.
  (gdb) FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 0: can spawn for attach (got interactive prompt)

so handle the case "A program is being debugged already.  Kill it" in
can_spawn_for_attach to fix the failed testcases.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2022-03-03 11:28:09 +08:00
Alan Modra
e26ff4b5a9 comment typo fix 2022-03-03 13:44:16 +10:30
Alan Modra
0aac2413d3 PowerPC64 DT_RELR relative reloc addresses
Section addresses can change between ppc64_elf_size_stubs and
ppc64_elf_build_stubs due to .eh_frame editing.  The idea of stashing
r_offset final addresses calculated in ppc64_elf_size_stubs for use by
ppc64_elf_build_stubs was never a good idea.  Instead, we need to keep
section/offset pairs.

	* elf64-ppc.c (struct ppc_link_hash_table): Delete relr_addr.
	Add relr section/offset array.
	(append_relr_off): Rewrite.  Update all callers.
	(sort_relr): New function.
	(ppc64_elf_size_stubs): Adjust to suit new relative reloc stash.
	(ppc64_elf_build_stubs): Likewise.
2022-03-03 12:47:40 +10:30
GDB Administrator
a8dc389afe Automatic date update in version.in 2022-03-03 00:00:26 +00:00
John Baldwin
74320502cb configure: Stop checking for PT_GETXMMREGS.
This request is present on all modern *BSD/i386 systems (those
released since mid-2006), and the *BSD/i386 targets now assume it is
present unconditionally.
2022-03-02 14:09:55 -08:00
John Baldwin
72919b16ec i386-bsd-nat: Assume PT_GETXMMREGS is present.
NetBSD has included PT_GETXMMREGS since 1.6 released in September
2002.  OpenBSD has included PT_GETXMMREGS since 3.8 released in
November 2005.
2022-03-02 14:09:55 -08:00
John Baldwin
63db53cd53 i386-fbsd-nat: Assume PT_GETXMMREGS is present.
PT_GETXMMREGS was first added in FreeBSD 6.0 released in November 2005.
The last FreeBSD release without support was 5.5 released in May 2006.
2022-03-02 14:09:55 -08:00
John Baldwin
c1dae0a6a0 fbsd-tdep: Implement the vsyscall_range gdbarch hook.
FreeBSD recently added a real vDSO in its shared page for the amd64
architecture.  The vDSO is mapped at the address given by the
AT_KPRELOAD ELF auxiliary vector entry.  To find the end of the
mapping range, parse the list of virtual map entries used by 'info
proc mappings' either from the NT_PROCSTAT_VMMAP core dump note, or
via the kinfo_getvmmap function for native targets (fetched from the
native target as the TARGET_OBJECT_FREEBSD_VMMAP object).

This silences warnings on recent FreeBSD/amd64 kernels due to not
finding symbols for the vdso:

warning: Could not load shared library symbols for [vdso].
Do you need "set solib-search-path" or "set sysroot"?
2022-03-02 14:00:36 -08:00
Tom Tromey
fb079cb5c4 Rewrite make-target-delegates in Python
I think gdb is probably better off having fewer languages involved
when generating code.  'sh' is unavoidable for build-time generation,
but for other things, let's use Python.

This rewrites make-target-delegates in Python.  I've stuck pretty
closely to the original code in this rewrite, so it may look slightly
weird from a Python perspective.

The only output difference is that a copyright header is now
generated, using the code introduced in the previous patch.

make-target-delegates.py is simpler to invoke, as it knows the correct
input file to scan and it creates the output file itself.
2022-03-02 09:11:30 -07:00
Tom Tromey
a8ab094a32 Move copyright code from gdbarch.py to new file
This moves the copyright code from gdbarch.py to a new Python source
file, gdbcopyright.py.  The function in this file will find the
copyright dates by scanning the calling script.  This will be reused
in a future patch.

This involved minor changes to the output of gdbarch.py.  Also, I've
updated copyright.py to remove the reference to gdbarch.sh.  We don't
need to mention gdbarch.py there, either.
2022-03-02 09:11:30 -07:00
GDB Administrator
aca6e93ecf Automatic date update in version.in 2022-03-02 00:00:18 +00:00
Tom Tromey
c675db743e Some "distclean" fixes in gdb
PR build/12440 points out that "make distclean" is broken in gdb.
Most of the breakage comes from other projects in the tree, but we can
fix some of the issues, which is what this patch does.

Note that the yacc output files, like c-exp.c, are left alone.  In a
source distribution, these are included in the tarball, and if the
user builds in-tree, we would not want to remove them.

While that seems a bit obscure, it seems to me that "distclean" is
only really useful for in-tree builds anyway -- out-of-tree I simply
delete the entire build directory and start over.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12440
2022-03-01 16:54:18 -07:00
Tom Tromey
17dccf1031 Fix typo in the "alias" example
PR cli/17332, filed around 8 years ago, points out a typo in the docs
-- in one example, the command and its output are obviously out of
sync.  This patch fixes it.  I'm checking this in as obvious.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17332
2022-03-01 16:50:39 -07:00
Nick Clifton
ba0eb22c8b Fix a typo in the previous delta to bfdio.c.
PR 25713
	* bfdio.c (_bfd_real_fopen): Fix typo.
2022-03-01 13:13:42 +00:00
Alan Modra
581c5ba435 Revert "Check thin archive element file size against archive header"
This reverts commit 48e3e6aec8.

	PR 28929
	* archive.c (_bfd_get_elt_at_filepos): Don't check thin archive
	element file size.
2022-03-01 21:56:04 +10:30
Nick Clifton
95e96e052a Fix linker tests to compile with gcc-12.
PR 21964
	* testsuite/ld-elf/pr21964-1a.c: Fix array comparisons.
	* testsuite/ld-elf/pr21964-1b.c: Likewise.
	* testsuite/ld-elf/pr21964-1c.c: Likewise.
	* testsuite/ld-elf/pr21964-2a.c: Likewise.
	* testsuite/ld-elf/pr21964-2b.c: Likewise.
	* testsuite/ld-elf/pr21964-3a.c: Likewise.
2022-03-01 10:10:20 +00:00
Nick Clifton
81c9e0f6c4 Prevent an assertion from being triggered when linking an ARM object file with incorrectly set build attributes.
PR 28848
	PR 28859
	* elf32-arm.c (elf32_arm_merge_eabi_attributes): If the first
	input bfd has a Tag_ABI_HardFP_use set to 3 but does not also have
	TAG_FP_arch set then reset the TAG_ABI_HardFP_use.
2022-03-01 09:51:59 +00:00
Tiezhu Yang
1dbf27133d gdb: testsuite: fix wrong expected result in attach-pie-noexec.exp
If /proc/sys/kernel/yama/ptrace_scope is 1, when execute the test case
gdb.base/attach-pie-noexec.exp without superuser, the gdb.log shows the
following info:

  (gdb) attach 6500
  Attaching to process 6500
  ptrace: Operation not permitted.
  (gdb) PASS: gdb.base/attach-pie-noexec.exp: attach

It is obviously wrong, the expected result should be UNSUPPORTED in such
a case.

It is better to make can_spawn_for_attach to return false for this case.
It would have to setup a small test program, compile it to exec, spawn it
and try to attach to it.

With this patch, we can see "Operation not permitted" in the log info,
and then we can do the following processes to test:
(1) set ptrace_scope as 0
    $ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
    $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp"
(2) use sudo
    $ sudo make check-gdb TESTS="gdb.base/attach-pie-noexec.exp"

Additionally, handle the other cases when test with RUNTESTFLAGS=
"--target_board=native-extended-gdbserver".

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2022-03-01 15:21:16 +08:00
Tiezhu Yang
863cd1c236 gdb: testsuite: print explicit test result in can_spawn_for_attach
In the current code, there is no test result when execute the following
commands:

  $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp" RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost"
  $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp" RUNTESTFLAGS="--target_board=native-gdbserver"

It is better to print explicit test result in can_spawn_for_attach.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2022-03-01 15:21:11 +08:00
Tiezhu Yang
d3827c8d2d gdb: add Tiezhu Yang as LoongArch maintainer
The patch series "gdb: Add basic support for LoongArch" has been
merged into master, list Tiezhu Yang as LoongArch maintainer.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2022-03-01 15:21:06 +08:00
GDB Administrator
cb3a9d1b79 Automatic date update in version.in 2022-03-01 00:00:26 +00:00