Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ ARM assembler instruction debugging method     - Node.js Getting the basics: Helloworld! (Linux)

- 29 practical examples Linux system / network administrator of nmap (Linux)

- The difference between equals and == in Java (Programming)

- Java Annotation Comments (Programming)

- Linux fast set ip bond (Linux)

- Use Oracle Data Guard to complete cross-platform database migration cases (Database)

- Android shutdown (reboot) process (Programming)

- Vim useful plugin: YouCompleteMe (Linux)

- Rails 4.1.6 start being given Could not find a JavaScript runtime (Linux)

- CentOS 6.4 (64bit) install Python 2.7.5 (Linux)

- CentOS6 installation configuration rsh (Server)

- Ubuntu and derivatives installation Atom 0.104.0 (Linux)

- How to install and configure the KVM and Open vSwitch on Linux distributions (Linux)

- OGG-03510 Problem (Database)

- Btrfs file system creation and their characteristics in Linux (Linux)

- Linux bash: scp: command not found the problem (Linux)

- How to enable Software Collections (SCL) on CentOS (Server)

- Install the latest development version of Wine on RedHat and Debian-based systems (Linux)

- Build your own Python coding environment (Linux)

- Vi syntax highlighting settings (Linux)

  ARM assembler instruction debugging method
  Add Date : 2018-11-21      
  Learning ARM assembly time, and ultimately, for debugging ARM assembly instructions. As a multi-language debugger, gdb nature is a better choice. The debugger work, generally by modifying the contents of the code segment structure trap soft interrupt instruction, and implement procedures to suspend the monitor program execution state. To execute ARM instruction on the x86 platform, you can use qemu emulator executing ARM assembly instructions.

First, prepare ARM assembler

First, we construct a simple piece of ARM assembler program as a test code main.s.

.globl _start
mov R0, # 0
swi 0x00900001
Above assembly instructions to complete the exit system call 0 calls. mov instruction system calls incoming register R0, then use 0x00900001 into soft interrupt system calls.

To run the ARM assembly code, you need to use a cross compiler arm-linux-gcc compiler for ARM assembly code. After downloading cross compiler installed on ARM assembly code to compile.

arm-linux-gcc main.s -o main -nostdlib
Compile option "-nostdlib" said they did not use any run-time library files, compiled executable file can only be run on the main system ARM architecture.

Second, compile and install qemu emulator

To run the ARM architecture executable within an x86 Linux system, you need to install qemu emulator.

First, download the source code qemu, and then ensure that the system has been installed flex and bison.

Compile and install qemu.

./configure --prefix = / usr
sudo make && make install
Then use the qemu emulator for ARM ARM program execution.

qemu ./main
Third, compile and install arm-gdb

To debug ARM program, you need to use the source code to compile gdb generation arm-gdb.

First, download the gdb source code, compile and install.

./configure --target = arm-linux --prefix = / usr / local
sudo make && make install
In order to avoid conflicts and gdb system, we will install gdb installation directory to / usr / local, and then create a soft link.

ln -s / usr / bin / arm-gdb / usr / local / gdb / gdb
Then you can use arm-gdb debugger command ARM program.

Fourth, the program debugging ARM

The first to use qemu turn on remote debugging port.

qemu-arm -g 1024 ./main
And then export the environment variable QEMU_GDB.

export QEMU_GDB = / usr / local / gdb
Finally, enter the gdb debugger.

arm-gdb ./main
After entering arm-gdb, first connect remote debugging port.

(Gdb) target remote localhost: 1024
Then use the usual gdb debugging commands to debug code.

(Gdb) disassemble // View Disassembly
(Gdb) x / 8xw 0x0000808e // Check memory
(Gdb) info register // View register
(Gdb) continue // continue
(Gdb) stepi // assembly-level process by
(Gdb) nexti // assembly-level statements by
- MySQL main and backup replication structures (using mysqld_multi) (Database)
- Linux system last command usage (Linux)
- Questions about Linux compiler u-boot (Programming)
- Oracle table Access Control (Database)
- Using Oracle for Oracle GoldenGate to achieve a one-way data synchronization (Database)
- MySQL binary packages install for RedHat Linux Enterprise 6.4 (Database)
- GNU Linux use diff to generate a patch with the patch (Linux)
- After you change the GRUB boot disk partition repair (Linux)
- Add your own kernel and ramfs based on an existing Linux LiveCD (Linux)
- Upgrading to Debian 7.6 glibc 2.15 (Linux)
- Linux (RHEL6 CENTOS6 OLE6) VNC-SERVER Installation and Configuration (Server)
- Linux System Getting Started Learning: Disable Ubuntu Apport internal error reporting procedures (Linux)
- CentOS7 installation configuration (Server)
- Realize screen recording and playback via Linux command (Linux)
- Killall five options you might not know (Linux)
- Oracle View Object Information (Database)
- Linux uses a screen recording under RecordMyDesktop (Linux)
- Stucts2 values on the page and how the attribute values corresponding to the Action (Programming)
- Getting Started with Linux system to learn: how to install autossh (Linux)
- Necessity in Java packages (Programming)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.