Comments (2)
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.
Closing this issue as it has been over a week since the last activity.
from scarab.
Related Issues (20)
- [Question] How do you access metadata about the Cache from a prefetcher function? HOT 2
- [Question] !ENABLE_ICACHE_PACKET_BREAKING && !PERFECT_BP HOT 8
- [Question] Runahead Execution in Scarab HOT 6
- [Question] Decoder: Redirect on btb_miss and !taken HOT 2
- recipe for target 'pin_exec' failed HOT 19
- [BUG] Running SPEC2006 Checkpoints with PIN tool HOT 1
- Tests cannot access github secret values when pull request created by fork
- [Question]About wrong path execution HOT 1
- [Question]About Wrong Path Execution HOT 2
- [Question] mem_req buffer and queues HOT 1
- [Question] Assertion failure when running gcc in SPEC2017 IntSpeed HOT 3
- [Question] Proper documentation for running SPEC 17 HOT 2
- [BUG] Link to auto-generated software documentation is broken HOT 1
- [Question] make -C docs fails HOT 1
- [Question] Running make in src/ fails HOT 8
- Running make in scarab/src fails HOT 1
- [BUG] "scarab --help" info is out of date?
- [Question and Bug] "Invalid header for input file #0" HOT 1
- Having issue in building src in scarab
- [BUG] Multiple compilation errors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scarab.