From 8968e1f0a6922d9602d29cdc1337a8f37608cd4c Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 4 Aug 2007 00:08:38 -0700 Subject: [PATCH] Implementing a buggy stack trace viewer. * Source/DebuggerConnection.m: ([DebuggerConnection _stackReceived:]): New method, that is probably leaky, that gets all the attributes for a stack trace and dictionary-izes and array-izes them * Source/DebuggerWindowController.m|h: Added a _stack ivar and then an appropriate setter ([DebuggerWindowController setStack:]): New method * English.lproj/Debugger.nib: Adding a binding to _stack to display the stacktrace --- English.lproj/Debugger.nib/keyedobjects.nib | Bin 11965 -> 13530 bytes Source/DebuggerConnection.m | 16 +++++++++++++++- Source/DebuggerWindowController.h | 3 +++ Source/DebuggerWindowController.m | 14 ++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/English.lproj/Debugger.nib/keyedobjects.nib b/English.lproj/Debugger.nib/keyedobjects.nib index ae4517560d598964227a94c7e1ce3e4ad16e61d6..9857d6a1ba852b695f147bd8e844fb6b2d38526b 100644 GIT binary patch delta 7070 zcmaJ_34Bb~_kZu*`(|I>EN}KbGxO$+h(rWM5o@Ew5?eJD5mQ1ICW#1T?%0YdWvIPK z>aYL*f8OUUcl(}m@A;l{&)gqBIFb8VE}1l?|G`iP zst47J%BFItTq;Nnp~|QbHIAA@O{S(%)2TVsJn9Q-33-=VO0CAvuc)u7_0$IHXKDv^ zm^wyXrT(DqQctOu)L(!C0w4ksU?j#9OMnY-zz1rA1ds&YB9;&rKm+hLXbMt6GtdgO z25mt*&>nOTk$1s+AR9k>gB;Kw3;;!-7z_r(!3Z!Gd<@2e&%hKg3(N*{K?PU@D#1#y z8f*aHfK6aC_zC4Hn0Qi0l$ND;5@htu7exkF1QCCgD2oQcm)Y4ffne3anKDt zkb^u-fVE&EOoDY_s3B|w--eB0OV|pwhUu_9>;QA&05}@XC40iJ;d;0MegnUS-@)%; z4fq4xh--f&9>7iH2DlmDKT+4LMh{`4T`(d(Xn3RS|8F~;V zC1J8wn3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H&54~e zoU@$oIp23Kb*^-lJJ&j^oEx1r&RXXdXT9^7^Mv!H^OQ4q-$lEiOW{(vG%k;;nX9F% zgR7UTudBZ+$(8IH>>A>F)0OVZbrrcvT(ewduGOv@*LK%_*GbnU*LBw)Zs^v#oo=_= z>u%+=txXx&P_0dh8yj z#~t)|JU)-$>FCM!Y44C?^)=n@zi>@c(!@!Jlj1xJ!id2uiC5i zGG2q1^_sn$*W+#GjrR8P_VFfq`+56&lf18c$9q?K*LW+umELvU4c?938t)G80q;TY zb?*)DE$?mb9q&DFqYwFB@pbYAyZE~KdiWB2y?lLq{d_6DR9~L2z*p!i@)i50`lk7o z`F8qt`}X?2^d0aW^d0tn}LPVWUtZ)Cv29dqSgdUw9xq6dnn`3x5cYg(t#O z;h9K@Kt!TaREt`X5e*_MnnjoB7n_SIVyZY)944lTBgD7G(c)NfocOLdUd$A;#7SZ> zSIieDi&Mm6ajG~?oFi@(>%{HiPI0%mSNu{uARZJCi}m6$@q~C%JSCnH8^rVC-^5Ge z74e#QTVf@%#7S1kE;%K)-aiPD|fPcci=0kJ2OQH|g)vGr67oviyqNN$w(dlY7Vsaxb}$oGAB` z2gn2EL2|M@SRNw3DZeETmq*H@5!8!!i40e8R~hzdjpS_Ik#;sfmi-2y$S$Pa*~E2?a|{;Lio F{|_N+pCbSO diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index f96164a..6f2db2e 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -202,7 +202,21 @@ */ - (void)_stackReceived: (NSString *)packet { - NSLog(@"stacktrace = %@", packet); + NSXMLDocument *doc = [[NSXMLDocument alloc] initWithXMLString: packet options: NSXMLDocumentTidyXML error: nil]; + NSArray *children = [[doc rootElement] children]; + NSMutableArray *stack = [NSMutableArray array]; + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + for (int i = 0; i < [children count]; i++) + { + NSArray *attrs = [[children objectAtIndex: i] attributes]; + for (int j = 0; j < [attrs count]; j++) + { + [dict setValue: [[attrs objectAtIndex: j] stringValue] forKey: [[attrs objectAtIndex: j] name]]; + } + [stack addObject: dict]; + dict = [NSMutableDictionary dictionary]; + } + [_windowController setStack: stack]; } /** diff --git a/Source/DebuggerWindowController.h b/Source/DebuggerWindowController.h index f982cb4..dfc08c0 100644 --- a/Source/DebuggerWindowController.h +++ b/Source/DebuggerWindowController.h @@ -22,6 +22,8 @@ { DebuggerConnection *_connection; + NSArray *_stack; + IBOutlet NSTextField *_status; IBOutlet NSTextField *_error; } @@ -30,6 +32,7 @@ - (void)setStatus: (NSString *)status; - (void)setError: (NSString *)error; +- (void)setStack: (NSArray *)node; - (IBAction)run: (id)sender; - (IBAction)stepIn: (id)sender; diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 7972066..7034b64 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -61,6 +61,20 @@ [_error setHidden: NO]; } +/** + * Sets the root node element of the stacktrace + */ +- (void)setStack: (NSArray *)stack +{ + if (_stack != nil) + { + [_stack release]; + } + + _stack = stack; + [_stack retain]; +} + /** * Forwards the message to run script execution to the connection */ -- 2.43.5