Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ ARM assembler instruction debugging method     - Linux performance monitoring - CPU, Memory, IO, Network (Linux)

- Linux Command Tutorial: du command to view disk space (Linux)

- Terminal multiplexing tool tmux use (Linux)

- Linux compression and decompression command (Linux)

- Volatile keyword in C language understanding (Programming)

- Achieve camera preview by ffplay (Linux)

- Linux System Getting Started Tutorial: Installing Brother printer in Linux (Linux)

- Linux System Getting Started Tutorial: how to find information on Linux-embedded module (Linux)

- Linux System Tutorial: How to Check MariaDB server versions (Database)

- Java Annotation Comments (Programming)

- Installation Atom text editor on Mint Ubuntu / Linux (Linux)

- Linux operating system security settings initial understanding (Linux)

- Customize the output format in Linux history (Linux)

- SpringMVC the use of interceptors (Programming)

- Setting Derby as Linux / Windows running as a service from the start (Server)

- Proficient in C / C ++ can also find a very good job (Programming)

- Oracle 11g RMAN virtual private directory (Database)

- C ++ inheritance and derived (induction principle) (Programming)

- Repair fatal error in Linux: lame / lame.h: No such file or dir Error (Linux)

- Linux Timing task Crontab command Detailed (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
- Kali Linux virtualbox rc = Error 1908 workaround (Linux)
- Linux environment variable configuration (Linux)
- Nginx server load balancing dual-system availability (Server)
- Getting Started with Linux: Learn how to upgrade Docker in Ubuntu (Server)
- Linux - EXT2 file system is described in detail (Linux)
- Java rewrite the hashcode method (Programming)
- Linux System Getting Started Tutorial: Installing Brother printer in Linux (Linux)
- On the PC goes heavy security watch your startup items (Linux)
- Oracle and MySQL difference between the jdbc (Database)
- Sublime Text 3 shortcuts summary (Linux)
- ogg Oracle to SQL Server 2005 to achieve synchronization (Database)
- Android Service service applications and the phone SMS Listener Listener (Programming)
- Linux iptables firewall settings whitelist (RHEL 6 and CentOS 7) (Linux)
- Git common skills (Linux)
- Guide: Trickle restrict application bandwidth usage (Linux)
- Linux shell script to adjust the Task Scheduler (Linux)
- Debugging with GDB tool Go (Programming)
- 11G ASM disk group does not automatically handle MOUNT (Database)
- Linux three ways to set environment variables (Linux)
- OGG-03510 Problem (Database)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.