[debugger] make the ScriptGroup inspection point weak

Breakpoints set on named ScriptGroups were never resolved by the
debugger due to aggressive optimizations by clang in release builds.

`debugHintScriptGroup2`, used by the debugger to inspect ScriptGroup
compilations at `optlevel == 0`, had its inner loop optimized away
completely as there are no visible side effects (where the ALOGV calls
are actually empty macros). This was fixed by using an `__asm__
__volatile__ ("")` construct as per the gcc docs:

    noinline This function attribute prevents a function from being
    considered for inlining. If the function does not have side-effects,
    there are optimizations other than inlining that causes function
    calls to be optimized away, although the function call is live. To
    keep such calls from being optimized away, put `asm ("")` in the
    called function, to serve as a special side-effect.
    (see also
     https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
     https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes)

Although preventing the inner loop from being optimized away is enough
to get the function called, it is apparent that clang only sets up the
call frame with arguments that it can see are used inside the function
body, meaning that we had garbage values for `groupName` and
`groupNameSize` unless the symbol is weakly visible so that the compiler
can no longer introspect that the arguments are ignored.

Test: aosp_x86_64-eng (emulator)
 - RsTest (32-bit, 64-bit)
 - cts -m RenderscriptTest
 - rs/lldb (required various other pending CLs)

Bug: 23535482

Change-Id: I24e23895e67d1ede8bf8e671165a3a6843a11082
Signed-off-by: Luke Drummond <luke.drummond@codeplay.com>
1 file changed
tree: 29a2d9c3c4c8b08123ef08cc7c06aba30c4b13ac
  1. cpp/
  2. cpu_ref/
  3. driver/
  4. rsov/
  5. script_api/
  6. support/
  7. tests/
  8. Android.bp
  9. Android.mk
  10. build_rs.py
  11. CleanSpec.mk
  12. libRS.map
  13. rs.h
  14. rs.spec
  15. rs_compat.spec
  16. rs_hal.h
  17. rsAllocation.cpp
  18. rsAllocation.h
  19. rsAnimation.cpp
  20. rsAnimation.h
  21. rsApiAllocation.cpp
  22. rsApiContext.cpp
  23. rsApiDevice.cpp
  24. rsApiElement.cpp
  25. rsApiFileA3D.cpp
  26. rsApiMesh.cpp
  27. rsApiStubs.cpp
  28. rsApiStubs.h
  29. rsApiType.cpp
  30. rsClosure.cpp
  31. rsClosure.h
  32. rsCompatibilityLib.h
  33. rsComponent.cpp
  34. rsComponent.h
  35. rsContext.cpp
  36. rsContext.h
  37. rsCppUtils.cpp
  38. rsCppUtils.h
  39. rsDebugHelper.h
  40. rsDefines.h
  41. rsDevice.cpp
  42. rsDevice.h
  43. rsDriverLoader.cpp
  44. rsElement.cpp
  45. rsElement.h
  46. rsEnv.h
  47. rsFallbackAdaptation.cpp
  48. rsFallbackAdaptation.h
  49. rsFBOCache.cpp
  50. rsFBOCache.h
  51. rsFifo.h
  52. rsFifoSocket.cpp
  53. rsFifoSocket.h
  54. rsFileA3D.cpp
  55. rsFileA3D.h
  56. rsFont.cpp
  57. rsFont.h
  58. rsg.spec
  59. rsg_generator.c
  60. rsgApi.cpp.rsg
  61. rsgApiFuncDecl.h.rsg
  62. rsgApiReplay.cpp.rsg
  63. rsgApiStructs.h.rsg
  64. rsGrallocConsumer.cpp
  65. rsGrallocConsumer.h
  66. rsHidlAdaptation.cpp
  67. rsHidlAdaptation.h
  68. rsInternalDefines.h
  69. rsList.h
  70. rsMap.h
  71. rsMatrix2x2.cpp
  72. rsMatrix2x2.h
  73. rsMatrix3x3.cpp
  74. rsMatrix3x3.h
  75. rsMatrix4x4.cpp
  76. rsMatrix4x4.h
  77. rsMesh.cpp
  78. rsMesh.h
  79. rsMutex.cpp
  80. rsMutex.h
  81. rsObjectBase.cpp
  82. rsObjectBase.h
  83. rsProgram.cpp
  84. rsProgram.h
  85. rsProgramBase.h
  86. rsProgramFragment.cpp
  87. rsProgramFragment.h
  88. rsProgramRaster.cpp
  89. rsProgramRaster.h
  90. rsProgramStore.cpp
  91. rsProgramStore.h
  92. rsProgramVertex.cpp
  93. rsProgramVertex.h
  94. rsRuntime.h
  95. rsSampler.cpp
  96. rsSampler.h
  97. rsScript.cpp
  98. rsScript.h
  99. rsScriptC.cpp
  100. rsScriptC.h
  101. rsScriptC_Lib.cpp
  102. rsScriptC_LibGL.cpp
  103. rsScriptGroup.cpp
  104. rsScriptGroup.h
  105. rsScriptGroup2.cpp
  106. rsScriptGroup2.h
  107. rsScriptGroupBase.h
  108. rsScriptIntrinsic.cpp
  109. rsScriptIntrinsic.h
  110. rsSignal.cpp
  111. rsSignal.h
  112. rsStream.cpp
  113. rsStream.h
  114. rsThreadIO.cpp
  115. rsThreadIO.h
  116. rsType.cpp
  117. rsType.h
  118. rsUtils.h
  119. run_rs_cts.sh
  120. spec.h
  121. spec.l
  122. update-prebuilts.py
  123. update_rs_prebuilts.sh