Only in ../gdb-6.8: debug Only in ../gdb-6.8: .directory Only in ../gdb-6.8: Doxyfile diff -r --ignore-space-change -u gdb-6.8/gdb/frame.c ../gdb-6.8/gdb/frame.c --- gdb-6.8/gdb/frame.c 2008-03-04 20:05:27.000000000 +0000 +++ ../gdb-6.8/gdb/frame.c 2008-06-21 21:26:47.000000000 +0100 @@ -109,6 +109,12 @@ /* The reason why we could not set PREV, or UNWIND_NO_REASON if we could. Only valid when PREV_P is set. */ enum unwind_stop_reason stop_reason; + + /* backtrace_only-specific stuff */ + /* The description of each frame (i.e. source file, line number, local args etc) + are generated in an "arbitrary" order - hang onto them before printing them + out in the correct order. */ + char *info_string; }; /* Flag to control debugging. */ @@ -492,6 +498,21 @@ return frame_func_unwind (fi->next, get_frame_type (fi)); } +void +set_frame_info_string(struct frame_info * frame_info, char* info_string) +{ + if (frame_info->info_string) + { + free(frame_info->info_string); + } + frame_info->info_string = info_string; +} + +char* get_frame_info_string(struct frame_info * frame_info) +{ + return frame_info->info_string; +} + static int do_frame_register_read (void *src, int regnum, gdb_byte *buf) { diff -r --ignore-space-change -u gdb-6.8/gdb/frame.h ../gdb-6.8/gdb/frame.h --- gdb-6.8/gdb/frame.h 2008-01-01 22:53:09.000000000 +0000 +++ ../gdb-6.8/gdb/frame.h 2008-06-21 19:00:24.000000000 +0100 @@ -640,6 +640,10 @@ extern void print_frame_info (struct frame_info *, int print_level, enum print_what print_what, int args); +extern void set_frame_info_string(struct frame_info * frame_info, char* info_string); + +extern char* get_frame_info_string(struct frame_info * frame_info); + extern struct frame_info *block_innermost_frame (struct block *); extern int deprecated_pc_in_call_dummy (CORE_ADDR pc); Only in ../gdb-6.8/gdb: gdb-patch.tar.bz2 Only in ../gdb-6.8/gdb/gdbserver: config.status.lineno diff -r --ignore-space-change -u gdb-6.8/gdb/infcmd.c ../gdb-6.8/gdb/infcmd.c --- gdb-6.8/gdb/infcmd.c 2008-01-31 13:37:21.000000000 +0000 +++ ../gdb-6.8/gdb/infcmd.c 2008-06-22 16:29:51.000000000 +0100 @@ -1921,6 +1921,7 @@ exec_file = target_pid_to_exec_file (PIDGET (inferior_ptid)); if (exec_file) { + int oldbacktrace_only_symbol_phase = backtrace_only_symbol_phase; /* It's possible we don't have a full path, but rather just a filename. Some targets, such as HP-UX, don't provide the full path, sigh. @@ -1933,7 +1934,20 @@ full_exec_path = savestring (exec_file, strlen (exec_file)); exec_file_attach (full_exec_path, from_tty); + + // We *always* want the main executable symbols to be fully loaded, + // as it a) will always be part of the backtrace; and b) + // does not appear in the so_list, so if it's not loaded + // now, it never will be. + if (backtrace_only_mode == 1) + backtrace_only_symbol_phase = load_full_symbols; + symbol_file_add_main (full_exec_path, from_tty); + + // Main executable symbols loaded - back to whatever symbol + // loading phase we were at originally. + if (backtrace_only_mode == 1) + backtrace_only_symbol_phase = oldbacktrace_only_symbol_phase; } } else diff -r --ignore-space-change -u gdb-6.8/gdb/main.c ../gdb-6.8/gdb/main.c --- gdb-6.8/gdb/main.c 2008-01-05 16:49:53.000000000 +0000 +++ ../gdb-6.8/gdb/main.c 2008-06-22 09:30:16.000000000 +0100 @@ -350,6 +350,7 @@ {"args", no_argument, &set_args, 1}, {"l", required_argument, 0, 'l'}, {"return-child-result", no_argument, &return_child_result, 1}, + {"backtrace-only", no_argument, &backtrace_only_mode, 1}, {0, no_argument, 0, 0} }; Only in ../gdb-6.8/gdb: observer.h Only in ../gdb-6.8/gdb: observer.inc diff -r --ignore-space-change -u gdb-6.8/gdb/solib.c ../gdb-6.8/gdb/solib.c --- gdb-6.8/gdb/solib.c 2008-01-07 15:19:58.000000000 +0000 +++ ../gdb-6.8/gdb/solib.c 2008-06-24 22:10:55.000000000 +0100 @@ -408,12 +408,16 @@ struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ struct section_addr_info *sap; + + if (!(backtrace_only_mode == 1 && backtrace_only_symbol_phase == load_full_symbols)) + { /* Have we already loaded this shared object? */ ALL_OBJFILES (so->objfile) { if (strcmp (so->objfile->name, so->so_name) == 0) return 1; } + } sap = build_section_addr_info_from_section_table (so->sections, so->sections_end); @@ -432,7 +436,7 @@ int solib_read_symbols (struct so_list *so, int from_tty) { - if (so->symbols_loaded) + if (so->symbols_loaded && !(backtrace_only_mode == 1 && backtrace_only_symbol_phase == load_full_symbols)) { if (from_tty) printf_unfiltered (_("Symbols already loaded for %s\n"), so->so_name); @@ -666,6 +670,10 @@ { struct so_list *gdb; + /* Pretty self explanatory, I guess :) */ + if (backtrace_only_mode == 1 && backtrace_only_symbol_phase == load_no_symbols) + readsyms = 0; + if (pattern) { char *re_err = re_comp (pattern); diff -r --ignore-space-change -u gdb-6.8/gdb/solib.h ../gdb-6.8/gdb/solib.h --- gdb-6.8/gdb/solib.h 2008-01-01 22:53:13.000000000 +0000 +++ ../gdb-6.8/gdb/solib.h 2008-06-21 16:56:12.000000000 +0100 @@ -61,4 +61,9 @@ extern void set_solib_ops (struct gdbarch *gdbarch, struct target_so_ops *new_ops); + +struct so_list * master_so_list (void); + +void free_so_objfile(struct so_list * so); + #endif /* SOLIB_H */ diff -r --ignore-space-change -u gdb-6.8/gdb/stack.c ../gdb-6.8/gdb/stack.c --- gdb-6.8/gdb/stack.c 2008-03-17 15:06:24.000000000 +0000 +++ ../gdb-6.8/gdb/stack.c 2008-06-24 23:21:11.000000000 +0100 @@ -22,6 +22,7 @@ #include "defs.h" #include "value.h" #include "symtab.h" +#include "symfile.h" #include "gdbtypes.h" #include "expression.h" #include "language.h" @@ -42,7 +43,10 @@ #include "reggroups.h" #include "regcache.h" #include "solib.h" +#include "solist.h" #include "valprint.h" +#include "bfd.h" +#include "objfiles.h" #include "gdb_assert.h" #include @@ -459,6 +463,7 @@ struct symtab_and_line sal; int source_print; int location_print; + struct ui_file *output_mem_buffer = NULL; if (get_frame_type (frame) == DUMMY_FRAME || get_frame_type (frame) == SIGTRAMP_FRAME) @@ -513,9 +518,49 @@ || print_what == LOC_AND_ADDRESS || print_what == SRC_AND_LOC); + + + if (backtrace_only_mode == 1) + { + // Redirect this output to an in-memory char array - + // the order in which frame's descriptions are + // created is not the order they should finally + // be printed in, so hang on to the output until + // the right time! + output_mem_buffer = mem_fileopen(); + ui_out_redirect(uiout, output_mem_buffer); + } + + if (location_print || !sal.symtab) print_frame (frame, print_level, print_what, print_args, sal); + if (backtrace_only_mode == 1) + { + long mem_buffer_len; + // May as well grab the local vars, too. NOTE: this was removed as DrKonqui slows + // down massively when there is a lot of text in the backtrace, + //print_frame_local_vars(frame, 1, output_mem_buffer); + + if (sal.symtab && get_frame_info_string(frame)) + { + // We have a source and line for this frame now, so + // the description in output_mem_buffer should + // supercede whatever we currently have. + set_frame_info_string(frame, NULL); + } + if (!get_frame_info_string(frame)) + { + // This is our current best description of this frame - save it. + char* frame_info_as_string = ui_file_xstrdup(output_mem_buffer, &mem_buffer_len); + set_frame_info_string(frame, frame_info_as_string); + } + + // Un-redirect output. + ui_out_redirect(uiout, NULL); + ui_file_delete(output_mem_buffer); + } + source_print = (print_what == SRC_LINE || print_what == SRC_AND_LOC); if (source_print && sal.symtab) @@ -1153,6 +1198,91 @@ } } + +static void do_backtrace_only(struct frame_info *trailing, int frame_count)//TODO - frame_count not required. +{ + + struct so_list* so_library; + int loaded_any_symbols = 0; + int from_tty = 0; + + struct frame_info *fi; + struct minimal_symbol *msymbol; + + // Strategy - go through each external (*.so.x.y) library. Since backtrace_only + // ensures that we have not loaded any (bulky!) separate debug info + // yet, we have only the (slim!) minimal symbols. + // For each library, go through the entire backtrace - if one stackframe + // in the backtrace requires a symbol from this library, load all + // external symbols for this library, and print_frame_info to + // get the full frame info - the string representation of this is in + // fact not printed straight away, but is stored in frame_info::info_string + // to be printed at the end. + // When we've gone through all the stack frames for a library, the bulky + // parts of the library are unloaded - this is a very effective memory- + // conservation strategy. + // In this way, we only ever load the separate debug info that we actually need + // (great as in KDE4Daily, all pieces of separate debug info must be downloaded, + // uncompressed, and patched, which is time-consuming) and we never hang onto + // it longer than we need to. + for (so_library = master_so_list(); so_library; so_library = so_library->next) + { + int full_symbols_loaded = 0; + backtrace_only_symbol_phase = load_no_separate_symbols; + solib_read_symbols (so_library, from_tty); + + + for (fi = trailing; fi ; fi = get_prev_frame (fi)) + { + + msymbol = + lookup_minimal_symbol_by_pc (get_frame_address_in_block (fi)); + + if (msymbol) + { + if (strcmp(msymbol->ginfo.bfd_section->owner->filename, so_library->objfile->name) != 0) + { + // Additional sanity-check - a rogue objfile from somewhere + // doesn't get deleted, and so we often find some symbol + // that should have been unloaded, and then we assume that + // this so file contains something important when it + // probably doesn't, etc. Make msymbol NULL if the symbol + // wasn't definitely read from this so file. + msymbol = NULL; + } + } + // One of the stack frames requires this .so.x.y file - + // reload all the symbols in preparation for using them to + // create a good description of this frame. + if (msymbol != NULL && full_symbols_loaded == 0) + { + backtrace_only_symbol_phase = load_full_symbols; + solib_read_symbols (so_library, from_tty); + full_symbols_loaded = 1; + } + + // Implictly prints local vars when backtrace_only_mode == 1 + print_frame_info (fi, 1, LOCATION, 1); + + + } + if (so_library->objfile) + { + // Discard the objfile associated with this .so file and all the bulky symbols + // that go with it! + free_objfile(so_library->objfile); + so_library->objfile = 0; + } + } + + // All done - lets print out our final backtrace in the correct order! + for (fi = trailing; fi ; fi = get_prev_frame (fi)) + { + if (get_frame_info_string(fi)) + printf_filtered (_("%s\n"), get_frame_info_string(fi)); + } +} + /* Print briefly all stack frames or just the innermost COUNT_EXP frames. */ @@ -1211,7 +1341,12 @@ } else count = -1; - + if (backtrace_only_mode == 1) + { + do_backtrace_only(trailing, count); + } + else + { if (info_verbose) { struct partial_symtab *ps; @@ -1262,6 +1397,7 @@ printf_filtered (_("Backtrace stopped: %s\n"), frame_stop_reason_string (reason)); } + } } struct backtrace_command_args Only in ../gdb-6.8/gdb: stamp-int diff -r --ignore-space-change -u gdb-6.8/gdb/symfile.c ../gdb-6.8/gdb/symfile.c --- gdb-6.8/gdb/symfile.c 2008-01-29 22:47:20.000000000 +0000 +++ ../gdb-6.8/gdb/symfile.c 2008-06-24 22:14:38.000000000 +0100 @@ -1355,12 +1355,33 @@ gdb_byte buffer[8*1024]; int count; + if (backtrace_only_mode == 1 && (backtrace_only_symbol_phase == load_no_separate_symbols || + backtrace_only_symbol_phase == load_no_symbols )) + { + // Denied! + return 0; + } + fd = open (name, O_RDONLY | O_BINARY); if (fd < 0) return 0; + if (strstr(name, "kde4dailydebug") != 0) + { + // Add "file_crc = crc" so that we can always give a file + // a "dummy" gnu_debuglink file - we are only interested in the filename, + // not the hash. Getting the .dbg file with the correct hash is handled + // elsewhere, in debugfusedownloader.rb + // This way, two files that differ *solely* in the crc of their .dbg files + // can be treated as the same. + + file_crc = crc; + } + else + { while ((count = read (fd, buffer, sizeof (buffer))) > 0) file_crc = gnu_debuglink_crc32 (file_crc, buffer, count); + } close (fd); @@ -3235,6 +3256,10 @@ enum overlay_debugging_state overlay_debugging = ovly_off; int overlay_cache_invalid = 0; /* True if need to refresh mapped state */ +/* In backtrace_only_mode, we load no external symbols until ordered to */ +enum backtrace_only_symbol_handling backtrace_only_symbol_phase = load_no_separate_symbols; +int backtrace_only_mode = 0; + /* Function: section_is_overlay (SECTION) Returns true if SECTION has VMA not equal to LMA, ie. SECTION is loaded at an address different from where it will "run". */ diff -r --ignore-space-change -u gdb-6.8/gdb/symfile.h ../gdb-6.8/gdb/symfile.h --- gdb-6.8/gdb/symfile.h 2008-02-03 22:13:29.000000000 +0000 +++ ../gdb-6.8/gdb/symfile.h 2008-06-21 10:55:45.000000000 +0100 @@ -311,6 +311,16 @@ } overlay_debugging; extern int overlay_cache_invalid; +/* backtrace_only stuff */ +extern enum backtrace_only_symbol_handling +{ + load_no_symbols, + load_no_separate_symbols, + load_full_symbols +} backtrace_only_symbol_phase; +/* 1 == on; 0 == off */ +extern int backtrace_only_mode; + /* Return the "mapped" overlay section containing the PC. */ extern asection *find_pc_mapped_section (CORE_ADDR); diff -r --ignore-space-change -u gdb-6.8/gdb/utils.c ../gdb-6.8/gdb/utils.c --- gdb-6.8/gdb/utils.c 2008-01-01 22:53:13.000000000 +0000 +++ ../gdb-6.8/gdb/utils.c 2008-06-21 19:58:09.000000000 +0100 @@ -1598,7 +1598,7 @@ #endif /* If the output is not a terminal, don't paginate it. */ - if (!ui_file_isatty (gdb_stdout)) + if (!ui_file_isatty (gdb_stdout) || backtrace_only_mode == 1) lines_per_page = UINT_MAX; #endif } Only in ../gdb-6.8: gdb.kdevelop Only in ../gdb-6.8: gdb.kdevelop.pcs Only in ../gdb-6.8: gdb.kdevses diff -r --ignore-space-change -u gdb-6.8/libdecnumber/gstdint.h ../gdb-6.8/libdecnumber/gstdint.h --- gdb-6.8/libdecnumber/gstdint.h 2008-03-27 18:25:08.000000000 +0000 +++ ../gdb-6.8/libdecnumber/gstdint.h 2008-06-22 13:04:12.000000000 +0100 @@ -1,4 +1,4 @@ -/* generated for gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9) */ +/* generated for gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) */ #ifndef GCC_GENERATED_STDINT_H #define GCC_GENERATED_STDINT_H 1