admin管理员组文章数量:1296911
Simics 6 had a "set-prefix" front-end command that could be used following creation of a breakpoint, e.g.,
for bp in self.breakpoint_list:
bp.break_num = SIM_breakpoint(bp.object, bp.addr_type, bp.mode, bp.addr, bp.length, bp.flags)
if bp.prefix is not None:
command = 'set-prefix %d "%s"' % (bp.break_num, bp.prefix)
SIM_run_alone(SIM_run_command, command)
The set-prefix command is deprecated out of Simics 7, and the documenation suggests using the bp.memory.break command instead. However, the bp.memory.break command uses the front end processor which is inefficent from within breakpoint-intensive scripts.
Using a mix of SIM_breakpoint (for efficiency) and bp.memory.break (to set a prefix) seems dangerous because the bp.manager and SIM_breakpoint are not exclusive on their use of breakpoint numbers. For example:
from simics import *
import cli
'''
Demonstrate how SIM_breakpoint and bp.memory.break do not use exclusive breakpoint numbers
'''
def theHap(cpu, the_obj, the_break, memory):
print('in theHap break %d memory 0x%x' % (the_break, memory.logical_address))
cmd = 'ubuntu.get-processor-list'
proclist = SIM_run_command(cmd)
cpu = SIM_get_object(proclist[0])
print('Our cpu is %s' % cpu.name)
bp1 = SIM_breakpoint(cpu.current_context, Sim_Break_Linear, Sim_Access_Execute, 0x00000000b774d753, 1, 0)
print('added break %s with SIM_breakpoint' % bp1)
proc_hap = SIM_hap_add_callback_index("Core_Breakpoint_Memop", theHap, cpu, bp1)
print('Hap set on breakpoint %d' % bp1)
bp2 = SIM_run_command('bp.memory.break 0x00000000b774d75d')
print('added break %s with bp.memory.break' % bp2)
proc_hap = SIM_hap_add_callback_index("Core_Breakpoint_Memop", theHap, cpu, bp2)
print('Hap set on breakpoint %d' % bp2)
Results in:
simics> run-script prefix.py
Our cpu is ubuntu.mb.cpu0.core[0][0]
added break 1 with SIM_breakpoint
Hap set on breakpoint 1
added break 1 with bp.memory.break
Hap set on breakpoint 1
NIL
simics> c
in theHap break 1 memory 0xb774d753
in theHap break 1 memory 0xb774d753
[ubuntu.cell_context] Breakpoint 1: ubuntu.cell_context 'x' access to v:0xb774d75d len=3
Is there a low-level Simics Python API for setting breakpoints with prefixes?
Simics 6 had a "set-prefix" front-end command that could be used following creation of a breakpoint, e.g.,
for bp in self.breakpoint_list:
bp.break_num = SIM_breakpoint(bp.object, bp.addr_type, bp.mode, bp.addr, bp.length, bp.flags)
if bp.prefix is not None:
command = 'set-prefix %d "%s"' % (bp.break_num, bp.prefix)
SIM_run_alone(SIM_run_command, command)
The set-prefix command is deprecated out of Simics 7, and the documenation suggests using the bp.memory.break command instead. However, the bp.memory.break command uses the front end processor which is inefficent from within breakpoint-intensive scripts.
Using a mix of SIM_breakpoint (for efficiency) and bp.memory.break (to set a prefix) seems dangerous because the bp.manager and SIM_breakpoint are not exclusive on their use of breakpoint numbers. For example:
from simics import *
import cli
'''
Demonstrate how SIM_breakpoint and bp.memory.break do not use exclusive breakpoint numbers
'''
def theHap(cpu, the_obj, the_break, memory):
print('in theHap break %d memory 0x%x' % (the_break, memory.logical_address))
cmd = 'ubuntu.get-processor-list'
proclist = SIM_run_command(cmd)
cpu = SIM_get_object(proclist[0])
print('Our cpu is %s' % cpu.name)
bp1 = SIM_breakpoint(cpu.current_context, Sim_Break_Linear, Sim_Access_Execute, 0x00000000b774d753, 1, 0)
print('added break %s with SIM_breakpoint' % bp1)
proc_hap = SIM_hap_add_callback_index("Core_Breakpoint_Memop", theHap, cpu, bp1)
print('Hap set on breakpoint %d' % bp1)
bp2 = SIM_run_command('bp.memory.break 0x00000000b774d75d')
print('added break %s with bp.memory.break' % bp2)
proc_hap = SIM_hap_add_callback_index("Core_Breakpoint_Memop", theHap, cpu, bp2)
print('Hap set on breakpoint %d' % bp2)
Results in:
simics> run-script prefix.py
Our cpu is ubuntu.mb.cpu0.core[0][0]
added break 1 with SIM_breakpoint
Hap set on breakpoint 1
added break 1 with bp.memory.break
Hap set on breakpoint 1
NIL
simics> c
in theHap break 1 memory 0xb774d753
in theHap break 1 memory 0xb774d753
[ubuntu.cell_context] Breakpoint 1: ubuntu.cell_context 'x' access to v:0xb774d75d len=3
Is there a low-level Simics Python API for setting breakpoints with prefixes?
Share Improve this question asked Feb 11 at 22:22 Mike ThompsonMike Thompson 52 bronze badges1 Answer
Reset to default 0However, the bp.memory.break command uses the front end processor which is inefficent from within breakpoint-intensive scripts.
Why is this inefficient? BTW, the bp.memory.break
takes optional object
parameter that can be use to select the object to set a breakpoint on.
Using a mix of SIM_breakpoint (for efficiency) and bp.memory.break (to set a prefix) seems dangerous because the bp.manager and SIM_breakpoint are not exclusive on their use of breakpoint numbers.
Yes, it is true. The numbers assigned are not related.
Is there a low-level Python API in Simics for setting breakpoints with prefixes?
The functionality is not available as Python API but one can "manually" update sim->breakpoints
attribute to set the required prefix. From Python the attribute is available as conf.sim.attr.breakpoints
. One can get the documentation for the attribute with the help sim->breakpoints
command.
is inefficent from within breakpoint-intensive scripts
I don't know your performance requirements and whether this Python code is a bottleneck but can note that rewriting related code in C can definitely give a performance boost.
本文标签: Is there a lowlevel Python API in Simics for setting breakpoints with prefixesStack Overflow
版权声明:本文标题:Is there a low-level Python API in Simics for setting breakpoints with prefixes? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741631207a2389376.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论