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

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

问题描述

我目前的问题是 libwebkitgtk-3.0-0,但我想这个问题已经足够通用了.

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

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

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. 我如何获得使用哪个库构建的准确源代码?我在转储核心后得到堆栈跟踪,但行号 gdb 表示与我在代码中看到的不匹配.换句话说,如果我安装 libwebkitgtk-3.0-0,我想获得它的确切源代码.

  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.

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

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.

如何使用我设法编译的调试版本?我设法在我的机器上编译了 webkit,并尝试摆弄加载路径等.无论我做什么,我的应用程序都不会选择新的共享库 - 我可以根据用户代理签名进行判断.有一次,我设法拿起了图书馆,但 SSL 停止工作.GtkLauncher 确实发生了同样的 SSL 问题.所以我在某处犯了错误.

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.

谢谢指点.

推荐答案

1) 当我需要深入研究通过包安装的库时,我做的第一件事就是从源代码安装它.我的意思是配置/制作/制作安装.我通常将源代码放在/usr/local/src 并将其安装在/usr/local 中.在我看来,这是运行您拥有源代码的确切代码的最可靠方式.

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?

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

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.

通过从 ubuntu 安装中删除库的二进制版本,您可以更加确定,确保您构建和安装的版本是硬盘上唯一存在的版本.通过这种方式,您将确定您能够配置您的应用程序以使用该库.否则它只会失败,而不是你不断地想知道它是使用新库还是旧库.

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) 通常是的.但这取决于库的编写方式,以及 ubuntu 打包程序决定做什么.

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

使用本地构建的库编译程序后,首先查看是否遇到完全相同的错误.如果不是,那么这也是一个数据点.也许自从 ubuntu 上次打包库以来问题就得到了解决.也许库没有正确打包,这就是问题所在.您甚至可能会遇到新的错误,因为 ubuntu 打包程序以某种方式配置了库,以便它可以工作,而您没有做同样的事情.无论如何,您都会获得有趣的潜在客户.

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.

祝你好运

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

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