Bug 12119 - push_frame_filter doesn't close over frame_filter, which will lead to infinite recursion with multiple filters
Summary: push_frame_filter doesn't close over frame_filter, which will lead to infinit...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: archer
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-13 20:12 UTC by Mark Florisson
Modified: 2011-01-07 20:30 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Florisson 2010-10-13 20:12:34 UTC
When installing multiple backtrace filters (gdb/python/lib/gdb/backtrace.py:push_frame_filter), filtering will lead to infinite recursion because 'frame_filter' is global and not part of the closure.
Comment 1 Tom Tromey 2011-01-06 21:26:59 UTC
Could you try this and verify that it works?

@@ -32,7 +32,7 @@ an iterator returning such objects."""
     if frame_filter == None:
         frame_filter = constructor
     else:
-        frame_filter = lambda iterator: constructor (frame_filter (iterator))
+        frame_filter = lambda iterator, filter = frame_filter: constructor (filter (iterator))
 
 def create_frame_filter (iter):
     global frame_filter


Note also that we are going to rewrite this code.
It has some design flaws as-is.
We'll be sure to send a note to the Archer list when this gets underway.
Comment 2 Tom Tromey 2011-01-07 20:30:53 UTC
I checked this in on archer-tromey-python.