Skip to content
  • Paolo Bonzini's avatar
    9f45a641
    trace: fix "-trace file=..." · 9f45a641
    Paolo Bonzini authored
    
    
    Because trace_opt_parse always deletes the options it has parsed,
    trace_init_file's call to qemu_find_opts_singleton always
    creates an empty -trace option group.  Therefore, the subsequent
    qemu_opt_get(opts, "file") always returns NULL.
    
    To fix this, save the last "-trace file=..." option in a global
    variable and use it later in trace_init_file.
    
    This is similar to what was done before commit 92eecfff ("trace:
    remove argument from trace_init_file", 2020-11-11), except contained
    within trace/control.c and without memory leaks.
    
    Fixes: 92eecfff ("trace: remove argument from trace_init_file", 2020-11-11)
    Cc: stefanha@redhat.com
    Reported-by: default avatar <armbru@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210209145759.141231-2-pbonzini@redhat.com>
    9f45a641
    trace: fix "-trace file=..."
    Paolo Bonzini authored
    
    
    Because trace_opt_parse always deletes the options it has parsed,
    trace_init_file's call to qemu_find_opts_singleton always
    creates an empty -trace option group.  Therefore, the subsequent
    qemu_opt_get(opts, "file") always returns NULL.
    
    To fix this, save the last "-trace file=..." option in a global
    variable and use it later in trace_init_file.
    
    This is similar to what was done before commit 92eecfff ("trace:
    remove argument from trace_init_file", 2020-11-11), except contained
    within trace/control.c and without memory leaks.
    
    Fixes: 92eecfff ("trace: remove argument from trace_init_file", 2020-11-11)
    Cc: stefanha@redhat.com
    Reported-by: default avatar <armbru@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210209145759.141231-2-pbonzini@redhat.com>
Loading