sirve que para instalar descargar como iphone objective-c gdb nstask

iphone - instalar - jailbreak que es y para que sirve



Extraño comportamiento de GDB una vez que la aplicación se implementa en un iPhone con jailbreak (3)

Descubrí que simplemente mover el ejecutable al directorio / Applications y luego volver a sincronizarlo con el sandbox, también funciona

Estoy tratando de hacer una aplicación que envía comandos a GDB a través de NSTask y dirige la salida a UITextView. Funciona bien en Mac (iOS Simulator). Sin embargo, cuando se implementa en el dispositivo real (iPhone), no muestra ningún registro después del comando "información se registra" El código es como tal:

- (void)viewDidLoad { self.title = @"GDB"; NSLog(@"Pid for GDB execution is :%@", pid); UIBarButtonItem *btnClicked = [[UIBarButtonItem alloc] initWithTitle:@"Commands" style:UIBarButtonItemStyleBordered target:self action:@selector(btnClicked:)]; self.navigationItem.rightBarButtonItem = btnClicked; [btnClicked release]; stringInput = @"info registers"; task = [[NSTask alloc] init]; [task setLaunchPath: @"/usr/bin/gdb"]; arguments; arguments = [NSArray arrayWithObjects:@"abc", pid, nil]; [task setArguments: arguments]; // dataInput = [stringInput dataUsingEncoding:NSUTF8StringEncoding]; outputPipe; outputPipe = [NSPipe pipe]; [task setStandardOutput: outputPipe]; // inputPipe; inputPipe = [NSPipe pipe]; [task setStandardInput:inputPipe]; taskOutput; taskOutput = [outputPipe fileHandleForReading]; // taskInput; taskInput = [inputPipe fileHandleForWriting]; [task launch]; [[[task standardInput] fileHandleForWriting] writeData:dataInput]; close([taskInput fileDescriptor]); dataOutput; dataOutput = [taskOutput readDataToEndOfFile]; NSString *stringOutput; stringOutput = [[NSString alloc] initWithData: dataOutput encoding: NSUTF8StringEncoding]; NSLog (@"GDB Output:/n%@", stringOutput); //NSLog(@"GDB Input:/n@", stringInput); //[string release]; [task release]; [arguments release]; textView = [[UITextView alloc]initWithFrame:CGRectMake(8,17,330,440)]; textView.editable=NO; textView.scrollEnabled=YES; [self.view addSubview:textView]; textView.text = [textView.text stringByAppendingString:stringOutput]; [super viewDidLoad]; }

La salida en el simulador IOS tiene el siguiente aspecto (registros x86)

La salida en el dispositivo real (iPhone) se ve así:

La salida de compilación cuando se ejecuta en el iPhone se ve así:

RE:Notice: Launching: com.apple.gdb abc: No such file or directory //420: No such file or directory Unable to access task for process-id 420: (os/kern) failure. The program has no registers now. 2011-08-29 09:10:05.923 TableViewController_09[421:507] GDB Output: GNU gdb 6.3.50.20050815-cvs (Fri May 20 08:08:42 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=arm-apple-darwin9 --target="... (gdb) (gdb)

Como nota al margen, incluso he tratado de agregar los argumentos -arch armv7 *. Todavía no se puede adjuntar al proceso especificado.

Editar: Pude haber encontrado la fuente de mis problemas. Esto apareció en la consola cuando intenté invocar gdb en mi iPhone a través de la aplicación:

Sep 8 11:13:26 unknown sandboxd[2138] <Notice>: gdb(2137) deny mach-priv-task-port Process: gdb [2137] Path: /usr/bin/gdb Load Address: 0x1000 Identifier: gdb Version: ??? (1.0) Code Type: ARM (Native) Parent Process: TableViewController_09 [2135] Date/Time: 2011-09-08 11:13:25.948 +0800 OS Version: iPhone OS 4.3.3 (8J2) Report Version: 104 Backtrace: 0 libsystem_kernel.dylib 0x36223c8c task_for_pid + 8 1 gdb 0x001e4428 macosx_child_attach + 44 (macosx-nat-inferior.c:1781) 2 gdb 0x00082f18 attach_command + 116 (infcmd.c:3089) 3 gdb 0x000a3788 catch_command_errors + 100 (exceptions.c:540) 4 gdb 0x000a53e4 captured_main + 2632 (main.c:888) 5 gdb 0x000a3838 catch_errors + 104 (exceptions.c:525) 6 gdb 0x000a4988 gdb_main + 56 (main.c:1033) 7 gdb 0x0000224c main + 40 (gdb.c:36) 8 gdb 0x0000217c _start + 312 9 gdb 0x00002018 start + 24 10 gdb 0x001e3dac macosx_lookup_task + 1596 (macosx-nat-inferior.c:1522) Binary Images: 0x1000 - 0x2fbf5b +gdb arm /usr/bin/gdb 0x36214000 - 0x3622bfff libsystem_kernel.dylib armv7 <a06ec84e53bf32098b63c0caebdb45b6> /usr/lib/system/libsystem_kernel.dylib

Si alguien sabe cómo evitar este problema, por favor, comparta. He estado buscando una solución por semanas en vano ...


Finalmente encontró una forma de evitarlo. Todo lo que tenía que hacer era instalar mi aplicación en la carpeta / Application en mi iPhone y configurarla. De esta forma, se ejecutaría con privilegios de administrador y, por lo tanto, se le permitiría ejecutar fuera de las limitaciones de espacio aislado de Apple.


No puede ejecutar gdb en el dispositivo a menos que haga un jailbreak en su dispositivo.