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