应该如何使用strace? [英] How should strace be used?

查看:176
本文介绍了应该如何使用strace?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一位同事曾经告诉我,在Linux上无法调试的最后一个选项是使用 strace



我试图学习这个奇怪工具背后的科学,但我不是一个系统管理大师,真的得到结果。



所以,




  • 它究竟是什么和什么

  • 如何和在哪种情况下使用?

  • 应该如何理解和处理输出?



简而言之,简单的单词,这个东西怎么工作?

解决方案

Strace概述

strace可以看作是一个轻量级的调试器。它允许程序员/用户快速了解程序如何与操作系统进行交互。通过监视系统调用和信号来实现。



使用

当您没有源代码时,或者不想打扰真正的通过它。

另外,如果你不喜欢打开GDB,但只是想了解外部交互感兴趣,那么对于你自己的代码也是有用的。 p>

一个很好的小介绍

我碰到这样做到strace只是在另一天使用: strace hello world


A colleague once told me that the last option when everything has failed to debug on Linux was to use strace.

I tried to learn the science behind this strange tool, but I am not a system admin guru and I didn’t really get results.

So,

  • What is it exactly and what does it do?
  • How and in which cases should it be used?
  • How should the output be understood and processed?

In brief, in simple words, how does this stuff work?

解决方案

Strace Overview
strace can be seen as a light weight debugger. It allows a programmer / user to quickly find out how a program is interacting with the OS. It does this by monitoring system calls and signals.

Uses
Good for when you don't have source code or don't want to be bothered to really go through it.
Also, useful for your own code if you don't feel like opening up GDB, but are just interested in understanding external interaction.

A good little introduction
I ran into this into to strace use just the other day: strace hello world

这篇关于应该如何使用strace?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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