1833 st->print(INTPTR_FORMAT " ", er->ExceptionInformation[i]); |
1833 st->print(INTPTR_FORMAT " ", er->ExceptionInformation[i]); |
1834 } |
1834 } |
1835 } |
1835 } |
1836 } |
1836 } |
1837 st->cr(); |
1837 st->cr(); |
|
1838 } |
|
1839 |
|
1840 |
|
1841 int os::vsnprintf(char* buf, size_t len, const char* fmt, va_list args) { |
|
1842 #if _MSC_VER >= 1900 |
|
1843 // Starting with Visual Studio 2015, vsnprint is C99 compliant. |
|
1844 int result = ::vsnprintf(buf, len, fmt, args); |
|
1845 // If an encoding error occurred (result < 0) then it's not clear |
|
1846 // whether the buffer is NUL terminated, so ensure it is. |
|
1847 if ((result < 0) && (len > 0)) { |
|
1848 buf[len - 1] = '\0'; |
|
1849 } |
|
1850 return result; |
|
1851 #else |
|
1852 // Before Visual Studio 2015, vsnprintf is not C99 compliant, so use |
|
1853 // _vsnprintf, whose behavior seems to be *mostly* consistent across |
|
1854 // versions. However, when len == 0, avoid _vsnprintf too, and just |
|
1855 // go straight to _vscprintf. The output is going to be truncated in |
|
1856 // that case, except in the unusual case of empty output. More |
|
1857 // importantly, the documentation for various versions of Visual Studio |
|
1858 // are inconsistent about the behavior of _vsnprintf when len == 0, |
|
1859 // including it possibly being an error. |
|
1860 int result = -1; |
|
1861 if (len > 0) { |
|
1862 result = _vsnprintf(buf, len, fmt, args); |
|
1863 // If output (including NUL terminator) is truncated, the buffer |
|
1864 // won't be NUL terminated. Add the trailing NUL specified by C99. |
|
1865 if ((result < 0) || (result >= (int) len)) { |
|
1866 buf[len - 1] = '\0'; |
|
1867 } |
|
1868 } |
|
1869 if (result < 0) { |
|
1870 result = _vscprintf(fmt, args); |
|
1871 } |
|
1872 return result; |
|
1873 #endif // _MSC_VER dispatch |
1838 } |
1874 } |
1839 |
1875 |
1840 void os::print_signal_handlers(outputStream* st, char* buf, size_t buflen) { |
1876 void os::print_signal_handlers(outputStream* st, char* buf, size_t buflen) { |
1841 // do nothing |
1877 // do nothing |
1842 } |
1878 } |