old-cross-binutils/gdb/testsuite/gdb.trace
Yao Qi 290a839c9a Partially available/unavailable data in requested range
In gdb.trace/unavailable.exp, an action is defined to collect
struct_b.struct_a.array[2] and struct_b.struct_a.array[100],

struct StructB
{
  int d, ef;
  StructA struct_a;
  int s:1;
  static StructA static_struct_a;
  const char *string;
};

and the other files are not collected.

When GDB examine traceframe collected by the action, "struct_b" is
unavailable completely, which is wrong.

(gdb) p struct_b
$1 = <unavailable>

When GDB reads 'struct_b', it will request to read memory at struct_b's address
of length LEN.  Since struct_b.d is not collected, no 'M' block
includes the first part of the desired range, so tfile_xfer_partial returns
TARGET_XFER_UNAVAILABLE and GDB thinks the whole requested range is unavailable.

In order to fix this problem, in the iteration to 'M' blocks, we record the
lowest address of blocks within the request range.  If it has, the requested
range isn't unavailable completely.  This applies to ctf too.  With this patch
applied, the result looks good and fails in unavailable.exp is fixed.

(gdb) p struct_b
$1 = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>,
<unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>,   static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>,
bitfield = <unavailable>}, string = <unavailable>}

gdb:

2014-05-05  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* tracefile-tfile.c (tfile_xfer_partial): Record the lowest
	address of blocks that intersects the requested range.  Trim
	LEN up to LOW_ADDR_AVAILABLE if read from executable read-only
	sections.
	* ctf.c (ctf_xfer_partial): Likewise.

gdb/testsuite:

2014-05-05  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/unavailable.exp (gdb_collect_args_test): Save
	traceframes into tfile and ctf trace files.  Read data from
	trace file and test collected data.
	(gdb_collect_locals_test): Likewise.
	(gdb_unavailable_registers_test): Likewise.
	(gdb_unavailable_floats): Likewise.
	(gdb_collect_globals_test): Likewise.
	(top-level): Append "ctf" to trace_file_targets if GDB
	supports.
2014-05-05 11:51:59 +08:00
..
actions-changed.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
actions-changed.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
actions.c Ensure unreferenced static symbols aren't omitted by clang (either marking them __attribute__((used)) or making them non-static) 2014-04-24 22:33:46 -07:00
actions.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ax.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
backtrace.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
change-loc-1.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
change-loc-2.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
change-loc.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
change-loc.exp Fix several "set remote foo-packet on/off" commands. 2014-04-25 18:07:02 +01:00
change-loc.h Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
circ.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
circ.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
collection.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
collection.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
deltrace.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
disconnected-tracing.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
disconnected-tracing.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
entry-values.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
entry-values.exp Fix regression on s390x with entry-values.exp. 2014-01-22 17:02:13 +01:00
ftrace.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ftrace.exp Fix several "set remote foo-packet on/off" commands. 2014-04-25 18:07:02 +01:00
infotrace.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Makefile.in tracepoint->step_count fixes 2013-04-04 19:22:38 +00:00
mi-trace-frame-collected.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi-trace-unavailable.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi-traceframe-changed.exp Check tracefile is generated by binary execution 2014-04-22 09:57:44 +08:00
mi-tracepoint-changed.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi-tsv-changed.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
packetlen.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
passc-dyn.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
passcount.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pending.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pending.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pendshr1.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pendshr2.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pr16508.exp Fix PR16508 2014-03-06 11:33:06 +08:00
qtro.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
qtro.exp Don't suppress errors inserting/removing hardware breakpoints in shared 2014-04-23 15:06:47 +01:00
range-stepping.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
range-stepping.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
read-memory.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
read-memory.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
report.exp Create inferior for ctf target. 2014-02-05 19:37:25 +08:00
save-trace.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
stap-trace.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
stap-trace.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
status-stop.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
status-stop.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
strace.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
strace.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tfile.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tfile.exp Check tracefile is generated by binary execution 2014-04-22 09:57:44 +08:00
tfind.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
trace-break.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
trace-break.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
trace-buffer-size.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
trace-buffer-size.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
trace-mt.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
trace-mt.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
trace-unavailable.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tracecmd.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tspeed.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tspeed.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tstatus.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tsv.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
unavailable-dwarf-piece.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
unavailable-dwarf-piece.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
unavailable.cc Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
unavailable.exp Partially available/unavailable data in requested range 2014-05-05 11:51:59 +08:00
while-dyn.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
while-stepping.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00