|
41 | 41 | #include <stack> |
42 | 42 | #include <utility> |
43 | 43 |
|
| 44 | +#if defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) |
| 45 | +#include "atoe.h" /* a2e_string() */ |
| 46 | +#endif /* defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) */ |
| 47 | + |
44 | 48 | #define DW_LIBDWARF_MAKE_VERSION(major, minor) (((major) * 100) + (minor)) |
45 | 49 |
|
46 | 50 | #if defined(DW_LIBDWARF_VERSION_MAJOR) && defined(DW_LIBDWARF_VERSION_MINOR) |
@@ -68,6 +72,7 @@ ddr_dw_finish( |
68 | 72 | static int |
69 | 73 | ddr_dw_init( |
70 | 74 | int fd, |
| 75 | + const char *filepath, |
71 | 76 | Dwarf_Handler errhand, |
72 | 77 | Dwarf_Ptr errarg, |
73 | 78 | Dwarf_Debug *dbg, |
@@ -138,14 +143,27 @@ ddr_dw_finish( |
138 | 143 | static int |
139 | 144 | ddr_dw_init( |
140 | 145 | int fd, |
| 146 | + const char *filepath, |
141 | 147 | Dwarf_Handler errhand, |
142 | 148 | Dwarf_Ptr errarg, |
143 | 149 | Dwarf_Debug *dbg, |
144 | 150 | Dwarf_Error *error) |
145 | 151 | { |
| 152 | +#if defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) |
| 153 | + int result = DW_DLV_ERROR; |
| 154 | + char *e_filepath = a2e_string(filepath); |
| 155 | + |
| 156 | + if (NULL != e_filepath) { |
| 157 | + result = dwarf_goff_init_with_GOFF_filename(e_filepath, errhand, errarg, 0, dbg, error); |
| 158 | + free(e_filepath); |
| 159 | + } |
| 160 | + |
| 161 | + return result; |
| 162 | +#else /* defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) */ |
146 | 163 | Dwarf_Unsigned access = DW_DLC_READ; |
147 | 164 |
|
148 | 165 | return dwarf_init(fd, access, errhand, errarg, dbg, error); |
| 166 | +#endif /* defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) */ |
149 | 167 | } |
150 | 168 |
|
151 | 169 | static int |
@@ -1814,7 +1832,17 @@ DwarfScanner::scanFile(OMRPortLibrary *portLibrary, Symbol_IR *ir, const char *f |
1814 | 1832 | Dwarf_Ptr errarg = NULL; |
1815 | 1833 | intptr_t native_fd = omrfile_convert_omrfile_fd_to_native_fd(fd); |
1816 | 1834 | DwarfScanner::scanFileName = filepath; |
1817 | | - res = ddr_dw_init((int)native_fd, errhand, errarg, &_debug, &error); |
| 1835 | + res = ddr_dw_init((int)native_fd, filepath, errhand, errarg, &_debug, &error); |
| 1836 | + |
| 1837 | +#if defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) |
| 1838 | + if (DW_DLV_NO_ENTRY == res) { |
| 1839 | + if (NULL != error) { |
| 1840 | + dwarf_dealloc(_debug, error, DW_DLA_ERROR); |
| 1841 | + } |
| 1842 | + goto done; |
| 1843 | + } |
| 1844 | +#endif /* defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) */ |
| 1845 | + |
1818 | 1846 | if (DW_DLV_OK != res) { |
1819 | 1847 | ERRMSG("Failed to initialize libDwarf scanning %s: %s\nExiting...\n", filepath, dwarf_errmsg(error)); |
1820 | 1848 | if (NULL != error) { |
@@ -1842,6 +1870,9 @@ DwarfScanner::scanFile(OMRPortLibrary *portLibrary, Symbol_IR *ir, const char *f |
1842 | 1870 | } |
1843 | 1871 | } |
1844 | 1872 |
|
| 1873 | +#if defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) |
| 1874 | +done: |
| 1875 | +#endif /* defined(J9ZOS390) && defined(__open_xl__) && !defined(OMR_EBCDIC) */ |
1845 | 1876 | if (fd >= 0) { |
1846 | 1877 | DEBUGPRINTF("Closing file: fd"); |
1847 | 1878 |
|
|
0 commit comments