GDB debug Segment Fault's online http Process Method, gdbsegment

Source: Internet
Author: User
Tags parse error

GDB debug Segment Fault's online http Process Method, gdbsegment

Some problems can only be reflected on online machines with high concurrency traffic, and the testing machines cannot reproduce them.

We can use GDB to solve this problem.

Start GDB in the command line.

GDB

Enter

Attach http process id

If you need to set a power failure, you can first stop and then set a power failure.

Enter c or continue to continue providing services. If A Segfault error occurs in this process, we can use the tracking commands such as bt to check the problem.


Hello, how do you solve the segment fault encountered during program compilation in linux? What do you know? # objdump-d xxx> debug

Objdump-d xxx> debug
The result of disassembly of executable programs is stored in the debug file, which can be understood only after the assembly language is used.

When you compile the program, you will encounter segment fault? Or when I run the program?
Generally, you can use gdb to trace and debug the program. (when compiling with gcc, you must add the-g option so that the executable program only contains the symbol table to match the source code with the command ).

In Embedded Linux, how does one implement GDB remote debugging?

Youdao Qixin embedded Research Institute-remote debugging environment consists of the host machine GDB and the target machine debugging stub, both of which are connected through serial port or TCP. The GDB standard Remote Serial protocol is used in collaboration to monitor and debug the system kernel and upper-layer applications on the target machine. Debugging stub is a piece of code in the embedded system, which exists as a medium between the local host GDB and the target machine debugging program.
 
Currently, there are three main remote debugging methods in the embedded Linux system, which are suitable for debugging in different scenarios: use ROM Monitor to debug the target program, use KGDB to debug the system kernel, and use gdbserver to debug the user space program. The main difference between the three debugging methods is that the existence of stub for remote debugging on the target machine is different, while the design idea and implementation method are roughly the same.
 
The most common practice is to debug applications. Debugging is performed using gdb + gdbserver. In many cases, users need to debug an application repeatedly, especially complex programs. The GDB method is used for debugging. Due to limited embedded system resources, debugging on the target system is generally not allowed. gdb + gdbserver is usually used for debugging. Gdbserver runs in the target system, while gdb runs on the host machine.
 
To debug GDB, the target system must contain the gdbserver program, and the local host must also install the gdb program. Generally, there is a running gdb in the linux release, but developers cannot directly use gdb in the release for remote debugging. Instead, they need to obtain the source code package of gdb, make a simple configuration for the arm platform and re-compile the corresponding gdb. the source code package of gdb can be:
# Tar jxvf gdb-6.4-tar-bz2
# Cd gdb-6.4
#./Configure -- target = arm-linux -- prefix =/usr/local/arm-gdb-v
# Make
(This step may cause a problem, prompting a function (the specific function name does not remember) parse error, that is, an "}" is added before the unsigned side "}", you can use vi to enter that line and delete it .)
# Make install
# Export PATH = $ PATH:/usr/local/arm-gdb
Go to the gdbserver directory:
#./Configure -- target = arm-linux-host = arm-linux
# Make CC =/usr/local/arm/2.95.3/bin/arm-linux-gcc
(This step specifies the location of arm-linux-gcc, which may be different from yours)
If there is no error, generate the gdbserver executable file in the gdbserver directory, and burn it to the root file system partition of flash, or use nfs mount. You only need to ensure that gdbserver can run on the Development Board.
 
Next we can use gdb + gdbserver to debug the program on our development board. Running gdbserver on the target board is actually running on the host... the remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.