• Jim Cromie's avatar
    dynamic_debug: process multiple debug-queries on a line · 85f7f6c0
    Jim Cromie authored
    Insert ddebug_exec_queries() in place of ddebug_exec_query().  It
    splits the query string on [;\n], and calls ddebug_exec_query() on
    each.  All queries are processed independent of errors, allowing a
    query to fail, for example when a module is not installed.  Empty
    lines and comments are skipped.  Errors are counted, and the last
    error seen (negative) or the number of callsites found (0 or positive)
    is returned.  Return code checks are altered accordingly.
    With this, multiple queries can be given in ddebug_query, allowing
    more selective enabling of callsites.  As a side effect, a set of
    commands can be batched in:
    	cat cmd-file > $DBGMT/dynamic_debug/control
    We dont want a ddebug_query syntax error to kill the dynamic debug
    facility, so dynamic_debug_init() zeros ddebug_exec_queries()'s return
    code after logging the appropriate message, so that ddebug tables are
    preserved and $DBGMT/dynamic_debug/control file is created.  This
    would be appropriate even without accepting multiple queries.
    This patch also alters ddebug_change() to return number of callsites
    matched (which typically is the same as number of callsites changed).
    ddebug_exec_query() also returns the number found, or a negative value
    if theres a parse error on the query.
    Splitting on [;\n] prevents their use in format-specs, but selecting
    callsites on punctuation is brittle anyway, meaningful and selective
    substrings are more typical.
    Note: splitting queries on ';' before handling trailing #comments
    means that a ';' also terminates a comment, and text after the ';' is
    treated as another query.  This trailing query will almost certainly
    result in a parse error and thus have no effect other than the error
    message.  The double corner case with unexpected results is:
         ddebug_query="func foo +p # enable foo ; +p"
    Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
    Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
dynamic-debug-howto.txt 9.26 KB