Re: [PATCH v4 00/18] All-stop on top of non-stop

Pedro Alves
2015-08-12T19:05:50Z

On 08/12/2015 07:32 PM, Joel Brobecker wrote:

> This uncovered what I think is a latent bug in the "how-did-we-never-
> see-this-before" category.

Wow! Indeed. Many thanks for tracking this down and fixing it.

A couple minor comments below, but this looks good to me.

> Does this patch look OK to you?

> * gdb.base/dso2dso-impl.c, gdb.base/dso2dso-impl.h,
> gdb.base/dso2dso-pck.c, gdb.base/dso2dso-pck.h, gdb.base/dso2dso.c,
> gdb.base/dso2dso.exp: New files.
>

Nit: the "pck" and "impl"s here confuse me -- I guess they meant something
in the original test? Do they still have any meaning here? I'd suggest
renaming to dso2dso-dso1.c, dso2dso-dso2.c, and then
sub() -> sub1(), impl__initialize() -> sub2(). That way, it should
be clearer that a function in dso1 calls a function in dso2.

> diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
> index 5e63b5e..5b4a8f4 100644
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -1662,7 +1662,7 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch,
>
> regcache_cooked_read_unsigned (regs, AMD64_RSP_REGNUM, &rsp);
> retaddr = read_memory_unsigned_integer (rsp, retaddr_len, byte_order);
> - retaddr = (retaddr - insn_offset) & 0xffffffffUL;
> + retaddr = (retaddr - insn_offset) & 0xffffffffffffffffUL;

I think this should use the ULL suffix now.

> +
> +if { [gdb_compile_shlib $srcfile_libimpl $binfile_libimpl \
> + [list debug additional_flags=-fPIC]] != "" } {
> + untested "Could not compile $binfile_libimpl."
> + return -1
> +}
> +
> +if { [gdb_compile_shlib $srcfile_libpck $binfile_libpck \
> + [list debug additional_flags=-fPIC]] != "" } {
> + untested "Could not compile $binfile_libpck."
> + return -1
> +}
> +
> +if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable \
> + [list debug shlib=$binfile_libimpl shlib=$binfile_libpck]] != "" } {
> + return -1
> +}
> +
> +clean_restart $binfile
> +

I think a

gdb_load_shlibs $binfile_libimpl $binfile_libpck

is missing here.

> +if { ![runto_main] } {
> + return -1
> +}
> +
> +set bp_location [gdb_get_line_number "impl__initialize" $srcfile_libpck]
> +gdb_breakpoint ${srcfile_libpck}:${bp_location}
> +
> +gdb_continue_to_breakpoint "at call to impl__initialize" \
> + ".*impl__initialize ().*"
> +
> +gdb_test "next" \
> + ".*return 5;.*" \
> + "next over call to impl__initialize"
> -- 2.1.4

Thanks,
Pedro Alves