]>
Commit | Line | Data |
---|---|---|
f727df28 | 1 | Index: gdb-7.7.50.20140609/gdb/event-top.c |
3a58abaf | 2 | =================================================================== |
f727df28 KK |
3 | --- gdb-7.7.50.20140609.orig/gdb/event-top.c 2014-06-13 20:10:19.632787642 +0200 |
4 | +++ gdb-7.7.50.20140609/gdb/event-top.c 2014-06-13 20:11:49.605878557 +0200 | |
5 | @@ -38,6 +38,7 @@ | |
6ed6bacf | 6 | #include "gdbcmd.h" /* for dont_repeat() */ |
03ffe914 | 7 | #include "annotate.h" |
321e94d6 | 8 | #include "maint.h" |
f412e1b4 | 9 | +#include "symfile.h" |
6ed6bacf | 10 | |
f412e1b4 PS |
11 | /* readline include files. */ |
12 | #include "readline/readline.h" | |
f727df28 | 13 | @@ -176,6 +177,8 @@ rl_callback_read_char_wrapper (gdb_clien |
f412e1b4 | 14 | void |
321e94d6 | 15 | cli_command_loop (void *data) |
f412e1b4 PS |
16 | { |
17 | + debug_flush_missing (); | |
3a58abaf | 18 | + |
f412e1b4 PS |
19 | display_gdb_prompt (0); |
20 | ||
21 | /* Now it's time to start the event loop. */ | |
f727df28 | 22 | @@ -243,6 +246,8 @@ display_gdb_prompt (char *new_prompt) |
3a58abaf AM |
23 | /* Reset the nesting depth used when trace-commands is set. */ |
24 | reset_command_nest_depth (); | |
25 | ||
26 | + debug_flush_missing (); | |
27 | + | |
f727df28 KK |
28 | old_chain = make_cleanup (free_current_contents, &actual_gdb_prompt); |
29 | ||
30 | /* Do not call the python hook on an explicit prompt change as | |
31 | Index: gdb-7.7.50.20140609/gdb/symfile.h | |
3a58abaf | 32 | =================================================================== |
f727df28 KK |
33 | --- gdb-7.7.50.20140609.orig/gdb/symfile.h 2014-06-13 20:10:19.633787643 +0200 |
34 | +++ gdb-7.7.50.20140609/gdb/symfile.h 2014-06-13 20:10:31.066799158 +0200 | |
35 | @@ -573,6 +573,8 @@ void map_symbol_filenames (symbol_filena | |
321e94d6 BS |
36 | /* build-id support. */ |
37 | extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr); | |
38 | extern void debug_print_missing (const char *binary, const char *debug); | |
39 | +extern void debug_flush_missing (void); | |
40 | +#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") | |
3a58abaf | 41 | |
321e94d6 | 42 | /* From dwarf2read.c */ |
3a58abaf | 43 | |
f727df28 | 44 | Index: gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp |
321e94d6 | 45 | =================================================================== |
f727df28 KK |
46 | --- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:19.634787644 +0200 |
47 | +++ gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:31.067799159 +0200 | |
48 | @@ -1492,7 +1492,7 @@ proc default_gdb_start { } { | |
321e94d6 BS |
49 | warning "Couldn't set the width to 0." |
50 | } | |
51 | } | |
52 | - # Turn off the missing warnings as the testsuite does not expect it. | |
53 | + # Turn off the missing RPMs warnings as the testsuite does not expect it. | |
54 | send_gdb "set build-id-verbose 0\n" | |
55 | gdb_expect 10 { | |
56 | -re "$gdb_prompt $" { | |
f727df28 | 57 | Index: gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp |
321e94d6 | 58 | =================================================================== |
f727df28 KK |
59 | --- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:19.635787645 +0200 |
60 | +++ gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:31.068799160 +0200 | |
321e94d6 BS |
61 | @@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } { |
62 | warning "Couldn't set the width to 0." | |
63 | } | |
64 | } | |
65 | - # Turn off the missing warnings as the testsuite does not expect it. | |
66 | + # Turn off the missing RPMs warnings as the testsuite does not expect it. | |
67 | send_gdb "190-gdb-set build-id-verbose 0\n" | |
68 | gdb_expect 10 { | |
69 | -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { | |
f727df28 | 70 | Index: gdb-7.7.50.20140609/gdb/tui/tui-interp.c |
321e94d6 | 71 | =================================================================== |
f727df28 KK |
72 | --- gdb-7.7.50.20140609.orig/gdb/tui/tui-interp.c 2014-06-13 20:10:31.068799160 +0200 |
73 | +++ gdb-7.7.50.20140609/gdb/tui/tui-interp.c 2014-06-13 20:10:47.806816542 +0200 | |
74 | @@ -32,6 +32,7 @@ | |
321e94d6 | 75 | #include "exceptions.h" |
f727df28 KK |
76 | #include "infrun.h" |
77 | #include "observer.h" | |
321e94d6 BS |
78 | +#include "symfile.h" |
79 | ||
f727df28 KK |
80 | static struct ui_out *tui_ui_out (struct interp *self); |
81 | ||
82 | Index: gdb-7.7.50.20140609/gdb/aclocal.m4 | |
321e94d6 | 83 | =================================================================== |
f727df28 KK |
84 | --- gdb-7.7.50.20140609.orig/gdb/aclocal.m4 2014-06-13 20:10:19.636787646 +0200 |
85 | +++ gdb-7.7.50.20140609/gdb/aclocal.m4 2014-06-13 20:10:31.069799161 +0200 | |
321e94d6 BS |
86 | @@ -11,6 +11,221 @@ |
87 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
88 | # PARTICULAR PURPOSE. | |
89 | ||
90 | +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- | |
91 | +# serial 1 (pkg-config-0.24) | |
92 | +# | |
93 | +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. | |
94 | +# | |
95 | +# This program is free software; you can redistribute it and/or modify | |
96 | +# it under the terms of the GNU General Public License as published by | |
97 | +# the Free Software Foundation; either version 2 of the License, or | |
98 | +# (at your option) any later version. | |
99 | +# | |
100 | +# This program is distributed in the hope that it will be useful, but | |
101 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
102 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
103 | +# General Public License for more details. | |
104 | +# | |
105 | +# You should have received a copy of the GNU General Public License | |
106 | +# along with this program; if not, write to the Free Software | |
107 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
108 | +# | |
109 | +# As a special exception to the GNU General Public License, if you | |
110 | +# distribute this file as part of a program that contains a | |
111 | +# configuration script generated by Autoconf, you may include it under | |
112 | +# the same distribution terms that you use for the rest of that program. | |
3a58abaf | 113 | + |
321e94d6 BS |
114 | +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) |
115 | +# ---------------------------------- | |
116 | +AC_DEFUN([PKG_PROG_PKG_CONFIG], | |
117 | +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) | |
118 | +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) | |
119 | +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) | |
120 | +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) | |
121 | +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) | |
122 | +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) | |
3a58abaf | 123 | + |
321e94d6 BS |
124 | +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then |
125 | + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) | |
126 | +fi | |
127 | +if test -n "$PKG_CONFIG"; then | |
128 | + _pkg_min_version=m4_default([$1], [0.9.0]) | |
129 | + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) | |
130 | + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | |
131 | + AC_MSG_RESULT([yes]) | |
132 | + else | |
133 | + AC_MSG_RESULT([no]) | |
134 | + PKG_CONFIG="" | |
135 | + fi | |
136 | +fi[]dnl | |
137 | +])# PKG_PROG_PKG_CONFIG | |
3a58abaf | 138 | + |
321e94d6 BS |
139 | +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) |
140 | +# | |
141 | +# Check to see whether a particular set of modules exists. Similar | |
142 | +# to PKG_CHECK_MODULES(), but does not set variables or print errors. | |
143 | +# | |
144 | +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | |
145 | +# only at the first occurence in configure.ac, so if the first place | |
146 | +# it's called might be skipped (such as if it is within an "if", you | |
147 | +# have to call PKG_CHECK_EXISTS manually | |
148 | +# -------------------------------------------------------------- | |
149 | +AC_DEFUN([PKG_CHECK_EXISTS], | |
150 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
151 | +if test -n "$PKG_CONFIG" && \ | |
152 | + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then | |
153 | + m4_default([$2], [:]) | |
154 | +m4_ifvaln([$3], [else | |
155 | + $3])dnl | |
156 | +fi]) | |
3a58abaf | 157 | + |
321e94d6 BS |
158 | +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) |
159 | +# --------------------------------------------- | |
160 | +m4_define([_PKG_CONFIG], | |
161 | +[if test -n "$$1"; then | |
162 | + pkg_cv_[]$1="$$1" | |
163 | + elif test -n "$PKG_CONFIG"; then | |
164 | + PKG_CHECK_EXISTS([$3], | |
165 | + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` | |
166 | + test "x$?" != "x0" && pkg_failed=yes ], | |
167 | + [pkg_failed=yes]) | |
168 | + else | |
169 | + pkg_failed=untried | |
170 | +fi[]dnl | |
171 | +])# _PKG_CONFIG | |
3a58abaf | 172 | + |
321e94d6 BS |
173 | +# _PKG_SHORT_ERRORS_SUPPORTED |
174 | +# ----------------------------- | |
175 | +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], | |
176 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | |
177 | +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | |
178 | + _pkg_short_errors_supported=yes | |
179 | +else | |
180 | + _pkg_short_errors_supported=no | |
181 | +fi[]dnl | |
182 | +])# _PKG_SHORT_ERRORS_SUPPORTED | |
3a58abaf | 183 | + |
3a58abaf | 184 | + |
321e94d6 BS |
185 | +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], |
186 | +# [ACTION-IF-NOT-FOUND]) | |
187 | +# | |
188 | +# | |
189 | +# Note that if there is a possibility the first call to | |
190 | +# PKG_CHECK_MODULES might not happen, you should be sure to include an | |
191 | +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac | |
192 | +# | |
193 | +# | |
194 | +# -------------------------------------------------------------- | |
195 | +AC_DEFUN([PKG_CHECK_MODULES], | |
196 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
197 | +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl | |
198 | +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl | |
3a58abaf | 199 | + |
321e94d6 BS |
200 | +pkg_failed=no |
201 | +AC_MSG_CHECKING([for $1]) | |
3a58abaf | 202 | + |
321e94d6 BS |
203 | +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) |
204 | +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) | |
e5178960 | 205 | + |
321e94d6 BS |
206 | +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS |
207 | +and $1[]_LIBS to avoid the need to call pkg-config. | |
208 | +See the pkg-config man page for more details.]) | |
e5178960 | 209 | + |
321e94d6 BS |
210 | +if test $pkg_failed = yes; then |
211 | + AC_MSG_RESULT([no]) | |
212 | + _PKG_SHORT_ERRORS_SUPPORTED | |
213 | + if test $_pkg_short_errors_supported = yes; then | |
214 | + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` | |
215 | + else | |
216 | + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` | |
217 | + fi | |
218 | + # Put the nasty error message in config.log where it belongs | |
219 | + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | |
3a58abaf | 220 | + |
321e94d6 BS |
221 | + m4_default([$4], [AC_MSG_ERROR( |
222 | +[Package requirements ($2) were not met: | |
3a58abaf | 223 | + |
321e94d6 | 224 | +$$1_PKG_ERRORS |
3a58abaf | 225 | + |
321e94d6 BS |
226 | +Consider adjusting the PKG_CONFIG_PATH environment variable if you |
227 | +installed software in a non-standard prefix. | |
3a58abaf | 228 | + |
321e94d6 BS |
229 | +_PKG_TEXT])[]dnl |
230 | + ]) | |
231 | +elif test $pkg_failed = untried; then | |
232 | + AC_MSG_RESULT([no]) | |
233 | + m4_default([$4], [AC_MSG_FAILURE( | |
234 | +[The pkg-config script could not be found or is too old. Make sure it | |
235 | +is in your PATH or set the PKG_CONFIG environment variable to the full | |
236 | +path to pkg-config. | |
3a58abaf | 237 | + |
321e94d6 | 238 | +_PKG_TEXT |
3a58abaf | 239 | + |
321e94d6 BS |
240 | +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl |
241 | + ]) | |
242 | +else | |
243 | + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | |
244 | + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | |
245 | + AC_MSG_RESULT([yes]) | |
246 | + $3 | |
247 | +fi[]dnl | |
248 | +])# PKG_CHECK_MODULES | |
3a58abaf | 249 | + |
3a58abaf | 250 | + |
321e94d6 BS |
251 | +# PKG_INSTALLDIR(DIRECTORY) |
252 | +# ------------------------- | |
253 | +# Substitutes the variable pkgconfigdir as the location where a module | |
254 | +# should install pkg-config .pc files. By default the directory is | |
255 | +# $libdir/pkgconfig, but the default can be changed by passing | |
256 | +# DIRECTORY. The user can override through the --with-pkgconfigdir | |
257 | +# parameter. | |
258 | +AC_DEFUN([PKG_INSTALLDIR], | |
259 | +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) | |
260 | +m4_pushdef([pkg_description], | |
261 | + [pkg-config installation directory @<:@]pkg_default[@:>@]) | |
262 | +AC_ARG_WITH([pkgconfigdir], | |
263 | + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, | |
264 | + [with_pkgconfigdir=]pkg_default) | |
265 | +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) | |
266 | +m4_popdef([pkg_default]) | |
267 | +m4_popdef([pkg_description]) | |
268 | +]) dnl PKG_INSTALLDIR | |
269 | + | |
270 | + | |
271 | +# PKG_NOARCH_INSTALLDIR(DIRECTORY) | |
272 | +# ------------------------- | |
273 | +# Substitutes the variable noarch_pkgconfigdir as the location where a | |
274 | +# module should install arch-independent pkg-config .pc files. By | |
275 | +# default the directory is $datadir/pkgconfig, but the default can be | |
276 | +# changed by passing DIRECTORY. The user can override through the | |
277 | +# --with-noarch-pkgconfigdir parameter. | |
278 | +AC_DEFUN([PKG_NOARCH_INSTALLDIR], | |
279 | +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) | |
280 | +m4_pushdef([pkg_description], | |
281 | + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) | |
282 | +AC_ARG_WITH([noarch-pkgconfigdir], | |
283 | + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, | |
284 | + [with_noarch_pkgconfigdir=]pkg_default) | |
285 | +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) | |
286 | +m4_popdef([pkg_default]) | |
287 | +m4_popdef([pkg_description]) | |
288 | +]) dnl PKG_NOARCH_INSTALLDIR | |
289 | + | |
290 | + | |
291 | +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, | |
292 | +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | |
293 | +# ------------------------------------------- | |
294 | +# Retrieves the value of the pkg-config variable for the given module. | |
295 | +AC_DEFUN([PKG_CHECK_VAR], | |
296 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
297 | +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl | |
3a58abaf | 298 | + |
321e94d6 BS |
299 | +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) |
300 | +AS_VAR_COPY([$1], [pkg_cv_][$1]) | |
3a58abaf | 301 | + |
321e94d6 BS |
302 | +AS_VAR_IF([$1], [""], [$5], [$4])dnl |
303 | +])# PKG_CHECK_VAR | |
3a58abaf | 304 | + |
321e94d6 BS |
305 | # AM_AUX_DIR_EXPAND -*- Autoconf -*- |
306 | ||
307 | # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. | |
f727df28 | 308 | Index: gdb-7.7.50.20140609/gdb/config.in |
321e94d6 | 309 | =================================================================== |
f727df28 KK |
310 | --- gdb-7.7.50.20140609.orig/gdb/config.in 2014-06-13 20:10:19.637787647 +0200 |
311 | +++ gdb-7.7.50.20140609/gdb/config.in 2014-06-13 20:10:31.069799161 +0200 | |
321e94d6 BS |
312 | @@ -33,6 +33,9 @@ |
313 | /* Define to BFD's default target vector. */ | |
314 | #undef DEFAULT_BFD_VEC | |
315 | ||
316 | +/* librpm version specific library name to dlopen. */ | |
317 | +#undef DLOPEN_LIBRPM | |
3a58abaf | 318 | + |
321e94d6 BS |
319 | /* Define to 1 if translation of program messages to the user's native |
320 | language is requested. */ | |
321 | #undef ENABLE_NLS | |
f727df28 | 322 | @@ -210,6 +213,9 @@ |
321e94d6 BS |
323 | /* Define if Python 2.7 is being used. */ |
324 | #undef HAVE_LIBPYTHON2_7 | |
325 | ||
326 | +/* Define if librpm library is being used. */ | |
327 | +#undef HAVE_LIBRPM | |
3a58abaf | 328 | + |
321e94d6 BS |
329 | /* Define to 1 if you have the <libunwind-ia64.h> header file. */ |
330 | #undef HAVE_LIBUNWIND_IA64_H | |
331 | ||
f727df28 | 332 | Index: gdb-7.7.50.20140609/gdb/configure |
321e94d6 | 333 | =================================================================== |
f727df28 KK |
334 | --- gdb-7.7.50.20140609.orig/gdb/configure 2014-06-13 20:10:19.642787652 +0200 |
335 | +++ gdb-7.7.50.20140609/gdb/configure 2014-06-13 20:10:31.073799165 +0200 | |
336 | @@ -692,6 +692,11 @@ PKGVERSION | |
321e94d6 BS |
337 | HAVE_NATIVE_GCORE_TARGET |
338 | TARGET_OBS | |
339 | subdirs | |
340 | +RPM_LIBS | |
341 | +RPM_CFLAGS | |
342 | +PKG_CONFIG_LIBDIR | |
343 | +PKG_CONFIG_PATH | |
344 | +PKG_CONFIG | |
345 | GDB_DATADIR | |
346 | DEBUGDIR | |
347 | MAKEINFO_EXTRA_FLAGS | |
f727df28 | 348 | @@ -795,6 +800,7 @@ with_gdb_datadir |
321e94d6 BS |
349 | with_relocated_sources |
350 | with_auto_load_dir | |
351 | with_auto_load_safe_path | |
352 | +with_rpm | |
353 | enable_targets | |
354 | enable_64_bit_bfd | |
355 | enable_gdbcli | |
f727df28 | 356 | @@ -846,6 +852,11 @@ CPPFLAGS |
321e94d6 BS |
357 | CPP |
358 | MAKEINFO | |
359 | MAKEINFOFLAGS | |
360 | +PKG_CONFIG | |
361 | +PKG_CONFIG_PATH | |
362 | +PKG_CONFIG_LIBDIR | |
363 | +RPM_CFLAGS | |
364 | +RPM_LIBS | |
365 | YACC | |
366 | YFLAGS | |
367 | XMKMF' | |
f727df28 | 368 | @@ -1516,6 +1527,8 @@ Optional Packages: |
321e94d6 BS |
369 | [--with-auto-load-dir] |
370 | --without-auto-load-safe-path | |
371 | do not restrict auto-loaded files locations | |
372 | + --with-rpm query rpm database for missing debuginfos (yes/no, | |
373 | + def. auto=librpm.so) | |
374 | --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets | |
375 | --with-curses use the curses library instead of the termcap | |
376 | library | |
f727df28 | 377 | @@ -1565,6 +1578,13 @@ Some influential environment variables: |
321e94d6 BS |
378 | MAKEINFO Parent configure detects if it is of sufficient version. |
379 | MAKEINFOFLAGS | |
380 | Parameters for MAKEINFO. | |
381 | + PKG_CONFIG path to pkg-config utility | |
382 | + PKG_CONFIG_PATH | |
383 | + directories to add to pkg-config's search path | |
384 | + PKG_CONFIG_LIBDIR | |
385 | + path overriding pkg-config's built-in search path | |
386 | + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config | |
387 | + RPM_LIBS linker flags for RPM, overriding pkg-config | |
388 | YACC The `Yet Another C Compiler' implementation to use. Defaults to | |
389 | the first program found out of: `bison -y', `byacc', `yacc'. | |
390 | YFLAGS The list of arguments that will be passed by default to $YACC. | |
f727df28 | 391 | @@ -5160,6 +5180,491 @@ _ACEOF |
321e94d6 BS |
392 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 |
393 | $as_echo "$with_auto_load_safe_path" >&6; } | |
394 | ||
395 | +# Integration with rpm library to support missing debuginfo suggestions. | |
396 | +# --without-rpm: Disable any rpm support. | |
397 | +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. | |
398 | +# Even with runtime missing `libname.so' GDB will still other run correctly. | |
399 | +# Missing `libname.so' during ./configure will abort the configuration. | |
400 | +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific | |
401 | +# minor version first such as `librpm-4.6.so' as minor version differences | |
402 | +# mean API+ABI incompatibility. If the specific match versioned library name | |
403 | +# could not be found still open dynamically at least `librpm.so'. | |
404 | +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try | |
405 | +# to find librpm for compilation-time linking by pkg-config. GDB binary will | |
406 | +# be probably linked with the version specific library (as `librpm-4.6.so'). | |
407 | +# Failure to find librpm by pkg-config will abort the configuration. | |
408 | +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config | |
409 | +# cannot find librpm use to the rpmless compilation (like `--without-rpm'). | |
3a58abaf | 410 | + |
3a58abaf | 411 | + |
321e94d6 BS |
412 | +# Check whether --with-rpm was given. |
413 | +if test "${with_rpm+set}" = set; then : | |
414 | + withval=$with_rpm; | |
415 | +else | |
416 | + with_rpm="auto" | |
417 | +fi | |
3a58abaf | 418 | + |
3a58abaf | 419 | + |
3a58abaf | 420 | + |
3a58abaf | 421 | + |
321e94d6 BS |
422 | +if test "x$with_rpm" != "xno"; then |
423 | + if test "x$with_rpm" = "xyes"; then | |
424 | + LIBRPM="librpm.so" | |
425 | + RPM_REQUIRE=true | |
426 | + DLOPEN_REQUIRE=false | |
427 | + elif test "x$with_rpm" = "xauto"; then | |
428 | + LIBRPM="librpm.so" | |
429 | + RPM_REQUIRE=false | |
430 | + DLOPEN_REQUIRE=false | |
431 | + else | |
432 | + LIBRPM="$with_rpm" | |
433 | + RPM_REQUIRE=true | |
434 | + DLOPEN_REQUIRE=true | |
435 | + fi | |
436 | + LIBRPM_STRING='"'"$LIBRPM"'"' | |
3a58abaf | 437 | + |
321e94d6 BS |
438 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5 |
439 | +$as_echo_n "checking specific librpm version... " >&6; } | |
440 | + HAVE_DLOPEN_LIBRPM=false | |
441 | + save_LIBS="$LIBS" | |
442 | + LIBS="$LIBS -ldl" | |
443 | + if test "$cross_compiling" = yes; then : | |
444 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
445 | +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
446 | +as_fn_error "cannot run test program while cross compiling | |
447 | +See \`config.log' for more details." "$LINENO" 5; } | |
448 | +else | |
449 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
450 | +/* end confdefs.h. */ | |
3a58abaf | 451 | + |
321e94d6 BS |
452 | +#include <rpm/rpmlib.h> |
453 | +#include <dlfcn.h> | |
454 | +#include <errno.h> | |
3a58abaf | 455 | + |
321e94d6 BS |
456 | +int |
457 | +main () | |
3a58abaf | 458 | +{ |
3a58abaf | 459 | + |
321e94d6 BS |
460 | + void *h; |
461 | + const char *const *rpmverp; | |
462 | + FILE *f; | |
3a58abaf | 463 | + |
321e94d6 BS |
464 | + f = fopen ("conftest.out", "w"); |
465 | + if (!f) | |
466 | + { | |
467 | + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", | |
468 | + strerror (errno)); | |
469 | + return 1; | |
470 | + } | |
471 | + h = dlopen ($LIBRPM_STRING, RTLD_LAZY); | |
472 | + if (!h) | |
473 | + { | |
474 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); | |
475 | + return 1; | |
476 | + } | |
477 | + rpmverp = dlsym (h, "RPMVERSION"); | |
478 | + if (!rpmverp) | |
479 | + { | |
480 | + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); | |
481 | + return 1; | |
482 | + } | |
483 | + fprintf (stderr, "RPMVERSION is: \""); | |
484 | + fprintf (stderr, "%s\"\n", *rpmverp); | |
3a58abaf | 485 | + |
321e94d6 BS |
486 | + /* Try to find the specific librpm version only for "librpm.so" as we do |
487 | + not know how to assemble the version string otherwise. */ | |
3a58abaf | 488 | + |
321e94d6 BS |
489 | + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) |
490 | + { | |
491 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
492 | + return 0; | |
493 | + } | |
494 | + else | |
495 | + { | |
496 | + char *h2_name; | |
497 | + void *h2; | |
498 | + int major, minor; | |
3a58abaf | 499 | + |
321e94d6 BS |
500 | + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) |
501 | + { | |
502 | + fprintf (stderr, "Unable to parse RPMVERSION.\n"); | |
503 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
504 | + return 0; | |
505 | + } | |
506 | + /* Avoid the square brackets by malloc. */ | |
507 | + h2_name = malloc (64); | |
508 | + sprintf (h2_name, "librpm-%d.%d.so", major, minor); | |
509 | + h2 = dlopen (h2_name, RTLD_LAZY); | |
510 | + if (!h2) | |
511 | + { | |
512 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); | |
513 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
514 | + return 0; | |
515 | + } | |
516 | + if (h2 != h) | |
517 | + { | |
518 | + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", | |
519 | + $LIBRPM_STRING, h2_name); | |
520 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
521 | + return 0; | |
522 | + } | |
523 | + /* Found the valid .so name with a specific version. */ | |
524 | + fprintf (f, "%s\n", h2_name); | |
525 | + return 0; | |
526 | + } | |
3a58abaf | 527 | + |
321e94d6 BS |
528 | + ; |
529 | + return 0; | |
530 | +} | |
531 | +_ACEOF | |
532 | +if ac_fn_c_try_run "$LINENO"; then : | |
3a58abaf | 533 | + |
321e94d6 BS |
534 | + DLOPEN_LIBRPM="`cat conftest.out`" |
535 | + if test "x$DLOPEN_LIBRPM" != "x"; then | |
536 | + HAVE_DLOPEN_LIBRPM=true | |
537 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5 | |
538 | +$as_echo "$DLOPEN_LIBRPM" >&6; } | |
539 | + fi | |
3a58abaf | 540 | + |
321e94d6 BS |
541 | +fi |
542 | +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | |
543 | + conftest.$ac_objext conftest.beam conftest.$ac_ext | |
544 | +fi | |
3a58abaf | 545 | + |
321e94d6 | 546 | + rm -f conftest.out |
3a58abaf | 547 | + |
3a58abaf | 548 | + |
3a58abaf | 549 | + |
321e94d6 | 550 | + if $HAVE_DLOPEN_LIBRPM; then |
3a58abaf | 551 | + |
321e94d6 BS |
552 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 |
553 | +$as_echo_n "checking rpm library API compatibility... " >&6; } | |
554 | + # The compilation requires -Werror to verify anything. | |
555 | + save_CFLAGS="$CFLAGS" | |
556 | + CFLAGS="$CFLAGS -Werror" | |
557 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
558 | +/* end confdefs.h. */ | |
3a58abaf | 559 | + |
321e94d6 BS |
560 | +/* Duplicate here the declarations to verify they match "elfread.c". */ |
561 | +#include <rpm/rpmlib.h> | |
562 | +#include <rpm/rpmts.h> | |
563 | +#include <rpm/rpmdb.h> | |
564 | +#include <rpm/header.h> | |
565 | +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); | |
566 | +extern int rpmReadConfigFiles(const char * file, const char * target); | |
567 | +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); | |
568 | +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); | |
569 | +extern rpmts rpmtsCreate(void); | |
570 | +extern rpmts rpmtsFree(rpmts ts); | |
571 | +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, | |
572 | + const void * keyp, size_t keylen); | |
573 | + | |
574 | +int | |
575 | +main () | |
3a58abaf | 576 | +{ |
321e94d6 BS |
577 | + |
578 | + ; | |
579 | + return 0; | |
3a58abaf | 580 | +} |
321e94d6 BS |
581 | +_ACEOF |
582 | +if ac_fn_c_try_compile "$LINENO"; then : | |
3a58abaf | 583 | + |
321e94d6 BS |
584 | + LIBRPM_COMPAT=true |
585 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
586 | +$as_echo "yes" >&6; } | |
3a58abaf | 587 | + |
321e94d6 | 588 | +else |
3a58abaf | 589 | + |
321e94d6 BS |
590 | + LIBRPM_COMPAT=false |
591 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
592 | +$as_echo "no" >&6; } | |
a7de96f0 | 593 | + |
3a58abaf | 594 | +fi |
321e94d6 BS |
595 | +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
596 | + CFLAGS="$save_CFLAGS" | |
3a58abaf | 597 | + |
321e94d6 BS |
598 | + if ! $LIBRPM_COMPAT; then |
599 | + HAVE_DLOPEN_LIBRPM=false | |
600 | + fi | |
601 | + fi | |
3a58abaf | 602 | + |
321e94d6 BS |
603 | + if $HAVE_DLOPEN_LIBRPM; then |
604 | + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' | |
3a58abaf | 605 | + |
321e94d6 BS |
606 | +cat >>confdefs.h <<_ACEOF |
607 | +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING | |
608 | +_ACEOF | |
3a58abaf | 609 | + |
3a58abaf | 610 | + |
321e94d6 | 611 | +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h |
3a58abaf | 612 | + |
321e94d6 BS |
613 | + else |
614 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
615 | +$as_echo "no" >&6; } | |
616 | + LIBS="$save_LIBS" | |
617 | + if $DLOPEN_REQUIRE; then | |
618 | + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 | |
619 | + fi | |
3a58abaf | 620 | + |
3a58abaf | 621 | + |
3a58abaf | 622 | + |
3a58abaf | 623 | + |
3a58abaf | 624 | + |
3a58abaf | 625 | + |
321e94d6 BS |
626 | +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then |
627 | + if test -n "$ac_tool_prefix"; then | |
628 | + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. | |
629 | +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 | |
630 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
631 | +$as_echo_n "checking for $ac_word... " >&6; } | |
632 | +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : | |
633 | + $as_echo_n "(cached) " >&6 | |
3a58abaf | 634 | +else |
321e94d6 BS |
635 | + case $PKG_CONFIG in |
636 | + [\\/]* | ?:[\\/]*) | |
637 | + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. | |
638 | + ;; | |
639 | + *) | |
640 | + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
641 | +for as_dir in $PATH | |
642 | +do | |
643 | + IFS=$as_save_IFS | |
644 | + test -z "$as_dir" && as_dir=. | |
645 | + for ac_exec_ext in '' $ac_executable_extensions; do | |
646 | + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
647 | + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" | |
648 | + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
649 | + break 2 | |
650 | + fi | |
651 | +done | |
652 | + done | |
653 | +IFS=$as_save_IFS | |
3a58abaf | 654 | + |
321e94d6 BS |
655 | + ;; |
656 | +esac | |
657 | +fi | |
658 | +PKG_CONFIG=$ac_cv_path_PKG_CONFIG | |
659 | +if test -n "$PKG_CONFIG"; then | |
660 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 | |
661 | +$as_echo "$PKG_CONFIG" >&6; } | |
662 | +else | |
663 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
664 | +$as_echo "no" >&6; } | |
665 | +fi | |
3a58abaf | 666 | + |
3a58abaf | 667 | + |
321e94d6 BS |
668 | +fi |
669 | +if test -z "$ac_cv_path_PKG_CONFIG"; then | |
670 | + ac_pt_PKG_CONFIG=$PKG_CONFIG | |
671 | + # Extract the first word of "pkg-config", so it can be a program name with args. | |
672 | +set dummy pkg-config; ac_word=$2 | |
673 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
674 | +$as_echo_n "checking for $ac_word... " >&6; } | |
675 | +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : | |
676 | + $as_echo_n "(cached) " >&6 | |
677 | +else | |
678 | + case $ac_pt_PKG_CONFIG in | |
679 | + [\\/]* | ?:[\\/]*) | |
680 | + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. | |
681 | + ;; | |
682 | + *) | |
683 | + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
684 | +for as_dir in $PATH | |
685 | +do | |
686 | + IFS=$as_save_IFS | |
687 | + test -z "$as_dir" && as_dir=. | |
688 | + for ac_exec_ext in '' $ac_executable_extensions; do | |
689 | + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
690 | + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" | |
691 | + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
692 | + break 2 | |
693 | + fi | |
694 | +done | |
695 | + done | |
696 | +IFS=$as_save_IFS | |
3a58abaf | 697 | + |
321e94d6 BS |
698 | + ;; |
699 | +esac | |
700 | +fi | |
701 | +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG | |
702 | +if test -n "$ac_pt_PKG_CONFIG"; then | |
703 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 | |
704 | +$as_echo "$ac_pt_PKG_CONFIG" >&6; } | |
705 | +else | |
706 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
707 | +$as_echo "no" >&6; } | |
708 | +fi | |
3a58abaf | 709 | + |
321e94d6 BS |
710 | + if test "x$ac_pt_PKG_CONFIG" = x; then |
711 | + PKG_CONFIG="" | |
712 | + else | |
713 | + case $cross_compiling:$ac_tool_warned in | |
714 | +yes:) | |
715 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 | |
716 | +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} | |
717 | +ac_tool_warned=yes ;; | |
718 | +esac | |
719 | + PKG_CONFIG=$ac_pt_PKG_CONFIG | |
720 | + fi | |
3a58abaf | 721 | +else |
321e94d6 | 722 | + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" |
7566401a ER |
723 | +fi |
724 | + | |
321e94d6 BS |
725 | +fi |
726 | +if test -n "$PKG_CONFIG"; then | |
727 | + _pkg_min_version=0.9.0 | |
728 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 | |
729 | +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } | |
730 | + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | |
731 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
732 | +$as_echo "yes" >&6; } | |
733 | + else | |
734 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
735 | +$as_echo "no" >&6; } | |
736 | + PKG_CONFIG="" | |
737 | + fi | |
738 | +fi | |
3a58abaf | 739 | + |
321e94d6 BS |
740 | +pkg_failed=no |
741 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5 | |
742 | +$as_echo_n "checking for RPM... " >&6; } | |
3a58abaf | 743 | + |
321e94d6 BS |
744 | +if test -n "$RPM_CFLAGS"; then |
745 | + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS" | |
746 | + elif test -n "$PKG_CONFIG"; then | |
747 | + if test -n "$PKG_CONFIG" && \ | |
748 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 | |
749 | + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 | |
750 | + ac_status=$? | |
751 | + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
752 | + test $ac_status = 0; }; then | |
753 | + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null` | |
754 | +else | |
755 | + pkg_failed=yes | |
756 | +fi | |
757 | + else | |
758 | + pkg_failed=untried | |
759 | +fi | |
760 | +if test -n "$RPM_LIBS"; then | |
761 | + pkg_cv_RPM_LIBS="$RPM_LIBS" | |
762 | + elif test -n "$PKG_CONFIG"; then | |
763 | + if test -n "$PKG_CONFIG" && \ | |
764 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 | |
765 | + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 | |
766 | + ac_status=$? | |
767 | + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
768 | + test $ac_status = 0; }; then | |
769 | + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null` | |
770 | +else | |
771 | + pkg_failed=yes | |
772 | +fi | |
773 | + else | |
774 | + pkg_failed=untried | |
775 | +fi | |
3a58abaf | 776 | + |
3a58abaf | 777 | + |
321e94d6 BS |
778 | + |
779 | +if test $pkg_failed = yes; then | |
780 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
781 | +$as_echo "no" >&6; } | |
782 | + | |
783 | +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | |
784 | + _pkg_short_errors_supported=yes | |
3a58abaf | 785 | +else |
321e94d6 BS |
786 | + _pkg_short_errors_supported=no |
787 | +fi | |
788 | + if test $_pkg_short_errors_supported = yes; then | |
789 | + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1` | |
790 | + else | |
791 | + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1` | |
792 | + fi | |
793 | + # Put the nasty error message in config.log where it belongs | |
794 | + echo "$RPM_PKG_ERRORS" >&5 | |
795 | + | |
796 | + HAVE_LIBRPM=false | |
797 | +elif test $pkg_failed = untried; then | |
798 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
799 | +$as_echo "no" >&6; } | |
800 | + HAVE_LIBRPM=false | |
801 | +else | |
802 | + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS | |
803 | + RPM_LIBS=$pkg_cv_RPM_LIBS | |
804 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
805 | +$as_echo "yes" >&6; } | |
806 | + HAVE_LIBRPM=true | |
807 | +fi | |
808 | + | |
809 | + if $HAVE_LIBRPM; then | |
810 | + | |
811 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 | |
812 | +$as_echo_n "checking rpm library API compatibility... " >&6; } | |
813 | + # The compilation requires -Werror to verify anything. | |
814 | + save_CFLAGS="$CFLAGS" | |
815 | + CFLAGS="$CFLAGS -Werror" | |
816 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3a58abaf AM |
817 | +/* end confdefs.h. */ |
818 | + | |
321e94d6 | 819 | +/* Duplicate here the declarations to verify they match "elfread.c". */ |
3a58abaf | 820 | +#include <rpm/rpmlib.h> |
321e94d6 BS |
821 | +#include <rpm/rpmts.h> |
822 | +#include <rpm/rpmdb.h> | |
823 | +#include <rpm/header.h> | |
824 | +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); | |
825 | +extern int rpmReadConfigFiles(const char * file, const char * target); | |
826 | +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); | |
827 | +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); | |
828 | +extern rpmts rpmtsCreate(void); | |
829 | +extern rpmts rpmtsFree(rpmts ts); | |
830 | +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, | |
831 | + const void * keyp, size_t keylen); | |
3a58abaf AM |
832 | + |
833 | +int | |
834 | +main () | |
835 | +{ | |
836 | + | |
321e94d6 BS |
837 | + ; |
838 | + return 0; | |
839 | +} | |
840 | +_ACEOF | |
841 | +if ac_fn_c_try_compile "$LINENO"; then : | |
842 | + | |
843 | + LIBRPM_COMPAT=true | |
844 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
845 | +$as_echo "yes" >&6; } | |
846 | + | |
847 | +else | |
848 | + | |
849 | + LIBRPM_COMPAT=false | |
850 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
851 | +$as_echo "no" >&6; } | |
852 | + | |
853 | +fi | |
854 | +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
855 | + CFLAGS="$save_CFLAGS" | |
856 | + | |
857 | + if ! $LIBRPM_COMPAT; then | |
858 | + HAVE_LIBRPM=false | |
859 | + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" | |
860 | + fi | |
861 | + fi | |
862 | + | |
863 | + if $HAVE_LIBRPM; then | |
864 | + | |
865 | +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h | |
866 | + | |
867 | + CFLAGS="$CFLAGS $RPM_CFLAGS" | |
868 | + LIBS="$LIBS $RPM_LIBS" | |
869 | + else | |
870 | + if $RPM_REQUIRE; then | |
871 | + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 | |
872 | + else | |
873 | + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 | |
874 | +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} | |
875 | + fi | |
876 | + fi | |
877 | + fi | |
878 | +fi | |
879 | + | |
880 | ||
881 | ||
882 | subdirs="$subdirs testsuite" | |
f727df28 | 883 | Index: gdb-7.7.50.20140609/gdb/configure.ac |
321e94d6 | 884 | =================================================================== |
f727df28 KK |
885 | --- gdb-7.7.50.20140609.orig/gdb/configure.ac 2014-06-13 20:10:19.643787653 +0200 |
886 | +++ gdb-7.7.50.20140609/gdb/configure.ac 2014-06-13 20:10:31.074799166 +0200 | |
321e94d6 BS |
887 | @@ -165,6 +165,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap |
888 | [Directories safe to hold auto-loaded files.]) | |
889 | AC_MSG_RESULT([$with_auto_load_safe_path]) | |
890 | ||
891 | +# Integration with rpm library to support missing debuginfo suggestions. | |
892 | +# --without-rpm: Disable any rpm support. | |
893 | +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. | |
894 | +# Even with runtime missing `libname.so' GDB will still other run correctly. | |
895 | +# Missing `libname.so' during ./configure will abort the configuration. | |
896 | +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific | |
897 | +# minor version first such as `librpm-4.6.so' as minor version differences | |
898 | +# mean API+ABI incompatibility. If the specific match versioned library name | |
899 | +# could not be found still open dynamically at least `librpm.so'. | |
900 | +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try | |
901 | +# to find librpm for compilation-time linking by pkg-config. GDB binary will | |
902 | +# be probably linked with the version specific library (as `librpm-4.6.so'). | |
903 | +# Failure to find librpm by pkg-config will abort the configuration. | |
904 | +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config | |
905 | +# cannot find librpm use to the rpmless compilation (like `--without-rpm'). | |
906 | + | |
907 | +AC_ARG_WITH([rpm], | |
908 | + [AS_HELP_STRING([--with-rpm], | |
909 | + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"]) | |
910 | + | |
911 | +m4_pattern_allow([^AC_MSG_ERROR$]) | |
912 | +m4_pattern_allow([^AC_MSG_WARN$]) | |
913 | +if test "x$with_rpm" != "xno"; then | |
914 | + if test "x$with_rpm" = "xyes"; then | |
915 | + LIBRPM="librpm.so" | |
916 | + RPM_REQUIRE=true | |
917 | + DLOPEN_REQUIRE=false | |
918 | + elif test "x$with_rpm" = "xauto"; then | |
919 | + LIBRPM="librpm.so" | |
920 | + RPM_REQUIRE=false | |
921 | + DLOPEN_REQUIRE=false | |
922 | + else | |
923 | + LIBRPM="$with_rpm" | |
924 | + RPM_REQUIRE=true | |
925 | + DLOPEN_REQUIRE=true | |
926 | + fi | |
927 | + LIBRPM_STRING='"'"$LIBRPM"'"' | |
928 | + | |
929 | + AC_MSG_CHECKING([specific librpm version]) | |
930 | + HAVE_DLOPEN_LIBRPM=false | |
931 | + save_LIBS="$LIBS" | |
932 | + LIBS="$LIBS -ldl" | |
933 | + AC_RUN_IFELSE(AC_LANG_PROGRAM([[ | |
934 | +#include <rpm/rpmlib.h> | |
935 | +#include <dlfcn.h> | |
936 | +#include <errno.h> | |
937 | + ]], [[ | |
938 | + void *h; | |
3a58abaf AM |
939 | + const char *const *rpmverp; |
940 | + FILE *f; | |
941 | + | |
942 | + f = fopen ("conftest.out", "w"); | |
943 | + if (!f) | |
944 | + { | |
945 | + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", | |
946 | + strerror (errno)); | |
947 | + return 1; | |
948 | + } | |
949 | + h = dlopen ($LIBRPM_STRING, RTLD_LAZY); | |
950 | + if (!h) | |
951 | + { | |
952 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); | |
953 | + return 1; | |
954 | + } | |
955 | + rpmverp = dlsym (h, "RPMVERSION"); | |
956 | + if (!rpmverp) | |
957 | + { | |
958 | + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); | |
959 | + return 1; | |
960 | + } | |
961 | + fprintf (stderr, "RPMVERSION is: \""); | |
962 | + fprintf (stderr, "%s\"\n", *rpmverp); | |
963 | + | |
964 | + /* Try to find the specific librpm version only for "librpm.so" as we do | |
965 | + not know how to assemble the version string otherwise. */ | |
966 | + | |
967 | + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) | |
968 | + { | |
969 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
970 | + return 0; | |
971 | + } | |
972 | + else | |
973 | + { | |
974 | + char *h2_name; | |
975 | + void *h2; | |
976 | + int major, minor; | |
977 | + | |
978 | + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) | |
979 | + { | |
980 | + fprintf (stderr, "Unable to parse RPMVERSION.\n"); | |
981 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
982 | + return 0; | |
983 | + } | |
984 | + /* Avoid the square brackets by malloc. */ | |
985 | + h2_name = malloc (64); | |
986 | + sprintf (h2_name, "librpm-%d.%d.so", major, minor); | |
987 | + h2 = dlopen (h2_name, RTLD_LAZY); | |
988 | + if (!h2) | |
989 | + { | |
990 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); | |
991 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
992 | + return 0; | |
993 | + } | |
994 | + if (h2 != h) | |
995 | + { | |
996 | + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", | |
997 | + $LIBRPM_STRING, h2_name); | |
998 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
999 | + return 0; | |
1000 | + } | |
1001 | + /* Found the valid .so name with a specific version. */ | |
1002 | + fprintf (f, "%s\n", h2_name); | |
1003 | + return 0; | |
1004 | + } | |
321e94d6 | 1005 | + ]]), [ |
3a58abaf AM |
1006 | + DLOPEN_LIBRPM="`cat conftest.out`" |
1007 | + if test "x$DLOPEN_LIBRPM" != "x"; then | |
1008 | + HAVE_DLOPEN_LIBRPM=true | |
321e94d6 | 1009 | + AC_MSG_RESULT($DLOPEN_LIBRPM) |
3a58abaf | 1010 | + fi |
321e94d6 | 1011 | + ]) |
3a58abaf AM |
1012 | + rm -f conftest.out |
1013 | + | |
321e94d6 BS |
1014 | + m4_define([CHECK_LIBRPM_COMPAT], [ |
1015 | + AC_MSG_CHECKING([rpm library API compatibility]) | |
3a58abaf AM |
1016 | + # The compilation requires -Werror to verify anything. |
1017 | + save_CFLAGS="$CFLAGS" | |
1018 | + CFLAGS="$CFLAGS -Werror" | |
321e94d6 | 1019 | + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ |
51a5ef0f | 1020 | +/* Duplicate here the declarations to verify they match "elfread.c". */ |
3a58abaf AM |
1021 | +#include <rpm/rpmlib.h> |
1022 | +#include <rpm/rpmts.h> | |
1023 | +#include <rpm/rpmdb.h> | |
1024 | +#include <rpm/header.h> | |
1025 | +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); | |
1026 | +extern int rpmReadConfigFiles(const char * file, const char * target); | |
1027 | +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); | |
1028 | +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); | |
1029 | +extern rpmts rpmtsCreate(void); | |
1030 | +extern rpmts rpmtsFree(rpmts ts); | |
1031 | +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, | |
1032 | + const void * keyp, size_t keylen); | |
321e94d6 | 1033 | + ]]), [ |
3a58abaf | 1034 | + LIBRPM_COMPAT=true |
321e94d6 BS |
1035 | + AC_MSG_RESULT(yes) |
1036 | + ], [ | |
3a58abaf | 1037 | + LIBRPM_COMPAT=false |
321e94d6 BS |
1038 | + AC_MSG_RESULT(no) |
1039 | + ]) | |
3a58abaf | 1040 | + CFLAGS="$save_CFLAGS" |
321e94d6 | 1041 | + ]) |
3a58abaf | 1042 | + |
321e94d6 BS |
1043 | + if $HAVE_DLOPEN_LIBRPM; then |
1044 | + CHECK_LIBRPM_COMPAT | |
3a58abaf AM |
1045 | + if ! $LIBRPM_COMPAT; then |
1046 | + HAVE_DLOPEN_LIBRPM=false | |
1047 | + fi | |
1048 | + fi | |
1049 | + | |
1050 | + if $HAVE_DLOPEN_LIBRPM; then | |
1051 | + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' | |
321e94d6 BS |
1052 | + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.]) |
1053 | + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) | |
3a58abaf | 1054 | + else |
321e94d6 | 1055 | + AC_MSG_RESULT(no) |
3a58abaf AM |
1056 | + LIBS="$save_LIBS" |
1057 | + if $DLOPEN_REQUIRE; then | |
321e94d6 | 1058 | + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.]) |
3a58abaf | 1059 | + fi |
321e94d6 | 1060 | + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false]) |
3a58abaf | 1061 | + |
321e94d6 BS |
1062 | + if $HAVE_LIBRPM; then |
1063 | + CHECK_LIBRPM_COMPAT | |
1064 | + if ! $LIBRPM_COMPAT; then | |
1065 | + HAVE_LIBRPM=false | |
1066 | + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" | |
1067 | + fi | |
1068 | + fi | |
3a58abaf | 1069 | + |
321e94d6 BS |
1070 | + if $HAVE_LIBRPM; then |
1071 | + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) | |
1072 | + CFLAGS="$CFLAGS $RPM_CFLAGS" | |
1073 | + LIBS="$LIBS $RPM_LIBS" | |
1074 | + else | |
1075 | + if $RPM_REQUIRE; then | |
1076 | + AC_MSG_ERROR($RPM_PKG_ERRORS) | |
1077 | + else | |
1078 | + AC_MSG_WARN($RPM_PKG_ERRORS) | |
1079 | + fi | |
1080 | + fi | |
1081 | + fi | |
1082 | +fi | |
1083 | + | |
1084 | AC_CONFIG_SUBDIRS(testsuite) | |
1085 | ||
1086 | # Check whether to support alternative target configurations | |
f727df28 | 1087 | Index: gdb-7.7.50.20140609/gdb/corelow.c |
321e94d6 | 1088 | =================================================================== |
f727df28 KK |
1089 | --- gdb-7.7.50.20140609.orig/gdb/corelow.c 2014-06-13 20:10:19.644787654 +0200 |
1090 | +++ gdb-7.7.50.20140609/gdb/corelow.c 2014-06-13 20:10:31.074799166 +0200 | |
1091 | @@ -316,7 +316,7 @@ build_id_locate_exec (int from_tty) | |
321e94d6 BS |
1092 | symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; |
1093 | } | |
1094 | else | |
1095 | - debug_print_missing (_("the main executable file"), build_id_filename); | |
1096 | + debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename); | |
1097 | ||
1098 | do_cleanups (back_to); | |
1099 | ||
f727df28 | 1100 | Index: gdb-7.7.50.20140609/gdb/build-id.c |
321e94d6 | 1101 | =================================================================== |
f727df28 KK |
1102 | --- gdb-7.7.50.20140609.orig/gdb/build-id.c 2014-06-13 20:10:19.644787654 +0200 |
1103 | +++ gdb-7.7.50.20140609/gdb/build-id.c 2014-06-13 20:10:31.075799167 +0200 | |
321e94d6 BS |
1104 | @@ -32,6 +32,7 @@ |
1105 | #include "gdbcmd.h" | |
1106 | #include "observer.h" | |
1107 | #include <sys/stat.h> | |
1108 | +#include "elf/external.h" | |
1109 | ||
1110 | #define BUILD_ID_VERBOSE_NONE 0 | |
1111 | #define BUILD_ID_VERBOSE_FILENAMES 1 | |
1112 | @@ -666,8 +667,360 @@ build_id_to_filename (const struct elf_b | |
1113 | return result; | |
1114 | } | |
1115 | ||
1116 | +#ifdef HAVE_LIBRPM | |
a7de96f0 | 1117 | + |
321e94d6 BS |
1118 | +#include <rpm/rpmlib.h> |
1119 | +#include <rpm/rpmts.h> | |
1120 | +#include <rpm/rpmdb.h> | |
1121 | +#include <rpm/header.h> | |
1122 | +#ifdef DLOPEN_LIBRPM | |
1123 | +#include <dlfcn.h> | |
1124 | +#endif | |
a7de96f0 | 1125 | + |
321e94d6 BS |
1126 | +/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files |
1127 | + and avoid their duplicities during a single inferior run. */ | |
a7de96f0 | 1128 | + |
321e94d6 | 1129 | +static struct htab *missing_rpm_hash; |
a7de96f0 | 1130 | + |
321e94d6 BS |
1131 | +/* This MISSING_RPM_LIST tracker is used to collect and print as a single line |
1132 | + all the rpms right before the nearest GDB prompt. It gets cleared after | |
1133 | + each such print (it is questionable if we should clear it after the print). | |
1134 | + */ | |
3a58abaf | 1135 | + |
321e94d6 BS |
1136 | +struct missing_rpm |
1137 | + { | |
1138 | + struct missing_rpm *next; | |
1139 | + char rpm[1]; | |
1140 | + }; | |
1141 | +static struct missing_rpm *missing_rpm_list; | |
1142 | +static int missing_rpm_list_entries; | |
7566401a | 1143 | + |
321e94d6 | 1144 | +/* Returns the count of newly added rpms. */ |
3a58abaf | 1145 | + |
321e94d6 BS |
1146 | +static int |
1147 | +missing_rpm_enlist (const char *filename) | |
1148 | +{ | |
1149 | + static int rpm_init_done = 0; | |
1150 | + rpmts ts; | |
1151 | + rpmdbMatchIterator mi; | |
1152 | + int count = 0; | |
3a58abaf | 1153 | + |
321e94d6 BS |
1154 | +#ifdef DLOPEN_LIBRPM |
1155 | + /* Duplicate here the declarations to verify they match. The same sanity | |
1156 | + check is present also in `configure.ac'. */ | |
1157 | + extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); | |
1158 | + static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg); | |
1159 | + extern int rpmReadConfigFiles(const char * file, const char * target); | |
1160 | + static int (*rpmReadConfigFiles_p) (const char * file, const char * target); | |
1161 | + extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); | |
1162 | + static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi); | |
1163 | + extern Header rpmdbNextIterator(rpmdbMatchIterator mi); | |
1164 | + static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi); | |
1165 | + extern rpmts rpmtsCreate(void); | |
1166 | + static rpmts (*rpmtsCreate_p) (void); | |
1167 | + extern rpmts rpmtsFree(rpmts ts); | |
1168 | + static rpmts (*rpmtsFree_p) (rpmts ts); | |
1169 | + extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, | |
1170 | + const void * keyp, size_t keylen); | |
1171 | + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, | |
1172 | + rpmTag rpmtag, | |
1173 | + const void *keyp, | |
1174 | + size_t keylen); | |
1175 | +#else /* !DLOPEN_LIBRPM */ | |
1176 | +# define headerFormat_p headerFormat | |
1177 | +# define rpmReadConfigFiles_p rpmReadConfigFiles | |
1178 | +# define rpmdbFreeIterator_p rpmdbFreeIterator | |
1179 | +# define rpmdbNextIterator_p rpmdbNextIterator | |
1180 | +# define rpmtsCreate_p rpmtsCreate | |
1181 | +# define rpmtsFree_p rpmtsFree | |
1182 | +# define rpmtsInitIterator_p rpmtsInitIterator | |
1183 | +#endif /* !DLOPEN_LIBRPM */ | |
3a58abaf | 1184 | + |
321e94d6 | 1185 | + gdb_assert (filename != NULL); |
3a58abaf | 1186 | + |
321e94d6 BS |
1187 | + if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0) |
1188 | + return 0; | |
3a58abaf | 1189 | + |
321e94d6 BS |
1190 | + if (filename[0] != '/') |
1191 | + { | |
1192 | + warning (_("Ignoring non-absolute filename: <%s>"), filename); | |
1193 | + return 0; | |
1194 | + } | |
3a58abaf | 1195 | + |
321e94d6 BS |
1196 | + if (!rpm_init_done) |
1197 | + { | |
1198 | + static int init_tried; | |
3a58abaf | 1199 | + |
321e94d6 BS |
1200 | + /* Already failed the initialization before? */ |
1201 | + if (init_tried) | |
1202 | + return 0; | |
1203 | + init_tried = 1; | |
3a58abaf | 1204 | + |
321e94d6 BS |
1205 | +#ifdef DLOPEN_LIBRPM |
1206 | + { | |
1207 | + void *h; | |
3a58abaf | 1208 | + |
321e94d6 BS |
1209 | + h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY); |
1210 | + if (!h) | |
1211 | + { | |
1212 | + warning (_("Unable to open \"%s\" (%s), " | |
1213 | + "missing debuginfos notifications will not be displayed"), | |
1214 | + DLOPEN_LIBRPM, dlerror ()); | |
1215 | + return 0; | |
1216 | + } | |
3a58abaf | 1217 | + |
321e94d6 BS |
1218 | + if (!((headerFormat_p = dlsym (h, "headerFormat")) |
1219 | + && (rpmReadConfigFiles_p = dlsym (h, "rpmReadConfigFiles")) | |
1220 | + && (rpmdbFreeIterator_p = dlsym (h, "rpmdbFreeIterator")) | |
1221 | + && (rpmdbNextIterator_p = dlsym (h, "rpmdbNextIterator")) | |
1222 | + && (rpmtsCreate_p = dlsym (h, "rpmtsCreate")) | |
1223 | + && (rpmtsFree_p = dlsym (h, "rpmtsFree")) | |
1224 | + && (rpmtsInitIterator_p = dlsym (h, "rpmtsInitIterator")))) | |
1225 | + { | |
1226 | + warning (_("Opened library \"%s\" is incompatible (%s), " | |
1227 | + "missing debuginfos notifications will not be displayed"), | |
1228 | + DLOPEN_LIBRPM, dlerror ()); | |
1229 | + if (dlclose (h)) | |
1230 | + warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM, | |
1231 | + dlerror ()); | |
1232 | + return 0; | |
1233 | + } | |
1234 | + } | |
1235 | +#endif /* DLOPEN_LIBRPM */ | |
3a58abaf | 1236 | + |
321e94d6 BS |
1237 | + if (rpmReadConfigFiles_p (NULL, NULL) != 0) |
1238 | + { | |
1239 | + warning (_("Error reading the rpm configuration files")); | |
1240 | + return 0; | |
1241 | + } | |
3a58abaf | 1242 | + |
321e94d6 BS |
1243 | + rpm_init_done = 1; |
1244 | + } | |
3a58abaf | 1245 | + |
321e94d6 | 1246 | + ts = rpmtsCreate_p (); |
3a58abaf | 1247 | + |
321e94d6 BS |
1248 | + mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); |
1249 | + if (mi != NULL) | |
1250 | + { | |
1251 | + for (;;) | |
1252 | + { | |
1253 | + Header h; | |
1254 | + char *debuginfo, **slot, *s, *s2; | |
1255 | + errmsg_t err; | |
1256 | + size_t srcrpmlen = sizeof (".src.rpm") - 1; | |
1257 | + size_t debuginfolen = sizeof ("-debuginfo") - 1; | |
1258 | + rpmdbMatchIterator mi_debuginfo; | |
3a58abaf | 1259 | + |
321e94d6 BS |
1260 | + h = rpmdbNextIterator_p (mi); |
1261 | + if (h == NULL) | |
1262 | + break; | |
3a58abaf | 1263 | + |
321e94d6 | 1264 | + /* Verify the debuginfo file is not already installed. */ |
3a58abaf | 1265 | + |
321e94d6 BS |
1266 | + debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}", |
1267 | + &err); | |
1268 | + if (!debuginfo) | |
1269 | + { | |
1270 | + warning (_("Error querying the rpm file `%s': %s"), filename, | |
1271 | + err); | |
1272 | + continue; | |
1273 | + } | |
1274 | + /* s = `.src.rpm-debuginfo.%{arch}' */ | |
1275 | + s = strrchr (debuginfo, '-') - srcrpmlen; | |
1276 | + s2 = NULL; | |
1277 | + if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0) | |
1278 | + { | |
1279 | + /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */ | |
1280 | + s2 = memrchr (debuginfo, '-', s - debuginfo); | |
1281 | + } | |
1282 | + if (s2) | |
1283 | + { | |
1284 | + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ | |
1285 | + s2 = memrchr (debuginfo, '-', s2 - debuginfo); | |
1286 | + } | |
1287 | + if (!s2) | |
1288 | + { | |
1289 | + warning (_("Error querying the rpm file `%s': %s"), filename, | |
1290 | + debuginfo); | |
1291 | + xfree (debuginfo); | |
1292 | + continue; | |
1293 | + } | |
1294 | + /* s = `.src.rpm-debuginfo.%{arch}' */ | |
1295 | + /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ | |
1296 | + memmove (s2 + debuginfolen, s2, s - s2); | |
1297 | + memcpy (s2, "-debuginfo", debuginfolen); | |
1298 | + /* s = `XXXX.%{arch}' */ | |
1299 | + /* strlen ("XXXX") == srcrpmlen + debuginfolen */ | |
1300 | + /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */ | |
1301 | + /* strlen ("XX") == srcrpmlen */ | |
1302 | + memmove (s + debuginfolen, s + srcrpmlen + debuginfolen, | |
1303 | + strlen (s + srcrpmlen + debuginfolen) + 1); | |
1304 | + /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ | |
3a58abaf | 1305 | + |
321e94d6 BS |
1306 | + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ |
1307 | + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ | |
1308 | + mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0); | |
1309 | + xfree (debuginfo); | |
1310 | + if (mi_debuginfo) | |
1311 | + { | |
1312 | + rpmdbFreeIterator_p (mi_debuginfo); | |
1313 | + count = 0; | |
1314 | + break; | |
1315 | + } | |
3a58abaf | 1316 | + |
321e94d6 BS |
1317 | + /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ |
1318 | + debuginfo = headerFormat_p (h, | |
1319 | + "%{name}-%{version}-%{release}.%{arch}", | |
1320 | + &err); | |
1321 | + if (!debuginfo) | |
1322 | + { | |
1323 | + warning (_("Error querying the rpm file `%s': %s"), filename, | |
1324 | + err); | |
1325 | + continue; | |
1326 | + } | |
3a58abaf | 1327 | + |
321e94d6 BS |
1328 | + /* Base package name for `debuginfo-install'. We do not use the |
1329 | + `yum' command directly as the line | |
1330 | + yum --enablerepo='*debug*' install NAME-debuginfo.ARCH | |
1331 | + would be more complicated than just: | |
1332 | + debuginfo-install NAME-VERSION-RELEASE.ARCH | |
1333 | + Do not supply the rpm base name (derived from .src.rpm name) as | |
1334 | + debuginfo-install is unable to install the debuginfo package if | |
1335 | + the base name PKG binary rpm is not installed while for example | |
1336 | + PKG-libs would be installed (RH Bug 467901). | |
1337 | + FUTURE: After multiple debuginfo versions simultaneously installed | |
1338 | + get supported the support for the VERSION-RELEASE tags handling | |
1339 | + may need an update. */ | |
3a58abaf | 1340 | + |
321e94d6 BS |
1341 | + if (missing_rpm_hash == NULL) |
1342 | + { | |
1343 | + /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE | |
1344 | + should not deallocate the entries. */ | |
3a58abaf | 1345 | + |
321e94d6 BS |
1346 | + missing_rpm_hash = htab_create_alloc (64, htab_hash_string, |
1347 | + (int (*) (const void *, const void *)) streq, | |
1348 | + NULL, xcalloc, xfree); | |
1349 | + } | |
1350 | + slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT); | |
1351 | + /* XCALLOC never returns NULL. */ | |
1352 | + gdb_assert (slot != NULL); | |
1353 | + if (*slot == NULL) | |
1354 | + { | |
1355 | + struct missing_rpm *missing_rpm; | |
3a58abaf | 1356 | + |
321e94d6 | 1357 | + *slot = debuginfo; |
6ed6bacf | 1358 | + |
321e94d6 BS |
1359 | + missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo)); |
1360 | + strcpy (missing_rpm->rpm, debuginfo); | |
1361 | + missing_rpm->next = missing_rpm_list; | |
1362 | + missing_rpm_list = missing_rpm; | |
1363 | + missing_rpm_list_entries++; | |
1364 | + } | |
1365 | + else | |
1366 | + xfree (debuginfo); | |
1367 | + count++; | |
1368 | + } | |
3a58abaf | 1369 | + |
321e94d6 BS |
1370 | + rpmdbFreeIterator_p (mi); |
1371 | + } | |
3a58abaf | 1372 | + |
321e94d6 | 1373 | + rpmtsFree_p (ts); |
3a58abaf | 1374 | + |
321e94d6 BS |
1375 | + return count; |
1376 | +} | |
3a58abaf | 1377 | + |
321e94d6 BS |
1378 | +static int |
1379 | +missing_rpm_list_compar (const char *const *ap, const char *const *bp) | |
1380 | +{ | |
1381 | + return strcoll (*ap, *bp); | |
1382 | +} | |
3a58abaf | 1383 | + |
321e94d6 BS |
1384 | +/* It returns a NULL-terminated array of strings needing to be FREEd. It may |
1385 | + also return only NULL. */ | |
3a58abaf | 1386 | + |
321e94d6 BS |
1387 | +static void |
1388 | +missing_rpm_list_print (void) | |
1389 | +{ | |
1390 | + char **array, **array_iter; | |
1391 | + struct missing_rpm *list_iter; | |
1392 | + struct cleanup *cleanups; | |
3a58abaf | 1393 | + |
321e94d6 BS |
1394 | + if (missing_rpm_list_entries == 0) |
1395 | + return; | |
3a58abaf | 1396 | + |
321e94d6 BS |
1397 | + array = xmalloc (sizeof (*array) * missing_rpm_list_entries); |
1398 | + cleanups = make_cleanup (xfree, array); | |
3a58abaf | 1399 | + |
321e94d6 BS |
1400 | + array_iter = array; |
1401 | + for (list_iter = missing_rpm_list; list_iter != NULL; | |
1402 | + list_iter = list_iter->next) | |
1403 | + { | |
1404 | + *array_iter++ = list_iter->rpm; | |
1405 | + } | |
1406 | + gdb_assert (array_iter == array + missing_rpm_list_entries); | |
3a58abaf | 1407 | + |
321e94d6 BS |
1408 | + qsort (array, missing_rpm_list_entries, sizeof (*array), |
1409 | + (int (*) (const void *, const void *)) missing_rpm_list_compar); | |
3a58abaf | 1410 | + |
321e94d6 BS |
1411 | + printf_unfiltered (_("Missing separate debuginfos, use: %s"), |
1412 | + "debuginfo-install"); | |
1413 | + for (array_iter = array; array_iter < array + missing_rpm_list_entries; | |
1414 | + array_iter++) | |
1415 | + { | |
1416 | + putchar_unfiltered (' '); | |
1417 | + puts_unfiltered (*array_iter); | |
1418 | + } | |
1419 | + putchar_unfiltered ('\n'); | |
3a58abaf | 1420 | + |
321e94d6 BS |
1421 | + while (missing_rpm_list != NULL) |
1422 | + { | |
1423 | + list_iter = missing_rpm_list; | |
1424 | + missing_rpm_list = list_iter->next; | |
1425 | + xfree (list_iter); | |
1426 | + } | |
1427 | + missing_rpm_list_entries = 0; | |
1428 | + | |
1429 | + do_cleanups (cleanups); | |
1430 | +} | |
1431 | + | |
1432 | +static void | |
1433 | +missing_rpm_change (void) | |
1434 | +{ | |
1435 | + debug_flush_missing (); | |
1436 | + | |
1437 | + gdb_assert (missing_rpm_list == NULL); | |
1438 | + if (missing_rpm_hash != NULL) | |
1439 | + { | |
1440 | + htab_delete (missing_rpm_hash); | |
1441 | + missing_rpm_hash = NULL; | |
1442 | + } | |
1443 | +} | |
1444 | + | |
1445 | +enum missing_exec | |
1446 | + { | |
1447 | + /* Init state. EXEC_BFD also still could be NULL. */ | |
1448 | + MISSING_EXEC_NOT_TRIED, | |
1449 | + /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */ | |
1450 | + MISSING_EXEC_NOT_FOUND, | |
1451 | + /* We found EXEC_BFD by RPM and we either have its symbols (either embedded | |
1452 | + or separate) or the main executable's RPM is now contained in | |
1453 | + MISSING_RPM_HASH. */ | |
1454 | + MISSING_EXEC_ENLISTED | |
1455 | + }; | |
1456 | +static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED; | |
1457 | + | |
1458 | +#endif /* HAVE_LIBRPM */ | |
1459 | + | |
1460 | +void | |
1461 | +debug_flush_missing (void) | |
1462 | +{ | |
1463 | +#ifdef HAVE_LIBRPM | |
1464 | + missing_rpm_list_print (); | |
1465 | +#endif | |
1466 | +} | |
1467 | + | |
1468 | /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages | |
1469 | - Try to install the hash file ... | |
1470 | + yum --enablerepo='*debug*' install ... | |
1471 | avoidance. */ | |
3a58abaf | 1472 | |
321e94d6 BS |
1473 | struct missing_filepair |
1474 | @@ -721,11 +1074,17 @@ missing_filepair_change (void) | |
1475 | /* All their memory came just from missing_filepair_OBSTACK. */ | |
1476 | missing_filepair_hash = NULL; | |
e5178960 | 1477 | } |
321e94d6 BS |
1478 | +#ifdef HAVE_LIBRPM |
1479 | + missing_exec = MISSING_EXEC_NOT_TRIED; | |
1480 | +#endif | |
1481 | } | |
e5178960 | 1482 | |
321e94d6 BS |
1483 | static void |
1484 | debug_print_executable_changed (void) | |
1485 | { | |
1486 | +#ifdef HAVE_LIBRPM | |
1487 | + missing_rpm_change (); | |
1488 | +#endif | |
1489 | missing_filepair_change (); | |
1490 | } | |
1491 | ||
1492 | @@ -792,14 +1151,34 @@ debug_print_missing (const char *binary, | |
1493 | ||
1494 | *slot = missing_filepair; | |
1495 | ||
1496 | - /* We do not collect and flush these messages as each such message | |
1497 | - already requires its own separate lines. */ | |
1498 | +#ifdef HAVE_LIBRPM | |
1499 | + if (missing_exec == MISSING_EXEC_NOT_TRIED) | |
1500 | + { | |
1501 | + char *execfilename; | |
1502 | ||
1503 | - fprintf_unfiltered (gdb_stdlog, | |
1504 | - _("Missing separate debuginfo for %s\n"), binary); | |
1505 | - if (debug != NULL) | |
1506 | - fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), | |
1507 | - debug); | |
1508 | + execfilename = get_exec_file (0); | |
1509 | + if (execfilename != NULL) | |
1510 | + { | |
1511 | + if (missing_rpm_enlist (execfilename) == 0) | |
1512 | + missing_exec = MISSING_EXEC_NOT_FOUND; | |
1513 | + else | |
1514 | + missing_exec = MISSING_EXEC_ENLISTED; | |
1515 | + } | |
1516 | + } | |
1517 | + if (missing_exec != MISSING_EXEC_ENLISTED) | |
1518 | + if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0) | |
1519 | + && (debug == NULL || missing_rpm_enlist (debug) == 0)) | |
1520 | +#endif /* HAVE_LIBRPM */ | |
1521 | + { | |
1522 | + /* We do not collect and flush these messages as each such message | |
1523 | + already requires its own separate lines. */ | |
1524 | + | |
1525 | + fprintf_unfiltered (gdb_stdlog, | |
1526 | + _("Missing separate debuginfo for %s\n"), binary); | |
1527 | + if (debug != NULL) | |
1528 | + fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), | |
1529 | + "yum --enablerepo='*debug*' install", debug); | |
1530 | + } | |
1531 | } | |
e5178960 | 1532 | |
321e94d6 | 1533 | /* See build-id.h. */ |