/* Trace file TFILE format support in GDB.
- Copyright (C) 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of GDB.
}
static void
-tfile_open (char *filename, int from_tty)
+tfile_open (const char *arg, int from_tty)
{
volatile struct gdb_exception ex;
char *temp;
struct trace_status *ts;
struct uploaded_tp *uploaded_tps = NULL;
struct uploaded_tsv *uploaded_tsvs = NULL;
+ char *filename;
target_preopen (from_tty);
- if (!filename)
+ if (!arg)
error (_("No trace file specified."));
- filename = tilde_expand (filename);
+ filename = tilde_expand (arg);
if (!IS_ABSOLUTE_PATH(filename))
{
temp = concat (current_directory, "/", filename, (char *) NULL);
{
int pos = 0;
enum target_xfer_status res;
+ /* Records the lowest available address of all blocks that
+ intersects the requested range. */
+ ULONGEST low_addr_available = 0;
/* Iterate through the traceframe's blocks, looking for
memory. */
return TARGET_XFER_OK;
}
+ if (offset < maddr && maddr < (offset + len))
+ if (low_addr_available == 0 || low_addr_available > maddr)
+ low_addr_available = maddr;
+
/* Skip over this block. */
pos += (8 + 2 + mlen);
}
/* Requested memory is unavailable in the context of traceframes,
and this address falls within a read-only section, fallback
- to reading from executable. */
+ to reading from executable, up to LOW_ADDR_AVAILABLE. */
+ if (offset < low_addr_available)
+ len = min (len, low_addr_available - offset);
res = exec_read_partial_read_only (readbuf, offset, len, xfered_len);
if (res == TARGET_XFER_OK)