mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
research st, add jmp_flow.
This commit is contained in:
parent
683b01a6c9
commit
4d4e840209
2 changed files with 29 additions and 1 deletions
27
trunk/research/arm/jmp_flow.cpp
Normal file
27
trunk/research/arm/jmp_flow.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
# for all supports setjmp and longjmp:
|
||||
g++ -g -O0 -o jmp_flow jmp_flow.cpp
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
jmp_buf context_level_0;
|
||||
|
||||
void func_level_0()
|
||||
{
|
||||
const char* level_0_0 = "stack variables for func_level_0";
|
||||
int ret = setjmp(context_level_0);
|
||||
printf("func_level_0 ret=%d\n", ret);
|
||||
if (ret != 0) {
|
||||
printf("call by longjmp.\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
func_level_0();
|
||||
longjmp(context_level_0, 1);
|
||||
return 0;
|
||||
}
|
|
@ -133,7 +133,8 @@ void func0()
|
|||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
#if defined(__amd64__) || defined(__x86_64__)
|
||||
printf("x86_64 sizeof(long int)=%d, sizeof(long)=%d, "
|
||||
"sizeof(int)=%d, __WORDSIZE=%d, __GLIBC__=%d, __GLIBC_MINOR__=%d\n",
|
||||
|
|
Loading…
Reference in a new issue