@@ -242,11 +242,49 @@ if (Java_VERSION_STRING VERSION_GREATER_EQUAL "25.0.0")
242242 endif ()
243243 endforeach ()
244244 if (NOT _HDF5_h2_patched)
245+ set (_HDF5_HDF5_H_2_LEGACY "${JEXTRACT_OUTPUT_DIR} /org/hdfgroup/javahdf5/hdf5_h_2.java" )
246+ if (EXISTS "${_HDF5_HDF5_H_2_LEGACY} " )
247+ file (READ "${_HDF5_HDF5_H_2_LEGACY} " _HDF5_h2_legacy_head LIMIT 8192 )
248+ string (REPLACE "\r\n " "\n " _HDF5_h2_legacy_head "${_HDF5_h2_legacy_head} " )
249+ message (
250+ STATUS
251+ "FFM jextract patch debug: beginning of hdf5_h_2.java "
252+ "(use to update needle-macos.txt on macOS if needed):\n "
253+ "${_HDF5_h2_legacy_head} "
254+ )
255+ else ()
256+ message (
257+ STATUS
258+ "FFM jextract patch debug: hdf5_h_2.java not found at "
259+ "${_HDF5_HDF5_H_2_LEGACY} "
260+ )
261+ endif ()
262+ file (READ "${_HDF5_HDF5_H_2} " _HDF5_h2_patch_head LIMIT 8192 )
263+ string (REPLACE "\r\n " "\n " _HDF5_h2_patch_head "${_HDF5_h2_patch_head} " )
264+ message (
265+ STATUS
266+ "FFM jextract patch debug: beginning of patch target "
267+ "${_HDF5_HDF5_H_2} :\n ${_HDF5_h2_patch_head} "
268+ )
269+ string (
270+ FIND "${_HDF5_h2_src} "
271+ "static final SymbolLookup SYMBOL_LOOKUP"
272+ _HDF5_h2_lookup_pos
273+ )
274+ if (NOT _HDF5_h2_lookup_pos EQUAL -1)
275+ string (SUBSTRING "${_HDF5_h2_src} " ${_HDF5_h2_lookup_pos} 600 _HDF5_h2_lookup_snippet)
276+ message (
277+ STATUS
278+ "FFM jextract patch debug: SYMBOL_LOOKUP block from patch target "
279+ "(exact needle candidate):\n ${_HDF5_h2_lookup_snippet} "
280+ )
281+ endif ()
245282 message (
246283 FATAL_ERROR
247284 "Post-jextract patch of ${_HDF5_HDF5_H_2} failed (needle not found). "
248285 "jextract output may have changed; update a platform needle under "
249- "${_HDF5_FFM_JEXTRACT_PATCH_DIR} ."
286+ "${_HDF5_FFM_JEXTRACT_PATCH_DIR} . See STATUS lines above for "
287+ "hdf5_h_2.java / SYMBOL_LOOKUP debug output."
250288 )
251289 endif ()
252290 message (STATUS "Patched ${_HDF5_HDF5_H_2} using ${_HDF5_h2_needle_used} " )
0 commit comments