Pedro Alves [Wed, 26 Feb 2014 16:33:13 +0000 (16:33 +0000)]
Mention PR breakpoints/16292 in corresponding ChangeLog entry.
Pedro Alves [Wed, 26 Feb 2014 14:36:05 +0000 (14:36 +0000)]
bsd-uthread.c: Don't install a to_xfer_partial method
Whatever the comment about deprecated_xfer_memory referred to,
deprecated_xfer_memory is gone now. There's no need to install a
target method that just delegates, as that's what the default
delegator does already.
Tested by building an --enable-targets=all gdb on x86_64 Fedora 17.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* bsd-uthread.c (bsd_uthread_xfer_partial): Delete function.
(bsd_uthread_target): Don't install bsd_uthread_xfer_partial as
to_xfer_partial method.
Pedro Alves [Wed, 26 Feb 2014 14:36:04 +0000 (14:36 +0000)]
eliminate target_ops->deprecated_xfer_memory
As no target uses it anymore, it can finally go away.
After removing the deprecated_xfer_memory handling from
default_xfer_partial, we can delete the latter, because the only thing
it does is delegate to the target beneath unconditionally, which is
what the delegator installed by target-delegates.c will do for us if
no to_xfer_partial method is installed.
This was the last user of de_fault, so that goes away too.
Tested on x86_64 Fedora 17.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* target.c (complete_target_initialization): Don't install
default_xfer_partial as to_xfer_partial hook.
(nomemory): Delete.
(update_current_target): Don't INHERIT nor de_fault
deprecated_xfer_memory. Delete de_fault macro.
(default_xfer_partial, deprecated_debug_xfer_memory): Delete.
(setup_target_debug): Don't install a deprecated_xfer_memory hook.
* target.h (struct target_ops) <deprecated_xfer_memory>: Delete
field.
Pedro Alves [Wed, 26 Feb 2014 14:36:04 +0000 (14:36 +0000)]
go32-nat.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user.
Unfortunately djgpp's write_child function takes a non-const buffer
pointer, while GDB's xfer_partial api passes a const pointer. To be
const-correct, we need to copy that buffer to a non-const buffer, and
pass the copy to write_child. This is actually what
target.c:default_xfer_partial itself does, when calling into the
ops->deprecated_xfer_memory hook.
Tested by cross-building djgpp gdb, on x86-64 Fedora 17.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* go32-nat.c (my_write_child): New function.
(go32_xfer_memory): Rewrite as to_xfer_partial helper.
(go32_xfer_partial): New function.
(init_go32_ops): Don't install a deprecated_xfer_memory hook.
Instead install a to_xfer_partial hook.
Pedro Alves [Wed, 26 Feb 2014 14:36:04 +0000 (14:36 +0000)]
nto-procfs.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user.
Completely untested.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* nto-procfs.c (procfs_xfer_memory): Adjust interface as a
to_xfer_partial helper. Rewrite.
(procfs_xfer_partial): New function.
(init_procfs_ops): Don't install a deprecated_xfer_memory hook.
Install a to_xfer_partial hook.
Pedro Alves [Wed, 26 Feb 2014 14:36:03 +0000 (14:36 +0000)]
remote-m32r-sdi.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user.
Tested by building a --enable-targets=all gdb, on x86-64 Fedora 17.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* remote-m32r-sdi.c (send_data): Constify 'buf' parameter.
(m32r_xfer_memory): Adjust as a to_xfer_partial helper.
(m32r_xfer_partial): New function.
(init_m32r_ops): Don't install a deprecated_xfer_memory hook.
Install a to_xfer_partial hook.
Pedro Alves [Wed, 26 Feb 2014 14:36:03 +0000 (14:36 +0000)]
remote-mips.c: Don't install a deprecated_xfer_memory method
This removes another yet instance of a deprecated_xfer_memory user.
Tested by building a --enable-targets=all gdb, on x86-64 Fedora 17.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* remote-mips.c (mips_xfer_memory): Adjust as to_xfer_partial
helper.
(mips_xfer_partial): New function.
(_initialize_remote_mips): Don't install a deprecated_xfer_memory
hook. Install a to_xfer_partial hook.
Joel Brobecker [Wed, 29 Jan 2014 13:39:56 +0000 (17:39 +0400)]
DWARF: Add array DW_AT_bit_stride and DW_AT_byte_stride support
Consider the following declarations in Ada...
type Item is range -32 .. 31;
for Item'Size use 6;
type Table is array (Natural range 0 .. 4) of Item;
pragma Pack (Table);
... which declare a packed array whose elements are 6 bits long.
The debugger currently does not notice that the array is packed,
and thus prints values of this type incorrectly. This can be seen
in the "ptype" output:
(gdb) ptype table
type = array (0 .. 4) of foo.item
Normally, the debugger should print:
(gdb) ptype table
type = array (0 .. 4) of foo.item <packed: 6-bit elements>
The debugging information for this array looks like this:
.uleb128 0xf # (DIE (0x15c) DW_TAG_array_type)
.long .LASF9 # DW_AT_name: "pck__table"
.byte 0x6 # DW_AT_bit_stride
.long 0x1a9 # DW_AT_type
.uleb128 0x10 # (DIE (0x16a) DW_TAG_subrange_type)
.long 0x3b # DW_AT_type
.byte 0 # DW_AT_lower_bound
.byte 0x4 # DW_AT_upper_bound
.byte 0 # end of children of DIE 0x15c
The interesting part is the DW_AT_bit_stride attribute, which tells
the size of the array elements is 6 bits, rather than the normal
element type's size.
This patch adds support for this attribute by first creating
gdbtypes.c::create_array_type_with_stride, which is an enhanced
version of create_array_type taking an extra parameter as the stride.
The old create_array_type can then be re-implemented very simply
by calling the new create_array_type_with_stride.
We can then use this new function from dwarf2read, to create
arrays with or without stride.
gdb/ChangeLog:
* gdbtypes.h (create_array_type_with_stride): Add declaration.
* gdbtypes.c (create_array_type_with_stride): New function,
renaming create_array_type, but with an added parameter
called "bit_stride".
(create_array_type): Re-implement using
create_array_type_with_stride.
* dwarf2read.c (read_array_type): Add support for DW_AT_byte_stride
and DW_AT_bit_stride attributes.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/arr-stride.c: New file.
* gdb.dwarf2/arr-stride.exp: New file.
The test, relying purely on generating an assembly file, only
verifies the type description of our array. But I was also
able to verify manually that the debugger print values of these
types correctly as well (which was not the case prior to this
patch).
Pedro Alves [Wed, 26 Feb 2014 14:22:33 +0000 (14:22 +0000)]
Multiple Ada task-specific breakpoints at the same address.
With the test changed as in the patch, against current mainline, we get:
(gdb) PASS: gdb.ada/tasks.exp: info tasks before inserting breakpoint
break break_me task 1
Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
(gdb) PASS: gdb.ada/tasks.exp: break break_me task 1
break break_me task 3
Note: breakpoint 2 also set at pc 0x4030b0.
Breakpoint 3 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
(gdb) PASS: gdb.ada/tasks.exp: break break_me task 3
continue
Continuing.
[Switching to Thread 0x7ffff7dc7700 (LWP 27133)]
Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27
27 null;
(gdb) FAIL: gdb.ada/tasks.exp: continue to breakpoint
info tasks
ID TID P-ID Pri State Name
1 63b010 48 Waiting on RV with 3 main_task
2 63bd80 1 48 Accept or Select Term task_list(1)
* 3 63f510 1 48 Accepting RV with 1 task_list(2)
4 642ca0 1 48 Accept or Select Term task_list(3)
(gdb) PASS: gdb.ada/tasks.exp: info tasks after hitting breakpoint
The breakpoint that caused a stop is breakpoint 3, but GDB end up
reporting (and running breakpoint commands of) "Breakpoint 2" instead.
The issue is that the bpstat_check_breakpoint_conditions logic of
"wrong thread" is missing the "wrong task" check. This is usually
harmless, because the thread hop code in infrun.c code that handles
wrong-task-hitting-breakpoint does check for task-specific breakpoints
(within breakpoint_thread_match):
/* Check if a regular breakpoint has been hit before checking
for a potential single step breakpoint. Otherwise, GDB will
not see this breakpoint hit when stepping onto breakpoints. */
if (regular_breakpoint_inserted_here_p (aspace, stop_pc))
{
if (!breakpoint_thread_match (aspace, stop_pc, ecs->ptid))
thread_hop_needed = 1;
}
IOW, usually, when one only has a task specific breakpoint at a given
address, things work correctly. Put another task-specific or
non-task-specific breakpoint there, and things break.
A patch that eliminates the special thread hop code in infrun.c is
what exposed this, as after that GDB solely relies on
bpstat_check_breakpoint_conditions to know whether the right or wrong
task hit a breakpoint. IOW, given the latent bug, Ada task-specific
breakpoints become non-task-specific, and that is caught by the
testsuite, as:
break break_me task 3
Breakpoint 2 at 0x4030b0: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb, line 27.
(gdb) PASS: gdb.ada/tasks.exp: break break_me task 3
continue
Continuing.
[Switching to Thread 0x7ffff7fcb700 (LWP 17122)]
Breakpoint 2, foo.break_me () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.ada/tasks/foo.adb:27
27 null;
(gdb) PASS: gdb.ada/tasks.exp: continue to breakpoint
info tasks
ID TID P-ID Pri State Name
1 63b010 48 Waiting on RV with 2 main_task
* 2 63bd80 1 48 Accepting RV with 1 task_list(1)
3 63f510 1 48 Accept or Select Term task_list(2)
4 642ca0 1 48 Accept or Select Term task_list(3)
(gdb) FAIL: gdb.ada/tasks.exp: info tasks after hitting breakpoint
It was after seeing this that I thought of how to expose the bug with
current mainline.
Tested on x86_64 Fedora 17.
gdb/
2014-02-26 Pedro Alves <palves@redhat.com>
* breakpoint.c (bpstat_check_breakpoint_conditions): Handle
task-specific breakpoints.
gdb/testsuite/
2014-02-26 Pedro Alves <palves@redhat.com>
* gdb.ada/tasks.exp: Set a task-specific breakpoint at break_me
that won't ever trigger. Make sure that GDB reports the correct
breakpoint that caused the stop.
Dan Mick [Wed, 26 Feb 2014 12:05:02 +0000 (12:05 +0000)]
Resolve PR ld/16569 by emitting (and comparing) unmangled names, unless
demangling has specifically been requested.
Pedro Alves [Wed, 26 Feb 2014 01:45:50 +0000 (20:45 -0500)]
Re-implement ia64-linux-nat.c::ia64_linux_xfer_partial
[description of this patch and ChangeLog entry by Joel Brobecker]
The recent implementation was questionable, and if it worked, it was
only by chance because the requested length is large enough that only
one read was sufficient. Note that the implementation before that
also made that assumption, in the form of only handling
TARGET_OBJECT_UNWIND_TABLE xfer requests when offset was zero.
gdb/ChangeLog:
* ia64-linux-nat.c (ia64_linux_xfer_partial): Reimplement
handling of object == TARGET_OBJECT_UNWIND_TABLE.
Stan Shebs [Tue, 25 Feb 2014 23:47:58 +0000 (15:47 -0800)]
Annotate comments for Doxygen.
Alan Modra [Tue, 25 Feb 2014 23:00:38 +0000 (09:30 +1030)]
daily update
Jan Kratochvil [Tue, 25 Feb 2014 19:47:09 +0000 (20:47 +0100)]
PR gdb/16626
gdb/testsuite/
2014-02-25 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16626
* gdb.base/auto-load.exp: Fix out-of-srctree run.
Message-ID: <87k3cjt3jl.fsf@fleche.redhat.com>
Tom Tromey [Mon, 24 Feb 2014 21:57:14 +0000 (14:57 -0700)]
remove target_ignore
This removes target_ignore, which isn't used any more.
2014-02-25 Tom Tromey <tromey@redhat.com>
* target.h (target_ignore): Don't declare.
* target.c (target_ignore): Remove.
Jan Kratochvil [Tue, 25 Feb 2014 17:32:32 +0000 (18:32 +0100)]
PR gdb/16626
Fix auto-load 7.7 regression,
the regression affects any loading from /usr/share/gdb/auto-load .
5b2bf9471f1499bee578fcd60c05afe85794e280 is the first bad commit
commit
5b2bf9471f1499bee578fcd60c05afe85794e280
Author: Doug Evans <xdje42@gmail.com>
Date: Fri Nov 29 21:29:26 2013 -0800
Move .debug_gdb_script processing to auto-load.c.
Simplify handling of auto-loaded objfile scripts.
Fedora 20 x86_64
$ gdb -q /usr/lib64/libgobject-2.0.so
Reading symbols from /usr/lib64/libglib-2.0.so.0.3800.2...Reading symbols from
/usr/lib/debug/usr/lib64/libglib-2.0.so.0.3800.2.debug...done.
done.
(gdb) _
Fedora Rawhide x86_64
$ gdb -q /usr/lib64/libgobject-2.0.so
Reading symbols from /usr/lib64/libglib-2.0.so...Reading symbols from
/usr/lib/debug/usr/lib64/libglib-2.0.so.0.3990.0.debug...done.
done.
warning: File "/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py" auto-loading has been declined by your `auto-load safe-path'
set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
add-auto-load-safe-path /usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
line to your configuration file "/home/jkratoch/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/jkratoch/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) _
That is it tries to load "forbidden"
/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
but it should load instead
/usr/share/gdb/auto-load/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py*
Although that is also not exactly this way, there does not exist any
/usr/lib64/libglib-2.0.so.0.3990.0-gdb.py
despite regressed GDB says so.
gdb/
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16626
* auto-load.c (auto_load_objfile_script_1): Change filename to
debugfile.
gdb/testsuite/
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16626
* gdb.base/auto-load-script: New file.
* gdb.base/auto-load.c: New file.
* gdb.base/auto-load.exp: New file.
Message-ID: <
20140223212400.GA8831@host2.jankratochvil.net>
Jan Kratochvil [Tue, 25 Feb 2014 17:28:38 +0000 (18:28 +0100)]
Fix dw2-icycle.exp -fsanitize=address GDB crash.
binutils readelf -wi:
<4><a2>: Abbrev Number: 26 (DW_TAG_inlined_subroutine)
<a3> DW_AT_abstract_origin: <0x5a>
<a7> DW_AT_low_pc : 0x400590
<ab> DW_AT_high_pc : 0x4
<af> DW_AT_call_file : 1
<b0> DW_AT_call_line : 20
<b1> DW_AT_sibling : <0xb8>
<2><b8>: Abbrev Number: 35 (DW_TAG_inlined_subroutine)
<b9> DW_AT_abstract_origin: <0x5a>
<bd> DW_AT_low_pc : 0x400590
<c1> DW_AT_high_pc : 0x4
<c5> DW_AT_call_file : 1
<c6> DW_AT_call_line : 29
<b1> DW_AT_sibling points to the next DIE - but that DIE is 2 levels
upwards - definitely not a sibling. This confuses GDB up to a crash:
==32143== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6024000198ac at pc 0xb4d104 bp 0x7fff63e96e70 sp
0x7fff63e96e60
READ of size 1 at 0x6024000198ac thread T0
#0 0xb4d103 in read_unsigned_leb128 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb4d103)
#1 0xb15f3c in peek_die_abbrev (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb15f3c)
#2 0xb46185 in load_partial_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb46185)
#3 0xb103fb in process_psymtab_comp_unit_reader (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb103fb)
#4 0xb0d2a9 in init_cutu_and_read_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb0d2a9)
#5 0xb1115f in process_psymtab_comp_unit (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1115f)
#6 0xb1235f in dwarf2_build_psymtabs_hard (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1235f)
#7 0xb05536 in dwarf2_build_psymtabs (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb05536)
#8 0x86d5a5 in read_psyms (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x86d5a5)
#9 0x9b1c37 in require_partial_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9b1c37)
#10 0x9bf2d0 in read_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9bf2d0)
#11 0x9c014c in syms_from_objfile_1 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9c014c)
gdb/testsuite/
2014-02-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix dw2-icycle.exp -fsanitize=address GDB crash.
* gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling.
Message-ID: <
20140224201011.GA28926@host2.jankratochvil.net>
Ilya Tocar [Thu, 20 Feb 2014 15:08:13 +0000 (19:08 +0400)]
Remove bogus vcvtps2ph variant.
We currently support version of vcvtps2ph with sae and only 1 register operand.
This version is encoded as if missing operand was equal to ymm0.
I didn't found any references to this variant in
http://download-software.intel.com/sites/default/files/managed/50/1a/319433-018.pdf
This patch removes it.
opcodes/
* i386-opc.tbl: Remove wrong variant of vcvtps2ph
* i386-tbl.h: Regenerate.
Joel Brobecker [Tue, 25 Feb 2014 14:58:25 +0000 (09:58 -0500)]
Adjust ia64_linux_xfer_partial following to_xfer_partial API change.
ia64-linux-nat.c no longer compiles because ia64_linux_xfer_partial
no longer matches the to_xfer_partial prototype. This patch fixes
the problem by adjusting it accordingly.
gdb/ChangeLog:
* ia64-linux-nat.c (ia64_linux_xfer_partial): Add function
documentation. Adjust prototype to match the target_ops
to_xfer_partial method. Adjust implementation accordingly.
Hui Zhu [Tue, 25 Feb 2014 15:59:47 +0000 (23:59 +0800)]
Fix a format issue of ChangeLog.
Hui Zhu [Tue, 25 Feb 2014 15:55:42 +0000 (23:55 +0800)]
2014-02-25 Hui Zhu <hui@codesourcery.com>
* target.h (target_ops): Fix TARGET_DEFAULT_RETURN of
to_traceframe_info.
Kevin Buettner [Tue, 25 Feb 2014 07:32:45 +0000 (00:32 -0700)]
Use 16-bit integer type for rl78 register pairs.
This patch changes rl78-tdep.c so that a 16-bit type is used for
register pairs instead of a pointer type as was previously the case.
This will cause these register pairs to be displayed as integers
instead of as a data address with a 0xf0000 ORed in.
E.g. registers ax, bc, de, and hl might now be displayed like this:
(gdb) info registers ax bc de hl
ax 0x6 6
bc 0x0 0
de 0x10c3 4291
hl 0x108d 423
Whereas, before, they were displayed as follows:
(gdb) info registers ax bc de hl
ax 0xf0006 0xf0006
bc 0xf0000 0xf0000
de 0xf10c3 0xf10c3
hl 0xf108d 0xf108d
These pairs are 16 bit quantities and should be displayed as such.
This change also affects the way that the banked register pairs are
displayed. Within GDB, the banked register pairs are named bank0_rp0,
bank0_rp1, .., bank3_rp2, bank3_rp3.
However, these register pairs need to be used as addresses in DWARF
expressions. I have added 16 pseudo registers corresponding to banked
register pairs. These new pseudo registers are all hidden from the
user and have a pointer type. Values from these registers are
intended to be used in DWARF expressions. Therefore,
rl78_dwarf_reg_to_regnum() has been adjusted to return these new
pseudo register numbers.
I had a much simpler patch which only changed the types, but it showed
a number of regressions due to integer values from the banked register
pairs being used as part of an address expression. This current patch
shows no regressions and now displays values of register pairs
correctly.
* rl78-tdep.c ( RL78_BANK0_RP0_PTR_REGNUM, RL78_BANK0_RP1_PTR_REGNUM)
(RL78_BANK0_RP2_PTR_REGNUM, RL78_BANK0_RP3_PTR_REGNUM)
(RL78_BANK1_RP0_PTR_REGNUM, RL78_BANK1_RP1_PTR_REGNUM)
(RL78_BANK1_RP2_PTR_REGNUM, RL78_BANK1_RP3_PTR_REGNUM)
(RL78_BANK2_RP0_PTR_REGNUM, RL78_BANK2_RP1_PTR_REGNUM)
(RL78_BANK2_RP2_PTR_REGNUM, RL78_BANK2_RP3_PTR_REGNUM)
(RL78_BANK3_RP0_PTR_REGNUM, RL78_BANK3_RP1_PTR_REGNUM)
(RL78_BANK3_RP2_PTR_REGNUM, RL78_BANK3_RP3_PTR_REGNUM):
New constants.
(rl78_register_type): Use a data pointer type for SP and
new pseudo registers mentioned above. Use a 16 bit integer
type for all other register pairs.
(rl78_register_name, rl78_g10_register_name): Update for
new pseudo registers.
(rl78_pseudo_register_read): Likewise.
(rl78_pseudo_register_write): Likewise.
(rl78_dwarf_reg_to_regnum): Return register numbers representing
to the newly added pseudo registers.
Alan Modra [Mon, 24 Feb 2014 23:00:39 +0000 (09:30 +1030)]
daily update
Doug Evans [Mon, 24 Feb 2014 22:01:45 +0000 (14:01 -0800)]
* value.c (record_latest_value): Fix comment.
* printcmd.c (print_command_1): Remove code to handle -1 return from
record_latest_value.
Doug Evans [Mon, 24 Feb 2014 21:39:14 +0000 (13:39 -0800)]
lib/gdb.exp (run_on_host): Log error output if program fails.
Pedro Alves [Wed, 19 Feb 2014 20:29:31 +0000 (20:29 +0000)]
procfs.c: Don't install a deprecated_xfer_memory method
This removes yet another instance of a deprecated_xfer_memory user,
and fixes a nasty regression as a side-effect:
(gdb) start
Temporary breakpoint 1 at 0x19070: file simple_main.adb, line 4.
Starting program: /[...]/simple_main
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x19070
Cannot insert breakpoint -3.
Temporarily disabling shared library breakpoints:
breakpoint #-3
The regression was introduced by the to_xfer_partial transition
to return a status enum. procfs_xfer_partial was updated but
not the case where object is TARGET_OBJECT_MEMORY. As result,
procfs_xfer_partial was returning the length xfered rather than
the status, and the xfered buffer was left uninitialized.
gdb/
2014-02-19 Pedro Alves <palves@redhat.com>
* procfs.c (procfs_target): Don't install procfs_xfer_memory as
deprecated_xfer_memory hook.
(procfs_xfer_partial): Call procfs_xfer_memory instead
of the deprecated_xfer_memory target hook.
(procfs_xfer_memory): Adjust interface as a to_xfer_partial
helper.
Yuanhui Zhang [Mon, 24 Feb 2014 07:22:10 +0000 (15:22 +0800)]
Fix a GDB assert failure on windows
A GDB internal error is found on native mingw32 target.
(gdb) run
../../binutils-gdb/gdb/target.c:1483: internal-error:
target_xfer_partial: Assertion `*xfered_len > 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
This error was introduced by the following snippet in commit
9b409511d07fe375284701af34909fb539029caf
> @@ -2536,27 +2538,30 @@ windows_xfer_shared_libraries (struct target_ops *ops,
> }
>
> obstack_free (&obstack, NULL);
> - return len;
> + *xfered_len = (ULONGEST) len;
> + return TARGET_XFER_OK;
> }
In the original code, len is returned, which could be 0, but after that
commit, only TARGET_XFER_OK is returned, which is wrong. If len is 0,
TARGET_XFER_EOF should be returned. (it is 0 in enum
target_xfer_status declaration).
gdb:
2014-02-24 Yuanhui Zhang <asmwarrior@gmail.com>
* windows-nat.c (windows_xfer_shared_libraries): Return
TARGET_XFER_EOF if LEN is zero to fix an assert failure when
requested object is TARGET_OBJECT_LIBRARIES.
Yao Qi [Sun, 23 Feb 2014 06:34:29 +0000 (14:34 +0800)]
Rename TARGET_XFER_E_UNAVAILABLE to TARGET_XFER_UNAVAILABLE
Nowadays, TARGET_XFER_E_UNAVAILABLE isn't regarded as an error in
to_xfer_partial interface, so _E_ looks odd. This patch is to
replace TARGET_XFER_E_UNAVAILABLE with TARGET_XFER_UNAVAILABLE,
and change its value from -2 to 2. Since there is no comparison
on the value of 'enum target_xfer_status', so it should be safe.
gdb:
2014-02-24 Yao Qi <yao@codesourcery.com>
* target.h (enum target_xfer_status)
<TARGET_XFER_E_UNAVAILABLE>: Rename it to ...
<TARGET_XFER_UNAVAILABLE>: ... it with setting value 2
explicitly. New.
* corefile.c (memory_error_message): User updated.
* exec.c (section_table_read_available_memory): Likewise.
* record-btrace.c (record_btrace_xfer_partial): Likewise.
* target.c (target_xfer_status_to_string): Likewise.
(raw_memory_xfer_partial): Likewise.
(memory_xfer_partial_1, target_xfer_partial): Likewise.
* valops.c (read_value_memory): Likewise.
* exec.h: Update comments.
Yao Qi [Sun, 23 Feb 2014 06:27:17 +0000 (14:27 +0800)]
Tweak target_xfer_status_to_string
This patch tweaks target_xfer_status_to_string on comments and argument
name.
gdb:
2014-02-24 Yao Qi <yao@codesourcery.com>
* target.c (target_xfer_status_to_string): Rename argument err
to status.
* target.h (target_xfer_status_to_string): Update declaration.
Replace target_xfer_error_to_string with
target_xfer_status_to_string in comment.
Yao Qi [Mon, 24 Feb 2014 04:03:05 +0000 (12:03 +0800)]
Unbreak mips native build
When I build mips native gdb today, I get the follow error,
../../../git/gdb/mips-linux-nat.c: In function '_initialize_mips_linux_nat':
../../../git/gdb/mips-linux-nat.c:792:15: error: assignment from incompatible pointer type [-Werror]
cc1: all warnings being treated as errors
It looks an oversight of recent target_ops delegation patches. This
patch is to fix the build error.
gdb:
2014-02-24 Yao Qi <yao@codesourcery.com>
* mips-linux-nat.c (super_close): Update its type.
(mips_linux_close): Pass 'self' to super_close.
Yao Qi [Sun, 23 Feb 2014 04:24:08 +0000 (12:24 +0800)]
Remove TARGET_XFER_STATUS_ERROR_P
This patch removes macro TARGET_XFER_STATUS_ERROR_P, as Pedro pointed
out during patches review that TARGET_XFER_STATUS_ERROR_P tends to
be unnecessary.
gdb:
2014-02-24 Yao Qi <yao@codesourcery.com>
* target.h (TARGET_XFER_STATUS_ERROR_P): Remove.
* corefile.c (read_memory): Adjusted.
* target.c (target_write_with_progress): Adjusted.
Alan Modra [Sun, 23 Feb 2014 23:00:35 +0000 (09:30 +1030)]
daily update
Yao Qi [Mon, 16 Dec 2013 13:13:36 +0000 (21:13 +0800)]
Revert previous tweaks
As we migrate to the new to_xfer_partial interface, some of previous
tweaks become unnecessary, we don't have to check traceframe is
selected in each target implementation, so this patch below is
reverted.
[PATCH] Send qXfer:traceframe-info:read when traceframe is selected.
https://sourceware.org/ml/gdb-patches/2013-10/msg00752.html
Third, to_traceframe_info is only called when traceframe is selected,
that means it is only called when target is remote, tfile or ctf, so
this patch can be partially reverted,
https://sourceware.org/ml/gdb-patches/2013-04/msg00000.html
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
Revert two patches:
2013-10-25 Yao Qi <yao@codesourcery.com>
* remote.c (remote_traceframe_info): Return early if
traceframe is not selected.
2013-07-19 Yao Qi <yao@codesourcery.com>
* target.c (update_current_target): Change the default action
of 'to_traceframe_info' from tcomplain to return_zero.
* target.h (struct target_ops) <to_traceframe_info>: Add more
comments.
Yao Qi [Tue, 5 Nov 2013 01:50:21 +0000 (09:50 +0800)]
Adjust read_value_memory to use to_xfer_partial
As the new to_xfer_partial implementations are done in ctf and tfile
targets, read_value_memory can be simplified a lot. Call
target_xfer_partial in a loop, check return value, and set bytes
unavailable when necessary.
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
* valops.c (read_value_memory): Rewrite it. Call
target_xfer_partial in a loop.
* exec.h (section_table_available_memory): Remove declaration.
Move comments to ...
* exec.c (section_table_available_memory): ... here. Make it static.
Yao Qi [Tue, 11 Feb 2014 04:20:05 +0000 (12:20 +0800)]
Use new to_xfer_partial interface in ctf and tfile target
This patch adjust both ctf and tfile target implementation of to_xfer_partial,
to return TARGET_XFER_E_UNAVAILABLE and set *XFERED_LEN if data is
unavailable. Note that some code on xfer in exec.c can be shared, but
we can do it in a separate pass later.
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
* exec.c (section_table_read_available_memory): New function.
* exec.h (section_table_read_available_memory): Declare.
* ctf.c (ctf_xfer_partial): Call
section_table_read_available_memory.
* tracefile-tfile.c (tfile_xfer_partial): Likewise.
Yao Qi [Mon, 10 Feb 2014 09:17:32 +0000 (17:17 +0800)]
Share code on to_xfer_partial for tfile and ctf target
In the to_xfer_partial implementations of ctf and tfile, the code on
reading from read-only sections is duplicated. This patch moves it to
a separate function exec_read_partial_read_only.
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
* ctf.c (ctf_xfer_partial): Move code to ...
* exec.c (exec_read_partial_read_only): ... it. New function.
* tracefile-tfile.c (tfile_xfer_partial): Likewise.
* tracefile.c: Include "exec.h".
* exec.h (exec_read_partial_read_only): Declare.
Yao Qi [Mon, 10 Feb 2014 07:28:33 +0000 (15:28 +0800)]
Let tracefile has_memory and has_all_memory.
At present, tfile target thinks it has memory but ctf doesn't.
This is an oversight when I added ctf target support. This patch
moves the implementations of to_has_all_memory and to_has_memory to
upper layer. After this change, both tfile and ctf target think
they have memory.
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
* tracefile-tfile.c (tfile_has_all_memory): Remove.
(tfile_has_memory): Remove.
(init_tfile_ops): Don't set fields to_has_all_memory and
to_has_memory of tfile_ops.
* tracefile.c (tracefile_has_all_memory): New function.
(tracefile_has_memory): New function.
(init_tracefile_ops): Initialize fields to_has_all_memory and
to_has_memory of 'ops'.
Yao Qi [Mon, 10 Feb 2014 07:22:55 +0000 (15:22 +0800)]
Share some code between ctf and tfile target.
This patch move the duplicated code between tfile and ctf
targets into file tracefile.c. The common part of target_ops
fields are set in init_tracefile_ops.
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
* ctf.c (ctf_has_stack, ctf_has_registers): Remove.
(ctf_thread_alive, ctf_get_trace_status): Remove.
(init_ctf_ops): Don't set some fields of ctf_ops. Call
init_tracefile_ops.
* tracefile-tfile.c (tfile_get_trace_status): Remove.
(tfile_has_stack, tfile_has_registers): Remove.
(tfile_thread_alive): Remove.
(init_tfile_ops): Don't set some fields of tfile_ops. Call
init_tracefile_ops.
* tracefile.c (tracefile_has_stack): New function.
(tracefile_has_registers): New function.
(tracefile_thread_alive): New function.
(tracefile_get_trace_status): New function.
(init_tracefile_ops): New function.
* tracefile.h (init_tracefile_ops): Declare.
Yao Qi [Mon, 10 Feb 2014 06:38:26 +0000 (14:38 +0800)]
Move tfile target to tracefile-tfile.c
This patch moves tfile target related code from tracepoint.c to
tracefile-tfile.c.
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
* tracepoint.c (TFILE_PID): Move it to tracefile-tfile.c.
(O_LARGEFILE): Likewise.
(tfile_ops): Likewise.
(TRACE_HEADER_SIZE): Likewise.
(trace_fd, trace_frames_offset, cur_offset): Likewise.
(cur_data_size): Likewise.
(tfile_read, tfile_open, tfile_interp_line): Likewise.
(tfile_close, tfile_files_info): Likewise.
(tfile_get_trace_status): Likewise.
(tfile_get_tracepoint_status): Likewise.
(tfile_get_traceframe_address): Likewise.
(tfile_trace_find, match_blocktype): Likewise.
(traceframe_walk_blocks, traceframe_find_block_type): Likewise.
(tfile_fetch_registers, tfile_xfer_partial): Likewise.
(tfile_get_trace_state_variable_value): Likewise.
(tfile_has_all_memory, tfile_has_memory): Likewise.
(tfile_has_stack, tfile_has_registers): Likewise.
(tfile_thread_alive, build_traceframe_info): Likewise.
(tfile_traceframe_info, init_tfile_ops): Likewise.
(_initialize_tracepoint): Don't call init_tfile_ops
and add_target_with_completer.
* tracefile-tfile.c: Include regcache.h, inferior.h, gdbthread.h,
exec.h, completer.h and filenames.h.
(_initialize_tracefile_tfile): New function.
Yao Qi [Mon, 10 Feb 2014 05:31:12 +0000 (13:31 +0800)]
Move trace file writer out of tracepoint.c
This patch is a refactor which moves trace file writer related code
out of tracepoint.c, which has 6k LOC. It moves general trace file
writer to a new file tracefile.c and moves tfile specific writer to
tracefile-tfile.c.
gdb:
2014-02-23 Yao Qi <yao@codesourcery.com>
* Makefile.in (REMOTE_OBS): Append tracefile.o and
tracefile-tfile.o.
(HFILES_NO_SRCDIR): Add tracefile.h.
* ctf.c: Include "tracefile.h".
* tracefile.h: New file.
* tracefile.c: New file
* tracefile-tfile.c: New file.
* tracepoint.c: Include "tracefile.h".
(free_uploaded_tps, free_uploaded_tsvs): Remove declarations.
(stop_reason_names): Add const.
(trace_file_writer_xfree): Move it to tracefile.c.
(trace_save, trace_save_command, trace_save_tfile): Likewise.
(trace_save_ctf): Likewise.
(struct tfile_trace_file_writer): Move it to tracefile-tfile.c.
(tfile_target_save, tfile_dtor, tfile_start): Likewise.
(tfile_write_header, tfile_write_regblock_type): Likewise.
(tfile_write_status, tfile_write_uploaded_tsv): Likewise.
(tfile_write_uploaded_tp, tfile_write_definition_end): Likewise.
(tfile_write_raw_data, tfile_end): Likewise.
(tfile_trace_file_writer_new): Likewise.
(free_uploaded_tp): Make it extern.
(free_uploaded_tsv): Make it extern.
(_initialize_tracepoint): Move code to register command 'tsave'
to tracefile.c.
* tracepoint.h (stop_reason_names): Declare.
(struct trace_frame_write_ops): Move it to tracefile.h.
(struct trace_file_write_ops): Likewise.
(struct trace_file_writer): Likewise.
(free_uploaded_tsvs, free_uploaded_tps): Declare.
Alan Modra [Sat, 22 Feb 2014 23:00:37 +0000 (09:30 +1030)]
daily update
Alan Modra [Fri, 21 Feb 2014 23:00:38 +0000 (09:30 +1030)]
daily update
Jan Kratochvil [Fri, 21 Feb 2014 17:39:40 +0000 (18:39 +0100)]
Fix crash on process name "(sd-pam)" (PR 16594).
info os processes -fsanitize=address error
https://sourceware.org/bugzilla/show_bug.cgi?id=16594
info os processes
=================================================================
==5795== ERROR: AddressSanitizer: heap-use-after-free on address
0x600600214974 at pc 0x757a92 bp 0x7fff95dd9f00 sp 0x7fff95dd9ef0
READ of size 4 at 0x600600214974 thread T0
#0 0x757a91 in get_cores_used_by_process (.../gdb/gdb+0x757a91)
At least Fedora 20 has process(es):
6678 ? Ss 0:00 /usr/lib/systemd/systemd --user
6680 ? S 0:00 \_ (sd-pam)
and GDB "info os processes" crashes on it as /proc/6680/stat contains:
6680 ((sd-pam)) S 6678 6678 6678 0 -1
1077961024 33 0 0 0 0 0 0 0 20 0 1 0 18568
73768960 120
18446744073709551615 1 1
0 0 0 0 0 4096 0
18446744073709551615 0 0 17 6 0 0 0 0 0 0 0 0 0 0 0 0 0
and GDB fails to find the proper end of the process name "((sd-pam))".
Therefore it reads core number off-by-one (it reads 17 instead of 6) and
overruns the array.
(1) Make the process name parsing more foolproof.
(2) Do not trust the parsed number from /proc/PID/stat and verify it against
the array size.
I noticed that 'ps' gets this right, so I've peeked at its
sources, and it just looks for the first ')' starting at
the end.
https://gitorious.org/procps/procps/source/
dc072aced7250fed9b01fb05f0d672678752a63e:proc/readproc.c
Look for stat2proc.
Given ps does that, I believe the kernel won't ever be changed
in a way that would break it. So it sounds like could do strrchr
from the end of stat just as well without worry, which is simpler.
gdb/
2014-02-21 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/16594
* common/linux-osdata.c (linux_common_core_of_thread): Find the end of
process name.
(get_cores_used_by_process): New parameter num_cores, use it.
(linux_xfer_osdata_processes): Pass num_cores to it.
* linux-tdep.c (linux_info_proc, linux_fill_prpsinfo): Find the end of
process name.
Message-ID: <
20140217212826.GA15080@host2.jankratochvil.net>
Ilya Tocar [Thu, 20 Feb 2014 14:57:31 +0000 (18:57 +0400)]
Add support for CPUID PREFETCHWT1
Latest AVX512 spec
http://download-software.intel.com/sites/default/files/managed/50/1a/319433-018.pdf
Has CPUID PREFETCHWT1 for prefetchwt1 instruction, which we list as AVX512PF.
This patch introduces CPUID PREFETCHWT1.
gas/
* config/tc-i386.c (cpu_arch): Add .prefetchwt1.
* doc/c-i386.texi: Document .prefetchwt1/prefetchwt1.
opcodes/
* i386-gen.c (cpu_flag_init): Add CPU_PREFETCHWT1_FLAGS/
(cpu_flags): Add CpuPREFETCHWT1.
* i386-init.h: Regenerate.
* i386-opc.h (CpuPREFETCHWT1): New.
(i386_cpu_flags): Add cpuprefetchwt1.
* i386-opc.tbl: Cahnge CPU of prefetchwt1 from CpuAVX512PF to CpuPREFETCHWT1.
* i386-tbl.h: Regenerate.
gas/testsuite
* gas/i386/avx512pf-intel.d: Remove prefetchwt1.
* gas/i386/avx512pf.s: Ditto.
* gas/i386/avx512pf.d: Ditto.
* gas/i386/x86-64-avx512pf-intel.d: Ditto.
* gas/i386/x86-64-avx512pf.s: Ditto.
* gas/i386/x86-64-avx512pf.d: Ditto.
* gas/i386/prefetchwt1-intel.d: New file.
* gas/i386/prefetchwt1.s: Ditto.
* gas/i386/prefetchwt1.d: Ditto.
* gas/i386/x86-64-prefetchwt1-intel.d: Ditto.
* gas/i386/x86-64-prefetchwt1.s: Ditto.
* gas/i386/x86-64-prefetchwt1.d: Ditto.
Andreas Krebbel [Fri, 21 Feb 2014 14:55:37 +0000 (15:55 +0100)]
Fix length arg in call to breakpoint_xfer_memory.
The patch "return target_xfer_status in to_xfer_partial" caused a
regression in various s390(x) test cases, because memory_xfer_partial
filled only the first byte of the read buffer from a breakpoint shadow:
https://sourceware.org/ml/gdb-patches/2014-01/msg01071.html
This patch fixes the regression.
Pedro Alves [Fri, 21 Feb 2014 13:30:12 +0000 (13:30 +0000)]
Rename test.
I realized that the name of this test only made sense when considering
the old (never committed) implementation of the fix that came along
with the test originally, that forced a schedlock while a step-resume
(to get over the signal handler) was inserted. The final solution
that went into the tree does not force that locking.
So this renames it to something more descriptive.
gdb/testsuite/
2014-02-21 Pedro Alves <palves@redhat.com>
* gdb.threads/step-after-sr-lock.c: Rename to ...
* gdb.threads/signal-while-stepping-over-bp-other-thread.c: ... this.
* gdb.threads/step-after-sr-lock.exp: Rename to ...
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
... this.
Alan Modra [Fri, 21 Feb 2014 12:48:50 +0000 (23:18 +1030)]
Add file missed from last commit.
Alan Modra [Thu, 20 Feb 2014 23:48:01 +0000 (10:18 +1030)]
Add ppc476 workaround bootstrap test
I was running this by hand to test out --ppc476-workaround. Another
bootstrap test doesn't take all that long, so let's add it to the
testsuite.
* ld-bootstrap/bootstrap.exp: Add ppc476 workaround test.
* ld-bootstrap/ppc476.t: New file.
Alan Modra [Thu, 20 Feb 2014 23:00:38 +0000 (09:30 +1030)]
daily update
Sergio Durigan Junior [Thu, 20 Feb 2014 21:49:09 +0000 (18:49 -0300)]
Fix for PR tdep/16397: SystemTap SDT probe support for x86 doesn't work with "triplet operands"
This is the continuation of what Joel proposed on:
<https://sourceware.org/ml/gdb-patches/2013-12/msg00977.html>
Now that I have already submitted and pushed the patch to split
i386_stap_parse_special_token into two smaller functions, it is indeed
simpler to understand this patch.
It occurs because, on x86, triplet displacement operands are allowed
(like "-4+8-20(%rbp)"), and the current parser for this expression is
buggy. It does not correctly extract the register name from the
expression, which leads to incorrect evaluation. The parser was also
being very "generous" with the expression, so I included a few more
checks to ensure that we're indeed dealing with a triplet displacement
operand.
This patch also includes testcases for the two different kind of
expressions that can be encountered on x86: the triplet displacement
(explained above) and the three-argument displacement (as in
"(%rbx,%ebx,-8)"). The tests are obviously arch-dependent and are
placed under gdb.arch/.
Message-ID: <m3mwj1j12v.fsf@redhat.com>
URL: <https://sourceware.org/ml/gdb-patches/2014-01/msg00310.html>
gdb/
2014-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR tdep/16397
* i386-tdep.c (i386_stap_parse_special_token_triplet): Check if a
number comes after the + or - signs. Adjust length of register
name to be extracted.
gdb/testsuite/
2014-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR tdep/16397
* gdb.arch/amd64-stap-special-operands.exp: New file.
* gdb.arch/amd64-stap-three-arg-disp.S: Likewise.
* gdb.arch/amd64-stap-three-arg-disp.c: Likewise.
* gdb.arch/amd64-stap-triplet.S: Likewise.
* gdb.arch/amd64-stap-triplet.c: Likewise.
Doug Evans [Thu, 20 Feb 2014 21:33:44 +0000 (13:33 -0800)]
Add single sentence description to top of entry of previous commit.
Tom Tromey [Thu, 20 Feb 2014 21:05:32 +0000 (14:05 -0700)]
mark *_varobj_ops as "extern"
The AIX linker pointed out that gdb had multiple definitions of the
various *_varobj_ops objects. This patch fixes the problem by marking
the declarations as "extern" in varobj.h. Tested by rebuilding on
x86-64 Fedora 18 and on AIX.
2014-02-20 Tom Tromey <tromey@redhat.com>
* varobj.h (c_varobj_ops, cplus_varobj_ops, java_varobj_ops)
(ada_varobj_ops): Mark "extern".
Doug Evans [Thu, 20 Feb 2014 20:23:26 +0000 (12:23 -0800)]
Remove all_lwps global.
* inferiors.h (ptid_of): Move here from linux-low.h.
(pid_of, lwpid_of): Ditto.
* linux-aarch64-low.c (debug_reg_change_callback): Update, "entry"
parameter is a struct thread_info * now.
(aarch64_notify_debug_reg_change): Fetch pid from current_inferior
directly. Pass &all_threads to find_inferior instead of &all_lwps.
(aarch64_stopped_data_address): Fetch lwpid from current_inferior
directly.
(aarch64_linux_prepare_to_resume): Fetch ptid from thread.
(aarch64_arch_setup): Fetch lwpid from current_inferior directly.
* linux-arm-low.c (update_registers_callback): Update, "entry"
parameter is a struct thread_info * now.
Fetch lwpid from current_inferior directly.
(arm_insert_point): Pass &all_threads to find_inferior instead of
&all_lwps.
(arm_remove_point): Ditto.
(arm_stopped_by_watchpoint): Fetch lwp from current_inferior.
(arm_prepare_to_resume): Fetch pid from thread.
(arm_read_description): Fetch lwpid from current_inferior directly.
* linux-low.c (all_lwps): Delete.
(delete_lwp): Delete call to remove_inferior.
(handle_extended_wait): Fetch lwpid from thread.
(add_lwp): Don't set lwp->entry.id. Remove call to
add_inferior_to_list.
(linux_attach_lwp_1): Fetch pid from current_inferior directly.
(linux_kill_one_lwp): Fetch ptid,lwpid from thread.
(kill_one_lwp_callback): Ditto.
(linux_kill): Don't dereference NULL pointer.
Fetch ptid,lwpid from thread.
(get_detach_signal): Fetch ptid from thread.
(linux_detach_one_lwp): Fetch ptid,lwpid from thread.
Simplify call to regcache_invalidate_thread.
(delete_lwp_callback): Update, "entry" parameter is a
struct thread_info * now. Fetch pid from thread.
(linux_mourn): Pass &all_threads to find_inferior instead of &all_lwps.
(status_pending_p_callback): Update, "entry" parameter is a
struct thread_info * now. Fetch ptid from thread.
(find_lwp_pid): Update, "entry" parameter is a
struct thread_info * now.
(linux_wait_for_lwp): Fetch pid from thread.
(linux_fast_tracepoint_collecting): Fetch lwpid from thread.
(maybe_move_out_of_jump_pad): Fetch lwpid from current_inferior.
(enqueue_one_deferred_signal): Fetch lwpid from thread.
(dequeue_one_deferred_signal): Ditto.
(cancel_breakpoint): Fetch ptid from current_inferior.
(linux_wait_for_event): Pass &all_threads to find_inferior,
not &all_lwps. Fetch ptid, lwpid from thread.
(count_events_callback): Update, "entry" parameter is a
struct thread_info * now.
(select_singlestep_lwp_callback): Ditto.
(select_event_lwp_callback): Ditto.
(cancel_breakpoints_callback): Ditto.
(linux_cancel_breakpoints): Pass &all_threads to find_inferior,
not &all_lwps.
(select_event_lwp): Ditto. Fetch ptid from event_thread.
(unsuspend_one_lwp): Update, "entry" parameter is a
struct thread_info * now.
(unsuspend_all_lwps): Pass &all_threads to find_inferior,
not &all_lwps.
(linux_stabilize_threads): Ditto. And for for_each_inferior.
Fetch lwpid from thread, not lwp.
(linux_wait_1): Fetch ptid, lwpid from current_inferior.
Pass &all_threads to find_inferior, not &all_lwps.
(send_sigstop): Fetch lwpid from thread, not lwp.
(send_sigstop_callback): Update, "entry" parameter is a
struct thread_info * now.
(suspend_and_send_sigstop_callback): Ditto.
(wait_for_sigstop): Ditto. Fetch ptid, lwpid from thread, lwp.
(stuck_in_jump_pad_callback): Update, "entry" parameter is a
struct thread_info * now.
(move_out_of_jump_pad_callback): Ditto. Fetch ptid, lwpid
from thread, lwp.
(lwp_running): Update, "entry" parameter is a
struct thread_info * now.
(stop_all_lwps): Fetch ptid from thread.
Pass &all_threads to find_inferior, for_each_inferior, not &all_lwps.
(linux_resume_one_lwp): Fetch lwpid from thread.
(linux_set_resume_request): Update, "entry" parameter is a
struct thread_info * now. Fetch pid, lwpid from thread.
(resume_status_pending_p): Update, "entry" parameter is a
struct thread_info * now.
(need_step_over_p): Ditto. Fetch lwpid from thread.
(start_step_over): Fetch lwpid from thread.
(linux_resume_one_thread): Update, "entry" parameter is a
struct thread_info * now. Fetch lwpid from thread.
(linux_resume): Pass &all_threads to find_inferior, not &all_lwps.
(proceed_one_lwp): Update, "entry" parameter is a
struct thread_info * now. Fetch lwpid from thread.
(unsuspend_and_proceed_one_lwp): Update, "entry" parameter is a
struct thread_info * now.
(proceed_all_lwps): Pass &all_threads to find_inferior, not &all_lwps.
(unstop_all_lwps): Ditto. Fetch lwpid from thread.
(regsets_fetch_inferior_registers): Fetch lwpid from current_inferior
directly.
(regsets_store_inferior_registers): Ditto.
(fetch_register, store_register): Ditto.
(linux_read_memory, linux_write_memory): Ditto.
(linux_request_interrupt): Ditto.
(linux_read_auxv): Ditto.
(linux_xfer_siginfo): Ditto.
(linux_qxfer_spu): Ditto.
(linux_qxfer_libraries_svr4): Ditto.
* linux-low.h (ptid_of, pid_of, lwpid_of): Delete,
moved to inferiors.h.
(get_lwp): Delete.
(get_thread_lwp): Update.
(struct lwp_info): Delete member "entry". Simplify comment for
member "thread".
(all_lwps): Delete.
* linux-mips-low.c (mips_read_description): Fetch lwpid from
current_inferior directly.
(update_watch_registers_callback): Update, "entry" parameter is a
struct thread_info * now. Fetch pid from thread.
(mips_linux_prepare_to_resume): Fetch ptid from thread.
(mips_insert_point): Fetch lwpid from current_inferior.
Pass &all_threads to find_inferior, not &all_lwps.
(mips_remove_point): Pass &all_threads to find_inferior, not &all_lwps.
(mips_stopped_by_watchpoint): Fetch lwpid from current_inferior
directly.
(mips_stopped_data_address): Ditto.
* linux-s390-low.c (s390_arch_setup): Fetch pid from current_inferior
directly.
* linux-tile-low.c (tile_arch_setup): Ditto.
* linux-x86-low.c (x86_get_thread_area): Fetch lwpid from thread.
(update_debug_registers_callback): Update, "entry" parameter is a
struct thread_info * now. Fetch pid from thread.
(i386_dr_low_set_addr): Fetch pid from current_inferior directly.
Pass &all_threads to find_inferior, not &all_lwps.
(i386_dr_low_get_addr): Fetch ptid from current_inferior directly.
(i386_dr_low_set_control): Fetch pid from current_inferior directly.
Pass &all_threads to find_inferior, not &all_lwps.
(i386_dr_low_get_control): Fetch ptid from current_inferior directly.
(i386_dr_low_get_status): Ditto.
(x86_linux_prepare_to_resume): Fetch ptid from thread.
(x86_siginfo_fixup): Fetch lwpid from current_inferior directly.
(x86_linux_read_description): Ditto.
* proc-service.c (ps_getpid): Fetch pid from current_inferior directly.
Tom Tromey [Thu, 20 Feb 2014 19:14:23 +0000 (12:14 -0700)]
minor cleanup in dbxread.c
I happened to notice that last_o_file_start is write-only in
read_dbx_symtab. This patch removes it. Tested by rebuilding.
2014-02-20 Tom Tromey <tromey@redhat.com>
* dbxread.c (read_dbx_symtab): Remove last_o_file_start.
Doug Evans [Thu, 20 Feb 2014 19:11:34 +0000 (11:11 -0800)]
* inferiors.c (get_first_inferior): Fix buglet.
Joel Brobecker [Thu, 20 Feb 2014 17:34:45 +0000 (18:34 +0100)]
Simplify .section in dw2-icycle.S
The arm-elf assembler chokes on the extra parameters in the .section
pseudo-op, so this patch removes them.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-icycle.S: Remove second and third parameters
in .section pseudo-op.
Doug Evans [Thu, 20 Feb 2014 17:27:12 +0000 (09:27 -0800)]
Move containing_scm arg from gdbscm_fill_eqable_gsmob_ptr_slot
to gdbscm_init_eqable_gsmob.
* guile/scm-gsmob.c (gdbscm_init_eqable_gsmob): New arg containing_scm.
All callers updated.
(gdbscm_fill_eqable_gsmob_ptr_slot): Delete arg containing_scm.
All callers updated.
* guile/guile-internal.h (gdbscm_init_eqable_gsmob): Update.
(gdbscm_fill_eqable_gsmob_ptr_slot): Update.
Doug Evans [Thu, 20 Feb 2014 17:16:32 +0000 (09:16 -0800)]
fix whitespace in previous commit
Doug Evans [Thu, 20 Feb 2014 17:13:53 +0000 (09:13 -0800)]
Fix PR symtab/16581
* dwarf2read.c (struct die_info): New member in_process.
(reset_die_in_process): New function.
(process_die): Set it at the start, reset when returning.
(inherit_abstract_dies): Only call process_die if origin_child_die
not already being processed.
testsuite/
* gdb.dwarf2/dw2-icycle.S: New file.
* gdb.dwarf2/dw2-icycle.c: New file.
* gdb.dwarf2/dw2-icycle.exp: New file.
Joel Brobecker [Thu, 20 Feb 2014 16:18:47 +0000 (17:18 +0100)]
windows-nat.c: Bring comment back regarding handling of DLL load events.
This patch brings back a comment that got stripped down a bit too much
during a recent change.
gdb/ChangeLog:
* windows-nat.c (handle_unload_dll): Add function documentation.
(do_initial_windows_stuff): Add comment explaining why we wait
until after inferior initialization has finished before
processing all DLLs.
Ilya Tocar [Thu, 20 Feb 2014 14:31:11 +0000 (18:31 +0400)]
Change cpu for vptestnmd and vptestnmq instructions.
In latest release of AVX512 spec
http://download-software.intel.com/sites/default/files/managed/50/1a/319433-018.pdf
Vptestnmq and vptestnmq instructions have CPUID AVX512F, not AVX512CD.
This patch fixes it.
opcodes/
* i386-opc.tbl: Change CPU of vptestnmq, vptestnmd from CpuAVX512CD,
to CpuAVX512F.
* i386-tbl.h: Regenerate.
gas/testsuite/
* gas/i386/avx512cd-intel.d: Remove vptestnmq, vptestnmd.
* gas/i386/avx512cd.s: Ditto.
* gas/i386/avx512cd.d: Ditto.
* gas/i386/x86-64-avx512cd-intel.d: Ditto.
* gas/i386/x86-64-avx512cd.s: Ditto.
* gas/i386/x86-64-avx512cd.d: Ditto.
* gas/i386/avx512f-intel.d: Add vptestnmq, vptestnmd.
* gas/i386/avx512f.s: Ditto.
* gas/i386/avx512f.d: Ditto.
* gas/i386/x86-64-avx512f-intel.d: Ditto.
* gas/i386/x86-64-avx512f.s: Ditto.
* gas/i386/x86-64-avx512f.d: Ditto.
Joel Brobecker [Mon, 3 Feb 2014 11:10:48 +0000 (06:10 -0500)]
Simplify windows-nat.c::get_module_name
Now that get_module_name is no longer called for handling DLL events,
we can simplify it a bit, knowing that the only use is to get the
executable's filename.
While doing so, we adjusted the implementation a bit to avoid
references to DLLs, renamed it to make its more-targeted usage
more explicit, moved it right before the only function that uses it.
We also remove the use of hard-coded length for the buffers being
used.
gdb/ChangeLog:
* windows-nat.c (get_module_name): Delete.
(windows_get_exec_module_filename): New function, mostly
inspired from get_module_name.
(windows_pid_to_exec_file): Replace call to get_module_name
by call to windows_get_exec_module_filename.
Joel Brobecker [Mon, 3 Feb 2014 08:03:39 +0000 (03:03 -0500)]
Windows: Rely purely on event info when handling DLL load event
When a DLL gets loaded an the debugger gets a debug event about it,
the currently implementation in handle_load_dll currently tries to
fetch the DLL's name by first iterating over all DLLs known to
the system. It should be sufficient to rely on the name provided
with the event, however, especially in the situation we are now,
where we now know that we're past the statup phase for our inferior.
This patch therefore simplifies windows-nat.c::handle_load_dll to
only rely on the event's lpImageName.
It also updates the function's comment to document the assumption
regarding not being during the inferior's startup phase. And while
at it, it fixes the function documentation, which was probably
unintentionally inherited from another function (perhaps windows_wait).
gdb/ChangeLog:
* windows-nat.c (handle_load_dll): Rewrite this function's
introductory comment. Remove code using get_module_name
to get the DLL's name.
Joel Brobecker [Mon, 3 Feb 2014 07:32:40 +0000 (08:32 +0100)]
Ignore DLL load/unload events during inferior initialization.
This patch aims at simplifying DLL handling during the inferior
initialization (process creation during the "run", or during an
"attach"). Instead of processing each DLL load event, which is
sometimes incomplete, we ignore these events until the inferior
has completed its startup phase, and then just iterate over all
DLLs via EnumProcessModules.
gdb/ChangeLog:
* windows-nat.c (get_windows_debug_event): Ignore
LOAD_DLL_DEBUG_EVENT and UNLOAD_DLL_DEBUG_EVENT
if windows_initialization_done == 0.
(windows_add_all_dlls): Renames windows_ensure_ntdll_loaded.
Adjust implementation to always load all DLLs.
(do_initial_windows_stuff): Replace call to
windows_ensure_ntdll_loaded by call to windows_add_all_dlls.
Joel Brobecker [Fri, 31 Jan 2014 09:22:53 +0000 (04:22 -0500)]
Deprecate windows-specific dll-symbols command and aliases
The "dll-symbols" command, specific to native Windows platforms,
gives the impression that the symbols were not loaded, first
because it completes silently, and second because the "info shared"
output does not get updated after the command completes:
(gdb) dll-symbols C:\WINDOWS\syswow64\rpcrt4.dll
(gdb) info shared
From To Syms Read Shared Object Library
[...]
0x77e51000 0x77ee2554 No C:\WINDOWS\system32\rpcrt4.dll
(we exected the "Syms Read" column to read "Yes").
As far as I can tell, the symbols actually do get loaded, but completely
independently from the solib framework, which explains the silent
loading and the fact that the "Syms Read" column does not get updated.
See windows-nat.c::safe_symbol_file_add_stub, which calls symbol_file_add
instead of calling solib_add.
But, aside from the fact that the "Syms Read" status does not get
updated, I also noticed that it does not take into account the DLL's
actual load address when loading its symbols. As a result, I believe
that we get it wrong if the DLL does not get loaded at the prefered
address.
Rather than trying to fix this command, there does not seem to be
a reason other than historical for having Windows-specific commands
which essentially re-implements the "sharedlibrary" command. The
command interface is slightly different (the latter takes a regexp
rather than a plain filename), but it should be just as easy to use
the "sharedlibrary" command, or its "share" alias, as usisng the
"dll-symbols" command. For instance:
(gdb) share rpcrt4.dll
Reading symbols from C:\WINDOWS\system32\rpcrt4.dll...(no debugging symbols found)...done.
Loaded symbols for C:\WINDOWS\system32\rpcrt4.dll
(gdb) info shared
From To Syms Read Shared Object Library
[...]
0x77e51000 0x77ee2554 Yes (*) C:\WINDOWS\system32\rpcrt4.dll
This patch therefore deprecates the "dll-symbols" command, as well
as its two aliases "add-shared-symbol-files" and "assf", with a view
of deleting them as soon as the 7.8 branch gets cut.
gdb/ChangeLog:
* windows-nat.c (_initialize_windows_nat): Deprecate the
"dll-symbols" command. Turn the "add-shared-symbol-files"
and "assf" aliases into commands, and deprecate them as well.
* NEWS: Add entry explaining that "dll-symbols" and its two
aliases are now deprecated.
gdb/doc/ChangeLog:
* gdb.texinfo (Files): Document "add-shared-symbol-files"
and "assf" as being deprecated.
(Cygwin Native): Likewise for "dll-symbols".
(Non-debug DLL Symbols): Remove reference to "dll-symbols"
as a way to force the loading of symbols from a DLL.
Joel Brobecker [Thu, 20 Feb 2014 07:56:35 +0000 (08:56 +0100)]
Fix ARI warning in thread-thread.c::dec_thread_get_ada_task_ptid
This patch fixes the following ARI warning:
gdb/dec-thread.c:695: regression: multi-line string: Multi-line string
must have the newline escaped
I think the new-line was unintentional, so I simply removed it,
and then reformatted the string to fit within our 70-80 max characters-
per-line rule.
gdb/ChangeLog:
* dec-thread.c (dec_thread_get_ada_task_ptid): Avoid unescaped
new-line in debug string. Remove trailing spaces.
Chung-Lin Tang [Thu, 20 Feb 2014 05:40:21 +0000 (21:40 -0800)]
2014-02-20 Chung-Lin Tang <cltang@codesourcery.com>
* elf32-nios2.c (nios2_elf32_relocate_section): Fix calculation
of GOTOFF relocations.
Stan Shebs [Thu, 20 Feb 2014 00:48:26 +0000 (16:48 -0800)]
darwin-nat.c (darwin_xfer_partial): Fix return type.
Doug Evans [Thu, 20 Feb 2014 00:38:44 +0000 (16:38 -0800)]
Add backlink from lwp_info to thread_info.
* gdbthread.h (add_thread): Change result type to struct thread_info *.
* inferiors.c (add_thread): Change result type to struct thread_info *.
All callers updated.
(add_lwp): Call add_thread here instead of in callers.
All callers updated.
* linux-low.h (get_lwp_thread): Rewrite.
(struct lwp_info): New member "thread".
This speeds up gdbserver attach in non-stop mode because now get_lwp_thread
doesn't do a linear search for the corresponding thread_info object.
Doug Evans [Thu, 20 Feb 2014 00:22:51 +0000 (16:22 -0800)]
* linux-low.c (add_lwp): Change result to struct lwp_info *.
All callers updated.
Doug Evans [Thu, 20 Feb 2014 00:19:10 +0000 (16:19 -0800)]
* inferiors.c (add_thread): Fix whitespace.
Siva Chandra [Mon, 2 Dec 2013 14:45:09 +0000 (06:45 -0800)]
Call overloaded operators to perform operations on gdb.Value objects.
* NEWS: Add entry for the new feature
* python/py-value.c (valpy_binop): Call value_x_binop for struct
and class values.
testsuite/
* gdb.python/py-value-cc.cc: Improve test case to enable testing
operations on gdb.Value objects.
* gdb.python/py-value-cc.exp: Add new test to test operations on
gdb.Value objects.
doc/
* python.texi (Values From Inferior): Add description about the
new feature.
Doug Evans [Wed, 19 Feb 2014 23:28:50 +0000 (15:28 -0800)]
Replace code accessing list implementation details with API calls.
* dll.c (clear_dlls): Replace accessing list implemention details
with API function.
* gdbthread.h (get_first_thread): Declare.
* inferiors.c (for_each_inferior_with_data): New function.
(get_first_thread): New function.
(find_thread_ptid): Simplify.
(get_first_inferior): New function.
(clear_list): Delete.
(one_inferior_p): New function.
(clear_inferior_list): New function.
(clear_inferiors): Update.
* inferiors.h (for_each_inferior_with_data): Declare.
(clear_inferior_list): Declare.
(one_inferior_p): Declare.
(get_first_inferior): Declare.
* linux-low.c (linux_wait_for_event): Replace accessing list
implemention details with API function.
* server.c (target_running): Ditto.
(accumulate_file_name_length): New function.
(emit_dll_description): New function.
(handle_qxfer_libraries): Replace accessing list implemention
details with API function.
(handle_qxfer_threads_worker): New function.
(handle_qxfer_threads_proper): Replace accessing list implemention
details with API function.
(handle_query): Ditto.
(visit_actioned_threads_callback_ftype): New typedef.
(visit_actioned_threads_data): New struct.
(visit_actioned_threads): Rewrite to be find_inferior callback.
(resume): Call find_inferior.
(handle_status): Replace accessing list implemention
details with API function.
(process_serial_event): Replace accessing list implemention details
with API function.
* target.c (set_desired_inferior): Replace accessing list implemention
details with API function.
* tracepoint.c (same_process_p): New function.
(gdb_agent_about_to_close): Replace accessing list implemention
details with API function.
* win32-low.c (child_delete_thread): Replace accessing list
implemention details with API function.
(match_dll_by_basename): New function.
(dll_is_loaded_by_basename): New function.
(win32_ensure_ntdll_loaded): Replace accessing list implemention
details call to dll_is_loaded_by_basename.
Alan Modra [Wed, 19 Feb 2014 23:00:38 +0000 (09:30 +1030)]
daily update
Doug Evans [Wed, 19 Feb 2014 22:51:55 +0000 (14:51 -0800)]
Rename inferior_list_entry uses from "head" to "entry" for consistency.
* dll.h (struct dll_info): Add comment.
* gdbthread.h (struct thread_info): Add comment.
(current_ptid): Simplify.
* inferiors.c (add_process): Update.
(remove_process): Update.
* inferiors.h (struct process_info): Rename member "head" to "entry".
* linux-low.c (delete_lwp): Update.
(add_lwp): Update.
(last_thread_of_process_p): Update.
(kill_one_lwp_callback, linux_kill): Update.
(status_pending_p_callback): Update.
(wait_for_sigstop): Update. Simplify read of ptid.
(start_step_over): Update.
* linux-low.h (ptid_of, pid_of, lwpid_of): Update.
(get_lwp_thread): Update.
(struct lwp_info): Rename member "head" to "entry".
* regcache.h (inferior_list_entry): Delete.
* server.c (kill_inferior_callback): Update.
(detach_or_kill_inferior_callback): Update.
(print_started_pid): Update.
(print_attached_pid): Update.
(process_serial_event): Simplify read of ptid.
* thread-db.c (thread_db_create_event): Update.
(thread_db_get_tls_address): Update.
* win32-low.c (current_inferior_ptid): Simplify.
Stan Shebs [Wed, 19 Feb 2014 21:38:12 +0000 (13:38 -0800)]
List Yao Qi as nios2 maintainer
H.J. Lu [Wed, 19 Feb 2014 20:53:27 +0000 (12:53 -0800)]
Don't output trailing space
* i386-gen.c (output_cpu_flags): Don't output trailing space.
(output_opcode_modifier): Likewise.
(output_operand_type): Likewise.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
H.J. Lu [Wed, 20 Nov 2013 17:01:04 +0000 (09:01 -0800)]
Create the second PLT for BND relocations
Intel MPX introduces 4 bound registers, which will be used for parameter
passing in x86-64. Bound registers are cleared by branch instructions.
Branch instructions with BND prefix will keep bound register contents.
This leads to 2 requirements to 64-bit MPX run-time:
1. Dynamic linker (ld.so) should save and restore bound registers during
symbol lookup.
2. Change the current 16-byte PLT0:
ff 35 08 00 00 00 pushq GOT+8(%rip)
ff 25 00 10 00 jmpq *GOT+16(%rip)
0f 1f 40 00 nopl 0x0(%rax)
and 16-byte PLT1:
ff 25 00 00 00 00 jmpq *name@GOTPCREL(%rip)
68 00 00 00 00 pushq $index
e9 00 00 00 00 jmpq PLT0
which clear bound registers, to preserve bound registers.
We use 2 new relocations:
to mark branch instructions with BND prefix.
When linker sees any R_X86_64_PC32_BND or R_X86_64_PLT32_BND relocations,
it switches to a different PLT0:
ff 35 08 00 00 00 pushq GOT+8(%rip)
f2 ff 25 00 10 00 bnd jmpq *GOT+16(%rip)
0f 1f 00 nopl (%rax)
to preserve bound registers for symbol lookup and it also creates an
external PLT section, .pl.bnd. Linker will create a BND PLT1 entry
in .plt:
68 00 00 00 00 pushq $index
f2 e9 00 00 00 00 bnd jmpq PLT0
0f 1f 44 00 00 nopl 0(%rax,%rax,1)
and a 8-byte BND PLT entry in .plt.bnd:
f2 ff 25 00 00 00 00 bnd jmpq *name@GOTPCREL(%rip)
90 nop
Otherwise, linker will create a legacy PLT1 entry in .plt:
68 00 00 00 00 pushq $index
e9 00 00 00 00 jmpq PLT0
66 0f 1f 44 00 00 nopw 0(%rax,%rax,1)
and a 8-byte legacy PLT in .plt.bnd:
ff 25 00 00 00 00 jmpq *name@GOTPCREL(%rip)
66 90 xchg %ax,%ax
The initial value of the GOT entry for "name" will be set to the the
"pushq" instruction in the corresponding entry in .plt. Linker will
resolve reference of symbol "name" to the entry in the second PLT,
.plt.bnd.
Prelink stores the offset of pushq of PLT1 (plt_base + 0x10) in GOT[1]
and GOT[1] is stored in GOT[3]. We can undo prelink in GOT by computing
the corresponding the pushq offset with
GOT[1] + (GOT offset - &GOT[3]) * 2
Since for each entry in .plt except for PLT0 we create a 8-byte entry in
.plt.bnd, there is extra 8-byte per PLT symbol.
We also investigated the 16-byte entry for .plt.bnd. We compared the
8-byte entry vs the the 16-byte entry for .plt.bnd on Sandy Bridge.
There are no performance differences in SPEC CPU 2000/2006 as well as
micro benchmarks.
Pros:
No change to undo prelink in dynamic linker.
Only 8-byte memory overhead for each PLT symbol.
Cons:
Extra .plt.bnd section is needed.
Extra 8 byte for legacy branches to PLT.
GDB is unware of the new layout of .plt and .plt.bnd.
bfd/
* elf64-x86-64.c (elf_x86_64_bnd_plt0_entry): New.
(elf_x86_64_legacy_plt_entry): Likewise.
(elf_x86_64_bnd_plt_entry): Likewise.
(elf_x86_64_legacy_plt2_entry): Likewise.
(elf_x86_64_bnd_plt2_entry): Likewise.
(elf_x86_64_bnd_arch_bed): Likewise.
(elf_x86_64_link_hash_entry): Add has_bnd_reloc and plt_bnd.
(elf_x86_64_link_hash_table): Add plt_bnd.
(elf_x86_64_link_hash_newfunc): Initialize has_bnd_reloc and
plt_bnd.
(elf_x86_64_copy_indirect_symbol): Also copy has_bnd_reloc.
(elf_x86_64_check_relocs): Create the second PLT for Intel MPX
in 64-bit mode.
(elf_x86_64_allocate_dynrelocs): Handle the second PLT for IFUNC
symbols. Resolve call to the second PLT if it is created.
(elf_x86_64_size_dynamic_sections): Keep the second PLT section.
(elf_x86_64_relocate_section): Resolve PLT references to the
second PLT if it is created.
(elf_x86_64_finish_dynamic_symbol): Use BND PLT0 and fill the
second PLT entry for BND relocation.
(elf_x86_64_finish_dynamic_sections): Use MPX backend data if
the second PLT is created.
(elf_x86_64_get_synthetic_symtab): New.
(bfd_elf64_get_synthetic_symtab): Likewise. Undefine for NaCl.
ld/
* emulparams/elf_x86_64.sh (TINY_READONLY_SECTION): New.
ld/testsuite/
* ld-x86-64/mpx.exp: Run bnd-ifunc-1 and bnd-plt-1.
* ld-x86-64/bnd-ifunc-1.d: New file.
* ld-x86-64/bnd-ifunc-1.s: Likewise.
* ld-x86-64/bnd-plt-1.d: Likewise.
Pedro Alves [Wed, 19 Feb 2014 18:25:41 +0000 (18:25 +0000)]
common/ptid.h: Mention that process_stratum targets should prefer ptid.lwp.
It's best that we standardize on process_stratum targets using the
ptid.lwp field to store thread ids. The idea being leave the ptid.tid
field free for any thread_stratum target that might want to sit on
top. This patch adds a comment in that direction to struct ptid's
definition.
gdb/
2014-02-19 Pedro Alves <palves@redhat.com>
* common/ptid.h (struct ptid): Mention that process_stratum
targets should prefer ptid.lwp.
Pedro Alves [Wed, 19 Feb 2014 18:25:40 +0000 (18:25 +0000)]
remote.c: Use the ptid.lwp field to store remote thread ids rather than ptid.tid.
From GDB's perspective, independently of how the target really
implements threads, gdb/remote sees all threads as if kernel/system
threads. A rationale along theses lines led to gdbserver storing
thread ids in ptid.lwp in all ports.
Because remote.c is currently using ptid.tid, we can't make gdbserver
and gdb share bits of remote-specific code that manipulates ptids
(e.g., write_ptid/read_ptid).
This patch thus makes remote.c use ptid.lwp instead of ptid.tid.
I believe that on the GDB side too, it's best that we standardize on
process_stratum targets using the ptid.lwp field to store thread ids
anyway. The idea being leave the ptid.tid field free for any
thread_stratum target that might want to sit on top.
Tested on x86_64 Fedora 17, w/ local gdbserver.
gdb/
2014-02-19 Pedro Alves <palves@redhat.com>
* remote.c (remote_thread_alive, write_ptid, read_ptid)
(read_ptid, remote_newthread_step, remote_threads_extra_info)
(remote_get_ada_task_ptid, append_resumption, remote_stop_ns)
(threadalive_test, remote_pid_to_str): Use the ptid.lwp field to
store remote thread ids rather than ptid.tid.
(_initialize_remote): Adjust.
Tom Tromey [Thu, 16 Jan 2014 20:00:07 +0000 (13:00 -0700)]
convert to_get_unwinder and to_get_tailcall_unwinder to methods
This converts to_get_unwinder and to_get_tailcall_unwinder to methods
and arranges for them to use the new delegation scheme.
This just lets us avoid having a differing style (neither new-style
nor INHERIT) of delegation in the tree.
2014-02-19 Tom Tromey <tromey@redhat.com>
* target.c (target_get_unwinder): Rewrite.
(target_get_tailcall_unwinder): Rewrite.
* record-btrace.c (record_btrace_to_get_unwinder): New function.
(record_btrace_to_get_tailcall_unwinder): New function.
(init_record_btrace_ops): Update.
* target.h (struct target_ops) <to_get_unwinder,
to_get_tailcall_unwinder>: Now function pointers. Use
TARGET_DEFAULT_RETURN.
Tom Tromey [Thu, 16 Jan 2014 18:46:23 +0000 (11:46 -0700)]
fix buglet in nto-procfs.c
I happened to notice that nto-procfs.c defines
procfs_remove_hw_breakpoint but never uses it. This caused it not to
be updated by my target-method-updating script. This patch fixes the
function and installs it properly. I have no way to test this,
however.
2014-02-19 Tom Tromey <tromey@redhat.com>
* nto-procfs.c (procfs_remove_hw_breakpoint): Add 'self'
argument.
(init_procfs_ops): Correctly set to_remove_hw_breakpoint.
Tom Tromey [Thu, 16 Jan 2014 18:39:32 +0000 (11:39 -0700)]
convert to_decr_pc_after_break
This converts to_decr_pc_after_break to the new style of delegation,
removing forward_target_decr_pc_after_break.
2014-02-19 Tom Tromey <tromey@redhat.com>
* record-btrace.c (record_btrace_decr_pc_after_break): Delegate
directly.
* target-delegates.c: Rebuild.
* target.h (struct target_ops) <to_decr_pc_after_break>: Use
TARGET_DEFAULT_FUNC.
* target.c (default_target_decr_pc_after_break): Rename from
forward_target_decr_pc_after_break. Simplify.
(target_decr_pc_after_break): Rely on delegation.
Tom Tromey [Wed, 15 Jan 2014 19:58:50 +0000 (12:58 -0700)]
remove some calls to INHERIT and de_fault
This removes a few unnecessary calls to INHERIT and de_fault:
* to_doc is only used when a target is registered
* to_magic is only used when a target is pushed and not useful for
current_target.
* to_open and to_close are only ever called using a specific
target_ops object; there is no need to de_fault them.
2014-02-19 Tom Tromey <tromey@redhat.com>
* target.c (update_current_target): Do not INHERIT to_doc or
to_magic. Do not de_fault to_open or to_close.
Tom Tromey [Wed, 15 Jan 2014 16:40:13 +0000 (09:40 -0700)]
remove exec_set_find_memory_regions
exec_set_find_memory_regions is used to modify the exec target.
However, it only has a single caller, and so it is much clearer to
simply set the appropriate field directly. It's also better for the
coming multi-target world to avoid this kind of global state change
anyway.
2014-02-19 Tom Tromey <tromey@redhat.com>
* gcore.h (objfile_find_memory_regions): Declare.
* gcore.c (objfile_find_memory_regions): No longer static. Add
"self" argument.
(_initialize_gcore): Don't call exec_set_find_memory_regions.
* exec.c: Include gcore.h.
(exec_set_find_memory_regions): Remove.
(exec_find_memory_regions): Remove.
(exec_do_find_memory_regions): Remove.
(init_exec_ops): Update.
* defs.h (exec_set_find_memory_regions): Remove.
Tom Tromey [Wed, 15 Jan 2014 16:30:05 +0000 (09:30 -0700)]
pass NULL to TARGET_DEFAULT_RETURN when appropriate
This changes instances of TARGET_DEFAULT_RETURN(0) to
TARGET_DEFAULT_RETURN(NULL) when appropriate. The use of "0" was a
relic from an earlier implementation of make-target-delegates; and I
didn't want to go back through the long patch series, fixing up
conflicts, just to change this small detail.
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.h (struct target_ops) <to_extra_thread_info,
to_thread_name, to_pid_to_exec_file, to_get_section_table,
to_memory_map, to_read_description, to_traceframe_info>: Use NULL,
not 0, in TARGET_DEFAULT_RETURN.
Tom Tromey [Mon, 13 Jan 2014 19:16:41 +0000 (12:16 -0700)]
remove function casts from target.c
This cleans up target.c to avoid function casts.
2014-02-19 Tom Tromey <tromey@redhat.com>
* target.c (complete_target_initialization): Remove casts. Use
return_zero_has_execution.
(return_zero): Add "ignore" argument.
(return_zero_has_execution): New function.
(init_dummy_target): Remove casts. Use
return_zero_has_execution.
Tom Tromey [Mon, 13 Jan 2014 18:49:32 +0000 (11:49 -0700)]
minor cleanups to update_current_target
During the conversion I kept all the "do not inherit" comments in
update_current_target. However, now they are not needed. This patch
updates the comments for INHERIT and de_fault, and removes the
somewhat odd INHERIT of to_stratum.
2014-02-19 Tom Tromey <tromey@redhat.com>
* target.c (update_current_target): Update comments. Do not
INHERIT to_stratum.
Tom Tromey [Mon, 13 Jan 2014 16:30:30 +0000 (09:30 -0700)]
change delegation for to_read_description
This switches to_read_description to the "new normal" delegation
scheme. This one was a bit trickier than the other changes due to the
way that target_read_description handled delegation. I examined all
the target implementations of to_read_description and changed the ones
returning NULL to instead delegate.
2014-02-19 Tom Tromey <tromey@redhat.com>
* arm-linux-nat.c (arm_linux_read_description): Delegate when
needed.
* corelow.c (core_read_description): Delegate when needed.
* remote.c (remote_read_description): Delegate when needed.
* target-delegates.c: Rebuild.
* target.c (target_read_description): Rewrite.
* target.h (struct target_ops) <to_read_description>: Update
comment. Use TARGET_DEFAULT_RETURN.
Tom Tromey [Fri, 20 Dec 2013 19:19:37 +0000 (12:19 -0700)]
convert to_can_run
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_can_run.
(find_default_run_target): Check against delegate_can_run.
* target.h (struct target_ops) <to_can_run>: Use
TARGET_DEFAULT_RETURN.
Tom Tromey [Fri, 20 Dec 2013 17:30:13 +0000 (10:30 -0700)]
convert to_disconnect
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_disconnect): Unconditionally delegate.
* target.h (struct target_ops) <to_disconnect>: Use
TARGET_DEFAULT_NORETURN.
Tom Tromey [Thu, 19 Dec 2013 15:21:20 +0000 (08:21 -0700)]
convert to_stop_recording
2014-02-19 Tom Tromey <tromey@redhat.com>
* record.c (record_stop): Unconditionally delegate.
* target-delegates.c: Rebuild.
* target.c (target_stop_recording): Unconditionally delegate.
* target.h (struct target_ops) <to_stop_recording>: Use
TARGET_DEFAULT_IGNORE.
Tom Tromey [Thu, 19 Dec 2013 15:19:41 +0000 (08:19 -0700)]
convert to_enable_btrace
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_enable_btrace): Unconditionally delegate.
* target.h (struct target_ops) <to_enable_btrace>: Use
TARGET_DEFAULT_NORETURN.
Tom Tromey [Thu, 19 Dec 2013 15:19:02 +0000 (08:19 -0700)]
convert to_read_btrace
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_read_btrace): Unconditionally delegate.
* target.h (struct target_ops) <to_read_btrace>: Use
TARGET_DEFAULT_NORETURN.
Tom Tromey [Thu, 19 Dec 2013 15:18:04 +0000 (08:18 -0700)]
convert to_teardown_btrace
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_teardown_btrace): Unconditionally delegate.
* target.h (struct target_ops) <to_teardown_btrace>: Use
TARGET_DEFAULT_NORETURN.
Tom Tromey [Thu, 19 Dec 2013 15:17:16 +0000 (08:17 -0700)]
convert to_disable_btrace
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_disable_btrace): Unconditionally delegate.
* target.h (struct target_ops) <to_disable_btrace>: Use
TARGET_DEFAULT_NORETURN.
Tom Tromey [Thu, 19 Dec 2013 15:12:26 +0000 (08:12 -0700)]
convert to_search_memory
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (default_search_memory): New function.
(simple_search_memory): Update comment.
(target_search_memory): Unconditionally delegate.
* target.h (struct target_ops) <to_search_memory>: Use
TARGET_DEFAULT_FUNC.
Tom Tromey [Thu, 19 Dec 2013 14:56:20 +0000 (07:56 -0700)]
convert to_auxv_parse
2014-02-19 Tom Tromey <tromey@redhat.com>
* auxv.c (default_auxv_parse): No longer static.
(target_auxv_parse): Unconditionally delegate.
* auxv.h (default_auxv_parse): Declare.
* target-delegates.c: Rebuild.
* target.c: Include auxv.h.
* target.h (struct target_ops) <to_auxv_parse>: Use
TARGET_DEFAULT_FUNC.
Tom Tromey [Thu, 19 Dec 2013 14:47:11 +0000 (07:47 -0700)]
convert to_memory_map
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_memory_map): Unconditionally delegate.
* target.h (struct target_ops) <to_memory_map>: Use
TARGET_DEFAULT_RETURN.
Tom Tromey [Thu, 19 Dec 2013 14:21:56 +0000 (07:21 -0700)]
convert to_thread_alive
2014-02-19 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (target_thread_alive): Unconditionally delegate.
* target.h (struct target_ops) <to_thread_alive>: Use
TARGET_DEFAULT_RETURN.