• Christopher Head's avatar
    Permit null target on TCL connection · ea410488
    Christopher Head authored
    In previous versions of OpenOCD, it was possible to connect to the TCL
    RPC interface without a current target. In `tcl_new_connection`, the
    curent target would be queried by number, and the possibility of a null
    current target was handled properly.
    
    In commit bb9d9c60
    
    , the
    `get_target_by_num` call was replaced by a `get_current_target` call,
    without noticing that `get_current_target` aborts if there is no current
    target, whereas `tcl_new_connection` is perfectly able to handle that
    situation.
    
    Provide a `get_current_target_or_null` function for use by consumers who
    are OK with a null current target, and use it in `tcl_new_connection`.
    
    Change-Id: I06f7e1e149f1169e23c73ba328c7ad9f9425cc2a
    Signed-off-by: default avatarChristopher Head <chead@zaber.com>
    Reviewed-on: http://openocd.zylin.com/4730
    
    
    Tested-by: jenkins
    Reviewed-by: default avatarTomas Vanek <vanekt@fbl.cz>
    Reviewed-by: default avatarFranck Jullien <franck.jullien@gmail.com>
    ea410488
target.c 172 KB