Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to set a breakpoint in VS for Mac for "set a breakpoint in malloc_error_break to debug" crashes?

$
0
0

Hi there,

I'm trying to convert a native cocoa app to Xamarin.Mac.

I'm getting a crash at one point and the stacktrace includes this message "set a breakpoint in malloc_error_break to debug"

Is there any way to do this in Visual Studio for Mac?

Here's a portion of the stacktrace

Chat(21463,0x7fffa1e0d340) malloc: *** error for object 0x111d3f1d0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Foundation.NSObject.xamarin_release_managed_ref (intptr,Foundation.NSObject) [0x00008] in <044825bde4b4485bae4832110feb8d50>:0
  at Foundation.NSObject.ReleaseManagedRef () [0x00008] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/Foundation/NSObject2.cs:208
  at Foundation.NSObject/NSObject_Disposer.Drain (Foundation.NSObject) [0x00067] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/Foundation/NSObject2.cs:784
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x00051] in <044825bde4b4485bae4832110feb8d50>:0
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain (int,string[]) [0x0005a] in <044825bde4b4485bae4832110feb8d50>:0
  at AppKit.NSApplication.Main (string[]) [0x00041] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/AppKit/NSApplication.cs:100
  at Chat.MainClass.Main (string[]) [0x00007] in /Users/troy.chard/Xamarin-macOS/Chat/Main.cs:10
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x00051] in <f963aa642d2b41aea1fcc0fa68747c44>:0

Native stacktrace:

    0   Chat                                0x000000010bb68fe1 mono_handle_native_crash + 257
    1   libsystem_platform.dylib            0x00007fff68a3ef5a _sigtramp + 26
    2   ???                                 0x0000000000000000 0x0 + 0
    3   libsystem_c.dylib                   0x00007fff6886a30a abort + 127
    4   libsystem_malloc.dylib              0x00007fff68967866 free + 521
    5   Foundation                          0x00007fff43277398 -[NSConcreteData dealloc] + 60
    6   Chat                                0x000000010ba78ec6 xamarin_release_managed_ref + 182
    7   ???                                 0x00000001180ba1c1 0x0 + 4698382785
    8   ???                                 0x00000001180b9f83 0x0 + 4698382211
    9   Chat                                0x000000010bb7a2c8 mono_jit_runtime_invoke + 1288
    10  Chat                                0x000000010bc45048 do_runtime_invoke + 88
    11  Chat                                0x000000010bc44fc0 mono_runtime_invoke + 208
    12  Chat                                0x000000010bd5b31d _ZL32native_to_managed_trampoline_111P11objc_objectP13objc_selectorPP11_MonoMethodP8NSObjectj + 285
    13  Chat                                0x000000010bd5b1f5 +[__NSObject_Disposer drain:] + 53
    14  Foundation                          0x00007fff432ce985 __NSThreadPerformPerform + 334
    15  CoreFoundation                      0x00007fff411f5821 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    16  CoreFoundation                      0x00007fff412af4cc __CFRunLoopDoSource0 + 108
    17  CoreFoundation                      0x00007fff411d82c0 __CFRunLoopDoSources0 + 208
    18  CoreFoundation                      0x00007fff411d773d __CFRunLoopRun + 1293
    19  CoreFoundation                      0x00007fff411d6fa3 CFRunLoopRunSpecific + 483
    20  HIToolbox                           0x00007fff404f6866 RunCurrentEventLoopInMode + 286
    21  HIToolbox                           0x00007fff404f65d6 ReceiveNextEventCommon + 613
    22  HIToolbox                           0x00007fff404f6354 _BlockUntilNextEventMatchingListInModeWithFilter + 64
    23  AppKit                              0x00007fff3e7f3a23 _DPSNextEvent + 2085
    24  AppKit                              0x00007fff3ef88e6c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
    25  AppKit                              0x00007fff3e7e8831 -[NSApplication run] + 764
    26  AppKit                              0x00007fff3e7b79d2 NSApplicationMain + 804
    27  ???                                 0x0000000111c859c8 0x0 + 4593310152
    28  ???                                 0x000000010df28043 0x0 + 4528963651
    29  Chat                                0x000000010bb7a2c8 mono_jit_runtime_invoke + 1288
    30  Chat                                0x000000010bc45048 do_runtime_invoke + 88
    31  Chat                                0x000000010bc48689 do_exec_main_checked + 137
    32  Chat                                0x000000010badfeff mono_jit_exec + 287
    33  Chat                                0x000000010bae278b mono_main + 9307
    34  Chat                                0x000000010ba83a3e xamarin_main + 1182
    35  Chat                                0x000000010ba84994 main + 36
    36  libdyld.dylib                       0x00007fff687be145 start + 1

Debug info from gdb:


(lldb) command source -s 0 '/tmp/mono-gdb-commands.Owb0tu'
Executing commands in '/tmp/mono-gdb-commands.Owb0tu'.
(lldb) process attach --pid 21463
Process 21463 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff6890e67a libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x7fff6890e67a <+10>: jae    0x7fff6890e684            ; <+20>
    0x7fff6890e67c <+12>: movq   %rax, %rdi
    0x7fff6890e67f <+15>: jmp    0x7fff68905791            ; cerror
    0x7fff6890e684 <+20>: retq
Target 0: (Chat) stopped.

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>