Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print signal name when Test interface exits #2604

Closed
ekrich opened this issue Apr 18, 2022 · 1 comment · Fixed by #2722
Closed

Print signal name when Test interface exits #2604

ekrich opened this issue Apr 18, 2022 · 1 comment · Fixed by #2722

Comments

@ekrich
Copy link
Member

ekrich commented Apr 18, 2022

The code in question should be here.

def signalToCString(str: CString, signal: Int): Unit = {
val reversedStr: Ptr[CChar] = stackalloc[CChar](8.toUInt)
var index = 0
var signalPart = signal
while (signalPart > 0) {
val digit = signalPart % 10
reversedStr(index) = (digit + '0').toByte
index += 1
signalPart = signalPart / 10
}
reversedStr(index) = 0.toByte
for (i <- 0 until index) {
str(i) = reversedStr(index - 1 - i)
}
str(index) = 0.toByte
}
val signalNumberStr: Ptr[CChar] = stackalloc[CChar](8.toUInt)
signalToCString(signalNumberStr, sig)
val stackTraceHeader: Ptr[CChar] = stackalloc[CChar](2048.toUInt)
stackTraceHeader(0.toUInt) = 0.toByte
strcat(stackTraceHeader, errorTag)
strcat(stackTraceHeader, c" Fatal signal ")
strcat(stackTraceHeader, signalNumberStr)
strcat(stackTraceHeader, c" caught\n")
printError(stackTraceHeader)

Potential idea for a fix.
https://stackoverflow.com/questions/16509614/signal-number-to-name

jmesyou added a commit to jmesyou/scala-native that referenced this issue Jul 12, 2022
jmesyou added a commit to jmesyou/scala-native that referenced this issue Jul 13, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
jmesyou added a commit to jmesyou/scala-native that referenced this issue Jul 13, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
jmesyou added a commit to jmesyou/scala-native that referenced this issue Jul 14, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
+ Update string import in posix/TimeTest
@jmesyou
Copy link
Contributor

jmesyou commented Jul 14, 2022

#2722 conditionally fixes the issue for Unix. I plan to fixing the issue for Windows in a separate PR after #2722 is merged.

jmesyou added a commit to jmesyou/scala-native that referenced this issue Jul 15, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
+ Update string import in posix/TimeTest
jmesyou added a commit to jmesyou/scala-native that referenced this issue Jul 15, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
+ Update string import in posix/TimeTest
jmesyou added a commit to jmesyou/scala-native that referenced this issue Jul 15, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
+ Update string import in posix/TimeTest
WojciechMazur pushed a commit that referenced this issue Jul 16, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
+ Update string import in posix/TimeTest
WojciechMazur pushed a commit to WojciechMazur/scala-native that referenced this issue Sep 1, 2022
…cala-native#2722)

+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
+ Update string import in posix/TimeTest
WojciechMazur pushed a commit that referenced this issue Sep 1, 2022
+ Add scala.scalanative.posix.string
+ Update lib/posixlib.rst
+ Conditionally print signal name when not in Windows
+ Update string import in posix/TimeTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants