Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ ARM assembler instruction debugging method     - What is a logical partition management LVM, how to use in Ubuntu (Linux)

- Graphical interface for the CentOS 6.4 installed and connected by remote VNC (Linux)

- Improve the efficiency of Linux development tools 5 (Linux)

- Wine 1.7 is installed on a system based on RedHat or Debian (Linux)

- ARM runtime environment built from scratch using QEMU emulator (Linux)

- Install DB2 V10 and Data Studio V3 under Linux (Ubuntu) environment (Database)

- Towards Docker (Server)

- CentOS 7.0 Close firewall is enabled by default iptables firewall (Linux)

- RedHat Performance Tuning (Server)

- Installation and operation GAMIT software under Linux operating system (Linux)

- Without Visual Studio .NET Windows application development (Programming)

- MySQL Study of --Percona Server 5.5 Upgrade 5.6 (Database)

- Sorting Algorithm (1) Quick Sort C ++ implementation (Programming)

- How to remove the files inside the privacy of data on Linux (Linux)

- Ten linux version of the system (Linux)

- Talk about Java EE Learning (Programming)

- Detailed usage history command (Linux)

- Open container cluster management system architecture and components introduced Kubernetes (Server)

- A process of how to get the current traffic in GNU Linux (Linux)

- Help you make Git Bisect (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
_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
     
         
         
         
  More:      
 
- The difference between Objective-C language nil, Nil, NULL, NSNull (Programming)
- Realize screen recording and playback via Linux command (Linux)
- Linux security-related basics (Linux)
- expdp / impdp use version parameter data migration across versions (Database)
- C ++ two second pointer memory model (two-dimensional array) (Programming)
- 10 useful Linux command Interview Questions and Answers (Linux)
- Installation and use Docker under Ubuntu 14.04 (Linux)
- Ubuntu Apache2 setting, problem solving css, pictures, etc. can not be displayed (Server)
- Linux basic introductory tutorial ---- simple text processing (Linux)
- Linux, Google Test (GTest) test environment to build step (Linux)
- How to migrate MySQL to MariaDB under linux (Database)
- Elixir: the future of programming languages (Programming)
- Python Multithreaded Programming (Programming)
- 64-bit Windows Server 2012 R2 install Oracle 10g Second Edition (Database)
- Keepalived + HAProxy high availability load balancing (Server)
- By way of a binary installation innobackupex (Database)
- Grading defense against Linux server attacks (Linux)
- Linux in order to make NMAP hide and seek with the firewall (Linux)
- PostgreSQL with the C Completing the storage process instances (Database)
- Oracle local user login authentication fails ORA-01031 insufficient privileges (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.