Cannot debug my Monotouch application anymore and it gets stuck randomly - xamarin.ios

I'm trying to debug my application and from the point I fire it up on the iPad, it will get killed by timeout before it ever reaches FinishedLaunching() (I have abreakpoint there)! Here' swhat I see in the output panel. All this takes almost 20s.
If I run the app in RELEASE build it randomly gets stuck. I hit a button and the delegate gets caled half a minute later. What is going on? In the Simulator it is all okay.
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/Mono.Security.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/System.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/monotouch.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/System.Xml.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/System.Data.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/System.Transactions.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/Mono.Data.Sqlite.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/System.Web.Services.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/System.Core.dll [External]
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/iMy.dll
Loaded assembly: /private/var/mobile/Applications/C3E70D7B-8C10-49CD-98A7-FCE857899BAA/MyBrowser.app/MyBrowser.exe
Thread started:
Resolved pending breakpoint at 'AppDelegateIPad.cs:110' to Boolean MyBrowser.AppDelegateIPad:FinishedLaunching ():0.

Avoid setting breakpoints in FinishedLaunching. When compiling in Debug mode, the code is always slower. On the simulator it works because:
a. There is no wifi connection between "device" and MonoDevelop
b. The "device" is your computer, so everything runs faster than it would on the actual device.
If it randomly gets stuck in Release mode, I think you have a lot going on in FinishedLaunching that you shouldn't.

Related

Can't debug shared library with gdb

When I attach to process with GDB I saw that warning:
Reading symbols from /CloneFileSystem/lib/ld-uClibc.so.0...
(No debugging symbols found in /CloneFileSystem/lib/ld-uClibc.so.0)
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Even I use set sysroot /CloneFileSystem with all the libraries there, that not help.
My process call to function in shared library and that function call to another function in another shared library.
For example ProcessFunc-> Lib1Func -> Lib2Func
I want to debug Lib2Func but when I run command
b Lib2Func
gdb can't set a breakpoint there event that library is already loaded
file myexe -> interpreter /lib/ld-uClibc.so.0
When I use info sharedlibrary in GDB I can't the value in From and To (address of loaded are empty)
You might want to try recompiling the library with a -g option. It's saying it can't find the debug info. -g provides for debugging info if you are using gcc. This is the first thing i'd check. If the library is big this may take awhile.

How to load seperate debug file e.g. abc.debug file instead of binary to debug in GDB?

"gdb program core.11230"
is the actual format of loading core to gdb. But I don't have 'program' binary. instead I have separate debug file along with core. So I am loading .debug file instead of binary as
"gdb coredump.debug coredump_core.dump"
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/coredump.debug...done.
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffdf0f23000
Core was generated by `./coredump'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000400848 in main ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.0.1.el6.x86_64 libgcc-4.4.7-23.0.1.el6.x86_64
(gdb)
(gdb) list +
1 coredump.cpp: No such file or directory.
in coredump.cpp
(gdb) bt
It won't show me the exact line number and source code file while debugging in GDB. It is not the case with normal debugging with binary and core.
also I don't have source file. I have access only to core dump and separate debug files.
What am I doing wrong. Please some experts suggest?

VS2015 Several projects throwing exceptions before main

I have several projects that were created in VS 2010 but have recently been updated to VS 2015. All of them compile OK, but many of them now throw an exception before reaching main:
'MyApp.exe' (Win32): Loaded 'C:\Users\kloux\Documents\Visual Studio 2010\Projects\BandwidthCruncher\Debug\MyApp.exe'. Symbols loaded.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sysfer.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-timezone-l1-1-0.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l2-1-0.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-localization-l1-2-0.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-processthreads-l1-1-1.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l1-2-0.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'MyApp.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
Exception thrown at 0x74F4C42D in MyApp.exe: Microsoft C++ exception: std::exception at memory location 0x0032F3EC.
Exception thrown at 0x74A17780 (sysfer.dll) in MyApp.exe: 0xC0000005: Access violation reading location 0x00000010.
I can always choose "Continue," in the resulting dialog, and the application seems to run without issue from that point on. These are a mix of GUI applications and console applications. This seems to be limited only to projects that I've imported from VS 2010 - I've never had this occur for applications created in VS 2015.
For one of these projects, I've gone through the process of removing all external libraries and reducing the source to a single file containing only the following:
#include <cstdlib>
int main(int, char**)
{
return 0;
}
I even unchecked the "Inherit from parent or project defaults" button. None of this has any effect - I still continue to get this exception.
If I compile any of these projects with VS 2010, the problem disappears -- until I compile with VS 2015 again. In VS 2015, changing the Platform Toolset has no effect, either.
Any help is appreciated.
Thanks!
EDIT: Incorrectly wrote VS 2005 when it should have read VS 2010
Visual Studio will load sysfer.dll (from Symantec CMC Firewall) when running the program.
From the log you copied here, It looks like sysfer.dll is a problem here.
It is actually a first chance exception.
Disable loading sysfer.dll, use regedit to set the following registry to 4:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SysPlant]
"Start"=dword:00000004
Reboot after changing the regedit.

Mono: "The runtime version supported by this application is unavailable"

When I try to run my VB.NET application on Debian 6 x86 I get this error:
WARNING **: The class System.Collections.Generic.List`1 could not be loaded, used in mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Stacktrace:
Native stacktrace:
mono() [0x80d5b19]
mono() [0x810f7ab]
[0xb774f600]
mono() [0x80620b8]
mono() [0x80637bf]
mono() [0x80645c8]
mono(mono_runtime_invoke+0x40) [0x81cbab0]
mono(mono_runtime_exec_main+0xde) [0x81cf55e]
mono(mono_runtime_run_main+0x112) [0x81cf862]
mono(mono_main+0x15ec) [0x80b3bdc]
mono() [0x805b675]
/lib/libc.so.6(__libc_start_main+0xe6) [0xb74fdc96]
mono() [0x805b5b1]
Debug info from gdb:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Aborted
How can I fix this? It doesn't look like my application is causing it, I was able to run the application on another machine with another distro.
The issue was caused because apt-get was installing older versions of mono. However, Ubuntu 12.10 seems to install a newer version.

GDB - Loading Debug information from external ".sym" files

I am attempting to carry out postmortem analysis of a crashed binary, "TestApp", on a linux system.
I have a copy of the binaries and and shared objects that are copied onto the device in a path:
/usr/public/target
This folder contains all the binaries in question in the directory structure used on the system under test, ie:
/usr/public/target/sbin/TestApp
/usr/public/target/lib/TestAppLib.so
/usr/public/target/usr/lib/TestAppAPILib.so
The automated build process strips the debug information from the binaries, and stores them in external, symbol files, all under:
/usr/public/target_external_symbols
So the symbol information for the above binaries would exist in files named:
/usr/public/target_external_symbols/sbin/TestApp.sym
/usr/public/target_external_symbols/lib/TestAppLib.so.sym
/usr/public/target_external_symbols/usr/lib/TestAppAPILib.so.sym
How do I get GDB to be aware of the existence of these external symbols and to load them?
I typically invoke GDB via:
gdb TestApp TestApp.core
I've referred to other articles on creating a test .gdbinit file and passing it to GDB via the -command argument, but it doesn't appear to work. Every time I attempt to get a backtrace from my core file, I get an indication from GDB that it cannot open the debug symbols. Any help in resolving this is appreciated.
(gdb) info shared
From To Syms Read Shared Object Library
0x78000000 0x780061e8 Yes (*) /usr/public/target/lib/TestAppLib.so
0x78010000 0x7806e60c Yes (*) /usr/public/target/usr/lib/TestAppAPILib.so
0x78070000 0x78091d2c Yes (*) /usr/public/target/lib/libm.so.2
(*): Shared library is missing debugging information.
Thank you.
There are commands set debug-file-directory, symbol-file and add-symbol-file to load debugging symbols from within a gdb session. The latter one might require the address where the shared library was loaded into memory.
Maybe during your build process 'gnu debuglinks' have been added to your binaries. This would mean that in the executables there's a path coded that directs gdb where to look for debug symbols. More can be found here.

Resources