From 3b08e5fa15587418e2fa83a94ce0f04efc699899 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 1 Dec 2008 12:50:11 -0500 Subject: [PATCH] Get the source code from the debugger engine in [GDBpConnection(Private) createStackFrame] * Source/GDBpConnection.m: (createStackFrame): Use the source GDBp command to get the source code for the stack frame --- Source/GDBpConnection.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/GDBpConnection.m b/Source/GDBpConnection.m index 408a529..0d43d79 100644 --- a/Source/GDBpConnection.m +++ b/Source/GDBpConnection.m @@ -299,6 +299,7 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; // get the stack frame [socket send:[self createCommand:@"stack_get -d 0"]]; NSXMLDocument *doc = [self processData:[socket receive]]; + NSXMLElement *xmlframe = [[[doc rootElement] children] objectAtIndex:0]; // get the names of all the contexts [socket send:[self createCommand:@"context_names -d 0"]]; @@ -316,11 +317,16 @@ NSString *kErrorOccurredNotif = @"GDBpConnection_ErrorOccured_Notification"; [contexts setObject:variables forKey:name]; } - NSXMLElement *xmlframe = [[[doc rootElement] children] objectAtIndex:0]; + // get the source + NSString *filename = [[xmlframe attributeForName:@"filename"] stringValue]; + [socket send:[self createCommand:[NSString stringWithFormat:@"source -f %@", filename]]]; + NSString *source = [[[self processData:[socket receive]] rootElement] value]; // decode base64 + + // create stack frame StackFrame *frame = [[StackFrame alloc] initWithIndex:0 - withFilename:[[xmlframe attributeForName:@"filename"] stringValue] - withSource:nil + withFilename:filename + withSource:source atLine:[[[xmlframe attributeForName:@"lineno"] stringValue] intValue] inFunction:[[xmlframe attributeForName:@"where"] stringValue] withContexts:contexts -- 2.22.5