Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2986821b
Commit
2986821b
authored
Mar 10, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Print source location in backtraces.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cdb264e8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
12 deletions
+23
-12
compile.c
dlls/jscript/compile.c
+14
-0
engine.c
dlls/jscript/engine.c
+3
-2
engine.h
dlls/jscript/engine.h
+2
-0
jscript.c
dlls/jscript/jscript.c
+4
-10
No files found.
dlls/jscript/compile.c
View file @
2986821b
...
...
@@ -2236,6 +2236,20 @@ static void resolve_labels(compiler_ctx_t *ctx, unsigned off)
ctx
->
labels_cnt
=
0
;
}
unsigned
get_location_line
(
bytecode_t
*
code
,
unsigned
loc
,
unsigned
*
char_pos
)
{
unsigned
line
=
code
->
start_line
;
const
WCHAR
*
nl
,
*
p
;
for
(
nl
=
p
=
code
->
source
;
p
<
code
->
source
+
loc
;
p
++
)
{
if
(
*
p
!=
'\n'
)
continue
;
line
++
;
nl
=
p
+
1
;
}
*
char_pos
=
loc
-
(
nl
-
code
->
source
);
return
line
;
}
void
release_bytecode
(
bytecode_t
*
code
)
{
unsigned
i
;
...
...
dlls/jscript/engine.c
View file @
2986821b
...
...
@@ -2703,7 +2703,7 @@ static void pop_call_frame(script_ctx_t *ctx)
static
void
print_backtrace
(
script_ctx_t
*
ctx
)
{
unsigned
depth
=
0
,
i
;
unsigned
depth
=
0
,
i
,
line
,
char_pos
;
call_frame_t
*
frame
;
for
(
frame
=
ctx
->
call_ctx
;
frame
;
frame
=
frame
->
prev_frame
)
{
...
...
@@ -2724,7 +2724,8 @@ static void print_backtrace(script_ctx_t *ctx)
}
else
{
WARN
(
"[detached frame]"
);
}
WARN
(
")
\n
"
);
line
=
get_location_line
(
frame
->
bytecode
,
frame
->
bytecode
->
instrs
[
frame
->
ip
].
loc
,
&
char_pos
);
WARN
(
") context %s line %u char %u
\n
"
,
wine_dbgstr_longlong
(
frame
->
bytecode
->
source_context
),
line
,
char_pos
);
if
(
!
(
frame
->
flags
&
EXEC_RETURN_TO_INTERP
))
{
WARN
(
"%u
\t
[native code]
\n
"
,
depth
);
...
...
dlls/jscript/engine.h
View file @
2986821b
...
...
@@ -201,6 +201,8 @@ struct _bytecode_t {
HRESULT
compile_script
(
script_ctx_t
*
,
const
WCHAR
*
,
UINT64
,
unsigned
,
const
WCHAR
*
,
const
WCHAR
*
,
BOOL
,
BOOL
,
named_item_t
*
,
bytecode_t
**
)
DECLSPEC_HIDDEN
;
void
release_bytecode
(
bytecode_t
*
)
DECLSPEC_HIDDEN
;
unsigned
get_location_line
(
bytecode_t
*
code
,
unsigned
loc
,
unsigned
*
char_pos
)
DECLSPEC_HIDDEN
;
static
inline
bytecode_t
*
bytecode_addref
(
bytecode_t
*
code
)
{
code
->
ref
++
;
...
...
dlls/jscript/jscript.c
View file @
2986821b
...
...
@@ -257,8 +257,7 @@ static HRESULT WINAPI JScriptError_GetSourcePosition(IActiveScriptError *iface,
{
JScriptError
*
This
=
impl_from_IActiveScriptError
(
iface
);
bytecode_t
*
code
=
This
->
ei
.
code
;
const
WCHAR
*
nl
,
*
p
;
unsigned
l
;
unsigned
line_pos
,
char_pos
;
TRACE
(
"(%p)->(%p %p %p)
\n
"
,
This
,
source_context
,
line
,
character
);
...
...
@@ -272,16 +271,11 @@ static HRESULT WINAPI JScriptError_GetSourcePosition(IActiveScriptError *iface,
if
(
!
line
&&
!
character
)
return
S_OK
;
l
=
code
->
start_line
;
for
(
nl
=
p
=
code
->
source
;
p
<
code
->
source
+
This
->
ei
.
loc
;
p
++
)
{
if
(
*
p
!=
'\n'
)
continue
;
l
++
;
nl
=
p
+
1
;
}
line_pos
=
get_location_line
(
code
,
This
->
ei
.
loc
,
&
char_pos
);
if
(
line
)
*
line
=
l
;
*
line
=
l
ine_pos
;
if
(
character
)
*
character
=
c
ode
->
source
+
This
->
ei
.
loc
-
nl
;
*
character
=
c
har_pos
;
return
S_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment