Guest User

GDB throws cryptic error when invoked from NSTask

a guest
Apr 2nd, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. NSMutableString *resultStringID = [NSMutableString stringWithCapacity:processSelected.length];
  2.  
  3. NSScanner *scanner = [NSScanner scannerWithString:processSelected];
  4. //define the allowed characters, here only all numbers are allowed
  5. NSCharacterSet *allowedChars = [NSCharacterSet characterSetWithCharactersInString:@"1234567890"];
  6.  
  7. while ([scanner isAtEnd] == NO) {
  8. NSString *buffer;
  9. if ([scanner scanCharactersFromSet:allowedChars intoString:&buffer]) {
  10. [resultStringID appendString:buffer];
  11. } else {
  12. [scanner setScanLocation:([scanner scanLocation] + 1)];
  13. }
  14. }
  15.  
  16. //Trim off the last 3 characters if the string is larger than 4 characters long
  17. if ( [resultStringID length] > 4 )
  18. resultStringID = [resultStringID substringToIndex:[resultStringID length] - 3];
  19.  
  20.  
  21. NSInteger pid1 = [resultStringID intValue];
  22.  
  23. //NSLog(@"pid 1 is :%@", pid1);
  24.  
  25. NSTask *task = [[NSTask alloc] init];
  26. [task setLaunchPath: @"/usr/bin/gdb"];
  27.  
  28. NSString * abc = @"abc";
  29.  
  30.  
  31.  
  32. //NSLog(@"Process with extension %@", fullString);
  33.  
  34. NSArray *arguments;
  35. arguments = [NSArray arrayWithObjects: abc, resultStringID, nil];
  36. [task setArguments: arguments];
  37.  
  38. NSPipe *pipe;
  39. pipe = [NSPipe pipe];
  40. [task setStandardOutput: pipe];
  41.  
  42. NSFileHandle *file;
  43. file = [pipe fileHandleForReading];
  44.  
  45. [task launch];
  46.  
  47. NSData *data;
  48. data = [file readDataToEndOfFile];
  49.  
  50. NSString *string;
  51. string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
  52. NSLog (@"GDB Output:n%@", string);
  53.  
  54. /*
  55. GDBViewController *bController = [[GDBViewController alloc] init];
  56. [self.navigationController pushViewController:bController animated:YES];
  57. [bController release];
  58. */
  59.  
  60. TableViewController_09AppDelegate *appDelegate = (TableViewController_09AppDelegate*)[[UIApplication sharedApplication] delegate];
  61.  
  62.  
  63. [string release];
  64. [task release];
  65.  
  66. RE:Notice: Launching: com.apple.gdb
  67. abc: No such file or directory
  68. //763: No such file or directory
  69. Unable to access task for process-id 763: (os/kern) failure.
  70. 2011-08-24 08:53:06.002 TableViewController_09[764:507] GDB Output:
  71. GNU gdb 6.3.50.20050815-cvs (Fri Mar 18 17:42:37 UTC 2011)
  72. Copyright 2004 Free Software Foundation, Inc.
  73. GDB is free software, covered by the GNU General Public License, and you are
  74. welcome to change it and/or distribute copies of it under certain conditions.
  75. Type "show copying" to see the conditions.
  76. There is absolutely no warranty for GDB. Type "show warranty" for details.
  77. This GDB was configured as "--host=arm-apple-darwin9 --target="...
  78. (gdb) Exception condition detected on fd 0
  79. error detected on stdin
  80.  
  81. 2011-08-24 08:53:06.002 TableViewController_09[764:507] GDB Output:
  82.  
  83. NSLog (@"GDB Output:n%@", string);
Add Comment
Please, Sign In to add comment