GDB: unable to read symbols - iphone

When trying to run my iOS app on a device, I get the following from GDB, and resulting in my app exiting just right after it started so I never get the chance to debug it. Anyone knows what I'm doing wrong or what I can do to fix it?
GNU gdb 6.3.50-20050815 (Apple version gdb-1470) (Thu May 27 05:54:06 UTC 2010)
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=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys002
sharedlibrary apply-load-rules all
warning: Unable to read symbols from "dyld" (prefix __dyld_) (not yet mapped into memory).
warning: Unable to read symbols for "(null)/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols from "Foundation" (not yet mapped into memory).
warning: Unable to read symbols for "(null)/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).
warning: Unable to read symbols from "AudioToolbox" (not yet mapped into memory).
warning: Unable to read symbols from "libgcc_s.1.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "libSystem.B.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "libobjc.A.dylib" (not yet mapped into memory).
warning: Unable to read symbols from "CoreFoundation" (not yet mapped into memory).
target remote-mobile /tmp/.XcodeGDBRemote-4572-43
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to thread 11523]
[Switching to thread 11523]
gdb stack crawl at point of internal error:
/SourceCache/gdb/gdb-1470/src/gdb/macosx/macosx-nat-dyld.c:1547: internal-error: unrecognized shared library breakpoint
A problem internal to GDB has been detected,
further debugging may prove unreliable.
0 gdb-arm-apple-darwin 0x0013117d internal_vproblem + 316

I have the same problem at the moment, but I believe it is to do with your frameworks.
Maybe try removing them and re-adding them to your project. Sorry I couldn't be more help, if I find a solution I will let you know.
*EDIT
Ignore the whole framework issue, the real problem is your IOS on your development screen. Make sure you have the latest version and that this matches your iphone's IOS.

Related

Eclipse remote debugging arm-linux library

I am running:
Eclipse 3.8.1 (Build id: deb build).
On Ubuntu 16.04 LTS in a VM and UbuntuMATE 16.04 LTS on target Raspberry Pi 3.
gdb-multiarch(architecture set to arm in .gdbinit) locally andgdbserver` on the target.
Cross compilation and remote deployment is successful. However, there appears to be some library issue when I run on the remote target. Output from gdb-multiarch below (superfluous text removed):
GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11 Copyright (C) 2016 Free Software
Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
http://gnu.org/licenses/gpl.html This GDB was configured as
"x86_64-linux-gnu".
Program stopped. 0x76fd7a40 in ?? () from
/home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf/ld-2.23.so
Execution stops at main. However, it doesn't appear to stop due to a breakpoint. The stop appears to be the result of some library issue possibly and unresolved symbol (or something more serious) resulting in the ??.
I have set sysroot in the .gdbinit file to indicate where the shared libraries can be found. The StepIn, StepOut icons are hi-lighted in Eclipse, and I can read ARM registers if I press pause and see which core is being used to run the process (with process ID)!
After further resume & pause operations a segmentation fault occurs:
Program stopped. 0x76fe2e92 in ?? () from
/home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf/ld-2.23.so
Program received signal SIGSEGV, Segmentation fault. 0x76fd905e in ??
() from
/home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf/ld-2.23.so
Program terminated with signal SIGSEGV, Segmentation fault. The
program no longer exists.
Any ideas? (I am very much new to Linux as it probably shows.)
Thanks for the questions which have resulted in further exploration below:
In Eclipse I started GDB by selecting Debug Configuration and then choosing the remote configuration that I had set up.
The code is very simple, consisting of a stream operator to output some text and then a loop, however it is never reached. I think I have just managed to reproduce the issue from the command line. Incidentally I started the target going first. (Again superfluous text was removed for clarity.)
gdb-multiarch Hello_Raspberry_Pi
Reading symbols from Hello_Raspberry_Pi...done.
The target architecture is assumed to be arm
(gdb) target remote ubuntumate-pi
(gdb) target remote 192.168.0.12:2345
Remote debugging using 192.168.0.12:2345
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initialisers
and track explicitly loaded dynamic code.
0x76fd7a40 in ?? ()
(gdb) set architecture arm
The target architecture is assumed to be arm
(gdb) set sysroot /home/fred/raspberrypi/rootfs/lib/arm-linux-gnueabihf
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initialisers
and track explicitly loaded dynamic code.
(gdb)
The target side behaved as would be expected:
fred#UbuntuMATE-Pi:~/Hello_Raspberry_Pi$ gdbserver 192.168.0.7:2345 Hello_Raspberry_Pi
Process Hello_Raspberry_Pi created; pid = 17363
Listening on port 2345
Remote debugging from host 192.168.0.7
So perhaps Unable to find dynamic linker breakpoint function. is a big clue?
It would appear that I had defined Shared Libraries incorrectly. When I deleted this setting something closer to expected behaviour occurred. As shown below, however I there is still a warning that I would like to remove:
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initialisers
and track explicitly loaded dynamic code.
0x76fd7a40 in ?? ()
Breakpoint 2, main () at ../src/Hello_Raspberry_Pi.cpp:18
18 cout << "I'm in the While loop and the value of variable i is: " << i << endl;
Breakpoint 1, main () at ../src/Hello_Raspberry_Pi.cpp:20
20 usleep(1000000); //wait for 1 seconds
So now Eclipse does breakpoint at main and permit stepping - finally!
I also faced problems similar to this, getting segmentation fault from ld.so. Did the following steps to fix it.
Install libc6-dbg package in both sysroot and target.
create a folder /lib/.debug in both sysroot and target.
copy /usr/lib/debug/lib/arm-linux-gnueabihf/ld-2.23.so to /lib/.debug in both sysroot and target.

Error Mapping Shared Libraries with Eclipse CDT and GDB

I'm trying to debug a program using a Ubuntu 12.04 host and an ARM client with Eclipse Kepler, CDT, and GDB. The host is running GDB 7.4 and the client 7.0.1.
In my .gdbinit file I set sysroot /usr/local/arm-none-gnueabi/arm-none-linux-gnueabi/
However, when I try to debug I get the following error:
Warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
The target endianness is set automatically (currently little endian)
Error while mapping shared library sections:
/usr//lib/libstdc++.so.6: No such file or directory.
Error while mapping shared library sections:
/lib/libm.so.6: No such file or directory.
Warning: .dynamic section for "/usr/local/arm-none-linux-gnueabi/arm-none-linux-gnueabi/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)
Error while mapping shared library sections:
/lib/libc.so.6: No such file or directyory.
Error while mapping shared library sections:
/lib/ld-linux.so.3: No such file or directory.
I've searched this problem to death and can't seem to resolve it. Any answers would be most appreciated!

Can't run project anymore

My project used to be called "TextFieldDemo", then I renamed it to "ShiftCipher". I cannot launch the project anymore. This is the message I'm getting. Can so please help?
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 8 20:32:45
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 "x86_64-apple-darwin".sharedlibrary
apply-load-rules all Attaching to process 2285. 2011-10-30
19:35:49.914 ShiftCipher[2285:f803] * Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason: 'Could
not load NIB in bundle: 'NSBundle (loaded)' with name 'TextFieldDemoViewController''
* First throw call stack: (0x14ce052 0x11b9d0a 0x1476a78 0x14769e9 0x585838 0x42ce2c 0x42d3a9 0x42d5cb 0x38da73 0x38e0b8 0x230b 0x3659d6
0x3668a6 0x375743 0x3761f8 0x369aa9 0x1bc4fa9 0x14a21c5 0x1407022
0x140590a 0x1404db4 0x1404ccb 0x3662a7 0x367a9b 0x225d 0x21d5)
terminate called throwing an exceptionCurrent language: auto;
currently objective-c (gdb)
TextFieldDemoViewController is now called ShiftCipherViewController. I don't know why it's looking for it with the old name.
Look in the XIB file that you're attempting to load and see what the "File's Owner" is listed as.
My guess is that it is still set to "TextFieldDemoViewController" instead of "ShiftCipherViewController". That's where you would need to make your change.
You have a nib that use to be named TextFieldDemoViewController.xib. The file was probably renamed to something like ShiftCipherViewController.xib. You are likely still referencing TextFieldDemoViewController in your initWithNibName.

Struggling with Xcode 4

I've recently downloaded Xcode 4 and now two of my projects that were working perfectly fine before have started giving me errors. Both errors are effectively to do with linking options, but I can't figure out how to change these options and get rid of the errors.
The first problem is with a project written in C++ using the SDL_ttf and SDL_image frameworks. The project builds correctly, but when I try to run, it gives me the following warnings on the console:
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf (file not found).
warning: Unable to read symbols from "SDL_ttf" (not yet mapped into memory).
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_image.framework/Versions/A/SDL_image (file not found).
warning: Unable to read symbols from "SDL_image" (not yet mapped into memory).
Since the files are not being found, the executable cannot load any images making it exit straight away when I try to load images. I think the issue here is that the frameworks are not in the directory above the executable, they are in /Library/Framework/ which worked fine before in Xcode 3.2. How do I resolve this?
The second problem comes when compiling an application I wrote for iOS. Along with giving me a bunch of warnings about depracated code on iOS 5, which I will deal with later, it fails to build due to a linker error which I have no clue how to resolve, it says:
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
I can answer the second question.
-lz.1.2.3
should be
-lz
You might have accidentally added the zlib.1.2.3.dylib to the project's "link binary with libraries" build phase. You should use the standard zlib without any version in its filename, or simply add -lz to the Other Linker Flags under Build Settings and not add zlib in the "link binary with libraries" build phase.
As for the missing frameworks my best guess is that it has to do with the relative path, ie if you can get rid of the /../ part and instead provide an absolute path that might resolve the issue.

Unable to read symbols error

I get these errors when I build and run for the device. Should I be worried about them? The app runs fine.
run
Running…
[Switching to thread 10755]
[Switching to thread 10755]
warning: Couldn't raise load state for requested shlib: "libobjc.A.dylib" for breakpoint 1.
(gdb) continue
warning: Unable to read symbols for ""/Users/tim/Code/Cat War/build/Debug-iphoneos"/Tiger War.app/Tiger War" (file not found).
warning: Unable to read symbols for ""/Users/tim/Code/Cat War/build/Debug-iphoneos"/Tiger War.app/Tiger War" (file not found).
You probably turned off debug symbols in the build settings. They should be off for release but they are helpful for debuging.
Hmm. I get this as well, but only when testing on the iPhone or iPod touch. Also, for my Debug Target Config settings, "Generate Debug Symbols" is set. (Not much in the Xcode project was changed in terms of the build settings, and I suspect it wasn't in yours either ... ?)
By any chance do you have an objc_exception_throw breakpoint in play? I have these two in my global breakpoints group:
[NSException raise] (CoreFoundation)
objc_exception_throw (libobjc.A.dylib)
Perhaps there's a correlation?