如何在ubuntu上使用调试库 [英] How to use debug libraries on ubuntu

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

问题描述

我目前的问题是libwebkitgtk-3.0-0,但我猜这个问题是一般的。



我的应用程序在webkit代码中的某个地方崩溃。我的假设是我们正在做一些愚蠢的事情,想要找出什么。最简单的事情是设置断点或使用调试版本的库。


  1. 如何获取哪个库的准确源代码被建?在堆栈核心之后,我收到堆栈跟踪,但行数gdb表示与我在代码中看到的不符。换句话说,如果我安装libwebkitgtk-3.0-0,我想得到这个的确切的源代码。


  2. 我已经安装了webkit库的调试版本。这些调试版本是否具有相同的功能,就像使用--enable-debug标志编译webkit一样? webkit的调试版本启用基于WEBKIT_DEBUG环境变量的日志记录,但是即使使用调试版本的库,也无法获得相同的日志记录。


  3. 如何使用调试版本我设法编译?我设法在我的机器上编译webkit,并尝试着加载路径等。我的应用程序不会拾取新的共享库,无论我做什么 - 我可以基于用户代理签名。有一次,我设法拿起图书馆,但是SSL停止工作。 GtkLauncher发生同样的SSL问题。所以我在某个地方犯错误。


感谢指针。

解决方案

1)当我需要挖掘一个通过一个包安装的库时,我所做的第一件事是从源安装。我的意思是配置/ make / make安装。我通常将源代码放在/ usr / local / src中,并将其安装在/ usr / local中。在我看来,这是运行确切代码的最可靠的方式,您有来源。



3)


如何使用我设法编译的调试版本?


这听起来像你我上面描述的您需要做的是确保您的软件正在使用托管已编译,启用调试功能的库的包含和链接目录。意思是确保-I / usr / local / include和-L / usr / local / lib标志被设置,并且它们在/ usr / include和/ usr / lib之前。



通过从ubuntu安装中删除二进制版本的库,您可以更加确定,确保您构建和安装的版本是唯一的版本硬盘。这样你就可以确定你能够配置你的应用来使用该库。否则它会失败,而不是你不断地想知道是使用新的库还是旧的库。



2)通常是的。但这取决于图书馆的写作方式,ubuntu packager决定做什么。



使用本地构建的库编译程序后,请先查看是否存在相同的错误。如果不是,那也是一个数据点。 ubuntu最后一次打包库后可能会出现问题。也许图书馆没有正确打包,这是问题。您甚至可能会收到新的错误,因为ubuntu打包程序以某种方式配置库,以便它可以正常工作,并且您没有做同样的事情。你会得到有趣的线索。



祝你好运


My current problem is with libwebkitgtk-3.0-0, but I guess this problem is generic enough.

My application is crashing somewhere in the webkit code. My assumption is we are doing something stupid and want to find out what. Easiest thing will be to set a breakpoint or use debug version of library.

  1. How do I get exact source code with which library was built? I am getting stack trace after it dumps the core, but line number gdb is saying do not match with those I see in the code. In other words if I install libwebkitgtk-3.0-0 I want to get exact source code of that.

  2. I have installed debug version of webkit library. Do these debug versions have same functionality as if you are compiling webkit with with --enable-debug flag? Debug versions of webkit enable logging based on WEBKIT_DEBUG environment variable, but I could not get the same logging even if use debug version of library.

  3. How to use the debug version I managed to compile? I managed to compile webkit on my machine and tried fiddling with load paths and such. My application does not pickup new shared library no matter what I do - I can tell based on user agent signature. At one point, I managed to pick up the library, but then SSL stops working. Same SSL problem does happen with GtkLauncher. So I am making mistake somewhere.

Thanks for the pointers.

解决方案

1) When I need to dig into a library that I installed through a package, the first thing I do is install it from source. I mean configur/make/make install. I typically put the source code in /usr/local/src and install it in /usr/local . This, in my opinion is the most reliable way of running the exact code for which you have the source.

3)

How to use the debug version I managed to compile?

This sounds like you did what I described above. What you need to do is make sure that your software is using the include and link directories that are hosting your compiled, debug enabled, library. Meaning making sure that -I/usr/local/include and -L /usr/local/lib flags are set and they come before /usr/include and /usr/lib.

You can be even more certain by removing the binary version of the libraries from the ubuntu installation, making sure that that version that you built and installed is the only version present on the hard disk. This way you will know for sure that you were able to configure your app to use that library. Otherwise it'll just fail, instead of you constantly wondering whether it's using the new library or the old library.

2) Typically yes. But it'd depend on how the library is written, and what the ubuntu packager decided to do.

Once you compile the program using your locally built library, see if you are getting the same exact error first. If not then that is also a data point. Maybe the problem got fixed since the last time ubuntu packaged the library. Maybe the library is not packaged properly and that's the problem. You might even get new errors, because the ubuntu packager configured the library a certain way so that it'd work and you didn't do the same thing. You will get interesting leads anyway.

Good luck

这篇关于如何在ubuntu上使用调试库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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