Giter Club home page Giter Club logo

Comments (2)

spruett avatar spruett commented on July 21, 2024

Running in debug mode requires 3 steps:

1. Build the debug version of Scarab.
It sounds like from your question you already did this, but I will still put the instructions here for completeness. Compiling the binary in debug mode is also useful if you would like to use gdb.

cd src
make dbg

2. Enable debug mode.

Debug mode prints a lot of information to the stdout, typically too much to dump for an entire run (the log files would be too large). For that reason, it is usually good practice to enable debug mode only for a region of interest. Scarab provides two ways to identify the region of interest: by instruction of by cycle.

To specify a region by instruction, use the --debug_inst_start and the --debug_inst_stop scarab params. By default, debug_inst_start is set to 0 and debug_inst_stop is set to -1, meaning that there is no debug region (and therefore no debug prints). To enable, debug_inst_start must be set to a value >= 1 and debug_inst_stop must be set to a value > debug_inst_start. I would generally try to narrow this range to a few thousand instructions. I usually shoot for 5,000 instructions, no more than 10,000.

To specify a region by cycle, use the --debug_cycle_start and --debug_cycle_stop scarab params. The rules for these parameters are the same as above.

3. Enable debug prints for a particular module.

Finally, you must enable debug prints for whichever module you are interested in debugging. A full list of modules can be found in src/debug/debug.param.def.

Usually the best way to identify which debug module you want to enable is to go to the file that is giving you trouble and look for a DEBUG macro defined at the top of the file. For example, if you having trouble with the decode stage, you could look src/decode_stage.c and search for the word DEBUG. There you will find a macro definition that includes the variable DEBUG_DECODE_STAGE. This is the name of the scarab parameter required to enable debug mode for this file. So if I wanted to enable debug, I would simply pass --debug_decode_stage 1 as a scarab arg. Make sense?

Sometimes you aren't looking for a specific bug in a file, but rather just trying to get a sense of what is going on in the pipeline. For that, the most important parameter is --debug_model 1. This will print a very helpful view of the pipeline and show ops as they move through the stages.

When I am debugging, I usually start with a mix of several models that provide enough information for most issues. Here is an example list that I have used in the past:

--debug_model                      1
--debug_map                         1
--debug_node_stage              1
--debug_thread                      1
--debug_icache_stage            1
--debug_exec_stage               1
--debug_pin_exec_driven       1

This certainly is not a complete list, or maybe not even a good list for whatever you are doing. I simply show it here as an example of how multiple parameters can be combined to form a very robust debug output.

from scarab.

spruett avatar spruett commented on July 21, 2024

Closing this issue as it has been over a week since the last activity.

from scarab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.