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