Age | Commit message (Collapse) | Author | Files | Lines |
|
This converts block_static_block and block_global_block to be methods.
This was mostly written by script. It was simpler to convert them at
the same time because they're often used near each other.
|
|
This converts block_containing_function to be a method. This was
mostly written by script.
|
|
This converts block_linkage_function to be a method. This was mostly
written by script.
|
|
This converts block_scope, block_set_scope, block_using, and
block_set_using to be methods. These are all done at once to make it
easier to also convert block_initialize_namespace at the same time.
This was mostly written by script.
|
|
This converts block_inlined_p to be a method. This was mostly written
by script.
|
|
This converts block_gdbarch to be a method. This was mostly written
by script.
|
|
This converts block_objfile to be a method. This was mostly written
by script.
|
|
block_global_block has special behavior when the block is NULL.
Remove this and patch up the callers instead.
|
|
block_static_block has special behavior when the block is NULL.
Remove this and patch up the callers instead.
|
|
block_using has special behavior when the block is NULL.
Remove this. No caller seems to be affected.
|
|
block_scope has special behavior when the block is NULL.
Remove this and patch up the callers instead.
|
|
block_set_scope and block_set_using unconditionally allocate the block
namespace object. However, this isn't truly needed, so arrange to
only allocate when it is.
|
|
Moving block_initialize_namespace before its callers lets us avoid a
forward declaration.
|
|
* vms-alpha.c (evax_bfd_print_eobj): Rewrite header handling,
sanity checking rec_len. Check bfd_malloc return.
|
|
An earlier patch of mine introduced a memory leak in chew. The bug
was that the new "variable" word didn't free the following word. This
patch fixes it by arranging to transfer ownership of the name to the
variable itself.
* doc/chew.c (add_variable): New function, from
add_intrinsic_variable.
(add_intrinsic_variable): Call add_variable.
(compile): Call add_variable.
|
|
|
|
The new DWARF indexer broke "start" for some languages.
For D, it is broken because, while the code in cooked_index_shard::add
specifically excludes Ada, it fails to exclude D. This means that the
C "main" will be detected as "main" here -- whereas what is intended
is for the code in find_main_name to use d_main_name to find the name.
The Rust compiler, on the other hand, uses DW_AT_main_subprogram.
However, the code in dwarf2_build_psymtabs_hard fails to create a
fully-qualified name, so the name always ends up as plain "main".
For D and Ada, a very simple approach suffices: remove the check
against "main" from cooked_index_shard::add. This also has the
benefit of slightly speeding up DWARF indexing. I assume this
approach will work for Pascal and Modula-2 as well, but I don't have a
way to test those at present.
For Rust, though, this is not sufficient. And, computing the
fully-qualified name in dwarf2_build_psymtabs_hard will crash, because
cooked_index_entry::full_name uses the canonical name -- and that is
not computed until after canonicalization.
However, we don't want to wait for canonicalization to be done before
computing the main name. That would remove any benefit from doing
canonicalization is the background.
This patch solves this dilemma by noticing that languages using
DW_AT_main_subprogram are, currently, disjoint from languages
requiring canonicalization. Because of this, we can add a parameter
to full_name to let us avoid crashes, slowdowns, and races here.
This is kind of tricky and ugly, so I've tried to comment it
sufficiently.
While doing this, I had to change gdb.dwarf2/main-subprogram.exp. A
different possibility here would be to ignore the canonicalization
needs of C in this situation, because those only affect certain types.
However, I chose this approach because the test case is artificial
anyhow.
A long time ago, in an earlier threading attempt, I changed the global
current_language to be a function (hidden behind a macro) to let us
attempt lazily computing the current language. Perhaps this approach
could still be made to work. However, that also seemed rather tricky,
more so than this patch.
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30116
|
|
go_symbol_package_name package name asserts that it is only passed a
Go symbol, but this is not enforced by one caller. It seems simplest
to just check and return early in this case.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17876
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
|
|
I noticed a couple of spots in go-lang.c that could be improved by
using unique_ptr.
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
|
|
|
|
A regression in gdb.xml/maint_print_struct.exp was introduced with
commit:
commit 81b86eced24f905545b58aa6c27478104c364976
Date: Fri Jan 6 09:30:40 2023 -0700
Do not record a rejected target description
The test relied on an invalid target description being stored within
the tdesc_info of the current inferior, the above commit stopped this
behaviour.
Update the test to check that the invalid architecture is NOT stored,
and then check printing the target description directly from the
file.
Approved-By: Tom Tromey <tromey@adacore.com>
|
|
gprofng/ChangeLog
2023-02-16 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
* src/Dwarf.cc: Skip DW_TAG_subprogram when DW_AT_declaration is 1.
|
|
already defined
gprofng/ChangeLog
2023-02-16 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gprofng/30036
* libcollector/iotrace.c: Define creat64 and pwrite64 only when
__USE_LARGEFILE64 and __USE_FILE_OFFSET64 are not defined.
* libcollector/mmaptrace.c: Likewise for mmap64.
|
|
Multi-threaded debugging using the libpthdebug debug interface
is currently broken due to multiple issues.
When debugging a single inferior, we were getting assertion
failures in get_aix_thread_info as no tp->priv structure was
allocated for the main thread.
We fixed this by switching the main
thread from a (pid, 0, 0) ptid_t to a (pid, 0, tid) ptid_t and
allocaing the tp->priv structure in sync_threadlists.
As a result, the switch_to_thread call in pdc_read_data could
now fail since the main thread no longer uses (pid, 0, 0).
So we replaced the call by only switching inferior_ptid, the current
inferior, and the current address space (like proc-service.c).
Add similar switching to pdc_write_data where it was missing
completely.
When debugging multiple inferiors, an additional set of
problems prevented correct multi-threaded debugging:
First of all, aix-thread.c used to have a number of global
variables holding per-inferior information.
We switched hese
to a per-inferior data structure instead.
Also, sync_threadlists was getting confused as we were
comparing the list of threads returned by libpthdebug
for *one* process with GDB's list of threads for *all*
processes. Now we only use he GDB threads of the current
inferior instead.
We also skip calling pd_activate
from pd_enable if that in_initial_library_scan flag is
true for the current inferior.
Finally, the presence of the thread library in any but
the first inferior was not correctly detected due to a
bug in solib-aix.c, where the BFD file name for shared
library members was changed when the library was loaded
for the first time, which caused the library to no longer
be recognized by name when loaded a second time.
|
|
I found a couple of spots in ada-lang.c where a return follows a call
to error. These are unnecessary because error never returns.
|
|
On SLE-11, with glibc 2.11.3, I run into:
...
(gdb) PASS: gdb.arch/amd64-disp-step-avx.exp: vex3: \
var128 has expected value after
continue^M
Continuing.^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0x0000000000400283 in _exit (status=0) at \
../sysdeps/unix/sysv/linux/_exit.c:33^M
33 ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory.^M
(gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: \
continue until exit at amd64-disp-step-avx
...
This is not related to gdb, we get the same result by just running the exec.
The problem is that the test-case:
- calls glibc's _exit, and
- uses -nostartfiles -static, putting the burden for any necessary
initialization for calling glibc's _exit on the test-case itself.
So, when we get to the second insn in _exit:
...
000000000040acb0 <_exit>:
40acb0: 48 63 d7 movslq %edi,%rdx
40acb3: 64 4c 8b 14 25 00 00 mov %fs:0x0,%r10
...
no glibc-related initialization is done, and we run into the segfault.
Adding this (borrowed from __libc_start_main) in _start in the .S file is
sufficient to fix it:
...
.rept 200
nop
+ call __pthread_initialize_minimal
.endr
...
But that already doesn't compile with say glibc 2.31, and regardless I think
this sort of fix is too fragile.
We could of course fix this by simply not running to exit. But ideally we'd
have an exec that doesn't segfault when you just run it.
Alternatively, we could hand-code an _exit syscall and bypass glibc
all together. But I'd rather fix this in a way that simplifies the test-case.
Taking a step back, the -nostartfiles -static was added to address that the
xmm registers were not zero at main (which AFAICT is a valid thing to happen).
[ The change itself silently broke the test-case, needing further fixing by
commit 40310f30a51 ("gdb: make gdb.arch/amd64-disp-step-avx.exp actually test
displaced stepping"). ]
Instead, simplify things by reverting to the original situation:
- no -nostartfiles -static compilation flags,
- no _start in the .S file,
- use exit instead of _exit in the .S file,
and fix the original problem by setting the xmm registers to zero rather than
checking that they're zero.
Now that we're no longer forcing -static, add nopie to the flags to prevent
compilation failure with target board unix/-fPIE/-pie.
Tested on x86_64-linux.
PR testsuite/30132
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30132
|
|
Fix these fails:
alpha-dec-vms +FAIL: ld-scripts/asciz
alpha-dec-vms +FAIL: ld-scripts/ascii
i386-go32 +FAIL: ld-scripts/asciz
sh-coff +FAIL: ld-scripts/asciz
It's better to positively select targets for .section support than to
try to exclude all targets that don't. Make a new is_coff_format so
we can easily select such.
binutils/
* testsuite/lib/binutils-common.exp (is_coff_format): New.
ld/
* testsuite/ld-scripts/ascii.d: Use is_elf_format and
is_coff_format to select targets, exclude ti coff.
* testsuite/ld-scripts/asciz.d: Likewise. Accept trailing zeros.
|
|
* ecofflink.c (mk_fdrtab): Sanity check fdr procedure descriptor
pointer and isymBase. Set fdrtab_len after possible discards.
Use size_t vars and catch possible size overflows.
|
|
|
|
PowerPC ELF always uses bfd_arch_powerpc, so we shouldn't allow the
gas -mpwr, -mpwr2 or -mpwrx options to choose bfd_arch_rs6000.
Given the possible values of ppc_cpu, I think the as_fatal at the end
of ppc_arch will never be reached, so it can be deleted and the code
simplified a little.
PR 30046
* config/tc-ppc.c (ppc_arch): Return bfd_arch_powerpc for ELF.
Delete dead code.
|
|
create_ada_exception_catchpoint has a parameter named "disabled", but
both its callers and callees use it to mean "enabled". This is
confusing, so this patch renames the parameter.
|
|
The 'g' packet documentation references a macro that no longer exists,
and it also claims that the 'x' response for an unavailable register
is limited to trace frames. This patch updates the documentation to
reflect what I think is currently correct.
Co-Authored-By: Pedro Alves <pedro@palves.net>
Approved-By: Eli Zaretskii <eliz@gnu.org>
Change-Id: I863baa3b9293059cfd4aa3d534602cbcb693ba87
|
|
* ldlex.l: Add ASCII token.
* ldgram.y: Add parsing of the ASCII command.
* ldlang.c (lang_add_string): Add maximum size parameter. Move escape character handling code into separate function.
* ldlang.h (lang_add_string): Update prototype.
* NEWS: Mention the new feature.
* ld.texi (Output Section Data): Document the new directives.
* testsuite/ld-scripts/asciz.t: Adjust to work on more architectures and to test more aspects of the ASCIZ directive.
* testsuite/ld-scripts/asciz.d: Adjust to match the changes to the test linker script.
* testsuite/ld-scripts/ascii.d: New test driver.
* testsuite/ld-scripts/ascii.s: New test assembler source.
* testsuite/ld-scripts/ascii.t: New test script.
* testsuite/ld-scripts/script.exp: Run the new test.
|
|
Unlike the other *_main_name functions, ada_main_name returns a
non-const "char *". This is strange, though, because the caller
should not in fact modify or free this pointer. This patch changes
this function to constify its return type.
|
|
I stumbled across this declaration in ada-lang.h. I don't know what
function did, but it no longer exists, so remove the declaration.
Tested by rebuilding.
|
|
I don't see much point in cluttering the source with the PROGRESS
macros, which of course do nothing at all with the definitions in
progress.h. progress.h is unchanged apart from the copyright comment
since commit d4d4c53c68f0 in 1994.
binutils/
* ar.c: Don't include progress.h, or invoke PROGRESS macros.
* nm.c: Likewise.
* objcopy.c: Likewise.
* objdump.c: Likewise.
gas/
* as.h: Don't include progress.h.
* as.c: Don't invoke PROGRESS macros.
* write.c: Likewise.
include/
* progress.h: Delete.
ld/
* ldmain.c: Don't include progress.h, or invoke PROGRESS macros.
|
|
Rename gas_late_init to plain gas_init, to reinforce the idea that
this is where the bulk of gas initialisation belongs. Also reorder
some initialisation.
* as.c (gas_init): Rename from gas_late_init. Open output
file and arrange for dump_statistics to be called here rather
than in main. Create .gasversion. local symbol earlier,
because we can.
|
|
Therefore there shouldn't be any at the end of the format string.
|
|
Back in 2010 the -remove-inferior command was added in commit
a79b8f6ea8c2, unfortunately this command was never added to the
documentation.
This commit addresses that oversight.
Approved-By: Eli Zaretskii <eliz@gnu.org>
|
|
PR gas/30117
Once a symbol had its expression evaluated, the "segment" of the symbol
may be reg_section if a register is merely involved in the expression,
not just when the expression references a "plain" register. Therefore
the first of the assertions put in place by 4d1bb7955a8b was too strict.
Convert it to an if() to deal with situations like this one found by
fuzzing:
x=s
s=%eax+0
y=s
or $6,x
In non-debug builds this also avoids potentially silently generating bad
code.
|
|
|
|
There are several more value methods that currently return 'int' but
that should return 'bool'. This patch updates these.
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
|
|
This changes value::bits_synthetic_pointer to return bool and fixes up
some fallout from this.
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
|
|
This changes value::m_stack to be a bool and updates the various uses.
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
|
|
This changes value::m_initialized to be a bool and updates the various
uses.
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
|
|
This changes value::m_lazy to be a bool and updates the various uses.
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
|
|
This changes value::m_modifiable to be a bool and updates the various
uses.
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
|
|
I noticed that if Ctrl-C was typed just while GDB is evaluating a
breakpoint condition in the background, and GDB ends up reaching out
to the Python interpreter, then the breakpoint condition would still
fail, like:
c&
Continuing.
(gdb) Error in testing breakpoint condition:
Quit
That happens because while evaluating the breakpoint condition, we
enter Python, and end up calling PyErr_SetInterrupt (it's called by
gdbpy_set_quit_flag, in frame #0):
(top-gdb) bt
#0 gdbpy_set_quit_flag (extlang=0x558c68f81900 <extension_language_python>) at ../../src/gdb/python/python.c:288
#1 0x0000558c6845f049 in set_quit_flag () at ../../src/gdb/extension.c:785
#2 0x0000558c6845ef98 in set_active_ext_lang (now_active=0x558c68f81900 <extension_language_python>) at ../../src/gdb/extension.c:743
#3 0x0000558c686d3e56 in gdbpy_enter::gdbpy_enter (this=0x7fff2b70bb90, gdbarch=0x558c6ab9eac0, language=0x0) at ../../src/gdb/python/python.c:212
#4 0x0000558c68695d49 in python_on_memory_change (inferior=0x558c6a830b00, addr=0x555555558014, len=4, data=0x558c6af8a610 "") at ../../src/gdb/python/py-inferior.c:146
#5 0x0000558c6823a071 in std::__invoke_impl<void, void (*&)(inferior*, unsigned long, long, unsigned char const*), inferior*, unsigned long, long, unsigned char const*> (__f=@0x558c6a8ecd98: 0x558c68695d01 <python_on_memory_change(inferior*, CORE_ADDR, ssize_t, bfd_byte const*)>) at /usr/include/c++/11/bits/invoke.h:61
#6 0x0000558c68237591 in std::__invoke_r<void, void (*&)(inferior*, unsigned long, long, unsigned char const*), inferior*, unsigned long, long, unsigned char const*> (__fn=@0x558c6a8ecd98: 0x558c68695d01 <python_on_memory_change(inferior*, CORE_ADDR, ssize_t, bfd_byte const*)>) at /usr/include/c++/11/bits/invoke.h:111
#7 0x0000558c68233e64 in std::_Function_handler<void (inferior*, unsigned long, long, unsigned char const*), void (*)(inferior*, unsigned long, long, unsigned char const*)>::_M_invoke(std::_Any_data const&, inferior*&&, unsigned long&&, long&&, unsigned char const*&&) (__functor=..., __args#0=@0x7fff2b70bd40: 0x558c6a830b00, __args#1=@0x7fff2b70bd38: 93824992247828, __args#2=@0x7fff2b70bd30: 4, __args#3=@0x7fff2b70bd28: 0x558c6af8a610 "") at /usr/include/c++/11/bits/std_function.h:290
#8 0x0000558c6830a96e in std::function<void (inferior*, unsigned long, long, unsigned char const*)>::operator()(inferior*, unsigned long, long, unsigned char const*) const (this=0x558c6a8ecd98, __args#0=0x558c6a830b00, __args#1=93824992247828, __args#2=4, __args#3=0x558c6af8a610 "") at /usr/include/c++/11/bits/std_function.h:590
#9 0x0000558c6830a620 in gdb::observers::observable<inferior*, unsigned long, long, unsigned char const*>::notify (this=0x558c690828c0 <gdb::observers::memory_changed>, args#0=0x558c6a830b00, args#1=93824992247828, args#2=4, args#3=0x558c6af8a610 "") at ../../src/gdb/../gdbsupport/observable.h:166
#10 0x0000558c68309d95 in write_memory_with_notification (memaddr=0x555555558014, myaddr=0x558c6af8a610 "", len=4) at ../../src/gdb/corefile.c:363
#11 0x0000558c68904224 in value_assign (toval=0x558c6afce910, fromval=0x558c6afba6c0) at ../../src/gdb/valops.c:1190
#12 0x0000558c681e3869 in expr::assign_operation::evaluate (this=0x558c6af8e150, expect_type=0x0, exp=0x558c6afcfe60, noside=EVAL_NORMAL) at ../../src/gdb/expop.h:1902
#13 0x0000558c68450c89 in expr::logical_or_operation::evaluate (this=0x558c6afab060, expect_type=0x0, exp=0x558c6afcfe60, noside=EVAL_NORMAL) at ../../src/gdb/eval.c:2330
#14 0x0000558c6844a896 in expression::evaluate (this=0x558c6afcfe60, expect_type=0x0, noside=EVAL_NORMAL) at ../../src/gdb/eval.c:110
#15 0x0000558c6844a95e in evaluate_expression (exp=0x558c6afcfe60, expect_type=0x0) at ../../src/gdb/eval.c:124
#16 0x0000558c682061ef in breakpoint_cond_eval (exp=0x558c6afcfe60) at ../../src/gdb/breakpoint.c:4971
...
The fix is to disable cooperative SIGINT handling while handling
inferior events, so that SIGINT is saved in the global quit flag, and
not in the extension language, while handling an event.
This commit augments the testcase added by the previous commit to test
this scenario as well.
Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: Idf8ab815774ee6f4b45ca2d0caaf30c9b9f127bb
|
|
get_active_ext_lang is not used anywhere. Delete it.
Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I4c2b6d0d11291103c098e4db1d6ea449875c96b7
|
|
This implements what I suggested here:
https://inbox.sourceware.org/gdb-patches/ab97c553-f406-b094-cdf3-ba031fdea925@palves.net/
Here is the current default quit_handler, a function that ends up
called by the QUIT macro:
void
default_quit_handler (void)
{
if (check_quit_flag ())
{
if (target_terminal::is_ours ())
quit ();
else
target_pass_ctrlc ();
}
}
As we can see above, when the inferior is running in the foreground,
then a Ctrl-C is translated into a call to target_pass_ctrlc().
The target_terminal::is_ours() case above is there to handle the
scenario where GDB has the terminal, meaning it is handling some
command the user typed, like "list", or "p a + b" or some such.
However, when the inferior is running on the background, say with
"c&", GDB also has the terminal. Run control handling is now done in
the "background". The CLI is responsive to user commands. If users
type Ctrl-C, they're expecting it to interrupt whatever command they
next type in the CLI, which again, could be "list", "p a + b", etc.
It's as if background run control was handled by a separate thread,
and the Ctrl-C is meant to go to the main thread, handling the CLI.
However, when handling an event, inside fetch_inferior_event &
friends, a Ctrl-C _also_ results in a Quit exception, from the same
default_quit_handler function shown above. This quit aborts run
control handling, breakpoint condition evaluation, etc., and may even
leave run control in an inconsistent state.
The testcase added by this patch illustrates this. The test program
just loops a number of times calling the "foo" function.
The idea is to set a breakpoint in the "foo" function with a condition
that sends SIGINT to GDB, and then evaluates to false, which results
in the program being re-resumed in the background. The SIGINT-sending
emulates pressing Ctrl-C just while GDB was evaluating the breakpoint
condition, except, it's more deterministic.
It looks like this:
(gdb) p $counter = 0
$1 = 0
(gdb) b foo if $counter++ == 10 || $_shell("kill -SIGINT `pidof gdb`") != 0
Breakpoint 2 at 0x555555555131: file gdb.base/bg-exec-sigint-bp-cond.c, line 21.
(gdb) c&
Continuing.
(gdb)
After that background continue, the breakpoint should be hit 10 times,
and we should see 10 "Quit" being printed on the screen. As if the
user typed Ctrl-C on the prompt a number of times with no inferior
running:
(gdb) <<< Ctrl-C
(gdb) Quit <<< Ctrl-C
(gdb) Quit <<< Ctrl-C
(gdb)
However, here's what you see instead:
(gdb) c&
Continuing.
(gdb) Quit
(gdb)
Just one Quit, and nothing else. If we look at the thread's state, we see:
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7ffff7d6f740 (LWP 112192) "bg-exec-sigint-" foo () at gdb.base/bg-exec-sigint-bp-cond.c:21
So the thread stopped, but we didn't report a stop...
Issuing another continue shows the same immediate-and-silent-stop:
(gdb) c&
Continuing.
(gdb) Quit
(gdb) p $counter
$2 = 2
As mentioned, since the run control handling, and breakpoint and
watchpoint evaluation, etc. are running in the background from the
perspective of the CLI, when users type Ctrl-C in this situation,
they're thinking of aborting whatever other command they were typing
or running at the prompt, not the run control side, not the previous
"c&" command.
So I think that we should install a custom quit_handler while inside
fetch_inferior_event, where we already disable pagination and other
things for a similar reason. This custom quit handler does nothing if
GDB has the terminal, and forwards Ctrl-C to the inferior otherwise.
With the patch implementing that, and the same testcase, here's what
you see instead:
(gdb) p $counter = 0
$1 = 0
(gdb) b foo if $counter++ == 10 || $_shell("kill -SIGINT `pidof gdb`") != 0
Breakpoint 2 at 0x555555555131: file gdb.base/bg-exec-sigint-bp-cond.c, line 21.
(gdb) c&
Continuing.
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb) Quit
(gdb)
Breakpoint 2, foo () at gdb.base/bg-exec-sigint-bp-cond.c:21
21 return 0;
Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I1f10d99496a7d67c94b258e45963e83e439e1778
|