Thank you, I think I figured out how to do.
If I want to print sth in arch-relevant code like cache_impl.hh,

1. I need to define my own Flag, Let's say the flag is myflag1

2. Add printf like this :  DPRINTF(myflag1, “The world is so small  %s\n”,
“arguments”); in the arch-relevant code

3. Add declaration of my flag in src/mem/cache/SConscript

    like this:
                    DebugFlag('myflag1')


4. Add #include debug/myflag1.hh in the file you put DPRINTF to output

5. Rebuild

6. Add --debug-flag=myflag1 in the running command

OK now.



2014-05-07 19:58 GMT+08:00 Pushkar Nandkar <nandk...@umn.edu>:

> Specify a file name using --debug-file option. DPRINTFs should get printed
> in it.
>
> -Pushkar
> On May 7, 2014 3:10 AM, "朱朱乐乐 via gem5-users" <gem5-us...@gem5.org> wrote:
>
>> Hi,
>>
>> I am debugging gem5 using gdb and DPRINTF. Since gem5 has wrapped
>> architecture-relevant C++ code with SWIG, It is hard to debug with gdb.
>>
>> I am trying to use DPRINTF in the architecture-relevant C++ code (let's
>> say cache_impl.hh), but it does not print to the shell during the
>> simulation.
>>
>> What should I do to find my output?
>>
>> _______________________________________________
>> gem5-users mailing list
>> gem5-us...@gem5.org
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to