--- crash-4.1.2/memory.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/memory.c 2009-12-22 15:28:52.000000000 -0500 @@ -853,6 +853,8 @@ PG_reserved_flag_init(); PG_slab_flag_init(); + + vt->flags |= VM_INIT; } /* @@ -10800,6 +10802,8 @@ fprintf(fp, "%sVM_EVENT", others++ ? "|" : "");\ if (vt->flags & PGCNT_ADJ) fprintf(fp, "%sPGCNT_ADJ", others++ ? "|" : "");\ + if (vt->flags & VM_INIT) + fprintf(fp, "%sVM_INIT", others++ ? "|" : "");\ fprintf(fp, ")\n"); if (vt->kernel_pgd[0] == vt->kernel_pgd[1]) @@ -12901,8 +12905,11 @@ if (IS_SPARSEMEM_EX()) { if (SECTION_NR_TO_ROOT(nr) >= NR_SECTION_ROOTS()) { - error(WARNING, - "sparsemem: invalid section number: %ld\n", nr); + if (!STREQ(pc->curcmd, "rd") && + !STREQ(pc->curcmd, "kmem")) + error(WARNING, + "sparsemem: invalid section number: %ld\n", + nr); return 0; } } --- crash-4.1.2/filesys.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/filesys.c 2009-12-18 16:37:50.000000000 -0500 @@ -1160,6 +1160,12 @@ switch(c) { case 'i': + if (INVALID_MEMBER(super_block_s_dirty)) { + error(INFO, + "the super_block.s_dirty linked list does " + "not exist in this kernel\n"); + option_not_supported(c); + } flags |= MOUNT_PRINT_INODES; break; @@ -1276,9 +1282,11 @@ space(MINSPACE), space(MINSPACE)); - s_dirty = OFFSET(super_block_s_dirty); + dirp = dentry = mnt_parent = sb_s_files = s_dirty = 0; + + if (VALID_MEMBER(super_block_s_dirty)) + s_dirty = OFFSET(super_block_s_dirty); - dirp = dentry = mnt_parent = sb_s_files = 0; dentry_list = NULL; mntlist = 0; ld = &list_data; --- crash-4.1.2/help.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/help.c 2010-01-05 14:51:04.000000000 -0500 @@ -2436,7 +2436,8 @@ " filesystems. The per-filesystem dirty inode list or list of open", " files for the filesystem may also be displayed.\n", " -f dump dentries and inodes for open files in each filesystem.", -" -i dump all dirty inodes associated with each filesystem.\n", +" -i dump all dirty inodes associated with each filesystem; only", +" supported on kernels with super_block.s_dirty linked list.\n", " For kernels supporting namespaces, the -n option may be used to", " display the mounted filesystems with respect to the namespace of a", " specified task:\n", @@ -5287,7 +5288,7 @@ static char *version_info[] = { -"Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Red Hat, Inc.", +"Copyright (C) 2002-2010 Red Hat, Inc.", "Copyright (C) 2004, 2005, 2006 IBM Corporation", "Copyright (C) 1999-2006 Hewlett-Packard Co", "Copyright (C) 2005, 2006 Fujitsu Limited", --- crash-4.1.2/task.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/task.c 2009-12-16 10:22:36.000000000 -0500 @@ -3168,6 +3168,7 @@ /* 12 */ "MSGQUEUE", /* 13 */ "NICE", /* 14 */ "RTPRIO", + /* 15 */ "RTTIME", NULL, }; @@ -3217,6 +3218,8 @@ error(FATAL, "cannot determine rlimit array size\n"); for (i = len1 = 0; i < rlimit_index; i++) { + if (rlim_names[i] == NULL) + continue; if ((j = strlen(rlim_names[i])) > len1) len1 = j; } --- crash-4.1.2/configure.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/configure.c 2010-01-06 14:35:33.000000000 -0500 @@ -1,8 +1,8 @@ /* configure.c - core analysis suite * * Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. - * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 David Anderson - * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. All rights reserved. + * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 David Anderson + * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,7 +131,7 @@ #define GDB_7_0 3 #define SUPPORTED_GDB_VERSIONS (GDB_7_0 + 1) -int default_gdb = GDB_6_1; +int default_gdb = GDB_7_0; struct supported_gdb_version { char *GDB; --- crash-4.1.2/ppc64.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/ppc64.c 2010-01-05 14:53:41.000000000 -0500 @@ -1,7 +1,7 @@ /* ppc64.c -- core analysis suite * - * Copyright (C) 2004, 2005, 2006, 2007, 2008 David Anderson - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 David Anderson + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. All rights reserved. * Copyright (C) 2004, 2006 Haren Myneni, IBM Corporation * * This program is free software; you can redistribute it and/or modify @@ -20,6 +20,7 @@ static int ppc64_kvtop(struct task_context *, ulong, physaddr_t *, int); static int ppc64_uvtop(struct task_context *, ulong, physaddr_t *, int); static ulong ppc64_vmalloc_start(void); +static int ppc64_vmemmap_to_phys(ulong, physaddr_t *, int); static int ppc64_is_task_addr(ulong); static int ppc64_verify_symbol(const char *, ulong, char); static ulong ppc64_get_task_pgd(ulong); @@ -136,6 +137,8 @@ machdep->line_number_hooks = ppc64_line_number_hooks; machdep->value_to_symbol = generic_machdep_value_to_symbol; machdep->init_kernel_pgd = NULL; + if (symbol_exists("vmemmap_populate")) + machdep->flags |= VMEMMAP; break; case POST_GDB: @@ -196,6 +199,8 @@ STRUCT_SIZE_INIT(irqdesc, "irqdesc"); STRUCT_SIZE_INIT(irq_desc_t, "irq_desc_t"); + if (INVALID_SIZE(irqdesc) && INVALID_SIZE(irq_desc_t)) + STRUCT_SIZE_INIT(irq_desc_t, "irq_desc"); /* as of 2.3.x PPC uses the generic irq handlers */ if (VALID_SIZE(irq_desc_t)) machdep->dump_irq = generic_dump_irq; @@ -321,6 +326,8 @@ fprintf(fp, "%sVM_ORIG", others++ ? "|" : ""); if (machdep->flags & VM_4_LEVEL) fprintf(fp, "%sVM_4_LEVEL", others++ ? "|" : ""); + if (machdep->flags & VMEMMAP) + fprintf(fp, "%sVMEMMAP", others++ ? "|" : ""); fprintf(fp, ")\n"); fprintf(fp, " kvbase: %lx\n", machdep->kvbase); @@ -646,6 +653,9 @@ if (!IS_KVADDR(kvaddr)) return FALSE; + if (REGION_ID(kvaddr) == VMEMMAP_REGION_ID) + return ppc64_vmemmap_to_phys(kvaddr, paddr, verbose); + if (!vt->vmalloc_start) { *paddr = VTOP(kvaddr); return TRUE; @@ -663,6 +673,39 @@ } /* + * If the vmemmap address translation information is stored in the kernel, + * make the translation. + */ +static int +ppc64_vmemmap_to_phys(ulong kvaddr, physaddr_t *paddr, int verbose) +{ + if (!(machdep->flags & VMEMMAP)) + return FALSE; + + /* + * If possible, make the translation here. + */ + + /* TBD -- kernel assist required */ + + /* + * During runtime, just fail the command. + */ + if (vt->flags & VM_INIT) + error(FATAL, "cannot translate vmemmap address: %lx\n", + kvaddr); + + /* + * During vm_init() initialization, print a warning message. + */ + error(WARNING, + "cannot translate vmemmap kernel virtual addresses:\n" + " commands requiring page structure contents will fail\n\n"); + + return FALSE; +} + +/* * Determine where vmalloc'd memory starts. */ static ulong @@ -2468,7 +2511,20 @@ kt->flags |= PER_CPU_OFF; cpus++; } - kt->cpus = cpus; + switch (map) + { + case POSSIBLE: + if (cpus > kt->cpus) { + i = get_highest_cpu_online() + 1; + if (i > kt->cpus) + kt->cpus = i; + } + break; + case ONLINE: + case PRESENT: + kt->cpus = cpus; + break; + } if (kt->cpus > 1) kt->flags |= SMP; } --- crash-4.1.2/x86_64.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/x86_64.c 2009-12-21 11:12:32.000000000 -0500 @@ -2346,6 +2346,9 @@ } } + if (STREQ(name, "invalid_op")) + eframe_check = 8; + if (bt->flags & BT_SCHEDULE) name = "schedule"; --- crash-4.1.2/symbols.c 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/symbols.c 2009-12-21 10:23:06.000000000 -0500 @@ -3512,6 +3512,13 @@ for ( ; sp < st->symend; sp++) { if (value == sp->value) { +#ifdef GDB_7_0 + if (STRNEQ(sp->name, ".text.")) { + spnext = sp+1; + if (spnext->value == value) + sp = spnext; + } +#endif if (offset) *offset = 0; return((struct syment *)sp); --- crash-4.1.2/defs.h 2010-01-06 14:44:29.000000000 -0500 +++ crash-5.0.0/defs.h 2009-12-15 16:31:12.000000000 -0500 @@ -807,6 +807,7 @@ #define VM_4_LEVEL (0x2000000) #define MCA (0x1000000) #define PAE (0x800000) +#define VMEMMAP (0x400000) extern struct machdep_table *machdep; @@ -1789,6 +1790,7 @@ #define CONFIG_NUMA (0x20000) #define VM_EVENT (0x40000) #define PGCNT_ADJ (0x80000) +#define VM_INIT (0x100000) #define IS_FLATMEM() (vt->flags & FLATMEM) #define IS_DISCONTIGMEM() (vt->flags & DISCONTIGMEM) @@ -3932,7 +3934,6 @@ #define SCHED_TEXT (0x40) #define PHYS_BASE (0x80) #define VM_XEN_RHEL4 (0x100) -#define VMEMMAP (0x200) #define VM_FLAGS (VM_ORIG|VM_2_6_11|VM_XEN|VM_XEN_RHEL4) @@ -4021,6 +4022,10 @@ error(FATAL, "-d option is not applicable to PowerPC architecture\n") #define KSYMS_START (0x1) #define VM_ORIG (0x2) + +#define REGION_SHIFT (60UL) +#define REGION_ID(addr) (((unsigned long)(addr)) >> REGION_SHIFT) +#define VMEMMAP_REGION_ID (0xfUL) #endif /* --- crash-4.1.2/gdb-7.0.patch 2010-01-06 14:45:44.000000000 -0500 +++ crash-5.0.0/gdb-7.0.patch 2010-01-05 15:41:29.000000000 -0500 @@ -0,0 +1,1242 @@ +--- gdb-7.0/gdb/ui-file.c.orig ++++ gdb-7.0/gdb/ui-file.c +@@ -525,6 +525,17 @@ gdb_fopen (char *name, char *mode) + return stdio_file_new (f, 1); + } + ++#ifdef CRASH_MERGE ++void ++replace_ui_file_FILE(struct ui_file *file, FILE *fp) ++{ ++ struct stdio_file *stdio_file; ++ ++ stdio_file = (struct stdio_file *)ui_file_data(file); ++ stdio_file->file = fp; ++} ++#endif ++ + /* ``struct ui_file'' implementation that maps onto two ui-file objects. */ + + static ui_file_write_ftype tee_file_write; +--- gdb-7.0/gdb/dwarf2read.c.orig ++++ gdb-7.0/gdb/dwarf2read.c +@@ -10502,8 +10502,19 @@ read_signatured_type (struct objfile *ob + callers will only want a very basic result and this can become a + complaint. + +- Note that stack[0] is unused except as a default error return. +- Note that stack overflow is not yet handled. */ ++ Note that stack[0] is unused except as a default error return. */ ++ ++#ifdef CRASH_MERGE ++/* ++ * crash/gdb-6.1 changelog for decode_locdesc() patch: ++ * ++ * Buffer overflow in the (1) DWARF (dwarfread.c) and (2) DWARF2 ++ * (dwarf2read.c) debugging code in GNU Debugger (GDB) 6.5 allows ++ * user-assisted attackers, or restricted users, to execute arbitrary ++ * code via a crafted file with a location block (DW_FORM_block) that ++ * contains a large number of operations. ++ */ ++#endif + + static CORE_ADDR + decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) +@@ -10520,8 +10531,11 @@ decode_locdesc (struct dwarf_block *blk, + + i = 0; + stacki = 0; ++#ifdef CRASH_MERGE ++ stack[++stacki] = 0; ++#else + stack[stacki] = 0; +- ++#endif + while (i < size) + { + op = data[i++]; +@@ -10702,6 +10716,18 @@ decode_locdesc (struct dwarf_block *blk, + dwarf_stack_op_name (op)); + return (stack[stacki]); + } ++#ifdef CRASH_MERGE ++ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing ++ outside of the allocated space. Also enforce minimum > 0. ++ -- wad@google.com 14 Aug 2006 */ ++ if (stacki >= sizeof (stack) / sizeof (*stack) - 1) ++ internal_error (__FILE__, __LINE__, ++ _("location description stack too deep: %d"), ++ stacki); ++ if (stacki <= 0) ++ internal_error (__FILE__, __LINE__, ++ _("location description stack too shallow")); ++#endif + } + return (stack[stacki]); + } +--- gdb-7.0/gdb/valprint.c.orig ++++ gdb-7.0/gdb/valprint.c +@@ -1268,8 +1268,13 @@ partial_memory_read (CORE_ADDR memaddr, + this function instead? */ + + int ++#ifdef CRASH_MERGE ++valprint_read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit, ++ enum bfd_endian byte_order, gdb_byte **buffer, int *bytes_read) ++#else + read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit, + enum bfd_endian byte_order, gdb_byte **buffer, int *bytes_read) ++#endif + { + int found_nul; /* Non-zero if we found the nul char. */ + int errcode; /* Errno returned from bad reads. */ +@@ -1408,8 +1413,13 @@ val_print_string (struct type *elttype, + + fetchlimit = (len == -1 ? options->print_max : min (len, options->print_max)); + ++#ifdef CRASH_MERGE ++ errcode = valprint_read_string (addr, len, width, fetchlimit, byte_order, ++ &buffer, &bytes_read); ++#else + errcode = read_string (addr, len, width, fetchlimit, byte_order, + &buffer, &bytes_read); ++#endif + old_chain = make_cleanup (xfree, buffer); + + addr += bytes_read; +--- gdb-7.0/gdb/valprint.h.orig ++++ gdb-7.0/gdb/valprint.h +@@ -143,8 +143,14 @@ extern void print_hex_chars (struct ui_f + extern void print_char_chars (struct ui_file *, struct type *, + const gdb_byte *, unsigned int, enum bfd_endian); + ++#ifdef CRASH_MERGE ++int valprint_read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit, ++ enum bfd_endian byte_order, gdb_byte **buffer, ++ int *bytes_read); ++#else + int read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit, + enum bfd_endian byte_order, gdb_byte **buffer, + int *bytes_read); ++#endif + + #endif +--- gdb-7.0/gdb/symfile.c.orig ++++ gdb-7.0/gdb/symfile.c +@@ -965,6 +965,12 @@ symbol_file_add_with_addrs_or_offsets (b + error (_("Not confirmed.")); + + objfile = allocate_objfile (abfd, flags); ++#ifdef CRASH_MERGE ++ if (add_flags & SYMFILE_MAINLINE) { ++ extern struct objfile *gdb_kernel_objfile; ++ gdb_kernel_objfile = objfile; ++ } ++#endif + discard_cleanups (my_cleanups); + + if (addrs) +@@ -1329,6 +1335,10 @@ find_separate_debug_file (struct objfile + char *dir; + char *debugfile; + char *name_copy; ++#ifdef CRASH_MERGE ++ extern int check_specified_module_tree(char *, char *); ++ extern char *check_specified_kernel_debug_file(); ++#endif + char *canon_name; + bfd_size_type debuglink_size; + unsigned long crc32; +@@ -1411,6 +1421,17 @@ find_separate_debug_file (struct objfile + return xstrdup (debugfile); + } + ++#ifdef CRASH_MERGE ++{ ++ if (check_specified_module_tree(objfile->name, debugfile) && ++ separate_debug_file_exists(debugfile, crc32)) { ++ xfree(basename); ++ xfree(dir); ++ return xstrdup(debugfile); ++ } ++} ++#endif ++ + /* Then try in the global debugfile directory. */ + strcpy (debugfile, debug_file_directory); + strcat (debugfile, "/"); +@@ -1450,7 +1471,14 @@ find_separate_debug_file (struct objfile + + xfree (basename); + xfree (dir); ++#ifdef CRASH_MERGE ++{ ++ name_copy = check_specified_kernel_debug_file(); ++ return (name_copy ? xstrdup (name_copy) : NULL); ++} ++#else + return NULL; ++#endif + } + + +@@ -2222,8 +2250,10 @@ add_symbol_file_command (char *args, int + so we can't determine what section names are valid. */ + } + ++#ifndef CRASH_MERGE + if (from_tty && (!query ("%s", ""))) + error (_("Not confirmed.")); ++#endif + + symbol_file_add (filename, from_tty ? SYMFILE_VERBOSE : 0, + section_addrs, flags); +@@ -3975,6 +4005,14 @@ symfile_dummy_outputs (bfd *abfd, asecti + bfd_byte * + symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf) + { ++#ifdef CRASH_MERGE ++ /* Executable files have all the relocations already resolved. ++ * Handle files linked with --emit-relocs. ++ * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html ++ */ ++ if ((abfd->flags & EXEC_P) != 0) ++ return NULL; ++#endif + /* We're only interested in sections with relocation + information. */ + if ((sectp->flags & SEC_RELOC) == 0) +--- gdb-7.0/gdb/c-lang.c.orig ++++ gdb-7.0/gdb/c-lang.c +@@ -690,7 +690,11 @@ c_get_string (struct value *value, gdb_b + } + else + { ++#ifdef CRASH_MERGE ++ err = valprint_read_string (value_as_address (value), *length, width, fetchlimit, ++#else + err = read_string (value_as_address (value), *length, width, fetchlimit, ++#endif + byte_order, buffer, length); + if (err) + { +--- gdb-7.0/gdb/main.c.orig ++++ gdb-7.0/gdb/main.c +@@ -746,6 +746,12 @@ Excess command line arguments ignored. ( + exit (1); + } + } ++#ifdef CRASH_MERGE ++{ ++ extern void update_gdb_hooks(void); ++ update_gdb_hooks(); ++} ++#endif + + /* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets + GDB retain the old MI1 interpreter startup behavior. Output the +@@ -773,7 +779,11 @@ Excess command line arguments ignored. ( + processed; it sets global parameters, which are independent of + what file you are debugging or what directory you are in. */ + if (system_gdbinit && !inhibit_gdbinit) ++#ifdef CRASH_MERGE ++ catch_command_errors (source_script, system_gdbinit, -1, RETURN_MASK_ALL); ++#else + catch_command_errors (source_script, system_gdbinit, 0, RETURN_MASK_ALL); ++#endif + + /* Read and execute $HOME/.gdbinit file, if it exists. This is done + *before* all the command line arguments are processed; it sets +@@ -781,7 +791,11 @@ Excess command line arguments ignored. ( + debugging or what directory you are in. */ + + if (home_gdbinit && !inhibit_gdbinit) ++#ifdef CRASH_MERGE ++ catch_command_errors (source_script, home_gdbinit, -1, RETURN_MASK_ALL); ++#else + catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL); ++#endif + + /* Now perform all the actions indicated by the arguments. */ + if (cdarg != NULL) +@@ -801,7 +815,11 @@ Excess command line arguments ignored. ( + open it, better only print one error message. + catch_command_errors returns non-zero on success! */ + if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL)) ++#ifdef CRASH_MERGE ++ catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); ++#else + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); ++#endif + } + else + { +@@ -850,7 +868,11 @@ Can't attach to process and specify a co + /* Read the .gdbinit file in the current directory, *if* it isn't + the same as the $HOME/.gdbinit file (it should exist, also). */ + if (local_gdbinit && !inhibit_gdbinit) ++#ifdef CRASH_MERGE ++ catch_command_errors (source_script, local_gdbinit, -1, RETURN_MASK_ALL); ++#else + catch_command_errors (source_script, local_gdbinit, 0, RETURN_MASK_ALL); ++#endif + + for (i = 0; i < ncmd; i++) + { +@@ -900,6 +922,12 @@ Can't attach to process and specify a co + while (1) + { + catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); ++#ifdef CRASH_MERGE ++ { ++ int console(char *, ...); ++ console("\n"); ++ } ++#endif + } + /* No exit -- exit is through quit_command. */ + } +@@ -914,6 +942,24 @@ gdb_main (struct captured_main_args *arg + return 1; + } + ++#ifdef CRASH_MERGE ++/* ++ * NOTE: adapted from gdb.c, which is no longer built in; changed name of ++ * original main() to gdb_main_entry() for use as crash entry point ++ */ ++int ++gdb_main_entry (int argc, char **argv) ++{ ++ struct captured_main_args args; ++ memset (&args, 0, sizeof args); ++ args.argc = argc; ++ args.argv = argv; ++ args.use_windows = 0; ++ args.interpreter_p = INTERP_CONSOLE; ++ return gdb_main (&args); ++} ++#endif ++ + + /* Don't use *_filtered for printing help. We don't want to prompt + for continue no matter how small the screen or how much we're going +--- gdb-7.0/gdb/amd64-linux-nat.c.orig ++++ gdb-7.0/gdb/amd64-linux-nat.c +@@ -28,6 +28,17 @@ + + #include "gdb_assert.h" + #include "gdb_string.h" ++#ifdef CRASH_MERGE ++/* ++ * When compiling within a 2.6.25-based Fedora build environment with ++ * gcc 4.3, four new "typedef unsigned int u32;" declarations were ++ * required due to a new ptrace_bts_config structure declaration in ++ * "asm-x86/ptrace-abi.h" that used u32 members, but u32 is defined in ++ * "asm-x86/types.h" within a __KERNEL__ section. They've been changed ++ * to __u32, but this patch remains for building in that environment. ++ */ ++typedef unsigned int u32; ++#endif + #include + #include + #include +--- gdb-7.0/gdb/exceptions.c.orig ++++ gdb-7.0/gdb/exceptions.c +@@ -210,6 +210,10 @@ exceptions_state_mc_action_iter_1 (void) + + /* Return EXCEPTION to the nearest containing catch_errors(). */ + ++#ifdef CRASH_MERGE ++NORETURN void (*error_hook) (void) ATTR_NORETURN; ++#endif ++ + NORETURN void + throw_exception (struct gdb_exception exception) + { +@@ -228,7 +232,13 @@ throw_exception (struct gdb_exception ex + + disable_current_display (); + do_cleanups (ALL_CLEANUPS); +- ++#ifdef CRASH_MERGE ++ if (error_hook) { ++ fprintf_filtered(gdb_stderr, "%s\n", exception.message); ++ (*error_hook)(); ++ } else ++ fprintf_filtered(gdb_stderr, "gdb called without error_hook: %s\n", exception.message); ++#endif + /* Jump to the containing catch_errors() call, communicating REASON + to that call via setjmp's return value. Note that REASON can't + be zero, by definition in defs.h. */ +--- gdb-7.0/gdb/cli/cli-cmds.c.orig ++++ gdb-7.0/gdb/cli/cli-cmds.c +@@ -467,7 +467,11 @@ source_script (char *file, int from_tty) + + if (fd == -1) + { ++#ifdef CRASH_MERGE ++ if (from_tty > 0) ++#else + if (from_tty) ++#endif + perror_with_name (file); + else + { +@@ -477,6 +481,29 @@ source_script (char *file, int from_tty) + } + + stream = fdopen (fd, FOPEN_RT); ++#ifdef CRASH_MERGE ++ /* ++ * Only allow trusted versions of .gdbinit files to be ++ * sourced during session initialization. ++ */ ++ if (from_tty == -1) ++ { ++ struct stat statbuf; ++ int fd = fileno (stream); ++ if (fstat (fd, &statbuf) < 0) ++ { ++ perror_with_name (file); ++ fclose (stream); ++ return; ++ } ++ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH)) ++ { ++ extern void untrusted_file(FILE *, char *); untrusted_file(NULL, file); ++ fclose (stream); ++ return; ++ } ++ } ++#endif + script_from_file (stream, file); + + do_cleanups (old_cleanups); +--- gdb-7.0/gdb/target.c.orig ++++ gdb-7.0/gdb/target.c +@@ -1444,6 +1444,13 @@ target_xfer_partial (struct target_ops * + int + target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len) + { ++#ifdef CRASH_MERGE ++ extern int gdb_readmem_callback(unsigned long, void *, int, int); ++ if (gdb_readmem_callback(memaddr, (void *)myaddr, len, 0)) ++ return 0; ++ else ++ return EIO; ++#endif + /* Dispatch to the topmost target, not the flattened current_target. + Memory accesses check target->to_has_(all_)memory, and the + flattened target doesn't inherit those. */ +@@ -1474,6 +1481,13 @@ target_read_stack (CORE_ADDR memaddr, gd + int + target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len) + { ++#ifdef CRASH_MERGE ++ extern int gdb_readmem_callback(unsigned long, void *, int, int); ++ if (gdb_readmem_callback(memaddr, myaddr, len, 1)) ++ return 0; ++ else ++ return EIO; ++#endif + /* Dispatch to the topmost target, not the flattened current_target. + Memory accesses check target->to_has_(all_)memory, and the + flattened target doesn't inherit those. */ +--- gdb-7.0/gdb/symtab.c.orig ++++ gdb-7.0/gdb/symtab.c +@@ -1186,7 +1186,9 @@ fixup_psymbol_section (struct partial_sy + doesn't affect these calls since they are looking for a known + variable and thus can probably assume it will never hit the C++ + code). */ +- ++#ifdef CRASH_MERGE ++static void gdb_bait_and_switch(char *, struct symbol *); ++#endif + struct symbol * + lookup_symbol_in_language (const char *name, const struct block *block, + const domain_enum domain, enum language lang, +@@ -1252,6 +1254,11 @@ lookup_symbol_in_language (const char *n + domain, lang, is_a_field_of_this); + do_cleanups (cleanup); + ++#ifdef CRASH_MERGE ++ if (returnval && (domain == VAR_DOMAIN)) ++ gdb_bait_and_switch((char *)modified_name, returnval); ++#endif ++ + return returnval; + } + +@@ -4783,3 +4790,619 @@ Valid values are \"ask\", \"all\", \"can + + observer_attach_executable_changed (symtab_observer_executable_changed); + } ++ ++#ifdef CRASH_MERGE ++#include "gdb-stabs.h" ++#include "version.h" ++#define GDB_COMMON ++#include "../../defs.h" ++ ++static void get_member_data(struct gnu_request *, struct type *); ++static void dump_enum(struct type *, struct gnu_request *); ++static void eval_enum(struct type *, struct gnu_request *); ++static void gdb_get_line_number(struct gnu_request *); ++static void gdb_get_datatype(struct gnu_request *); ++static void gdb_get_symbol_type(struct gnu_request *); ++static void gdb_command_exists(struct gnu_request *); ++static void gdb_debug_command(struct gnu_request *); ++static void gdb_function_numargs(struct gnu_request *); ++static void gdb_add_symbol_file(struct gnu_request *); ++static void gdb_delete_symbol_file(struct gnu_request *); ++static void gdb_patch_symbol_values(struct gnu_request *); ++extern void replace_ui_file_FILE(struct ui_file *, FILE *); ++static void get_user_print_option_address(struct gnu_request *); ++extern int get_frame_offset(CORE_ADDR); ++ ++struct objfile *gdb_kernel_objfile = { 0 }; ++ ++static ulong gdb_merge_flags = 0; ++#define KERNEL_SYMBOLS_PATCHED (0x1) ++ ++#undef STREQ ++#define STREQ(A, B) (A && B && (strcmp(A, B) == 0)) ++ ++/* ++ * All commands from above come through here. ++ */ ++void ++gdb_command_funnel(struct gnu_request *req) ++{ ++ struct symbol *sym; ++ ++ if (req->command != GNU_VERSION) { ++ replace_ui_file_FILE(gdb_stdout, req->fp); ++ replace_ui_file_FILE(gdb_stderr, req->fp); ++ do_cleanups((struct cleanup *)0); ++ } ++ ++ switch (req->command) ++ { ++ case GNU_VERSION: ++ req->buf = (char *)version; ++ break; ++ ++ case GNU_PASS_THROUGH: ++ execute_command(req->buf, ++ req->flags & GNU_FROM_TTY_OFF ? FALSE : TRUE); ++ break; ++ ++ case GNU_USER_PRINT_OPTION: ++ get_user_print_option_address(req); ++ break; ++ ++ case GNU_RESOLVE_TEXT_ADDR: ++ sym = find_pc_function(req->addr); ++ if (!sym || TYPE_CODE(sym->type) != TYPE_CODE_FUNC) ++ req->flags |= GNU_COMMAND_FAILED; ++ break; ++ ++ case GNU_DISASSEMBLE: ++ if (req->addr2) ++ sprintf(req->buf, "disassemble 0x%lx 0x%lx", ++ req->addr, req->addr2); ++ else ++ sprintf(req->buf, "disassemble 0x%lx", req->addr); ++ execute_command(req->buf, TRUE); ++ break; ++ ++ case GNU_ADD_SYMBOL_FILE: ++ gdb_add_symbol_file(req); ++ break; ++ ++ case GNU_DELETE_SYMBOL_FILE: ++ gdb_delete_symbol_file(req); ++ break; ++ ++ case GNU_GET_LINE_NUMBER: ++ gdb_get_line_number(req); ++ break; ++ ++ case GNU_GET_DATATYPE: ++ gdb_get_datatype(req); ++ break; ++ ++ case GNU_GET_SYMBOL_TYPE: ++ gdb_get_symbol_type(req); ++ break; ++ ++ case GNU_COMMAND_EXISTS: ++ gdb_command_exists(req); ++ break; ++ ++ case GNU_ALPHA_FRAME_OFFSET: ++ req->value = 0; ++ break; ++ ++ case GNU_FUNCTION_NUMARGS: ++ gdb_function_numargs(req); ++ break; ++ ++ case GNU_DEBUG_COMMAND: ++ gdb_debug_command(req); ++ break; ++ ++ case GNU_PATCH_SYMBOL_VALUES: ++ gdb_patch_symbol_values(req); ++ break; ++ ++ default: ++ req->flags |= GNU_COMMAND_FAILED; ++ break; ++ } ++} ++ ++/* ++ * Given a PC value, return the file and line number. ++ */ ++static void ++gdb_get_line_number(struct gnu_request *req) ++{ ++ struct symtab_and_line sal; ++ CORE_ADDR pc; ++ ++#define LASTCHAR(s) (s[strlen(s)-1]) ++ ++ pc = req->addr; ++ ++ sal = find_pc_line(pc, 0); ++ ++ if (!sal.symtab) { ++ req->buf[0] = '\0'; ++ return; ++ } ++ ++ if (sal.symtab->filename && sal.symtab->dirname) { ++ if (sal.symtab->filename[0] == '/') ++ sprintf(req->buf, "%s: %d", ++ sal.symtab->filename, sal.line); ++ else ++ sprintf(req->buf, "%s%s%s: %d", ++ sal.symtab->dirname, ++ LASTCHAR(sal.symtab->dirname) == '/' ? "" : "/", ++ sal.symtab->filename, sal.line); ++ } ++} ++ ++ ++/* ++ * General purpose routine for determining datatypes. ++ */ ++ ++static void ++gdb_get_datatype(struct gnu_request *req) ++{ ++ register struct cleanup *old_chain = NULL; ++ register struct type *type; ++ register struct type *typedef_type; ++ struct expression *expr; ++ struct symbol *sym; ++ register int i; ++ struct field *nextfield; ++ struct value *val; ++ ++ if (gdb_CRASHDEBUG(2)) ++ console("gdb_get_datatype [%s] (a)\n", req->name); ++ ++ req->typecode = TYPE_CODE_UNDEF; ++ ++ /* ++ * lookup_symbol() will pick up struct and union names. ++ */ ++ sym = lookup_symbol(req->name, 0, STRUCT_DOMAIN, 0); ++ if (sym) { ++ req->typecode = TYPE_CODE(sym->type); ++ req->length = TYPE_LENGTH(sym->type); ++ if (req->member) ++ get_member_data(req, sym->type); ++ ++ if (TYPE_CODE(sym->type) == TYPE_CODE_ENUM) { ++ if (req->flags & GNU_PRINT_ENUMERATORS) ++ dump_enum(sym->type, req); ++ } ++ ++ return; ++ } ++ ++ /* ++ * Otherwise parse the expression. ++ */ ++ if (gdb_CRASHDEBUG(2)) ++ console("gdb_get_datatype [%s] (b)\n", req->name); ++ ++ expr = parse_expression(req->name); ++ ++ old_chain = make_cleanup(free_current_contents, &expr); ++ ++ ++ switch (expr->elts[0].opcode) ++ { ++ case OP_VAR_VALUE: ++ if (gdb_CRASHDEBUG(2)) ++ console("expr->elts[0].opcode: OP_VAR_VALUE\n"); ++ type = expr->elts[2].symbol->type; ++ if (TYPE_CODE(type) == TYPE_CODE_ENUM) { ++ req->typecode = TYPE_CODE(type); ++ req->value = SYMBOL_VALUE(expr->elts[2].symbol); ++ req->tagname = TYPE_TAG_NAME(type); ++ if (!req->tagname) { ++ val = evaluate_type(expr); ++ eval_enum(value_type(val), req); ++ } ++ } ++ break; ++ ++ case OP_TYPE: ++ if (gdb_CRASHDEBUG(2)) ++ console("expr->elts[0].opcode: OP_TYPE\n"); ++ type = expr->elts[1].type; ++ ++ req->typecode = TYPE_CODE(type); ++ req->length = TYPE_LENGTH(type); ++ ++ if (TYPE_CODE(type) == TYPE_CODE_TYPEDEF) { ++ req->is_typedef = TYPE_CODE_TYPEDEF; ++ if ((typedef_type = check_typedef(type))) { ++ req->typecode = TYPE_CODE(typedef_type); ++ req->length = TYPE_LENGTH(typedef_type); ++ type = typedef_type; ++ } ++ } ++ ++ if (TYPE_CODE(type) == TYPE_CODE_ENUM) { ++ if (req->is_typedef) ++ if (req->flags & GNU_PRINT_ENUMERATORS) { ++ if (req->is_typedef) ++ fprintf_filtered(gdb_stdout, ++ "typedef "); ++ dump_enum(type, req); ++ } ++ } ++ ++ if (req->member) ++ get_member_data(req, type); ++ ++ break; ++ ++ default: ++ if (gdb_CRASHDEBUG(2)) ++ console("expr->elts[0].opcode: %d (?)\n", ++ expr->elts[0].opcode); ++ break; ++ ++ } ++ ++ do_cleanups(old_chain); ++} ++ ++/* ++ * More robust enum list dump that gdb's, showing the value of each ++ * identifier, each on its own line. ++ */ ++static void ++dump_enum(struct type *type, struct gnu_request *req) ++{ ++ register int i; ++ int len; ++ int lastval; ++ ++ len = TYPE_NFIELDS (type); ++ lastval = 0; ++ if (TYPE_TAG_NAME(type)) ++ fprintf_filtered(gdb_stdout, ++ "enum %s {\n", TYPE_TAG_NAME (type)); ++ else ++ fprintf_filtered(gdb_stdout, "enum {\n"); ++ ++ for (i = 0; i < len; i++) { ++ fprintf_filtered(gdb_stdout, " %s", ++ TYPE_FIELD_NAME (type, i)); ++ if (lastval != TYPE_FIELD_BITPOS (type, i)) { ++ fprintf_filtered (gdb_stdout, " = %d", ++ TYPE_FIELD_BITPOS (type, i)); ++ lastval = TYPE_FIELD_BITPOS (type, i); ++ } else ++ fprintf_filtered(gdb_stdout, " = %d", lastval); ++ fprintf_filtered(gdb_stdout, "\n"); ++ lastval++; ++ } ++ if (TYPE_TAG_NAME(type)) ++ fprintf_filtered(gdb_stdout, "};\n"); ++ else ++ fprintf_filtered(gdb_stdout, "} %s;\n", req->name); ++} ++ ++/* ++ * Given an enum type with no tagname, determine its value. ++ */ ++static void ++eval_enum(struct type *type, struct gnu_request *req) ++{ ++ register int i; ++ int len; ++ int lastval; ++ ++ len = TYPE_NFIELDS (type); ++ lastval = 0; ++ ++ for (i = 0; i < len; i++) { ++ if (lastval != TYPE_FIELD_BITPOS (type, i)) { ++ lastval = TYPE_FIELD_BITPOS (type, i); ++ } ++ if (STREQ(TYPE_FIELD_NAME(type, i), req->name)) { ++ req->tagname = "(unknown)"; ++ req->value = lastval; ++ return; ++ } ++ lastval++; ++ } ++} ++ ++/* ++ * Walk through a struct type's list of fields looking for the desired ++ * member field, and when found, return its relevant data. ++ */ ++static void ++get_member_data(struct gnu_request *req, struct type *type) ++{ ++ register short i; ++ struct field *nextfield; ++ short nfields; ++ struct type *typedef_type; ++ ++ req->member_offset = -1; ++ ++ nfields = TYPE_MAIN_TYPE(type)->nfields; ++ nextfield = TYPE_MAIN_TYPE(type)->fields; ++ ++ if (nfields == 0) { ++ struct type *newtype; ++ newtype = lookup_transparent_type(req->name); ++ if (newtype) { ++ console("get_member_data(%s.%s): switching type from %lx to %lx\n", ++ req->name, req->member, type, newtype); ++ nfields = TYPE_MAIN_TYPE(newtype)->nfields; ++ nextfield = TYPE_MAIN_TYPE(newtype)->fields; ++ } ++ } ++ ++ for (i = 0; i < nfields; i++) { ++ if (STREQ(req->member, nextfield->name)) { ++ req->member_offset = nextfield->loc.bitpos; ++ req->member_length = TYPE_LENGTH(nextfield->type); ++ req->member_typecode = TYPE_CODE(nextfield->type); ++ if ((req->member_typecode == TYPE_CODE_TYPEDEF) && ++ (typedef_type = check_typedef(nextfield->type))) ++ req->member_length = TYPE_LENGTH(typedef_type); ++ return; ++ } ++ nextfield++; ++ } ++} ++ ++/* ++ * Check whether a command exists. If it doesn't, the command will be ++ * returned indirectly via the error_hook. ++ */ ++static void ++gdb_command_exists(struct gnu_request *req) ++{ ++ extern struct cmd_list_element *cmdlist; ++ register struct cmd_list_element *c; ++ ++ req->value = FALSE; ++ c = lookup_cmd(&req->name, cmdlist, "", 0, 1); ++ req->value = TRUE; ++} ++ ++static void ++gdb_function_numargs(struct gnu_request *req) ++{ ++ struct symbol *sym; ++ ++ sym = find_pc_function(req->pc); ++ ++ if (!sym || TYPE_CODE(sym->type) != TYPE_CODE_FUNC) { ++ req->flags |= GNU_COMMAND_FAILED; ++ return; ++ } ++ ++ req->value = (ulong)TYPE_NFIELDS(sym->type); ++} ++ ++struct load_module *gdb_current_load_module = NULL; ++ ++static void ++gdb_add_symbol_file(struct gnu_request *req) ++{ ++ register struct objfile *loaded_objfile = NULL; ++ register struct objfile *objfile; ++ register struct minimal_symbol *m; ++ struct load_module *lm; ++ struct syment *sp; ++ struct syment *spx; ++ int external, subsequent, found; ++ off_t offset; ++ ulong value, adjusted; ++ struct symbol *sym; ++ struct expression *expr; ++ struct cleanup *old_chain; ++ int i; ++ int allsect = 0; ++ char *secname; ++ char buf[80]; ++ ++ gdb_current_load_module = lm = (struct load_module *)req->addr; ++ ++ req->name = lm->mod_namelist; ++ gdb_delete_symbol_file(req); ++ ++ if ((lm->mod_flags & MOD_NOPATCH) == 0) { ++ for (i = 0 ; i < lm->mod_sections; i++) { ++ if (STREQ(lm->mod_section_data[i].name, ".text") && ++ (lm->mod_section_data[i].flags & SEC_FOUND)) ++ allsect = 1; ++ } ++ ++ if (!allsect) { ++ sprintf(req->buf, "add-symbol-file %s 0x%lx", lm->mod_namelist, ++ lm->mod_text_start ? lm->mod_text_start : lm->mod_base); ++ if (lm->mod_data_start) { ++ sprintf(buf, " -s .data 0x%lx", lm->mod_data_start); ++ strcat(req->buf, buf); ++ } ++ if (lm->mod_bss_start) { ++ sprintf(buf, " -s .bss 0x%lx", lm->mod_bss_start); ++ strcat(req->buf, buf); ++ } ++ if (lm->mod_rodata_start) { ++ sprintf(buf, " -s .rodata 0x%lx", lm->mod_rodata_start); ++ strcat(req->buf, buf); ++ } ++ } else { ++ sprintf(req->buf, "add-symbol-file %s 0x%lx", lm->mod_namelist, ++ lm->mod_text_start); ++ for (i = 0; i < lm->mod_sections; i++) { ++ secname = lm->mod_section_data[i].name; ++ if ((lm->mod_section_data[i].flags & SEC_FOUND) && ++ !STREQ(secname, ".text")) { ++ sprintf(buf, " -s %s 0x%lx", secname, ++ lm->mod_section_data[i].offset + lm->mod_base); ++ strcat(req->buf, buf); ++ } ++ } ++ } ++ } ++ ++ if (gdb_CRASHDEBUG(1)) ++ fprintf_filtered(gdb_stdout, "%s\n", req->buf); ++ ++ execute_command(req->buf, FALSE); ++ ++ ALL_OBJFILES(objfile) { ++ if (same_file(objfile->name, lm->mod_namelist)) { ++ loaded_objfile = objfile; ++ break; ++ } ++ } ++ ++ if (!loaded_objfile) ++ req->flags |= GNU_COMMAND_FAILED; ++} ++ ++static void ++gdb_delete_symbol_file(struct gnu_request *req) ++{ ++ register struct objfile *objfile; ++ ++ ALL_OBJFILES(objfile) { ++ if (STREQ(objfile->name, req->name) || ++ same_file(objfile->name, req->name)) { ++ free_objfile(objfile); ++ break; ++ } ++ } ++ ++ if (gdb_CRASHDEBUG(2)) { ++ fprintf_filtered(gdb_stdout, "current object files:\n"); ++ ALL_OBJFILES(objfile) ++ fprintf_filtered(gdb_stdout, " %s\n", objfile->name); ++ } ++} ++ ++/* ++ * Walk through all minimal_symbols, patching their values with the ++ * correct addresses. ++ */ ++static void ++gdb_patch_symbol_values(struct gnu_request *req) ++{ ++ struct minimal_symbol *msymbol; ++ struct objfile *objfile; ++ ++ req->name = PATCH_KERNEL_SYMBOLS_START; ++ patch_kernel_symbol(req); ++ ++ ALL_MSYMBOLS (objfile, msymbol) ++ { ++ req->name = msymbol->ginfo.name; ++ req->addr = (ulong)(&SYMBOL_VALUE_ADDRESS(msymbol)); ++ if (!patch_kernel_symbol(req)) { ++ req->flags |= GNU_COMMAND_FAILED; ++ break; ++ } ++ } ++ ++ req->name = PATCH_KERNEL_SYMBOLS_STOP; ++ patch_kernel_symbol(req); ++ ++ clear_symtab_users(); ++ gdb_merge_flags |= KERNEL_SYMBOLS_PATCHED; ++} ++ ++static void ++gdb_get_symbol_type(struct gnu_request *req) ++{ ++ struct expression *expr; ++ struct value *val; ++ struct cleanup *old_chain = NULL; ++ struct type *type; ++ struct type *target_type; ++ ++ req->typecode = TYPE_CODE_UNDEF; ++ ++ expr = parse_expression (req->name); ++ old_chain = make_cleanup (free_current_contents, &expr); ++ val = evaluate_type (expr); ++ ++ type = value_type(val); ++ ++ req->typename = TYPE_MAIN_TYPE(type)->name; ++ req->typecode = TYPE_MAIN_TYPE(type)->code; ++ req->length = type->length; ++ target_type = TYPE_MAIN_TYPE(type)->target_type; ++ ++ if (target_type) { ++ req->target_typename = TYPE_MAIN_TYPE(target_type)->name; ++ req->target_typecode = TYPE_MAIN_TYPE(target_type)->code; ++ req->target_length = target_type->length; ++ } ++ ++ if (req->member) ++ get_member_data(req, type); ++ ++ do_cleanups (old_chain); ++} ++ ++static void ++gdb_debug_command(struct gnu_request *req) ++{ ++ ++} ++ ++/* ++ * Only necessary on "patched" kernel symbol sessions, and called only by ++ * lookup_symbol(), pull a symbol value bait-and-switch operation by altering ++ * either a data symbol's address value or a text symbol's block start address. ++ */ ++static void ++gdb_bait_and_switch(char *name, struct symbol *sym) ++{ ++ struct minimal_symbol *msym; ++ struct block *block; ++ ++ if ((gdb_merge_flags & KERNEL_SYMBOLS_PATCHED) && ++ (msym = lookup_minimal_symbol(name, NULL, gdb_kernel_objfile))) { ++ if (sym->aclass == LOC_BLOCK) { ++ block = (struct block *)SYMBOL_BLOCK_VALUE(sym); ++ BLOCK_START(block) = SYMBOL_VALUE_ADDRESS(msym); ++ } else ++ SYMBOL_VALUE_ADDRESS(sym) = SYMBOL_VALUE_ADDRESS(msym); ++ } ++} ++ ++#include "valprint.h" ++ ++void ++get_user_print_option_address(struct gnu_request *req) ++{ ++ extern struct value_print_options user_print_options; ++ ++ req->addr = 0; ++ ++ if (strcmp(req->name, "output_format") == 0) ++ req->addr = (ulong)&user_print_options.output_format; ++ if (strcmp(req->name, "print_max") == 0) ++ req->addr = (ulong)&user_print_options.print_max; ++ if (strcmp(req->name, "prettyprint_structs") == 0) ++ req->addr = (ulong)&user_print_options.prettyprint_structs; ++ if (strcmp(req->name, "prettyprint_arrays") == 0) ++ req->addr = (ulong)&user_print_options.prettyprint_arrays; ++ if (strcmp(req->name, "repeat_count_threshold") == 0) ++ req->addr = (ulong)&user_print_options.repeat_count_threshold; ++ if (strcmp(req->name, "stop_print_at_null") == 0) ++ req->addr = (ulong)&user_print_options.stop_print_at_null; ++ if (strcmp(req->name, "output_radix") == 0) ++ req->addr = (ulong)&output_radix; ++} ++ ++#endif +--- gdb-7.0/gdb/Makefile.in.orig ++++ gdb-7.0/gdb/Makefile.in +@@ -371,7 +371,7 @@ CONFIG_UNINSTALL = @CONFIG_UNINSTALL@ + # It is also possible that you will need to add -I/usr/include/sys if + # your system doesn't have fcntl.h in /usr/include (which is where it + # should be according to Posix). +-DEFS = @DEFS@ ++DEFS = -DCRASH_MERGE @DEFS@ + GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/common -I$(srcdir)/config \ + -DLOCALEDIR="\"$(localedir)\"" $(DEFS) + +@@ -843,7 +843,7 @@ XML_SYSCALLS_FILES = gdb-syscalls.dtd \ + + TSOBS = inflow.o + +-SUBDIRS = @subdirs@ ++SUBDIRS = build_no_subdirs + CLEANDIRS = $(SUBDIRS) gnulib + + # For now, shortcut the "configure GDB for fewer languages" stuff. +@@ -874,8 +874,8 @@ generated_files = config.h observer.h ob + $(COMPILE) $< + $(POSTCOMPILE) + +-all: gdb$(EXEEXT) $(CONFIG_ALL) xml-syscall-copy +- @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do ++all: gdb$(EXEEXT) ++ @$(MAKE) -s $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do + .PHONY: all-tui + all-tui: $(TUI)$(EXEEXT) + +@@ -1123,10 +1123,11 @@ init.c: $(INIT_FILES) + + # Removing the old gdb first works better if it is running, at least on SunOS. + gdb$(EXEEXT): gdb.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) ++ @(cd ../..; make --no-print-directory GDB_FLAGS=-DGDB_7_0 library) + rm -f gdb$(EXEEXT) + $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \ +- -o gdb$(EXEEXT) gdb.o libgdb.a \ +- $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) ++ -o $(shell /bin/cat mergeobj) libgdb.a \ ++ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) $(shell /bin/cat mergelibs) + + $(TUI)$(EXEEXT): tui-main.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) + rm -f $(TUI)$(EXEEXT) +@@ -1346,12 +1347,12 @@ $(srcdir)/copying.c: @MAINTAINER_MODE_TR + mv $(srcdir)/copying.tmp $(srcdir)/copying.c + + version.c: Makefile version.in +- rm -f version.c-tmp version.c +- echo '#include "version.h"' >> version.c-tmp +- echo 'const char version[] = "'"`sed q ${srcdir}/version.in`"'";' >> version.c-tmp +- echo 'const char host_name[] = "$(host_alias)";' >> version.c-tmp +- echo 'const char target_name[] = "$(target_alias)";' >> version.c-tmp +- mv version.c-tmp version.c ++ @rm -f version.c-tmp version.c ++ @echo '#include "version.h"' >> version.c-tmp ++ @echo 'const char version[] = "'"`sed q ${srcdir}/version.in`"'";' >> version.c-tmp ++ @echo 'const char host_name[] = "$(host_alias)";' >> version.c-tmp ++ @echo 'const char target_name[] = "$(target_alias)";' >> version.c-tmp ++ @mv version.c-tmp version.c + + observer.h: observer.sh doc/observer.texi + ${srcdir}/observer.sh h ${srcdir}/doc/observer.texi observer.h +--- gdb-7.0/gdb/xml-syscall.c.orig ++++ gdb-7.0/gdb/xml-syscall.c +@@ -40,7 +40,11 @@ + static void + syscall_warn_user (void) + { ++#ifdef CRASH_MERGE ++ static int have_warned = 1; ++#else + static int have_warned = 0; ++#endif + if (!have_warned) + { + have_warned = 1; +--- gdb-7.0/opcodes/i386-dis.c.orig ++++ gdb-7.0/opcodes/i386-dis.c +@@ -9616,6 +9616,10 @@ print_insn (bfd_vma pc, disassemble_info + threebyte = *++codep; + dp = &dis386_twobyte[threebyte]; + need_modrm = twobyte_has_modrm[*codep]; ++ if (dp->name && strcmp(dp->name, "ud2a") == 0) { ++ extern int kernel_BUG_encoding_bytes(void); ++ codep += kernel_BUG_encoding_bytes(); ++ } + codep++; + } + else +--- gdb-7.0/readline/readline.h.orig ++++ gdb-7.0/readline/readline.h +@@ -375,7 +375,7 @@ extern int rl_crlf PARAMS((void)); + #if defined (USE_VARARGS) && defined (PREFER_STDARG) + extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2))); + #else +-extern int rl_message (); ++extern int rl_message (void); + #endif + + extern int rl_show_char PARAMS((int)); +--- gdb-7.0/readline/misc.c.orig ++++ gdb-7.0/readline/misc.c +@@ -401,7 +401,7 @@ _rl_history_set_point () + + #if defined (VI_MODE) + if (rl_editing_mode == vi_mode && _rl_keymap != vi_insertion_keymap) +- rl_point = 0; ++ rl_point = rl_end; + #endif /* VI_MODE */ + + if (rl_editing_mode == emacs_mode) +--- gdb-7.0/readline/rltypedefs.h.orig ++++ gdb-7.0/readline/rltypedefs.h +@@ -32,10 +32,10 @@ extern "C" { + #if !defined (_FUNCTION_DEF) + # define _FUNCTION_DEF + +-typedef int Function (); +-typedef void VFunction (); +-typedef char *CPFunction (); +-typedef char **CPPFunction (); ++typedef int Function (void); ++typedef void VFunction (void); ++typedef char *CPFunction (void); ++typedef char **CPPFunction (void); + + #endif /* _FUNCTION_DEF */ + +--- gdb-7.0/Makefile.in.orig ++++ gdb-7.0/Makefile.in +@@ -313,6 +313,9 @@ AR_FOR_BUILD = @AR_FOR_BUILD@ + AS_FOR_BUILD = @AS_FOR_BUILD@ + CC_FOR_BUILD = @CC_FOR_BUILD@ + CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ ++ifeq ($(shell arch), ppc64) ++CFLAGS_FOR_BUILD += -m64 -fPIC ++endif + CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ + CXX_FOR_BUILD = @CXX_FOR_BUILD@ + DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ +@@ -376,6 +379,9 @@ GNATBIND = @GNATBIND@ + GNATMAKE = @GNATMAKE@ + + CFLAGS = @CFLAGS@ ++ifeq ($(shell arch), ppc64) ++CFLAGS += -m64 -fPIC ++endif + LDFLAGS = @LDFLAGS@ + LIBCFLAGS = $(CFLAGS) + CXXFLAGS = @CXXFLAGS@ --- crash-4.1.2/COPYING3 2010-01-06 14:45:44.000000000 -0500 +++ crash-5.0.0/COPYING3 2009-10-28 15:11:35.000000000 -0400 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +.