Skip to content

[Enhancement] Better 'cqsearch.exe' output results #92

@pidgeon777

Description

@pidgeon777

Let consider this command:

cqsearch.exe -s "C:\Work\Test\CodeQuery.db" -p8 -t func_name -f -u

We are searching for all the func_name function calls in the code.

This would be the output:

func_name        C:\Work\Test\main.c:16628     func_name(REG_CHB,&num_bytes);
func_name        C:\Work\Test\main.c:16941     err = func_name(read_reg,&temp);
func_name        C:\Work\Test\utils.c:31   err = func_name(0xD1000A00 , cpu_version);
func_name        C:\Work\Test\utils.c:781  func_name(REG_CHA,value);
func_name        C:\Work\Test\utils.c:783  func_name(REG_CHB,value);

My proposal, and I hope it will be considered, is to replace the first column of the results (consisting in the name of the searched function), with the function name where the call occurs.

Thus, something as follows would be achieved:

main          C:\Work\Test\main.c:16628     func_name(REG_CHB,&num_bytes);
func_b        C:\Work\Test\main.c:16941     err = func_name(read_reg,&temp);
func_b        C:\Work\Test\utils.c:31   err = func_name(0xD1000A00 , cpu_version);
func_c        C:\Work\Test\utils.c:781  func_name(REG_CHA,value);
func_d        C:\Work\Test\utils.c:783  func_name(REG_CHB,value);

This improved output could be applied by adding a new command line switch to the cqsearch.exe executable so that a user could decide if to enable it or not.

Moreover, when searching for symbol occurrences with cqsearch.exe, the possible values for the n switch are:

 1: Symbol (default)                       -> V
 2: Function or macro definition           -> ?
 3: Class or struct                        -> ?
 4: Files including this file              -> X
 5: Full file path                         -> X
 6: Functions calling this function        -> X
 7: Functions called by this function      -> X
 8: Calls of this function or macro        -> V
 9: Members and methods of this class      -> ?
10: Class which owns this member or method -> ?
11: Children of this class (inheritance)   -> ?
12: Parent of this class (inheritance)     -> ?
13: Functions or macros inside this file   -> X

My proposal is to enhance the output for the types marked with V. With the ? symbol I marked the kinds for which I'm not sure the new output format should be applied. Finally, X marks those types for which, in my opinion, the new output format would not make sense.

What do you think, @ruben2020?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions