Fail gracefully when a unknown stream is found
This commit is contained in:
parent
0eb88af4b9
commit
8bf5d8c571
@ -92,15 +92,24 @@ emu_connect(struct emu *emu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
set_current(struct emu *emu)
|
||||
{
|
||||
emu->ev = player_ev(&emu->player);
|
||||
emu->stream = player_stream(&emu->player);
|
||||
struct lpt *lpt = system_get_lpt(emu->stream);
|
||||
if (lpt == NULL) {
|
||||
/* For now die if we have a unknown stream */
|
||||
err("event from unknown stream: %s",
|
||||
emu->stream->path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
emu->loom = lpt->loom;
|
||||
emu->proc = lpt->proc;
|
||||
emu->thread = lpt->thread;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -145,7 +154,10 @@ emu_step(struct emu *emu)
|
||||
return -1;
|
||||
}
|
||||
|
||||
set_current(emu);
|
||||
if (set_current(emu) != 0) {
|
||||
err("cannot set current event information");
|
||||
return -1;
|
||||
}
|
||||
|
||||
dbg("----- mvc=%s dclock=%ld -----", emu->ev->mcv, emu->ev->dclock);
|
||||
|
||||
|
@ -413,10 +413,9 @@ init_offsets(struct system *sys, struct trace *trace)
|
||||
|
||||
for (struct stream *s = trace->streams; s; s = s->next) {
|
||||
struct lpt *lpt = system_get_lpt(s);
|
||||
if (lpt == NULL) {
|
||||
err("cannot get stream lpt");
|
||||
return -1;
|
||||
}
|
||||
/* Not LPT stream */
|
||||
if (lpt == NULL)
|
||||
continue;
|
||||
|
||||
int64_t offset = lpt->loom->clock_offset;
|
||||
if (stream_clkoff_set(s, offset) != 0) {
|
||||
@ -478,6 +477,9 @@ system_get_lpt(struct stream *stream)
|
||||
{
|
||||
struct lpt *lpt = stream_data_get(stream);
|
||||
|
||||
if (lpt == NULL)
|
||||
return NULL;
|
||||
|
||||
if (lpt->stream != stream)
|
||||
die("inconsistent stream in lpt map");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user