Skip to content
  • Peter Maydell's avatar
    90c072e0
    semihosting/config: Merge --semihosting-config option groups · 90c072e0
    Peter Maydell authored
    
    
    Currently we mishandle the --semihosting-config option if the
    user specifies it on the command line more than once. For
    example with:
     --semihosting-config target=gdb --semihosting-config arg=foo,arg=bar
    
    the function qemu_semihosting_config_options() is called twice, once
    for each argument.  But that function expects to be called only once,
    and it always unconditionally sets the semihosting.enabled,
    semihost_chardev and semihosting.target variables.  This means that
    if any of those options were set anywhere except the last
    --semihosting-config option on the command line, those settings are
    ignored.  In the example above, 'target=gdb' in the first option is
    overridden by an implied default 'target=auto' in the second.
    
    The QemuOptsList machinery has a flag for handling this kind of
    "option group is setting global state": by setting
     .merge_lists = true;
    we make the machinery merge all the --semihosting-config arguments
    the user passes into a single set of options and call our
    qemu_semihosting_config_options() just once.
    
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarLuc Michel <luc@lmichel.fr>
    Message-id: 20220526190053.521505-3-peter.maydell@linaro.org
    90c072e0
    semihosting/config: Merge --semihosting-config option groups
    Peter Maydell authored
    
    
    Currently we mishandle the --semihosting-config option if the
    user specifies it on the command line more than once. For
    example with:
     --semihosting-config target=gdb --semihosting-config arg=foo,arg=bar
    
    the function qemu_semihosting_config_options() is called twice, once
    for each argument.  But that function expects to be called only once,
    and it always unconditionally sets the semihosting.enabled,
    semihost_chardev and semihosting.target variables.  This means that
    if any of those options were set anywhere except the last
    --semihosting-config option on the command line, those settings are
    ignored.  In the example above, 'target=gdb' in the first option is
    overridden by an implied default 'target=auto' in the second.
    
    The QemuOptsList machinery has a flag for handling this kind of
    "option group is setting global state": by setting
     .merge_lists = true;
    we make the machinery merge all the --semihosting-config arguments
    the user passes into a single set of options and call our
    qemu_semihosting_config_options() just once.
    
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarLuc Michel <luc@lmichel.fr>
    Message-id: 20220526190053.521505-3-peter.maydell@linaro.org
Loading