~ubuntu-support-team/binutils/+git/binutils-gdb:users/jv/patches/pr-30249

Last commit made on 2023-03-29
Get this branch:
git clone -b users/jv/patches/pr-30249 https://git.launchpad.net/~ubuntu-support-team/binutils/+git/binutils-gdb

Branch merges

Branch information

Name:
users/jv/patches/pr-30249
Repository:
lp:~ubuntu-support-team/binutils/+git/binutils-gdb

Recent commits

f48f805... by Jan Vrany <email address hidden>

gdb: fix post-hook execution for remote targets

Commit b5661ff2 ("gdb: fix possible use-after-free when
executing commands") attempted to fix possible use-after-free
in case command redefines itself.

Commit 37e5833d ("gdb: fix command lookup in execute_command ()")
updated the previous fix to handle subcommands as well by using the
original command string to lookup the command again after its execution.

This fixed the test in gdb.base/define.exp but it turned out that it
does not work (at least) for "target remote" and "target extended-remote".

The problem is that the command buffer P passed to execute_command ()
gets overwritten in dont_repeat () while executing "target remote"
command itself:

 #0 dont_repeat () at top.c:822
 #1 0x000055555730982a in target_preopen (from_tty=1) at target.c:2483
 #2 0x000055555711e911 in remote_target::open_1 (name=0x55555881c7fe ":1234", from_tty=1, extended_p=0)
     at remote.c:5946
 #3 0x000055555711d577 in remote_target::open (name=0x55555881c7fe ":1234", from_tty=1) at remote.c:5272
 #4 0x00005555573062f2 in open_target (args=0x55555881c7fe ":1234", from_tty=1, command=0x5555589d0490)
     at target.c:853
 #5 0x0000555556ad22fa in cmd_func (cmd=0x5555589d0490, args=0x55555881c7fe ":1234", from_tty=1)
     at cli/cli-decode.c:2737
 #6 0x00005555573487fd in execute_command (p=0x55555881c802 "4", from_tty=1) at top.c:688

Therefore the second call to lookup_cmd () at line 697 fails to find
command because the original command string is gone.

This commit addresses this particular problem by creating a *copy* of
original command string for the sole purpose of using it after command
execution to lookup the command again. It may not be the most efficient
way but it's safer given that command buffer is shared and overwritten
in hard-to-foresee situations.

Tested on x86_64-linux.

PR 30249
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30249

af2724d... by Tom de Vries <email address hidden>

[gdb/testsuite] Fix gdb.guile/scm-symbol.exp for remote host

Fix test-case gdb.guile/scm-symbol.exp for remote host by making a regexp less
strict.

Likewise in gdb.guile/scm-symtab.exp.

Tested on x86_64-linux.

5fc6043... by Tom de Vries <email address hidden>

[gdb/testsuite] Fix /gdb.guile/scm-parameter.exp for remote host

Fix test-case gdb.guile/scm-parameter.exp for remote host by taking into
account that gdb_reinitialize_dir has no effect for remote host.

Tested on x86_64-linux.

7eb59fa... by Tom de Vries <email address hidden>

[gdb/testsuite] Fix gdb.guile/scm-objfile-script.exp for remote host

Fix test-case gdb.guile/scm-objfile-script.exp using gdb_remote_download.

Tested on x86_64-linux.

eb338e5... by Tom de Vries <email address hidden>

[gdb/testsuite] Fix gdb.guile/scm-objfile-script.exp for remote host

Fix test-case gdb.guile/scm-objfile-script.exp using host_standard_output_file.

Tested on x86_64-linux.

7b193de... by Tom de Vries <email address hidden>

[gdb/testsuite] Fix gdb.guile/scm-cmd.exp without readline

Fix test-case gdb.guile/scm-cmd.exp using readline_is_used.

Tested on x86_64-linux.

79260be... by Tom de Vries <email address hidden>

[gdb/testsuite] Fix gdb.guile/guile.exp for remote host

Fix test-case gdb.guile/guile.exp for remote host using gdb_remote_download.

Tested on x86_64-linux.

aec101a... by Alan Modra

Sanity check section size in bfd_init_section_compress_status

This function doesn't just initialise for compression, it actually
compresses. This patch sanity checks section size before allocating
buffers for the uncompressed contents.

 * compress.c (bfd_init_section_compress_status): Sanity check
 section size.

6477444... by Alan Modra

Re: Fix an aout memory leak

We have way too much duplicated code in bfd. Apply dd3a3d0af9f6 and
920581c57e08 to pdp11.c.

 * pdp11.c (bfd_free_cached_info): Free line_buf. Return true
 if tdata.aout_data is NULL.

3901d7d... by Alan Modra

ld testsuite CFLAGS_FOR_TARGET

run_host_cmd adds $gcc_B_opt and $ld_L_opt to the command line if it
detects the program being run is a compiler. Since the program being
run in lto.exp linking pr28138 is "sh", we need to add these by hand.
This isn't exactly as run_host_cmd does, as it lacks reordering of
any user -B option in $CC_FOR_TARGET, but it's better than ignoring
gcc_B_opt. This fixes a mips64 testsuite fail.

ld_compile adds CFLAGS_FOR_TARGET and other flags as well, so there
is no need for the ld_compile command line to include
CFLAGS_FOR_TARGET. Fixing this is just a tidy.

 * testsuite/ld-plugin/lto.exp: Add gcc_B_opt, CFLAGS_FOR_TARGET
 and $ld_L_opt to pr28138 link line.
 * testsuite/lib/ld-lib.exp (run_ld_link_tests): Don't pass
 unnecessary flags to ld_compile.
 (run_ld_link_exec_tests, run_cc_link_tests): Likewise.