From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28977 invoked by alias); 23 Jul 2012 09:43:59 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 28947 invoked by uid 9514); 23 Jul 2012 09:43:57 -0000 Date: Mon, 23 Jul 2012 09:43:00 -0000 Message-ID: <20120723094357.28932.qmail@sourceware.org> From: pmuldoon@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-pmuldoon-python-backtrace: Remove whitespace X-Git-Refname: refs/heads/archer-pmuldoon-python-backtrace X-Git-Reftype: branch X-Git-Oldrev: 33561fe62ab2936dceda596fd2115807a8b16f15 X-Git-Newrev: aea8f4bb1a33cfcddd55a6c8446e3d39e42b46ac X-SW-Source: 2012-q3/txt/msg00014.txt.bz2 List-Id: The branch, archer-pmuldoon-python-backtrace has been updated via aea8f4bb1a33cfcddd55a6c8446e3d39e42b46ac (commit) from 33561fe62ab2936dceda596fd2115807a8b16f15 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit aea8f4bb1a33cfcddd55a6c8446e3d39e42b46ac Author: Phil Muldoon Date: Mon Jul 23 10:43:38 2012 +0100 Remove whitespace ----------------------------------------------------------------------- Summary of changes: gdb/python/lib/gdb/BaseFrameWrapper.py | 2 +- gdb/python/lib/gdb/FrameFilter.py | 4 +- gdb/python/lib/gdb/FrameWrapper.py | 6 +- gdb/python/lib/gdb/command/frame_filters.py | 14 ++-- gdb/python/py-framefilter.c | 63 ++++++++++----------- gdb/stack.c | 8 +- gdb/testsuite/gdb.python/py-framefilter-gdb.py.in | 1 - gdb/testsuite/gdb.python/py-framefilter-mi.c | 7 +- gdb/testsuite/gdb.python/py-framefilter-mi.exp | 1 - gdb/testsuite/gdb.python/py-framefilter.c | 7 +- gdb/testsuite/gdb.python/py-framefilter.exp | 1 - gdb/testsuite/gdb.python/py-framefilter.py | 5 +- 12 files changed, 56 insertions(+), 63 deletions(-) First 500 lines of diff: diff --git a/gdb/python/lib/gdb/BaseFrameWrapper.py b/gdb/python/lib/gdb/BaseFrameWrapper.py index bb9974e..242592a 100644 --- a/gdb/python/lib/gdb/BaseFrameWrapper.py +++ b/gdb/python/lib/gdb/BaseFrameWrapper.py @@ -79,7 +79,7 @@ class BaseFrameWrapper (FrameWrapper): sal = self.base.find_sal() if (sal): - return sal.line + return sal.line else: return None diff --git a/gdb/python/lib/gdb/FrameFilter.py b/gdb/python/lib/gdb/FrameFilter.py index 4ce8497..14b14a1 100644 --- a/gdb/python/lib/gdb/FrameFilter.py +++ b/gdb/python/lib/gdb/FrameFilter.py @@ -1,7 +1,7 @@ import gdb class FrameFilter(): - + name = "Default" priority = 100 enabled = True @@ -10,7 +10,7 @@ class FrameFilter(): self.name = name self.priority = pri self.enabled = enb - + gdb.frame_filters[name] = self def filter(iter): diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py index b565b89..0db37de 100644 --- a/gdb/python/lib/gdb/FrameWrapper.py +++ b/gdb/python/lib/gdb/FrameWrapper.py @@ -30,8 +30,8 @@ class FrameWrapper (object): that occurs over many frames but might be better represented as a group of frames distinct from the other frames. - Arguments: None - + Arguments: None + Returns: The 'elide' function must return an iterator that contains the frames that are being elided. Elided frames are indented from normal frames in a backtrace, to show affinity @@ -43,7 +43,7 @@ class FrameWrapper (object): If this function returns a Python None, no frames will be elided. """ - + pass def function (self): diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py index 8b71ab7..c6992da 100644 --- a/gdb/python/lib/gdb/command/frame_filters.py +++ b/gdb/python/lib/gdb/command/frame_filters.py @@ -37,10 +37,10 @@ def _parse_arg (cmd_name, arg): if argc != 2: raise SyntaxError(cmd_name + " takes exactly " + \ "two arguments.") - + object_list = argv[0] argument = argv[1] - + return (object_list, argument) def _get_priority(filter_item): @@ -94,7 +94,7 @@ def _set_enabled(filter_item, state): """ if hasattr(filter_item, "enabled"): filter_item.enabled = state - else: + else: raise gdb.GdbError("Cannot find class attribute 'enabled'") def _get_name (frame_filter): @@ -171,7 +171,7 @@ def invoke (frame): # Apply base filter to all gdb.Frames. This unifies the in # interface - frame_iterator = itertools.imap (BaseFrameWrapper, frame_iterator) + frame_iterator = itertools.imap (BaseFrameWrapper, frame_iterator) for ff in sorted_list: frame_iterator = ff[1].filter (frame_iterator) @@ -254,7 +254,7 @@ def do_enable_frame_filter (command_tuple, flag): class FilterPrefixCmd (gdb.Command): def __init__ (self): super (FilterPrefixCmd, self).__init__ ("set python frame-filter", - gdb.COMMAND_DATA, + gdb.COMMAND_DATA, gdb.COMPLETE_COMMAND, True) class EnableFrameFilter (gdb.Command): @@ -331,7 +331,7 @@ class SetFrameFilterPriority (gdb.Command): if argc != 3: raise SyntaxError("set python frame-filter priority " \ "takes exactly three arguments.") - + object_list = argv[0] name = argv[1] priority = argv[2] @@ -339,7 +339,7 @@ class SetFrameFilterPriority (gdb.Command): def _set_filter_priority_1 (self, frame_filters, name, priority): """Worker for setting priority of frame_filters. - + Arguments: frame_filters: list of frame_filters. diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index bb4d4a0..330aee7 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -211,7 +211,7 @@ py_print_args (PyObject *filter, /* Frame arguments. */ annotate_frame_args (); ui_out_text (out, " ("); - + if (PyObject_HasAttrString (filter, "frame_args")) { PyObject *result; @@ -348,7 +348,7 @@ eq_printed_frame_entry (const void *a, const void *b) { const struct frame_info *ea = a; const struct frame_info *eb = b; - + return ea == eb; } @@ -393,12 +393,12 @@ py_print_frame (PyObject *filter, _("'inferior_frame' API must be implemented.")); goto error; } - + /* Elided frames are also printed with this function (recursively) and are printed with indention. */ if (indent > 0) ui_out_spaces (out, indent); - + /* The address is required for frame annotations, and also for address printing. */ if (PyObject_HasAttrString (filter, "address")) @@ -416,7 +416,7 @@ py_print_frame (PyObject *filter, else goto error; } - + /* Print frame level. */ if (print_level) { @@ -424,9 +424,9 @@ py_print_frame (PyObject *filter, int level; slot = (struct frame_info **) htab_find_slot (levels_printed, - frame, INSERT); + frame, INSERT); level = frame_relative_level (frame); - + /* Check if this frame has already been printed (there are cases where elided synthetic dummy-frames have to 'borrow' the frame architecture from the eliding frame. If that is the case, do @@ -439,15 +439,15 @@ py_print_frame (PyObject *filter, } else { - *slot = frame; + *slot = frame; annotate_frame_begin (print_level ? level : 0, - gdbarch, address); + gdbarch, address); ui_out_text (out, "#"); ui_out_field_fmt_int (out, 2, ui_left, "level", level); } } - + /* Print address to the address field. If no is provided address, printing nothing. */ if (opts.addressprint && has_addr) @@ -456,14 +456,14 @@ py_print_frame (PyObject *filter, ui_out_field_core_addr (out, "addr", gdbarch, address); annotate_frame_address_end (); } - + ui_out_text (out, " in "); /* Print frame function. */ if (PyObject_HasAttrString (filter, "function")) { PyObject *result = PyObject_CallMethod (filter, "function", NULL); - + if (result) { if (result != Py_None) @@ -476,13 +476,13 @@ py_print_frame (PyObject *filter, Py_DECREF (result); goto error; } - - func = xstrdup (dup); + + func = xstrdup (dup); annotate_frame_function_name (); ui_out_field_string (out, "func", func); xfree (func); - - } + + } Py_DECREF (result); } else @@ -495,7 +495,7 @@ py_print_frame (PyObject *filter, if (! py_print_args (filter, out, opts, print_args_type)) goto error; } - + annotate_frame_source_begin (); if (PyObject_HasAttrString (filter, "filename")) @@ -508,13 +508,13 @@ py_print_frame (PyObject *filter, { char *filename = NULL; char *dup = PyString_AsString (result); - + if (! dup) { Py_DECREF (result); goto error; } - + filename = xstrdup (dup); ui_out_wrap_hint (out, " "); ui_out_text (out, " at "); @@ -557,14 +557,14 @@ py_print_frame (PyObject *filter, annotate_frame_end (); ui_out_text (out, "\n"); } - + if (print_locals) { int success = py_print_locals (filter, opts); if (success == 0 && PyErr_Occurred ()) - goto error; + goto error; } - + /* Finally recursively print elided frames, if any. */ if (PyObject_HasAttrString (filter, "elided")) { @@ -615,7 +615,7 @@ py_print_frame (PyObject *filter, do_cleanups (cleanup_stack); } - } + } } return PY_BT_COMPLETED; @@ -646,7 +646,7 @@ apply_frame_filter (struct frame_info *frame, int print_level, module = PyImport_ImportModule ("gdb.command.frame_filters"); if (! module) goto done; - + frame_obj = frame_info_to_frame_object (frame); if (! frame_obj) goto done; @@ -658,15 +658,15 @@ apply_frame_filter (struct frame_info *frame, int print_level, Py_DECREF (frame_obj); goto done; } - + iterable = PyObject_CallFunctionObjArgs (sort_func, frame_obj, NULL); Py_DECREF (module); Py_DECREF (sort_func); Py_DECREF (frame_obj); - + if (!iterable) goto done; - + if (iterable == Py_None) { Py_DECREF (iterable); @@ -683,12 +683,11 @@ apply_frame_filter (struct frame_info *frame, int print_level, PyObject *iterator = PyObject_GetIter (iterable); PyObject *item; htab_t levels_printed; - - + if (iterator == NULL) goto done; - - levels_printed = htab_create (20, + + levels_printed = htab_create (20, hash_printed_frame_entry, eq_printed_frame_entry, NULL); @@ -697,7 +696,7 @@ apply_frame_filter (struct frame_info *frame, int print_level, { success = py_print_frame (item, print_level, print_what, print_args, print_args_type, - print_locals, out, opts, 0, + print_locals, out, opts, 0, levels_printed); if (success == PY_BT_ERROR && PyErr_Occurred ()) { diff --git a/gdb/stack.c b/gdb/stack.c index 4240817..48dd421 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1651,7 +1651,7 @@ frame_info (char *addr_exp, int from_tty) frames. */ static void -backtrace_command_1 (char *count_exp, int show_locals, int raw, +backtrace_command_1 (char *count_exp, int show_locals, int raw, int from_tty) { @@ -1721,12 +1721,12 @@ backtrace_command_1 (char *count_exp, int show_locals, int raw, find_pc_sect_symtab_via_partial (pc, find_pc_mapped_section (pc)); } } - + if (! raw) result = apply_frame_filter (trailing, 1, LOCATION, 1, print_frame_arguments, current_uiout, show_locals, count); - + /* Run the inbuilt backtrace if there are no filters registered, or if there was an error in the Python backtracing output. */ if (raw || result == PY_BT_ERROR || result == PY_BT_NO_FILTERS) @@ -1800,7 +1800,7 @@ backtrace_command (char *arg, int from_tty) for (j = 0; j < strlen (argv[i]); j++) argv[i][j] = tolower (argv[i][j]); - + if (raw_arg < 0 && subset_compare (argv[i], "raw")) raw_arg = argc; else diff --git a/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in b/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in index dc3d2f9..547673a 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in +++ b/gdb/testsuite/gdb.python/py-framefilter-gdb.py.in @@ -44,4 +44,3 @@ class FrameObjFile2 (): FrameObjFile() FrameObjFile2() - diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.c b/gdb/testsuite/gdb.python/py-framefilter-mi.c index 25a8a6e..931ae42 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-mi.c +++ b/gdb/testsuite/gdb.python/py-framefilter-mi.c @@ -66,8 +66,7 @@ void func1(void) } int func2(void) -{ - +{ func1(); return 1; } @@ -91,11 +90,11 @@ int func5(int f, int d) int i = 0; char *random = "random"; i=i+f; - + func4(i); return i; } - + main() { func5(3,5); diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite/gdb.python/py-framefilter-mi.exp index f6e3444..d1b7f82 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp +++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp @@ -65,4 +65,3 @@ mi_gdb_test "-stack-list-frames 22 24" \ remote_file host delete ${remote_python_file} - diff --git a/gdb/testsuite/gdb.python/py-framefilter.c b/gdb/testsuite/gdb.python/py-framefilter.c index 25a8a6e..931ae42 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.c +++ b/gdb/testsuite/gdb.python/py-framefilter.c @@ -66,8 +66,7 @@ void func1(void) } int func2(void) -{ - +{ func1(); return 1; } @@ -91,11 +90,11 @@ int func5(int f, int d) int i = 0; char *random = "random"; i=i+f; - + func4(i); return i; } - + main() { func5(3,5); diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp index c845ebe..44db502 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.exp +++ b/gdb/testsuite/gdb.python/py-framefilter.exp @@ -82,4 +82,3 @@ gdb_test "bt 3" \ {.*#0.*end_func.*#1.*in funca ().*#2.*in funcb ().*} remote_file host delete ${remote_python_file} - diff --git a/gdb/testsuite/gdb.python/py-framefilter.py b/gdb/testsuite/gdb.python/py-framefilter.py index 44aa7e1..d44cb84 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.py +++ b/gdb/testsuite/gdb.python/py-framefilter.py @@ -25,7 +25,7 @@ class Reverse_Function (BaseFrameWrapper): def __init__(self, fobj): super(Reverse_Function, self).__init__(fobj) self.fobj = fobj - + def function (self): fname = str (self.fobj.function()) if (fname == None or fname == ""): @@ -60,7 +60,7 @@ class Dummy (BaseFrameWrapper): def elided (self): return None - + class FrameFilter (): def __init__ (self): @@ -102,7 +102,6 @@ class ElidingIterator: # "sentinel". elided = next(self.input_iterator) return ElidingFrameWrapper(frame, [elided]) - class FrameElider (): hooks/post-receive -- Repository for Project Archer.