From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12157 invoked by alias); 16 Nov 2010 05:04:14 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 12100 invoked by uid 9674); 16 Nov 2010 05:04:13 -0000 Date: Tue, 16 Nov 2010 05:04:00 -0000 Message-ID: <20101116050413.12085.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] master: Merge remote branch 'gdb/master' X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 1cc93f904c223a595c3f41894751af0b30445e86 X-Git-Newrev: fe12b092e5f0085281ce09e94c541ea2eeb8e4e4 X-SW-Source: 2010-q4/txt/msg00065.txt.bz2 List-Id: The branch, master has been updated via fe12b092e5f0085281ce09e94c541ea2eeb8e4e4 (commit) via ccae871af2e5963b0b6d5467a41982f7f218875b (commit) via 83ef38220fa6a963e11b592dc63fe5ff540fcbf1 (commit) via b3dc839d953520a1e4b2a66425e5c589475cec4d (commit) via f4160a60204da977af41ce5cc984af76a0b96e65 (commit) via 35e427b76abcbcbf3faa7be78828a900777476e3 (commit) via 479d34415d438cb903b03495d21024f7a0d2bb38 (commit) via 4da0884073e5a4e464eed13293fb4458255d8dd7 (commit) via dd80b3ebfaae70b2fb34cc0a92348a272e6cc848 (commit) via 603686b32e907e5a2f6761e2633c6a3937128c07 (commit) via 5097cdcc3758b39b213555d944e995c57531004c (commit) via 1f3223243cb9dce65d15e485eb7b10c3c29b3e0e (commit) via 91e77a2dadfcc2da238145c8f7538e1bf60cd893 (commit) via 1fbfe5836f6cb33edb0d232ba145ccd52c359b7e (commit) via 95aa50e02997e2c95e342adb6895bda63bf89bac (commit) via 94607e51af04ec6ee708c55239cdeb78c7d41df0 (commit) via e8b212e21800a12661936e7a943c7daa9d1088a7 (commit) via 97060a82bac95c43b0ad497fa1313b5ca59c3d00 (commit) via e15d3f1e9a9e0373291f0f8ca8420ca3fc749ba2 (commit) via 1b080e5c812a10d012790f79eefbf638de75ccd1 (commit) via 774ffe9e9d84a0ff884bb2b21d97c8f915c5152e (commit) via 550202613b8b567107580a062f418947b689e1ed (commit) via 787ced139be0421e8c5e0fbfe7ff5429d8b67601 (commit) via dcca8d3dfdd4166e3192214edb8e04dca236731f (commit) via 0c775a6234f13a97229cc0bcebeb73f0cafa9d9d (commit) via 1afa9b4c79b59bf187f6629e31cafb85f4e445c6 (commit) via 9f2a4c761ef976fdfb4f577965f533ece6ae5fbd (commit) from 1cc93f904c223a595c3f41894751af0b30445e86 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit fe12b092e5f0085281ce09e94c541ea2eeb8e4e4 Merge: 1cc93f9 ccae871 Author: Jan Kratochvil Date: Tue Nov 16 06:04:00 2010 +0100 Merge remote branch 'gdb/master' commit ccae871af2e5963b0b6d5467a41982f7f218875b Author: Mike Frysinger Date: Tue Nov 16 03:27:05 2010 +0000 gdbserver: fix warning in nommu clone Building gdbserver for nommu targets atm fails with: linux-low.c: In function 'linux_tracefork_child': linux-low.c:4151: error: pointer of type 'void *' used in arithmetic So cast the void* to a char*. Signed-off-by: Mike Frysinger commit 83ef38220fa6a963e11b592dc63fe5ff540fcbf1 Author: gdbadmin Date: Tue Nov 16 00:00:03 2010 +0000 *** empty log message *** commit b3dc839d953520a1e4b2a66425e5c589475cec4d Author: Alan Modra Date: Mon Nov 15 23:00:05 2010 +0000 daily update commit f4160a60204da977af41ce5cc984af76a0b96e65 Author: Mike Frysinger Date: Mon Nov 15 22:30:45 2010 +0000 blackfin: add support for L1 code/data flags Add new linker options for marking programs to load into L1 memory at runtime. This needs new EF flag bits, so declare them. Signed-off-by: Jie Zhang Signed-off-by: Mike Frysinger commit 35e427b76abcbcbf3faa7be78828a900777476e3 Author: Doug Evans Date: Mon Nov 15 17:25:09 2010 +0000 revert previous patch commit 479d34415d438cb903b03495d21024f7a0d2bb38 Author: Doug Evans Date: Mon Nov 15 17:17:56 2010 +0000 * gdb.base/maint.exp (maint print statistics): Increase timeout for all targets. Restore old timeout afterwards. commit 4da0884073e5a4e464eed13293fb4458255d8dd7 Author: mgretton Date: Mon Nov 15 10:03:05 2010 +0000 PR gas/12198 * gas/config/tc-arm.c (arm_arch_v6m_only): New variable. (aeabi_set_public_attributes): Ensure we only set the Operating System Extension when we are on an M-profile core. * gas/testsuite/gas/arm/pr12198-1.d: New test. * gas/testsuite/gas/arm/pr12918-1.s: Likewise. * gas/testsuite/gas/arm/pr12198-2.d: Likewise. * gas/testsuite/gas/arm/pr12918-2.s: Likewise. * include/opcode/arm.h (ARM_AEXT_V6M_ONLY): New define. (ARM_AEXT_V6M): Rewrite in terms of ARM_AEXT_V6M_ONLY. (ARM_ARCH_V6M_ONLY): New define. commit dd80b3ebfaae70b2fb34cc0a92348a272e6cc848 Author: Mike Frysinger Date: Mon Nov 15 08:33:59 2010 +0000 bfd: bfin: drop needless symbol flag handling imported from FRV The Blackfin bfd merged some FRV code recently, and then removed pieces that didn't make sense. In the FRV code, it outputs a "_gp" symbol in its BFD whereas in the Blackfin code, we don't. So while on the FRV side it fiddles with the "flags" variable (sometimes using it for section flags and sometimes using it for symbol flags), we don't need any of that. This lead to BZ 12177 where the Blackfin code is a bit confusing. So to fix things up, remove more stuff we don't need. Shouldn't change the behavior at all. Signed-off-by: Mike Frysinger commit 603686b32e907e5a2f6761e2633c6a3937128c07 Author: gdbadmin Date: Mon Nov 15 00:00:33 2010 +0000 *** empty log message *** commit 5097cdcc3758b39b213555d944e995c57531004c Author: Alan Modra Date: Sun Nov 14 23:00:06 2010 +0000 daily update commit 1f3223243cb9dce65d15e485eb7b10c3c29b3e0e Author: DJ Delorie Date: Sun Nov 14 21:42:54 2010 +0000 merge from gcc commit 91e77a2dadfcc2da238145c8f7538e1bf60cd893 Author: Pierre Muller Date: Sun Nov 14 12:10:55 2010 +0000 * arm-tdep.c (arm_in_function_epilogue_p): Fix code to avoid possible used of uninitialized variable. commit 1fbfe5836f6cb33edb0d232ba145ccd52c359b7e Author: gdbadmin Date: Sun Nov 14 00:00:34 2010 +0000 *** empty log message *** commit 95aa50e02997e2c95e342adb6895bda63bf89bac Author: Alan Modra Date: Sat Nov 13 23:00:06 2010 +0000 daily update commit 94607e51af04ec6ee708c55239cdeb78c7d41df0 Author: DJ Delorie Date: Sat Nov 13 02:20:29 2010 +0000 merge from gcc commit e8b212e21800a12661936e7a943c7daa9d1088a7 Author: gdbadmin Date: Sat Nov 13 00:00:33 2010 +0000 *** empty log message *** commit 97060a82bac95c43b0ad497fa1313b5ca59c3d00 Author: Alan Modra Date: Fri Nov 12 23:00:05 2010 +0000 daily update commit e15d3f1e9a9e0373291f0f8ca8420ca3fc749ba2 Author: H.J. Lu Date: Fri Nov 12 22:10:17 2010 +0000 Properly copy BFD_COMPRESS and BFD_DECOMPRESS to archive element. 2010-11-12 H.J. Lu * archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS and BFD_DECOMPRESS. (bfd_openr_next_archived_file): Revert the last change. commit 1b080e5c812a10d012790f79eefbf638de75ccd1 Author: Nathan Froyd Date: Fri Nov 12 21:54:31 2010 +0000 gdb/ * rs6000-tdep.c (bfd_uses_spe_extensions): New function. (rs6000_gdbarch_init): Call it. commit 774ffe9e9d84a0ff884bb2b21d97c8f915c5152e Author: Nathan Froyd Date: Fri Nov 12 21:53:09 2010 +0000 gdb/ * rs6000-tdep.c (gdb_print_insn_powerpc): Disassemble e500 instructions if debugging an E500 binary. commit 550202613b8b567107580a062f418947b689e1ed Author: Nathan Froyd Date: Fri Nov 12 21:49:55 2010 +0000 gdb/testsuite/ * gdb.stabs/gdb11479.exp: Use runto_main. commit 787ced139be0421e8c5e0fbfe7ff5429d8b67601 Author: Nathan Froyd Date: Fri Nov 12 21:47:47 2010 +0000 gdb/testsuite/ * gdb.base/break-entry.exp: Skip if using a stub. commit dcca8d3dfdd4166e3192214edb8e04dca236731f Author: Nathan Froyd Date: Fri Nov 12 21:44:48 2010 +0000 gdb/testsuite/ * gdb.python/py-inferior.exp: Pack values in target endianness. commit 0c775a6234f13a97229cc0bcebeb73f0cafa9d9d Author: Tom Tromey Date: Fri Nov 12 20:49:40 2010 +0000 gdb * varobj.c (value_get_print_value): Rearrange. Pass stream to apply_varobj_pretty_printer. * c-lang.c: Include exceptions.h. (c_get_string): Throw MEMORY_ERROR when appropriate. * python/py-prettyprint.c (enum string_repr_result): New. (print_stack_unless_memory_error): New function. (print_string_repr): Change return type. Use print_stack_unless_memory_error. (print_children): Use print_stack_unless_memory_error. (apply_val_pretty_printer): Update. Don't print children if string representation threw an exception. (apply_varobj_pretty_printer): Add 'stream' argument. Use print_stack_unless_memory_error. * python/python.c (gdbpy_gdb_error, gdbpy_gdb_memory_error): New globals. (_initialize_python): Initialize them. * python/python-internal.h (GDB_PY_HANDLE_EXCEPTION): Use gdbpy_convert_exception. (GDB_PY_SET_HANDLE_EXCEPTION): Likewise. (gdbpy_gdb_error, gdbpy_gdb_memory_error): Declare. (gdbpy_convert_exception): Declare. (apply_varobj_pretty_printer): Update. * python/py-utils.c (gdbpy_convert_exception): New function. gdb/doc * gdb.texinfo (Basic Python): Update. Add xref. (Exception Handling): Document new exception classes. (Types In Python): Update. (Frames In Python): Update. gdb/testsuite * gdb.python/py-prettyprint.c (main): Add new 'ns2' local. * gdb.python/py-prettyprint.exp (run_lang_tests): Add test for MemoryError. * gdb.python/python.exp (gdb_py_test_multiple): Update exception type. * gdb.python/py-value.exp (test_value_in_inferior): Add test for MemoryError. (test_subscript_regression): Update exception type. commit 1afa9b4c79b59bf187f6629e31cafb85f4e445c6 Author: Marc Khouzam Date: Fri Nov 12 18:46:42 2010 +0000 2010-11-12 Marc Khouzam * mi/mi-main.c (mi_cmd_target_detach): Accept new thread-group id format. commit 9f2a4c761ef976fdfb4f577965f533ece6ae5fbd Author: Jan Kratochvil Date: Fri Nov 12 12:38:38 2010 +0000 gdb/ * spu-tdep.c (spu_catch_start): Fix compilation error typo. ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 18 +++ bfd/archive.c | 13 +-- bfd/elf32-bfin.c | 24 +++- bfd/version.h | 2 +- gdb/ChangeLog | 50 +++++++++ gdb/arm-tdep.c | 1 + gdb/c-lang.c | 15 ++- gdb/doc/ChangeLog | 7 ++ gdb/doc/gdb.texinfo | 47 ++++++--- gdb/gdbserver/ChangeLog | 4 + gdb/gdbserver/linux-low.c | 2 +- gdb/mi/mi-main.c | 31 +++++- gdb/python/py-prettyprint.c | 90 ++++++++++++---- gdb/python/py-utils.c | 19 ++++ gdb/python/python-internal.h | 18 ++-- gdb/python/python.c | 13 +++ gdb/rs6000-tdep.c | 149 ++++++++++++++++++++++++-- gdb/spu-tdep.c | 2 +- gdb/testsuite/ChangeLog | 23 ++++ gdb/testsuite/gdb.base/break-entry.exp | 14 +++ gdb/testsuite/gdb.python/py-inferior.exp | 25 +++-- gdb/testsuite/gdb.python/py-prettyprint.c | 6 +- gdb/testsuite/gdb.python/py-prettyprint.exp | 2 + gdb/testsuite/gdb.python/py-value.exp | 7 +- gdb/testsuite/gdb.python/python.exp | 4 +- gdb/testsuite/gdb.stabs/gdb11479.exp | 6 +- gdb/varobj.c | 16 ++- gdb/version.in | 2 +- include/ChangeLog | 5 + include/elf/bfin.h | 3 + include/opcode/ChangeLog | 7 ++ include/opcode/arm.h | 7 +- libiberty/ChangeLog | 12 ++ libiberty/cp-demangle.c | 6 - libiberty/simple-object-coff.c | 3 +- libiberty/testsuite/demangle-expected | 9 ++- 36 files changed, 549 insertions(+), 113 deletions(-) First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index aab75e9..a67868e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,21 @@ +2010-11-16 Jie Zhang + + * elf32-bfin.c (elf32_bfin_code_in_l1): New variable. + (elf32_bfin_data_in_l1): New variable. + (elf32_bfin_final_write_processing): New. + (elf_backend_final_write_processing): Define. + +2010-11-15 Mike Frysinger + + PR binutils/12177 + * elf32-bfin.c (_bfin_create_got_section): Drop unused flags code. + +2010-11-12 H.J. Lu + + * archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS and + BFD_DECOMPRESS. + (bfd_openr_next_archived_file): Revert the last change. + 2010-11-11 Mingming Sun * archures.c (bfd_mach_mips_loongson_3a): Defined. diff --git a/bfd/archive.c b/bfd/archive.c index ed40141..258c8d9 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -655,6 +655,9 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos) n_nfd->arelt_data = new_areldata; + /* Copy BFD_COMPRESS and BFD_DECOMPRESS flags. */ + n_nfd->flags |= archive->flags & (BFD_COMPRESS | BFD_DECOMPRESS); + if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd)) return n_nfd; @@ -697,8 +700,6 @@ DESCRIPTION bfd * bfd_openr_next_archived_file (bfd *archive, bfd *last_file) { - bfd *abfd; - if ((bfd_get_format (archive) != bfd_archive) || (archive->direction == write_direction)) { @@ -706,14 +707,8 @@ bfd_openr_next_archived_file (bfd *archive, bfd *last_file) return NULL; } - abfd = BFD_SEND (archive, + return BFD_SEND (archive, openr_next_archived_file, (archive, last_file)); - - /* Copy BFD_COMPRESS and BFD_DECOMPRESS flags. */ - if (abfd) - abfd->flags |= archive->flags & (BFD_COMPRESS | BFD_DECOMPRESS); - - return abfd; } bfd * diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 237391b..56af244 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1120,6 +1120,22 @@ bfin_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return (reloc_howto_type *) NULL; } +/* Set by ld emulation if --code-in-l1. */ +bfd_boolean elf32_bfin_code_in_l1 = 0; + +/* Set by ld emulation if --data-in-l1. */ +bfd_boolean elf32_bfin_data_in_l1 = 0; + +static void +elf32_bfin_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) +{ + if (elf32_bfin_code_in_l1) + elf_elfheader (abfd)->e_flags |= EF_BFIN_CODE_IN_L1; + if (elf32_bfin_data_in_l1) + elf_elfheader (abfd)->e_flags |= EF_BFIN_DATA_IN_L1; +} + /* Return TRUE if the name is a local label. bfin local labels begin with L$. */ static bfd_boolean @@ -3442,14 +3458,8 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) return FALSE; bfinfdpic_gotfixup_section (info) = s; - flags = BSF_GLOBAL; - } - else - { - flags = BSF_GLOBAL | BSF_WEAK; } - flags = pltflags; pltflags |= SEC_CODE; if (bed->plt_not_loaded) pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS); @@ -5793,6 +5803,8 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] = elf32_bfin_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data \ elf32_bfin_print_private_bfd_data +#define elf_backend_final_write_processing \ + elf32_bfin_final_write_processing #define elf_backend_reloc_type_class elf32_bfin_reloc_type_class #define elf_backend_can_gc_sections 1 #define elf_backend_special_sections elf32_bfin_special_sections diff --git a/bfd/version.h b/bfd/version.h index 653cfa1..36fbb4f 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20101112 +#define BFD_VERSION_DATE 20101116 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2c413a3..7669965 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,53 @@ +2010-11-14 Pierre Muller + + * arm-tdep.c (arm_in_function_epilogue_p): Fix code to avoid + possible used of uninitialized variable. + +2010-11-12 Nathan Froyd + + * rs6000-tdep.c (bfd_uses_spe_extensions): New function. + (rs6000_gdbarch_init): Call it. + +2010-11-12 Nathan Froyd + + * rs6000-tdep.c (gdb_print_insn_powerpc): Disassemble e500 + instructions if debugging an E500 binary. + +2010-11-12 Tom Tromey + + * varobj.c (value_get_print_value): Rearrange. Pass stream to + apply_varobj_pretty_printer. + * c-lang.c: Include exceptions.h. + (c_get_string): Throw MEMORY_ERROR when appropriate. + * python/py-prettyprint.c (enum string_repr_result): New. + (print_stack_unless_memory_error): New function. + (print_string_repr): Change return type. Use + print_stack_unless_memory_error. + (print_children): Use print_stack_unless_memory_error. + (apply_val_pretty_printer): Update. Don't print children if + string representation threw an exception. + (apply_varobj_pretty_printer): Add 'stream' argument. Use + print_stack_unless_memory_error. + * python/python.c (gdbpy_gdb_error, gdbpy_gdb_memory_error): New + globals. + (_initialize_python): Initialize them. + * python/python-internal.h (GDB_PY_HANDLE_EXCEPTION): Use + gdbpy_convert_exception. + (GDB_PY_SET_HANDLE_EXCEPTION): Likewise. + (gdbpy_gdb_error, gdbpy_gdb_memory_error): Declare. + (gdbpy_convert_exception): Declare. + (apply_varobj_pretty_printer): Update. + * python/py-utils.c (gdbpy_convert_exception): New function. + +2010-11-12 Marc Khouzam + + * mi/mi-main.c (mi_cmd_target_detach): Accept new + thread-group id format. + +2010-11-12 Jan Kratochvil + + * spu-tdep.c (spu_catch_start): Fix compilation error typo. + 2010-11-11 Phil Muldoon * python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 2df96cd..7c24d30 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2233,6 +2233,7 @@ arm_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) if (pc < func_start + 4) return 0; + found_stack_adjust = 0; insn = read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code); if (bits (insn, 28, 31) != INST_NV) { diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 015ba16..775a6f8 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -35,6 +35,7 @@ #include "cp-support.h" #include "gdb_obstack.h" #include +#include "exceptions.h" extern void _initialize_c_language (void); @@ -698,13 +699,19 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length, } else { - err = read_string (value_as_address (value), *length, width, fetchlimit, - byte_order, buffer, length); + CORE_ADDR addr = value_as_address (value); + + err = read_string (addr, *length, width, fetchlimit, + byte_order, buffer, length); if (err) { xfree (*buffer); - error (_("Error reading string from inferior: %s"), - safe_strerror (err)); + if (err == EIO) + throw_error (MEMORY_ERROR, "Address %s out of bounds", + paddress (get_type_arch (type), addr)); + else + error (_("Error reading string from inferior: %s"), + safe_strerror (err)); } } diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index d999772..75f6f70 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2010-11-12 Tom Tromey + + * gdb.texinfo (Basic Python): Update. Add xref. + (Exception Handling): Document new exception classes. + (Types In Python): Update. + (Frames In Python): Update. + 2010-11-11 Phil Muldoon * gdb.texinfo (Breakpoints In Python): Document "internal" diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index cf70ce4..ddc711b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20729,8 +20729,9 @@ spaces if the parameter has a multi-part name. For example, @samp{print object} is a valid parameter name. If the named parameter does not exist, this function throws a -@code{RuntimeError}. Otherwise, the parameter's value is converted to -a Python value of the appropriate type, and returned. +@code{gdb.error} (@pxref{Exception Handling}). Otherwise, the +parameter's value is converted to a Python value of the appropriate +type, and returned. @end defun @findex gdb.history @@ -20741,7 +20742,7 @@ If @var{number} is negative, then @value{GDBN} will take its absolute value and count backward from the last element (i.e., the most recent element) to find the value to return. If @var{number} is zero, then @value{GDBN} will return the most recent element. If the element specified by @var{number} -doesn't exist in the value history, a @code{RuntimeError} exception will be +doesn't exist in the value history, a @code{gdb.error} exception will be raised. If no exception is raised, the return value is always an instance of @@ -20869,15 +20870,31 @@ Traceback (most recent call last): NameError: name 'foo' is not defined @end smallexample -@value{GDBN} errors that happen in @value{GDBN} commands invoked by Python -code are converted to Python @code{RuntimeError} exceptions. User -interrupt (via @kbd{C-c} or by typing @kbd{q} at a pagination -prompt) is translated to a Python @code{KeyboardInterrupt} -exception. If you catch these exceptions in your Python code, your -exception handler will see @code{RuntimeError} or -@code{KeyboardInterrupt} as the exception type, the @value{GDBN} error -message as its value, and the Python call stack backtrace at the -Python statement closest to where the @value{GDBN} error occured as the +@value{GDBN} errors that happen in @value{GDBN} commands invoked by +Python code are converted to Python exceptions. The type of the +Python exception depends on the error. + +@ftable @code +@item gdb.error +This is the base class for most exceptions generated by @value{GDBN}. +It is derived from @code{RuntimeError}, for compatibility with earlier +versions of @value{GDBN}. + +If an error occurring in @value{GDBN} does not fit into some more +specific category, then the generated exception will have this type. + +@item gdb.MemoryError +This is a subclass of @code{gdb.error} which is thrown when an +operation tried to access invalid memory in the inferior. + +@item KeyboardInterrupt +User interrupt (via @kbd{C-c} or by typing @kbd{q} at a pagination +prompt) is translated to a Python @code{KeyboardInterrupt} exception. +@end ftable + +In all cases, your exception handler will see the @value{GDBN} error +message as its value and the Python call stack backtrace at the Python +statement closest to where the @value{GDBN} error occured as the traceback. @findex gdb.GdbError @@ -21242,7 +21259,7 @@ variant of this type. That is, the result is neither @code{const} nor Return a Python @code{Tuple} object that contains two elements: the low bound of the argument type and the high bound of that type. If the type does not have a range, @value{GDBN} will raise a -@code{RuntimeError} exception. +@code{gdb.error} exception (@pxref{Exception Handling}). @end defmethod @defmethod Type reference @@ -22433,8 +22450,8 @@ When the debugged program stops, @value{GDBN} is able to analyze its call stack (@pxref{Frames,,Stack frames}). The @code{gdb.Frame} class represents a frame in the stack. A @code{gdb.Frame} object is only valid while its corresponding frame exists in the inferior's stack. If you try -to use an invalid frame object, @value{GDBN} will throw a @code{RuntimeError} -exception. +to use an invalid frame object, @value{GDBN} will throw a @code{gdb.error} +exception (@pxref{Exception Handling}). Two @code{gdb.Frame} objects can be compared for equality with the @code{==} operator, like: diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index cbee17c..656506c 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2010-11-16 Mike Frysinger + + * linux-low.c (linux_tracefork_child): Add char* cast to arg. + 2010-10-22 Jie Zhang * Makefile.in: Add FLAGS_TO_PASS variable. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index b798c16..c65ce54 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4148,7 +4148,7 @@ linux_tracefork_child (void *arg) __clone2 (linux_tracefork_grandchild, arg, STACK_SIZE, CLONE_VM | SIGCHLD, NULL); #else - clone (linux_tracefork_grandchild, arg + STACK_SIZE, + clone (linux_tracefork_grandchild, (char *) arg + STACK_SIZE, CLONE_VM | SIGCHLD, NULL); #endif diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 49e913e..3343c03 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -418,19 +418,40 @@ void mi_cmd_target_detach (char *command, char **argv, int argc) { if (argc != 0 && argc != 1) - error ("Usage: -target-detach [thread-group]"); + error ("Usage: -target-detach [pid | thread-group]"); if (argc == 1) { struct thread_info *tp; char *end = argv[0]; - int pid = strtol (argv[0], &end, 10); + int pid; - if (*end != '\0') - error (_("Cannot parse thread group id '%s'"), argv[0]); + /* First see if we are dealing with a thread-group id. */ + if (*argv[0] == 'i') + { + struct inferior *inf; + int id = strtoul (argv[0] + 1, &end, 0); + + if (*end != '\0') + error (_("Invalid syntax of thread-group id '%s'"), argv[0]); + + inf = find_inferior_id (id); + if (!inf) + error (_("Non-existent thread-group id '%d'"), id); + + pid = inf->pid; + } + else + { + /* We must be dealing with a pid. */ + pid = strtol (argv[0], &end, 10); + + if (*end != '\0') + error (_("Invalid identifier '%s'"), argv[0]); + } /* Pick any thread in the desired process. Current - target_detach deteches from the parent of inferior_ptid. */ + target_detach detaches from the parent of inferior_ptid. */ tp = iterate_over_threads (find_thread_of_process, &pid); if (!tp) error (_("Thread group is empty")); diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index afe2b40..7be1409 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -29,6 +29,18 @@ #ifdef HAVE_PYTHON #include "python-internal.h" +/* Return type of print_string_repr. */ + +enum string_repr_result + { + /* The string method returned None. */ + string_repr_none, + /* The string method had an error. */ + string_repr_error, + /* Everything ok. */ + string_repr_ok + }; + /* Helper function for find_pretty_printer which iterates over a list, calls each function and inspects output. This will return a printer object if one recognizes VALUE. If no printer is found, it @@ -256,12 +268,40 @@ gdbpy_get_display_hint (PyObject *printer) return result; } +/* A wrapper for gdbpy_print_stack that ignores MemoryError. */ + +static void +print_stack_unless_memory_error (struct ui_file *stream) +{ + if (PyErr_ExceptionMatches (gdbpy_gdb_memory_error)) + { + struct cleanup *cleanup; + PyObject *type, *value, *trace; + char *msg; + + PyErr_Fetch (&type, &value, &trace); + cleanup = make_cleanup_py_decref (type); + make_cleanup_py_decref (value); + make_cleanup_py_decref (trace); + + msg = gdbpy_exception_to_string (type, value); + make_cleanup (xfree, msg); + + if (msg == NULL || *msg == '\0') + fprintf_filtered (stream, _(""), msg); + + do_cleanups (cleanup); + } + else + gdbpy_print_stack (); +} + /* Helper for apply_val_pretty_printer which calls to_string and - formats the result. If the value returnd is Py_None, nothing is - printed and the function returns a 1; in all other cases data is - printed as given by the pretty printer and the function returns 0. -*/ -static int + formats the result. */ + +static enum string_repr_result print_string_repr (PyObject *printer, const char *hint, struct ui_file *stream, int recurse, const struct value_print_options *options, @@ -270,7 +310,7 @@ print_string_repr (PyObject *printer, const char *hint, { struct value *replacement = NULL; PyObject *py_str = NULL; - int is_py_none = 0; + enum string_repr_result result = string_repr_ok; py_str = pretty_print_one_value (printer, &replacement); if (py_str) @@ -278,7 +318,7 @@ print_string_repr (PyObject *printer, const char *hint, struct cleanup *cleanup = make_cleanup_py_decref (py_str); if (py_str == Py_None) - is_py_none = 1; + result = string_repr_none; else if (gdbpy_is_lazy_string (py_str)) { CORE_ADDR addr; @@ -316,7 +356,10 @@ print_string_repr (PyObject *printer, const char *hint, fputs_filtered (output, stream); } else - gdbpy_print_stack (); hooks/post-receive -- Repository for Project Archer.