From: Jan Kratochvil Date: Mon, 1 Aug 2011 14:57:48 +0000 (+0000) Subject: gdb/ X-Git-Tag: binutils-2_22-branchpoint~365 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1d288d35675434002cd5681b000a0e037989d36;p=platform%2Fupstream%2Fbinutils.git gdb/ * stack.c (do_gdb_disassembly): Use RETURN_MASK_ERROR, simplify the exception_print code path. (backtrace_command): Remove variable e. Protect arg by make_cleanup in advance. Simplify memset. Remove TRY_CATCH. Remove explicit xfree. (backtrace_full_command): Remove variable e. Remove TRY_CATCH. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9559c6b..2904980 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2011-08-01 Jan Kratochvil + * stack.c (do_gdb_disassembly): Use RETURN_MASK_ERROR, simplify the + exception_print code path. + (backtrace_command): Remove variable e. Protect arg by make_cleanup in + advance. Simplify memset. Remove TRY_CATCH. Remove explicit xfree. + (backtrace_full_command): Remove variable e. Remove TRY_CATCH. + +2011-08-01 Jan Kratochvil + Code cleanup. * stack.c (struct print_stack_frame_args, print_stack_frame_stub): Remove, merge them into ... diff --git a/gdb/stack.c b/gdb/stack.c index 873451f..6e871c0 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -434,15 +434,17 @@ do_gdb_disassembly (struct gdbarch *gdbarch, { volatile struct gdb_exception exception; - TRY_CATCH (exception, RETURN_MASK_ALL) + TRY_CATCH (exception, RETURN_MASK_ERROR) { gdb_disassembly (gdbarch, uiout, 0, DISASSEMBLY_RAW_INSN, how_many, low, high); } - /* If an exception was thrown while doing the disassembly, print - the error message, to give the user a clue of what happened. */ - if (exception.reason == RETURN_ERROR) - exception_print (gdb_stderr, exception); + if (exception.reason < 0) + { + /* If an exception was thrown while doing the disassembly, print + the error message, to give the user a clue of what happened. */ + exception_print (gdb_stderr, exception); + } } /* Print information about frame FRAME. The output is format according @@ -1348,7 +1350,6 @@ backtrace_command (char *arg, int from_tty) { struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); int fulltrace_arg = -1, arglen = 0, argc = 0; - volatile struct gdb_exception e; if (arg) { @@ -1379,7 +1380,8 @@ backtrace_command (char *arg, int from_tty) if (arglen > 0) { arg = xmalloc (arglen + 1); - memset (arg, 0, arglen + 1); + make_cleanup (xfree, arg); + arg[0] = 0; for (i = 0; i < (argc + 1); i++) { if (i != fulltrace_arg) @@ -1394,13 +1396,7 @@ backtrace_command (char *arg, int from_tty) } } - TRY_CATCH (e, RETURN_MASK_ERROR) - { - backtrace_command_1 (arg, fulltrace_arg >= 0 /* show_locals */, from_tty); - } - - if (fulltrace_arg >= 0 && arglen > 0) - xfree (arg); + backtrace_command_1 (arg, fulltrace_arg >= 0 /* show_locals */, from_tty); do_cleanups (old_chain); } @@ -1408,12 +1404,7 @@ backtrace_command (char *arg, int from_tty) static void backtrace_full_command (char *arg, int from_tty) { - volatile struct gdb_exception e; - - TRY_CATCH (e, RETURN_MASK_ERROR) - { - backtrace_command_1 (arg, 1 /* show_locals */, from_tty); - } + backtrace_command_1 (arg, 1 /* show_locals */, from_tty); }