Thanks, Patrick. I think it at least gives me a way to get access to the
pc.
Of course it would be ideal if there is any way that can directly access
the pc without getting the address of the thread first.

On Wed, Aug 5, 2015 at 12:42 PM, Patrick <[email protected]> wrote:

> Lingxiao,
> ​​
> In lieu of a response from someone else with more gem5 expertise, I
> thought this might help.
>
> (I assume you've seen this page: link
> <http://www.m5sim.org/Debugger_Based_Debugging>.)
>
> I put a breakpoint in src/cpu/simple/base.cc in the BaseSimpleCPU
> constructor. After it allocates a "SimpleThread" for its "thread" member, I
> can get the address of "thread." Then, at another point in the program, I
> can use that address to examine the pc member of "thread" like this
> (assuming the address of "thread" is 0x385e9c0):
>
> (gdb) call ((SimpleThread*)0x385e9c0)->pcState()
> $6 = {<GenericISA::UPCState<unsigned long>> =
> {<GenericISA::SimplePCState<unsigned long>> = {<GenericISA::PCStateBase> =
> {_pc = 4194710, _npc = 4194718}, <No data fields>}, _upc = 0, _nupc = 1},
> _size = 0 '\000'}
>
> ​A caveat is that gdb won't let me print out the address of "thread". When
> I try to print it in gdb, I get this error:
>
> (gdb)​ p thread​
>
> ​A syntax error in expression, near `'.
>
>
> ​My guess is that it's because "thread" is a keyword in gdb. In the code,
> I stored the value of "thread" in a variable with a different name, and it
> let me print the other variable.
>
> ​I don't know if this answers your question. If it does, I would guess
> there's probably a better way than this. Maybe someone else can give input.
>
> Hope this helps,
> Patrick​
>
> On Tue, Aug 4, 2015 at 10:31 AM, Lingxiao Jia <[email protected]>
> wrote:
>
>> Hello all,
>>
>> I am new to gem5. I want to use gdb to inspect what is going on inside
>> the simulator in SE mode.
>> Specifically, I want to stop at certain PC and make a checkpoint at that
>> point, but I don't find an easy way to do that. The existing way to take
>> checkpoints can only be taken at certain tick.
>> I reviewed the source code and generally located where the PC is stored
>> (in the ThreadState structure of the thread of the corresponding CPU).
>> But since gem5 use swig to bridge python and C++, I am really confused if
>> it is possible to access the PC globally in gdb?
>>
>> Thanks.
>>
>> --
>>
>> Best regards,
>>
>> Lingxiao Jia
>>
>>
>> Electrical & Computer Engineering (ECE)
>>
>> The University of Texas at Austin (UT-Austin)
>>
>> _______________________________________________
>> gem5-users mailing list
>> [email protected]
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>
>
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>



-- 

Best regards,

Lingxiao Jia

贾凌霄


Electrical & Computer Engineering (ECE)

The University of Texas at Austin (UT-Austin)
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to