-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix style and start refining the API
- Loading branch information
Showing
3 changed files
with
35 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright (C) 2020 Ole André Vadla Ravnås <[email protected]> | ||
* Copyright (C) 2024 DaVinci <[email protected]> | ||
* | ||
* Licence: wxWindows Library Licence, Version 3.1 | ||
*/ | ||
|
@@ -19,7 +20,7 @@ GUMJS_DECLARE_FUNCTION (gumjs_thread_sleep) | |
|
||
static const JSCFunctionListEntry gumjs_thread_entries[] = | ||
{ | ||
JS_CFUNC_DEF ("backtrace", 0, gumjs_thread_backtrace), | ||
JS_CFUNC_DEF ("_backtrace", 0, gumjs_thread_backtrace), | ||
JS_CFUNC_DEF ("sleep", 0, gumjs_thread_sleep), | ||
}; | ||
|
||
|
@@ -105,9 +106,14 @@ GUMJS_DEFINE_FUNCTION (gumjs_thread_backtrace) | |
goto not_available; | ||
|
||
if (limit > -1) | ||
gum_backtracer_generate_with_limit (backtracer, cpu_context, &ret_addrs, limit); | ||
{ | ||
gum_backtracer_generate_with_limit (backtracer, cpu_context, &ret_addrs, | ||
limit); | ||
} | ||
else | ||
{ | ||
gum_backtracer_generate (backtracer, cpu_context, &ret_addrs); | ||
} | ||
|
||
result = JS_NewArray (ctx); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright (C) 2010-2022 Ole André Vadla Ravnås <[email protected]> | ||
* Copyright (C) 2024 DaVinci <[email protected]> | ||
* | ||
* Licence: wxWindows Library Licence, Version 3.1 | ||
*/ | ||
|
@@ -17,7 +18,7 @@ GUMJS_DECLARE_FUNCTION (gumjs_thread_sleep) | |
|
||
static const GumV8Function gumjs_thread_functions[] = | ||
{ | ||
{ "backtrace", gumjs_thread_backtrace }, | ||
{ "_backtrace", gumjs_thread_backtrace }, | ||
{ "sleep", gumjs_thread_sleep }, | ||
|
||
{ NULL, NULL } | ||
|
@@ -131,9 +132,13 @@ GUMJS_DEFINE_FUNCTION (gumjs_thread_backtrace) | |
|
||
GumReturnAddressArray ret_addrs; | ||
|
||
if (!limit.IsEmpty () && limit->IsUint32 ()) { | ||
gum_backtracer_generate_with_limit (backtracer, cpu_context, &ret_addrs, limit->Uint32Value(context).FromJust()); | ||
} else { | ||
if (!limit.IsEmpty () && limit->IsUint32 ()) | ||
{ | ||
gum_backtracer_generate_with_limit (backtracer, cpu_context, &ret_addrs, | ||
limit->Uint32Value (context).FromJust ()); | ||
} | ||
else | ||
{ | ||
gum_backtracer_generate (backtracer, cpu_context, &ret_addrs); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters