2016-08-25 10 views
2

아무도 답변을 찾지 못해 추가 정보가있는 this 질문까지 이어집니다. 최신 QEMU 레포를 복제 한 후 this 자습서를 따라 arm-softmmu 용 Hello World 프로그램을 만들었습니다. 나는 도우미 함수를 사용하여 기본 블록의 레지스터 대신 TCG를 추적했지만 트레이스 기능을 발견 했으므로 사용해보고 싶었다. documentation 다음에, 이는 추적 이벤트 파일의 주석 처리를 제거한 후 my/tmp/events 파일입니다.QEMU의 간단한 추적 백엔드 사용 방법은 무엇입니까?

exec_tb 
exec_tb_exit 

비활성화 키워드가 추적을 가능하게 제거하는 트레이스 이벤트 파일의 일부는 다음과 같습니다

./configure --target-list=arm-softmmu --enable-trace-backends=simple 

make 

./qemu-system-arm -trace events=/tmp/events -M versatilepb -m 256M -nographic -kernel ~/FileName.bin 
:

# TCG related tracing (mostly disabled by default) 
# cpu-exec.c 
exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR 
exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR 
exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x" 

이것은 내가 구성하고 QEMU 실행 파일을 실행하는 방법입니다

arm-softmmu 디렉토리에서 간단한 추적 파이썬 스크립트를 다음과 같이 실행합니다.

./scripts/simpletrace.py trace-events arm-softmmu/trace-*pid* | head 

여기에 잘못된 것이 있습니까? 나는 절대적으로 아무런 정보도받지 못하기 때문에. 추적 후 바이너리조차도 짧은 줄 (물론 횡설수설)입니다. 나는 실제로 충분히 큰 추적을 기대했다.

답변

-1

난 당신이 잘못하고있는 것을 발견 할 수없는,하지만 최소한 자기가 한 명령에서 작동 예를 들어 작업을 포함 제공 할 수 https://github.com/cirosantilli/linux-kernel-module-cheat/tree/467923860b78bb5d0c787f1433682dfc9c83223a#count-instructions

당신이 복제되면 :

./run -n -- -trace exec_tb,file=trace 
./qemu/scripts/simpletrace.py qemu/trace-events trace >trace.txt 
wc -l trace 

및 그 흔적을 볼 수 있습니다. ARM의 경우

:

./run -a arm -- -trace exec_tb,file=trace 

어쩌면 이것이 당신이 잘못 무엇인지 diff를 할 수 있습니다.

Buildroot했던 정확한 QEMU의 설정 라인

이었다

./configure --target-list="arm-softmmu" --prefix="/home/ciro/bak/git/linux-kernel-module-cheat/buildroot/output.arm~/hos 
t/usr" --interp-prefix=/home/ciro/bak/git/linux-kernel-module-cheat/buildroot/output.arm~/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot --cc="/usr/bin/gcc" --host-cc="/usr 
/bin/gcc" --python=/home/ciro/bak/git/linux-kernel-module-cheat/buildroot/output.arm~/host/usr/bin/python2 --extra-cflags="-O2 -I/home/ciro/bak/git/linux-kernel-module-cheat/bu 
ildroot/output.arm~/host/usr/include" --extra-ldflags="-L/home/ciro/bak/git/linux-kernel-module-cheat/buildroot/output.arm~/host/lib -L/home/ciro/bak/git/linux-kernel-module-ch 
eat/buildroot/output.arm~/host/usr/lib -Wl,-rpath,/home/ciro/bak/git/linux-kernel-module-cheat/buildroot/output.arm~/host/usr/lib" --enable-debug --enable-sdl --extra-cflags='- 
DDEBUG_PL061=1' --with-sdlabi=2.0 
QEMU의 v2.7.0에

및 전체 QEMU 명령했다 :

./buildroot/output.x86_64~/host/usr/bin/qemu-system-x86_64 -m 128M -monitor telnet::45454,server,nowait -netdev user,hostfwd=tcp::45455-:45455,id=net0 -smp 1 -M pc -append 'root=/dev/vda nopat nokaslr norandmaps printk.devkmsg=on printk.time=y console=ttyS0 init=/poweroff.out' -device edu -device lkmc_pci_min -device virtio-net-pci,netdev=net0 -kernel ./buildroot/output.x86_64~/images/bzImage -nographic -trace exec_tb,file=trace -drive file='./buildroot/output.x86_64~/images/rootfs.ext2.qcow2,if=virtio,format=qcow2' 

내가 또한, --enable-trace-backends없이 시작하는 것이 좋습니다한다 큰 성능 저하로 stdout으로 물건을 뱉어 버리는 더 단순한 백엔드로 연결됩니다. 또한 GDB QEMU를 시도해보십시오. 누락 된 부분을 쉽게 찾아 낼 수 있어야합니다.

업데이트 2.11