[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Logging program execution artifacts in TCG

From: Alex Bennée
Subject: Re: Logging program execution artifacts in TCG
Date: Fri, 12 Nov 2021 10:36:24 +0000
User-agent: mu4e 1.7.4; emacs 28.0.60

Arnabjyoti Kalita <akalita@cs.stonybrook.edu> writes:

> Hello all,
> I have a requirement to record a few artifacts when I start a program
> execution in the TCG mode of QEMU. I use 'nochain,exec' debug flags
> when starting QEMU in TCG mode. This is for the x86_64 host and target
> architectures. I am using QEMU version 5.0.1.
> 1. sequence of memory instructions [ld/st and virtual address]
> 2. sequence of instruction accesses [cr3+virtual IP of executing instructions]
> 3. sequence of annotated instructions [cr3+virtual IP of instruction,
> opcode, if ld/st instruction, also virtual address]
> I presume that the virtual IP and cr3 values can be obtained through
> the "CPUX86State *env" variable that is passed around at translation
> time.
> But I am not sure how I will be able to do part 1 and part 3 in the
> TCG mode of QEMU.
> Can you please provide me ideas as to how the artifacts in Part 1 and
> Part 3 be recorded?

You could try running your program with the execlog plugin:

  ./qemu-system-aarch64 -monitor none -display none -chardev stdio,id=output  
-M virt -cpu max -display none -semihosting-config 
enable=on,target=native,chardev=output -ker
  nel tests/tcg/aarch64-softmmu/hello -plugin ./contrib/plugins/libexeclog.so 
-d plugin
  0, 0x400027b0, 0x10ffc280, "adr x0, #0x40002000"
  0, 0x400027b4, 0xd518c000, "msr vbar_el1, x0"
  0, 0x400027b8, 0xd0000fe0, "adrp x0, #0x40200000"
  0, 0x400027bc, 0x91000000, "add x0, x0, #0"
  0, 0x400027c0, 0xd5182000, "msr ttbr0_el1, x0"
  0, 0x400027c4, 0x10000001, "adr x1, #0x400027c4"
  0, 0x400027c8, 0x92628421, "and x1, x1, #0xffffffffc0000000"
  0, 0x400027cc, 0x8b416c02, "add x2, x0, x1, lsr #27"
  0, 0x400027d0, 0xf0000fe0, "adrp x0, #0x40201000"
  0, 0x400027d4, 0xb2400401, "orr x1, x0, #3"
  0, 0x400027d8, 0xf9000041, "str x1, [x2]", store, 0x40200008, RAM
  0, 0x400027dc, 0x58000625, "ldr x5, #0x400028a0", load, 0x400028a0, RAM

> Thank you very much.
> Best Regards,
> Arnabjyoti Kalita

Alex Bennée

reply via email to

[Prev in Thread] Current Thread [Next in Thread]