Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Visual Studio fails to debug IL2CPP code

Discussion in 'Android' started by AndersModen, Mar 10, 2020.

  1. AndersModen

    AndersModen

    Joined:
    Nov 19, 2019
    Posts:
    51
    In smaller projects we can debug IL2CPP 64 bits code. We attach a debugger and waits for the application input. The debugger finds the symbols and you can see that it swiftly enables all breakpoints. In Unity 2019.3.1f1


    In a larger application, the attachment of the debugger takes a lot longer time before the breakpoints are shown as active and if I let the application continue, the breakpoints are never hit.

    This is caused by a third thread that is blocking before our code has started executing. We can see out breakpoint is set in one thread but another thread is active and taking all focus so we ca not start the application.

    Anyone seen this ? We do have some shaders that fails to compile but in normal run the application starts and runs just fine.
     
    Last edited: Mar 10, 2020
  2. AndersModen

    AndersModen

    Joined:
    Nov 19, 2019
    Posts:
    51
    If i release the debugger, the application continues and runs the application just fine


    This is the output of LogCat before debugger attached..


    03-10 11:00:14.440: D/Unity(12882): CommandLine:
    03-10 11:00:14.451: I/Unity(12882): onResume
    03-10 11:00:14.468: D/Unity(12882): SetWindow 0 0x7c1ebcf010
    03-10 11:00:14.468: D/Unity(12882): SetWindow 0 0x7c1ebcf010
    03-10 11:00:14.482: I/Unity(12882): windowFocusChanged: true
    03-10 11:00:14.493: D/Unity(12882): Enabling Unity systrace
    03-10 11:00:14.500: D/Unity(12882): [VFS] Mount /data/app/com.SaabAB.Streaming_Map_Demo-onE5FyJwK-89lWjBEd58tA==/base.apk
    03-10 11:00:14.505: I/Unity(12882): SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 8, Memory = 5466mb
    03-10 11:00:14.505: I/Unity(12882): SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf0), 4 little (mask: 0xf)
    03-10 11:00:14.506: I/Unity(12882): ApplicationInfo com.SaabAB.Streaming_Map_Demo version 0.1 build 976ad2ad-42b4-4a49-9724-f4ab79607c19
    03-10 11:00:14.506: I/Unity(12882): Built from '2019.3/staging' branch, Version '2019.3.1f1 (89d6087839c2)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a', Stripping 'Enabled'
    03-10 11:00:14.508: D/Unity(12882): Script Patching: Patch files are not available, '/storage/emulated/0/Android/data/com.SaabAB.Streaming_Map_Demo/cache/ScriptOnly/2019.3.1f1/il2cpp/patch.config' is missing.
    03-10 11:00:14.513: D/Unity(12882): Same Unity build, not extracting il2cpp resources.
    03-10 11:00:14.513: D/Unity(12882): PlayerConnection initialized from /data/app/com.SaabAB.Streaming_Map_Demo-onE5FyJwK-89lWjBEd58tA==/base.apk/assets/bin/Data (debug = 0)
    03-10 11:00:14.514: D/Unity(12882): PlayerConnection initialized network socket : 0.0.0.0 55132
    03-10 11:00:14.514: D/Unity(12882): PlayerConnection initialized unix socket : Unity-com.SaabAB.Streaming_Map_Demo
    03-10 11:00:14.514: D/Unity(12882): Multi-casting "[IP] 192.168.137.72 [Port] 55132 [Flags] 3 [Guid] 2539336160 [EditorId] 3940265114 [Version] 1048832 [Id] AndroidPlayer(Google_Pixel_4_XL@192.168.137.72) [Debug] 1 [PackageName] AndroidPlayer [ProjectName] Streaming_Map_Demo" to [225.0.0.222:54997]...
    03-10 11:00:14.514: D/Unity(12882): Waiting for connection from host on [0.0.0.0:55132]...
    03-10 11:00:15.526: D/Unity(12882): Remaining time:8s
    03-10 11:00:16.549: D/Unity(12882): Remaining time:7s
    03-10 11:00:17.572: D/Unity(12882): Remaining time:6s
    03-10 11:00:18.596: D/Unity(12882): Remaining time:5s
    03-10 11:00:19.617: D/Unity(12882): Remaining time:4s
    03-10 11:00:20.638: D/Unity(12882): Remaining time:3s
    03-10 11:00:21.660: D/Unity(12882): Remaining time:2s
    03-10 11:00:22.684: D/Unity(12882): Remaining time:1s
    03-10 11:00:23.708: D/Unity(12882): Remaining time:0s
    03-10 11:00:24.528: D/Unity(12882): Timed out. Continuing without host connection.
    03-10 11:00:24.528: D/Unity(12882): Started listening to [0.0.0.0:55132]
    03-10 11:00:24.528: D/Unity(12882): Starting managed debugger on port 56160
    03-10 11:00:24.669: D/Unity(12882): [EGL] Attaching window :0x7c1ebcf010
    03-10 11:00:24.669: D/Unity(12882): InitializeScriptEngine OK (0x7c1f775fc0)
    03-10 11:00:24.670: D/Unity(12882): PlayerConnection already initialized - listening to [0.0.0.0:55132]
    03-10 11:00:24.687: D/Unity(12882): PlayerInitEngineNoGraphics OK
    03-10 11:00:24.687: D/Unity(12882): AndroidGraphics::Startup window = 0x7c1ebcf010
    03-10 11:00:24.687: D/Unity(12882): [EGL] Attaching window :0x7c1ebcf010
    03-10 11:00:24.697: D/Unity(12882): [EGL] Request: ES 3.2 RGB0 000 0/0
    03-10 11:00:24.698: D/Unity(12882): [EGL] Checking ES 3.2 support...
    03-10 11:00:24.699: D/Unity(12882): [EGL] ES 3.2 support detected
    03-10 11:00:24.699: D/Unity(12882): [EGL] Found: ID[1] ES 3.2 RGB16 565 0/0
    03-10 11:00:24.699: D/Unity(12882): GfxDevice: creating device client; threaded=1
    03-10 11:00:24.699: D/Unity(12882): [EGL] Request: ES 3.2 RGB0 000 0/0
    03-10 11:00:24.699: D/Unity(12882): [EGL] Found: ID[1] ES 3.2 RGB16 565 0/0
    03-10 11:00:24.699: D/Unity(12882): [EGL] Request: ES 3.0 RGBA32 8888 0/0
    03-10 11:00:24.700: D/Unity(12882): [EGL] Found: ID[9] ES 3.0 RGBA32 8888 0/0
    03-10 11:00:24.702: D/Unity(12882): ANativeWindow: (1440/3040) RequestedResolution: (0/0) RenderingResolution: (0/0) EGLSurface: (1440/3040)
    03-10 11:00:24.704: D/Unity(12882): Renderer: Adreno (TM) 640
    03-10 11:00:24.704: D/Unity(12882): Vendor: Qualcomm
    03-10 11:00:24.704: D/Unity(12882): Version: OpenGL ES 3.2 V@384.0 (GIT@9b214d0, Ibc75db1fca) (Date:06/30/19)
    03-10 11:00:24.704: D/Unity(12882): GLES: 3
    03-10 11:00:24.704: D/Unity(12882): GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_half_float GL_OES_framebuffer_object GL_OES_rgb8_rgba8 GL_OES_compressed_ETC1_RGB8_texture GL_AMD_compressed_ATC_texture GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_OES_texture_compression_astc GL_OES_texture_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_read_format_bgra GL_OES_texture_3D GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_QCOM_alpha_test GL_OES_depth24 GL_OES_packed_depth_stencil GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_EXT_sRGB GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_EXT_texture_type_2_10_10_10_REV GL_EXT_texture_sRGB_decode GL_EXT_texture_format_sRGB_override GL_OES_element_index_uint GL_EXT_copy_image GL_EXT_geometry_shader GL_EXT_tessellation_shader GL_OES_texture_stencil8 GL_EXT_shader_io_blocks GL_OES_shader_image_atomic GL_OES_sample_variables GL_EXT_texture_b
    03-10 11:00:24.704: D/Unity(12882): order_clamp GL_EXT_EGL_image_external_wrap_modes GL_EXT_multisampled_render_to_texture GL_EXT_multisampled_render_to_texture2 GL_OES_shader_multisample_interpolation GL_EXT_texture_cube_map_array GL_EXT_draw_buffers_indexed GL_EXT_gpu_shader5 GL_EXT_robustness GL_EXT_texture_buffer GL_EXT_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_OES_texture_storage_multisample_2d_array GL_OES_sample_shading GL_OES_get_program_binary GL_EXT_debug_label GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_QCOM_tiled_rendering GL_ANDROID_extension_pack_es31a GL_EXT_primitive_bounding_box GL_OES_standard_derivatives GL_OES_vertex_array_object GL_EXT_disjoint_timer_query GL_KHR_debug GL_EXT_YUV_target GL_EXT_sRGB_write_control GL_EXT_texture_norm16 GL_EXT_discard_framebuffer GL_OES_surfaceless_context GL_OVR_multiview GL_OVR_multiview2 GL_EXT_texture_sRGB_R8 GL_KHR_no_error GL_EXT_debug_marker GL_OES_EGL_image_external_essl3 GL_OVR_multiview_multisampled_render_to_texture GL_E
    03-10 11:00:24.704: D/Unity(12882): XT_buffer_storage GL_EXT_external_buffer GL_EXT_blit_framebuffer_params GL_EXT_clip_cull_distance GL_EXT_protected_textures GL_EXT_shader_non_constant_global_initializers GL_QCOM_texture_foveated GL_QCOM_texture_foveated_subsampled_layout GL_QCOM_shader_framebuffer_fetch_noncoherent GL_QCOM_shader_framebuffer_fetch_rate GL_EXT_memory_object GL_EXT_memory_object_fd GL_EXT_EGL_image_array GL_NV_shader_noperspective_interpolation GL_KHR_robust_buffer_access_behavior GL_EXT_EGL_image_storage GL_EXT_blend_func_extended GL_EXT_clip_control GL_OES_texture_view GL_EXT_fragment_invocation_density GL_QCOM_validate_shader_binary
    03-10 11:00:24.705: D/Unity(12882): OPENGL LOG: Creating OpenGL ES 3.2 graphics device ; Context level <OpenGL ES 3.2> ; Context handle -742469632
    03-10 11:00:24.705: D/Unity(12882): [EGL] Attaching window :0x7c1ebcf010
    03-10 11:00:24.706: D/Unity(12882): Requested framebuffer: resolution[1440x3040], rgba[8/8/8/8], depth+stencil[on], samples[1]
    03-10 11:00:24.706: D/Unity(12882): Created framebuffer: resolution[1440x3040], rgba[8/8/8/8], depth+stencil[24/8], samples[0]
    03-10 11:00:24.706: D/Unity(12882): [EGL] Attaching window :0x7c1ebcf010
    03-10 11:00:24.706: D/Unity(12882): Initialize engine version: 2019.3.1f1 (89d6087839c2)
    03-10 11:00:24.766: I/Unity(12882): windowFocusChanged: false

    Ant this is the output after the debugger is attached and wait for debug is released


    03-10 11:04:53.133: I/Unity(12882): windowFocusChanged: true
    03-10 11:04:53.159: D/Unity(12882): PlayerInitEngineGraphics OK
    03-10 11:04:53.161: D/Unity(12882): Found 35 native sensors
    03-10 11:04:53.173: D/Unity(12882): Sensor : Accelerometer ( 1) ; 0.004786 / 0.00s ; LSM6DSR Accelerometer / STMicro
    03-10 11:04:53.174: D/Unity(12882): Sensor : Accelerometer ( 1) ; 0.004786 / 0.00s ; LSM6DSR Accelerometer / STMicro
    03-10 11:04:53.204: D/Unity(12882): SetWindow 0 0x7c1ebcf010
    03-10 11:04:53.205: D/Unity(12882): [EGL] Attaching window :0x7c1ebcf010
    03-10 11:04:53.234: D/Unity(12882): WARNING: Shader
    03-10 11:04:53.234: D/Unity(12882): Unsupported: 'Instanced/Trees/Opaque/Compute/Crossboard' - Pass '' has no vertex shader
    03-10 11:04:53.234: D/Unity(12882): WARNING: Shader
    03-10 11:04:53.234: D/Unity(12882): Unsupported: 'Instanced/Trees/Opaque/Compute/Crossboard' - All passes removed
    03-10 11:04:53.234: D/Unity(12882): WARNING: Shader
    03-10 11:04:53.234: D/Unity(12882): Did you use #pragma only_renderers and omit this platform?
    03-10 11:04:53.234: D/Unity(12882): ERROR: Shader
    03-10 11:04:53.234: D/Unity(12882): Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
    03-10 11:04:53.234: D/Unity(12882): WARNING: Shader
    03-10 11:04:53.234: D/Unity(12882): Unsupported: 'Instanced/Trees/Opaque/Compute/Crossboard' - Setting to default shader.
    03-10 11:04:55.240: D/Unity(12882): UnloadTime: 0.129323 ms
    03-10 11:04:55.245: D/Unity(12882): UUID: d095b4cc3771ae1d => 3d62760f319f639d1c908fb67cf6cb5c

    Then it totally stopps until i relese the debugger
     
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,789
    This looks like it might be a bug - I'm not sure what the cause is though. This should work, so can to submit a bug report?
     
  4. AndersModen

    AndersModen

    Joined:
    Nov 19, 2019
    Posts:
    51
    i Will. I have a git repo you can test
     
    JoshPeterson likes this.
  5. AndersModen

    AndersModen

    Joined:
    Nov 19, 2019
    Posts:
    51
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,789
    Can you drop us a bug report as well, and mention the case number to me? That way it will run through our normal QA process.
     
  7. AndersModen

    AndersModen

    Joined:
    Nov 19, 2019
    Posts:
    51
    This is randomly occuring. I can not reproduce now on my phone but collegues have on theirs so its a bit tricky to issue a bug. We do have other bugs we can continue to issue first
     
  8. AndersModen

    AndersModen

    Joined:
    Nov 19, 2019
    Posts:
    51
    I issued another IL2CPP bug here (Case 1226943) Compiled with IL2CPP
     
  9. AndersModen

    AndersModen

    Joined:
    Nov 19, 2019
    Posts:
    51
    How do you marshall bool values in a native call ?

    Code (CSharp):
    1.  
    2. [DllImport(Platform.BRIDGE, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    3. private static extern bool Texture_getMipMapImageArray(IntPtr texture_reference, bool createMipMaps, bool uncompress, ref UInt32 size, ref IntPtr native_image_data,ref ImageFormat format,ref ComponentType compType, ref UInt32 components, ref UInt32 width,ref UInt32 height,ref UInt32 depth);
    4.  
    The return value ? The two bool parameters ? As bytes. As shorts or as words ?