Age | Commit message (Collapse) | Author |
|
|
|
Also update the r12 and r13 options so that they imply no_line_info.
|
|
|
|
Remove the old kludgy parse transformations and line numbers
macros in common_test and test_server, and use the line numbers
in exceptions instead.
|
|
The exact layout of the stack backtrace is an implementation detail
that may be changed at any time.
|
|
|
|
|
|
Put the actual saving of the continuation pointers on the stack
in the new function erts_save_stacktrace() so that it can be reused.
The code is too tricky and complicated to allow it to
become duplicated.
|
|
In the location information tables in the run-time system, source
filenames that are the same as the module name plus ".erl" extension
are not stored explicitly, thus saving memory.
To take advantage of that optimization, avoid complicating the names of
files in the current working directory; specifically, make sure that
"./" is not prepended to the name.
|
|
|
|
|
|
|
|
As a preparation for providing information about the source
location for an MFA item in an exception stacktrace, refactor
the code that builds the exception stacktrace. Basically we
need two passes over the saved continuation counters: a first
pass to calculate the needed heap space and a second pass to
actually build the stacktrace.
|
|
|
|
This commit is a preparation for introducing location information
(filename/line number) in stacktraces in exceptions. Currently
a stack trace looks like:
[{Mod1,Function1,Arity1},
.
.
.
{ModN,FunctionN,ArityN}]
Add a forth element to each tuple that can be used indication
the filename and line number of the source file:
[{Mod1,Function1,Arity1,Location1},
.
.
.
{ModN,FunctionN,ArityN,LocationN}]
In this commit, the fourth element will just be an empty list,
and we will change all code that look at or manipulate stacktraces.
|
|
|
|
|
|
Introduce the line/1 instruction in the compiler and the BEAM
virtual machine. It will not yet be generated by the compiler and
will not actually carry any information.
|
|
|
|
|
|
Since the run-time system cannot load those BEAM files, it was
not possible to debug them anyway.
|
|
The stacktrace in debugger-generated exceptions should be
as similar to stacktraces in BEAM-generated exceptions as
possible.
|
|
The 'no_tail' option was broken and would work almost as the
'all' option, because it would use #ieval.top (formerly
known as #ieval.last_call) as the basis for its decision
to push or not.
Fix it by including a boolean in each call/apply instruction
indicating whether the call is tail-recursive and pass
that boolean to the dbg_istk:push() function.
|
|
An exception from eval_bits:expr_grp/5 (for constructing binaries)
was not caught and handled by exception/4; thus exit_info and
and stacktrace for the process was not set.
|
|
'eval_bits' is a common utility module used for evaluting binary
construction and matching. The functions that do matching
(match_bits/{6,7} and bin_gen/6) are supposed to treat the bindings as
an abstract data type, but they assume that the bindings have the same
representation as in the erl_eval module. That may cause binary
matching to fail in the debugger, because the debugger represents the
bindings as an unordered list of two-tuples, while the erl_eval
modules uses an ordered list of two-tuple (an ordset).
One way to fix the problem would be to let the debugger to use ordered
lists to represent the bindings. Unfortunately, that would also change
how the bindings are presented in the user interface. Currently, the
variable have most been recently assigned is shown first, which is
convenient.
Fix the matching problem by mending the leaky abstraction in
eval_bits. The matching functions needs to be passed two additional
operations: one for looking up a variable in the bindings and one for
adding a binding. Those operations could be passed as two more funs
(in addition to the evaluation and match fun already passed), but the
functions already have too many arguments. Therefore, change the
meaning of the match fun, so that the first argument is the operation
to perform ('match', 'binding', or 'add_binding') and second argument
is a tuple with arguments for the operation.
|
|
When an exception occurs, the entire stack will be converted to
the external term format and kept in the exit_info variable in
the process dictionary. But the exit_info variable will only be
needed if the exception causes the process to terminate (not if
it is caught).
Delay the conversion of the stack to external format. That can
save significant amounts of time (e.g. in bs_construct:mem_leak/1).
|
|
|
|
A long time ago, test suites were copied from other applications.
Copy the tests again to get more test cases.
|
|
In a list comprehension, a failing call to a guard BIF means
false (rather than an exception).
|
|
Expressions in guards such as:
f() when [1,2,3] ->
ok.
would cause the debugger to crash when attempting to interpret the
module containing the expressions. Other kind of constants such as:
f() when 42 ->
ok.
were converted to an invalid internal format ({integer,Line,42}
instead of {value,Line,42}), but that happened to work because
because anything not equal to 'true' (even a crash) was interpreted
as 'false'.
Make sure to handle all possible expressions and convert them
directly to {value,Line,false}. Remove the special handling of
the atom 'true' in and_guard/1 since it is no longer needed.
|
|
erlang:raise/3 was evaluated in the real process, which produced
a correct stacktrace, but did not set emulated stacktrace for the
process. Thus, a subsequent call to erlang:get_stacktrace/0 would
retrieve the previous stacktrace for the process.
|
|
When an exception was generated from interpreted code, the stacktrace
would not look exactly like BEAM's stacktraces. There would generally
be fewer entries (never more than three), and the top entry would
always have MFAs with the actual arguments (rather than the arity).
There are two good reasons for making the stacktraces as similar
as possible:
* Code that examines a stacktrace can behave differently in the
interpreted and BEAM code if the stacktraces are different.
* It is easier to test the debugger if test suites for other
applications (such as the emulator) can be run with the debugger
with as few modifications as possible.
|
|
Currently, dbg_istk:exception_stacktrace/2 does not do a very good job
imitating BEAM's stacktrace. The reason is that it need to be
relatively fast since a simulated stacktrace is constructed not only
when an exception oocurs, but also before every call to
non-interpreted code.
To prepare for a future more thorough (and slower) stacktrace
construction, refactor the building of the stacktrace so that
it only is done when erlang:get_stacktrace/0 is called.
|
|
Problems with the current stack implementation:
* The GUI assumes that the stack frame pushed on the stack
is level 2. If the 'no_tail' option is set for the process,
there may not be an entry for level 2.
* In each stack entry, the line number is the line number of
the caller, not the line number for the function in the 'mfa'
field as might be expected. That complicates generation of
a stacktrace with line number information.
Change the implementation as follows:
* Keep the information for the current function (its MFA and
current line number) in the #ieval{} record. Don't push it
onto the stack. Only push the information when another function
is called. That will ensure that the MFA and the line number
is found in the same stack entry. That also has the advantage
that if the 'no_tail' option is set, the stack not need to
be modified for tail-recursive calls.
* Make sure that there always is an entry for level two.
|
|
There is no need to set #ieval.top to false in every
iteration of eval_list/1.
|
|
The 'last_call' is badly named. What is means is that the
next call will leave intepreted code.
|
|
|
|
|
|
sys_pre_expand has already rewritten old guard tests to
new guard tests.
|
|
Many releases ago, Mod:module_info/{0,1} used to be specially
handled in the BEAM loader. The debugger has similar special
handling.
In the current implementation, Mod:module_info/{0,1} are ordinary
functions that call special BIFs to do their work.
Therefore, remove the special handling of Mod:module_info/{0,1}
in the debugger.
|
|
BIFs that spawn new processes once upon a time needed/benefited
from special handling, but now they are handled in exactly the
same way as an unsafe BIF (except for a bug in the handling of
the return value trace). Therefore, treat spawn BIFs as unsafe
BIFs.
|
|
|
|
Make sure that all guards BIFs are handled as safe BIFs in function
bodies. BIFs in guards are already handled as safe. (self/0 is not
safe, but it is already specially handled.)
|
|
Since erlang:fault/{1,2} is no longer supported in the run-time
system (it was removed several releases ago), there is no need
to still support it in the debugger.
|
|
|
|
|
|
* nick/lht-idl-compiler-opt/OTP-9460:
Changed version, added release note and updated license headers.
ic: Implement multiple include optimization
ic: Fix preprocessor double expanded included files
ic: Improve ic_pragma performance by using ets:match
|
|
|
|
* dev:
Added test case for ticket 9411.
Entity replacement in attributes doesn't work poperly.
|
|
* lars/xmerl/attr_val_bug/OTP-9411:
Added test case for ticket 9411.
Entity replacement in attributes doesn't work poperly.
|