如何调试在启动/登录时加载的应用程序?

如何调试在启动/登录时加载的应用程序?

我在 Ubuntu 10.10 AMD64 上使用 NetworkManger Applet 0.8.1。它(或 NetworkManager 或我的无线驱动程序)似乎偶尔会崩溃,这意味着我失去了所有网络连接。如何在启动和登录时调试 NetworkManager 和 Applet?我想知道是什么导致了这个问题,以便我可以修复它或提交错误报告。

编辑:这一页提供了一些有关调试 NetworkManager 守护程序的详细信息,但我仍然遇到该小程序的问题(例如,小程序崩溃,我失去连接,我重新启动 NetworkManager 并使用命令行实用程序,重新获得连接,但没有小程序回来)。

答案1

Network-Manager 从 启动/etc/init.d,简单看一下就会发现:

ls /etc/init.d/netw*
  /etc/init.d/networking
  /etc/init.d/network-interface
  /etc/init.d/network-manager

因此你首先可以停止它:

sudo /etc/init.d/network-manager stop

我不知道你喜欢用什么方法来调试它strace


man NetworkManager

       --no-daemon
              Do  not  daemonize.   This  is useful for debugging, and directs log output to the controlling
              terminal in addition to syslog.

DEBUGGING
       The following environment variables are supported to help debugging.  When used in  conjunction  with
       the  "--no-daemon"  option (thus echoing PPP and DHCP helper output to stdout) these can quickly help
       pinpoint the source of connection issues.

因此,您不应该使用 strace 和简单的重启,而应该先停止守护进程,然后在控制台中使用上述选项启动,这样您就可以实时查看正在发生的事情。

答案2

搜索日志文件:

dmesg | tail 

事件发生后不久,也许tail -n 40,看到man tail

grep -i net /var/log/*log

如果你发现一些有趣的东西:

less /var/log/XY.log

如果您知道您的 wlan 模块名称,请用 grep 搜索。

相关内容