如何调试远程Linux二进制文件? [英] How to debug a remote linux binary?

查看:157
本文介绍了如何调试远程Linux二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是情况:

我有一个正在崩溃的linux二进制文件。没有日志文件,跟踪文件等。我需要能够附加一个调试器(我本地有源代码)并追踪错误。



什么是最简单,最好的方法来解决这个问题?

解决方案

远程调试相当简单:在目标平台上,使用GDBserver ,同时指定主机和端口以侦听传入的TCP连接:

  gdbserver HOST:PORT PROG [ARGS ...] 

在开发工作站上,启动跨目标GDB:

  powerpc-7450-linux-gnu-gdb PROG 

务必指定不可剥离的可执行文件。在GDB控制台上键入:

 目标远程主机:PORT 
break主要
继续

使用GDB和GDBserver进行远程跨目标调试


Here is the situation:

I've got a linux binary that is crashing. No log files, trace files, etc. I need to be able to attach a debugger to it (I have the source locally) and track down the error.

Whats the easiest, best way to approach this problem?

解决方案

Remote debugging is rather straightforward: on the target platform, launch the application with GDBserver, while specifying the host and port for listening to an incoming TCP connection:

  gdbserver HOST:PORT PROG [ARGS ...]

On the development workstation, launch the cross-target GDB:

  powerpc-7450-linux-gnu-gdb PROG

Be sure to specify the non-stripped executable. At the GDB console, type:

  target remote HOST:PORT
  break main
  continue

Remote cross-target debugging with GDB and GDBserver

这篇关于如何调试远程Linux二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆