[Chapel Merge] dyno query tracing updates

Branch: refs/heads/main
Revision: 4845b80
Author: arezaii
Link: dyno query tracing updates by arezaii · Pull Request #19956 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19956 from arezaii/query-tracing

dyno query tracing updates

This PR updates the dyno query tracing features to include a query depth
indicator for nested queries, makes small fixes for formatting of FormalDetail
and CallInfo, implements stringify for Function::Kind and
Function::ReturnIntent, adds a list of query names to ignore when tracing,
and changes the dyno-break-on-hash flag to accept hex and similarly changes
query + args hash to output in hex.

The query depth indicator is just a number that indicates the depth of the
nested query, starting at 1. Here is an incomplete sample output:

1 { parse (/home/arezaii/git/chapel/test/types/bool/bradc/numBitsBytesDefault.chpl) QUERY+ARGS HASH: 0x726a5a85ae347e15
2 { parseFile (/home/arezaii/git/chapel/test/types/bool/bradc/numBitsBytesDefault.chpl) QUERY+ARGS HASH: 0xdcfafbaf0532de96
3 { fileTextQuery ("/home/arezaii/git/chapel/test/types/bool/bradc/numBitsBytesDefault.chpl") QUERY+ARGS HASH: 0x1c66113d41ff21ee
3   fileTextQuery UPDATED } 
3 { getStringParam (numBits = ) QUERY+ARGS HASH: 0x1e7fbff86d3c6d6
3   getStringParam UPDATED } 
3 { getStringParam (numBytes = ) QUERY+ARGS HASH: 0xc63edbd3f02bedf7
3   getStringParam UPDATED } 
3 { getStringParam (-------------) QUERY+ARGS HASH: 0x76bd6dc96f2108ba
3   getStringParam UPDATED } 
2 SETTING FILE PATH FOR MODULE numBitsBytesDefault -> /home/arezaii/git/chapel/test/types/bool/bradc/numBitsBytesDefault.chpl
2   parseFile UPDATED } 
1   parse UPDATED } 

Also note that the QUERY+ARGS HASH has been moved to the same line as
QUERY BEGIN and the output of the hash is now written in hex instead of
decimal.

The list of queries we will ignore is stored in Context.h and initially
includes only idToTagQuery and idToParentId.

The implementation of stringify for Function::Kind and
Function::ReturnIntent is nearly identical to that in the kindToString
functions in chpl-syntax-printer. Ideally these would be centralized in a
function that can be called from either place.

We also stopped printing the memory address of the QueryMapResult after
UPDATED or NO CHANGE. In the future we may want to have a way to write some
details of the QueryMapResult and have a toggle to control if it prints or not.

Added some support for colorizing the output if your terminal supports it.

TESTING:

  • make test-dyno
  • paratest

reviewed by @dlongnecke-cray and @mppf - thank you!

Signed-off-by: arezaii ahmad.rezaii@hpe.com

Modified Files:
A compiler/dyno/include/chpl/util/terminal.h

A compiler/dyno/lib/util/terminal.cpp
M compiler/dyno/include/chpl/queries/Context.h
M compiler/dyno/include/chpl/queries/query-impl.h
M compiler/dyno/include/chpl/resolution/resolution-types.h
M compiler/dyno/include/chpl/uast/Function.h
M compiler/dyno/lib/queries/Context.cpp
M compiler/dyno/lib/resolution/resolution-types.cpp
M compiler/dyno/lib/uast/AstNode.cpp
M compiler/dyno/lib/util/CMakeLists.txt
M compiler/dyno/lib/util/Makefile.include
M compiler/main/arg.cpp
M compiler/main/driver.cpp
M compiler/util/misc.cpp

Compare: https://github.com/chapel-lang/chapel/compare/b9686805ba04...4845b8025e6a