Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QlArchARM object has no attribute unicorn_exception_handler during ARM Cortex-M emulation #1478

Open
thdemarty opened this issue Jun 27, 2024 · 3 comments

Comments

@thdemarty
Copy link

thdemarty commented Jun 27, 2024

Describe the bug
When attempting to emulate a bare-metal ARM program for Cortex-M using Qiling, the following error occurs: AttributeError: 'QlArchARM' object has no attribute 'unicorn_exception_handler'.

Sample Code

from qiling import Qiling
from qiling.const import *

ELF_FILE_PATH = "my-application.axf"
ROOT_FS_PATH = "./rootfs"

ql = Qiling([ELF_FILE_PATH], ROOT_FS_PATH, archtype=QL_ARCH.ARM, ostype=QL_OS.MCU, verbose=QL_VERBOSE.DEBUG)
ql.run()

Expected behavior
The Qiling emulator should successfully initialize and run the provided ARM Cortex-M ELF file without raising an AttributeError.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

  • Qiling version: 1.4.6
  • Python version: 3.10.12
  • Operating System: Ubuntu 22.04.4 LTS - x86_64
  • Detailed error message: AttributeError: 'QlArchARM' object has no attribute 'unicorn_exception_handler'
@elicn
Copy link
Member

elicn commented Jun 27, 2024

Hi there and welcome to Qiling.
Can you please provide the relevant error message from the logs?

@thdemarty
Copy link
Author

Hello,

Here is the full traceback when executing the program :

[+]     Profile: default
Traceback (most recent call last):
  File "/home/me/emulation/qiling_emulation.py", line 15, in <module>
    ql = Qiling([ELF_FILE_PATH], ROOT_FS_PATH, archtype=QL_ARCH.ARM, ostype=QL_OS.MCU, verbose=QL_VERBOSE.DEBUG)
  File "/home/me/emulation/env/lib/python3.10/site-packages/qiling/core.py", line 190, in __init__
    self.loader.run()
  File "/home/me/emulation/env/lib/python3.10/site-packages/qiling/loader/mcu.py", line 136, in run
    self.ql.hook_intr(self.ql.arch.unicorn_exception_handler)
AttributeError: 'QlArchARM' object has no attribute 'unicorn_exception_handler'

'QlArchARM' object has no attribute 'unicorn_exception_handler'

@elicn
Copy link
Member

elicn commented Jul 2, 2024

archtype=QL_ARCH.ARM is not supported for MCU; try archtype=QL_ARCH.CORTEX_M instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants