diff options
Diffstat (limited to 'lib/debugger')
-rw-r--r-- | lib/debugger/Makefile | 4 | ||||
-rw-r--r-- | lib/debugger/doc/src/Makefile | 84 | ||||
-rw-r--r-- | lib/debugger/doc/src/attach.jpg (renamed from lib/debugger/doc/src/images/attach.jpg) | bin | 56341 -> 56341 bytes | |||
-rw-r--r-- | lib/debugger/doc/src/cond_break_dialog.jpg (renamed from lib/debugger/doc/src/images/cond_break_dialog.jpg) | bin | 21770 -> 21770 bytes | |||
-rw-r--r-- | lib/debugger/doc/src/debugger_chapter.xml | 68 | ||||
-rw-r--r-- | lib/debugger/doc/src/function_break_dialog.jpg (renamed from lib/debugger/doc/src/images/function_break_dialog.jpg) | bin | 13532 -> 13532 bytes | |||
-rw-r--r-- | lib/debugger/doc/src/i.xml | 16 | ||||
-rw-r--r-- | lib/debugger/doc/src/int.xml | 6 | ||||
-rw-r--r-- | lib/debugger/doc/src/interpret.jpg (renamed from lib/debugger/doc/src/images/interpret.jpg) | bin | 28924 -> 28924 bytes | |||
-rw-r--r-- | lib/debugger/doc/src/introduction.xml | 2 | ||||
-rw-r--r-- | lib/debugger/doc/src/line_break_dialog.jpg (renamed from lib/debugger/doc/src/images/line_break_dialog.jpg) | bin | 14414 -> 14414 bytes | |||
-rw-r--r-- | lib/debugger/doc/src/monitor.jpg (renamed from lib/debugger/doc/src/images/monitor.jpg) | bin | 40742 -> 40742 bytes | |||
-rw-r--r-- | lib/debugger/doc/src/notes.xml | 37 | ||||
-rw-r--r-- | lib/debugger/doc/src/view.jpg (renamed from lib/debugger/doc/src/images/view.jpg) | bin | 34504 -> 34504 bytes | |||
-rw-r--r-- | lib/debugger/src/dbg_ieval.erl | 32 | ||||
-rw-r--r-- | lib/debugger/src/dbg_iload.erl | 6 | ||||
-rw-r--r-- | lib/debugger/src/dbg_wx_win.erl | 5 | ||||
-rw-r--r-- | lib/debugger/test/Makefile | 1 | ||||
-rw-r--r-- | lib/debugger/test/bs_size_expr_SUITE.erl | 273 | ||||
-rw-r--r-- | lib/debugger/test/exception_SUITE.erl | 81 | ||||
-rw-r--r-- | lib/debugger/test/int_eval_SUITE_data/stacktrace.erl | 13 | ||||
-rw-r--r-- | lib/debugger/test/line_number_SUITE.erl | 4 | ||||
-rw-r--r-- | lib/debugger/test/map_SUITE.erl | 52 | ||||
-rw-r--r-- | lib/debugger/vsn.mk | 2 |
24 files changed, 479 insertions, 207 deletions
diff --git a/lib/debugger/Makefile b/lib/debugger/Makefile index 8c8b617831..3a06d72c5d 100644 --- a/lib/debugger/Makefile +++ b/lib/debugger/Makefile @@ -34,3 +34,7 @@ SPECIAL_TARGETS = # Default Subdir Targets # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk + +DIA_PLT_APPS=wx + +include $(ERL_TOP)/make/app_targets.mk diff --git a/lib/debugger/doc/src/Makefile b/lib/debugger/doc/src/Makefile index 49b5a4be57..b02d35b802 100644 --- a/lib/debugger/doc/src/Makefile +++ b/lib/debugger/doc/src/Makefile @@ -30,11 +30,6 @@ VSN=$(DEBUGGER_VSN) APPLICATION=debugger # ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- # Target Specs # ---------------------------------------------------- XML_APPLICATION_FILES = ref_man.xml @@ -49,74 +44,13 @@ XML_FILES = \ $(BOOK_FILES) $(XML_CHAPTER_FILES) $(XML_PART_FILES) \ $(XML_REF3_FILES) $(XML_APPLICATION_FILES) -GIF_FILES = \ - images/attach.jpg \ - images/cond_break_dialog.jpg \ - images/function_break_dialog.jpg \ - images/interpret.jpg \ - images/line_break_dialog.jpg \ - images/monitor.jpg \ - images/view.jpg - -# ---------------------------------------------------- - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.jpg: %.jpg - $(INSTALL_DIR) $(HTMLDIR)/images - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -rf $(XMLDIR) - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR_DATA) $(HTMLDIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" +IMAGE_FILES = \ + attach.jpg \ + cond_break_dialog.jpg \ + function_break_dialog.jpg \ + interpret.jpg \ + line_break_dialog.jpg \ + monitor.jpg \ + view.jpg -release_spec: +include $(ERL_TOP)/make/doc.mk diff --git a/lib/debugger/doc/src/images/attach.jpg b/lib/debugger/doc/src/attach.jpg Binary files differindex 95f227d21b..95f227d21b 100644 --- a/lib/debugger/doc/src/images/attach.jpg +++ b/lib/debugger/doc/src/attach.jpg diff --git a/lib/debugger/doc/src/images/cond_break_dialog.jpg b/lib/debugger/doc/src/cond_break_dialog.jpg Binary files differindex 40bcb299a9..40bcb299a9 100644 --- a/lib/debugger/doc/src/images/cond_break_dialog.jpg +++ b/lib/debugger/doc/src/cond_break_dialog.jpg diff --git a/lib/debugger/doc/src/debugger_chapter.xml b/lib/debugger/doc/src/debugger_chapter.xml index 3c37d4b924..a0c67b3257 100644 --- a/lib/debugger/doc/src/debugger_chapter.xml +++ b/lib/debugger/doc/src/debugger_chapter.xml @@ -38,7 +38,7 @@ <p><em>Step 1.</em> Start Debugger by calling <c>debugger:start()</c>.</p> - <p>The <seealso marker="#monitor">Monitor window</seealso> is + <p>The <seeguide marker="#monitor">Monitor window</seeguide> is displayed with information about all debugged processes, interpreted modules, and selected options. Initially there are normally no debugged processes. First, it must be specified which @@ -48,7 +48,7 @@ <p><em>Step 2.</em> Select <em>Module > Interpret...</em> in the Monitor window.</p> - <p>The <seealso marker="#interpret">Interpret Modules window</seealso> + <p>The <seeguide marker="#interpret">Interpret Modules window</seeguide> is displayed.</p> <p><em>Step 3.</em> Select the appropriate modules from the Interpret @@ -64,10 +64,10 @@ <em>Module > the module to be interpreted > View</em>.</p> <p>The contents of the source file is displayed in the - <seealso marker="#view">View Module window</seealso>.</p> + <seeguide marker="#view">View Module window</seeguide>.</p> <p><em>Step 5.</em> Set the - <seealso marker="#breakpoints">breakpoints</seealso>, if any.</p> + <seeguide marker="#breakpoints">breakpoints</seeguide>, if any.</p> <p><em>Step 6.</em> Start the program to be debugged. This is done the normal way from the Erlang shell.</p> @@ -78,7 +78,7 @@ <p><em>Step 7.</em> To <em>attach</em> to one of these processes, double-click it, or select the process and then choose <em>Process > Attach</em>. Attaching to a process opens an - <seealso marker="#attach">Attach Process window</seealso> for this + <seeguide marker="#attach">Attach Process window</seeguide> for this process.</p> <p><em>Step 8.</em> From the Attach Process window, you can control @@ -153,7 +153,7 @@ <p>A line breakpoint is created at a certain line in a module.</p> - <image file="images/line_break_dialog.jpg"> + <image file="line_break_dialog.jpg"> <icaption>Line Break Dialog Window</icaption> </image> @@ -182,10 +182,10 @@ <p><c>Bindings</c> is a list of variable bindings. To retrieve the value of <c>Variable</c> (given as an atom), use function - <seealso marker="int#get_binding/2"><c>int:get_binding(Variable,Bindings)</c></seealso>. + <seemfa marker="int#get_binding/2"><c>int:get_binding(Variable,Bindings)</c></seemfa>. The function returns <c>unbound</c> or <c>{value,Value}</c>.</p> - <image file="images/cond_break_dialog.jpg"> + <image file="cond_break_dialog.jpg"> <icaption>Conditional Break Dialog Window</icaption> </image> @@ -225,7 +225,7 @@ c_break(Bindings) -> <p>A function breakpoint is a set of line breakpoints, one at the first line of each clause in the specified function.</p> - <image file="images/function_break_dialog.jpg"> + <image file="function_break_dialog.jpg"> <icaption>Function Break Dialog Window</icaption> </image> @@ -255,7 +255,7 @@ c_break(Bindings) -> {shell,eval_loop,3,[{file,"shell.erl"},{line,614}]}]}}</pre> <p>For details about the stack trace, see section - <seealso marker="doc/reference_manual:errors">Errors and Error Handling</seealso> + <seeguide marker="system/reference_manual:errors">Errors and Error Handling</seeguide> in the Erlang Reference Manual.</p> <p>Debugger emulates the stack trace by keeping track of recently @@ -265,7 +265,7 @@ c_break(Bindings) -> <p>This information can be used to traverse the chain of function calls, using the <em>Up</em> and <em>Down</em> buttons in the - <seealso marker="#attach">Attach Process window</seealso>.</p> + <seeguide marker="#attach">Attach Process window</seeguide>.</p> <p>By default, Debugger only saves information about recursive function calls, that is, function calls that have not yet returned @@ -286,7 +286,7 @@ c_break(Bindings) -> </note> <p>For information about how to change the stack trace option, see - section <seealso marker="#monitor">Monitor Window</seealso>.</p> + section <seeguide marker="#monitor">Monitor Window</seeguide>.</p> </section> <section> @@ -307,14 +307,14 @@ c_break(Bindings) -> modules</p></item> </list> - <image file="images/monitor.jpg"> + <image file="monitor.jpg"> <icaption>Monitor Window</icaption> </image> <p>The <em>Auto Attach</em> boxes, <em>Stack Trace</em> label, <em>Back Trace Size</em> label, and <em>Strings</em> box display some options set. For details about these options, see section - <seealso marker="#options">Options Menu</seealso>.</p> + <seeguide marker="#options">Options Menu</seeguide>.</p> <section> <title>Process Grid</title> @@ -410,7 +410,7 @@ c_break(Bindings) -> <taglist> <tag><em>Interpret...</em></tag> <item><p>Opens the - <seealso marker="#interpret">Interpret Modules window</seealso>, + <seeguide marker="#interpret">Interpret Modules window</seeguide>, where new modules to be interpreted can be specified.</p></item> <tag><em>Delete All</em></tag> @@ -427,7 +427,7 @@ c_break(Bindings) -> <tag><em>View</em></tag> <item><p>Opens a - <seealso marker="#view">View Module window</seealso>, displaying the + <seeguide marker="#view">View Module window</seeguide>, displaying the contents of the selected module.</p></item> </taglist> </section> @@ -437,7 +437,7 @@ c_break(Bindings) -> <p>The following menu items apply to the currently selected process, provided it is stopped at a breakpoint (for details, see section - <seealso marker="#attach">Attach Process window</seealso>):</p> + <seeguide marker="#attach">Attach Process window</seeguide>):</p> <taglist> <tag><em>Step</em></tag><item></item> <tag><em>Next</em></tag><item></item> @@ -450,7 +450,7 @@ c_break(Bindings) -> <taglist> <tag><em>Attach</em></tag> <item><p>Attaches to the process and open an - <seealso marker="#attach">Attach Process window</seealso>.</p></item> + <seeguide marker="#attach">Attach Process window</seeguide>.</p></item> <tag><em>Kill</em></tag> <item><p>Terminates the process using <c>exit(Pid,kill)</c>.</p></item> @@ -461,7 +461,7 @@ c_break(Bindings) -> <title>Break Menu</title> <p>The items in this menu are used to create and delete breakpoints. For details, see section - <seealso marker="#breakpoints">Breakpoints</seealso>.</p> + <seeguide marker="#breakpoints">Breakpoints</seeguide>.</p> <taglist> <tag><em>Line Break...</em></tag> @@ -495,7 +495,7 @@ c_break(Bindings) -> <taglist> <tag><em>Trace Window</em></tag> <item><p>Sets the areas to be visible in an - <seealso marker="#attach">Attach Process window</seealso>. + <seeguide marker="#attach">Attach Process window</seeguide>. Does not affect existing Attach Process windows.</p> </item> @@ -513,7 +513,7 @@ c_break(Bindings) -> <tag><em>Stack Trace</em></tag> <item><p>Sets the stack trace option, see section - <seealso marker="#stack_trace">Stack Trace</seealso>. Does not + <seeguide marker="#stack_trace">Stack Trace</seeguide>. Does not affect existing debugged processes.</p> <list type="bulleted"> <item><p><em>Stack On, Tail</em> - Saves information about all @@ -532,7 +532,7 @@ c_break(Bindings) -> <list type="bulleted"> <item><p><em>Use range of +pc flag</em> - Uses the printable character range set by the <c>erl(1)</c> flag - <seealso marker="erts:erl#printable_character_range"><c>+pc</c></seealso>.</p> + <seecom marker="erts:erl#printable_character_range"><c>+pc</c></seecom>.</p> </item> </list> </item> @@ -593,7 +593,7 @@ c_break(Bindings) -> <pre> 4> c(module, debug_info).</pre> - <image file="images/interpret.jpg"> + <image file="interpret.jpg"> <icaption>Interpret Modules Window</icaption> </image> @@ -609,7 +609,7 @@ c_break(Bindings) -> <note> <p>When Debugger is started in global mode (which is the default, see - <seealso marker="debugger#start/0">debugger:start/0</seealso>), + <seemfa marker="debugger#start/0">debugger:start/0</seemfa>), modules added (or deleted) for interpretation are added (or deleted) on all known Erlang nodes.</p> </note> @@ -624,7 +624,7 @@ c_break(Bindings) -> been attached to. Notice that when attaching to a process, its execution is automatically stopped.</p> - <image file="images/attach.jpg"> + <image file="attach.jpg"> <icaption>Attach Process Window</icaption> </image> @@ -785,13 +785,13 @@ c_break(Bindings) -> other Attach Process windows.</p></item> <tag><em>Stack Trace</em></tag> - <item><p>Same as in the <seealso marker="#monitor">Monitor - window</seealso>, but only affects the debugged + <item><p>Same as in the <seeguide marker="#monitor">Monitor + window</seeguide>, but only affects the debugged process the window is attached to.</p></item> <tag><em>Strings</em></tag> - <item><p>Same as in the <seealso marker="#monitor">Monitor - window</seealso>, but only affects the debugged + <item><p>Same as in the <seeguide marker="#monitor">Monitor + window</seeguide>, but only affects the debugged process the window is attached to.</p></item> <tag><em>Back Trace Size...</em></tag> @@ -806,7 +806,7 @@ c_break(Bindings) -> <p>The <em>Break</em>, <em>Windows</em>, and <em>Help</em> menus are the same as in the - <seealso marker="#monitor">Monitor Window</seealso>, except + <seeguide marker="#monitor">Monitor Window</seeguide>, except that the <em>Breaks</em> menu applies only to local breakpoints.</p> </section> @@ -819,7 +819,7 @@ c_break(Bindings) -> <p>The View Module window displays the contents of an interpreted module and makes it possible to set breakpoints.</p> - <image file="images/view.jpg"> + <image file="view.jpg"> <icaption>View Module Window</icaption> </image> @@ -837,7 +837,7 @@ c_break(Bindings) -> <section> <title>File and Edit Menus</title> <p>The <em>File</em> and <em>Edit</em> menus are the same as in the - <seealso marker="#attach">Attach Process Window</seealso>.</p> + <seeguide marker="#attach">Attach Process Window</seeguide>.</p> </section> <section> @@ -845,7 +845,7 @@ c_break(Bindings) -> <p>The <em>Break</em>, <em>Windows</em>, and <em>Help</em> menus are the same as in the - <seealso marker="#monitor">Monitor Window</seealso>, except + <seeguide marker="#monitor">Monitor Window</seeguide>, except that the <em>Break</em> menu applies only to local breakpoints.</p> </section> </section> @@ -881,7 +881,7 @@ c_break(Bindings) -> <title>Debugging Remote Nodes</title> <p>By using - <seealso marker="debugger#start/1">debugger:start/1</seealso>, + <seemfa marker="debugger#start/1">debugger:start/1</seemfa>, you can specify if Debugger is to be started in local or global mode:</p> <pre> diff --git a/lib/debugger/doc/src/images/function_break_dialog.jpg b/lib/debugger/doc/src/function_break_dialog.jpg Binary files differindex db56d5a096..db56d5a096 100644 --- a/lib/debugger/doc/src/images/function_break_dialog.jpg +++ b/lib/debugger/doc/src/function_break_dialog.jpg diff --git a/lib/debugger/doc/src/i.xml b/lib/debugger/doc/src/i.xml index 06b0eb876a..b74a7ab8b9 100644 --- a/lib/debugger/doc/src/i.xml +++ b/lib/debugger/doc/src/i.xml @@ -34,7 +34,7 @@ <p>The <c>i</c> module provides short forms for some of the functions used by the graphical Debugger and some of the functions in module - <seealso marker="int"><c>int</c></seealso>, the Erlang interpreter.</p> + <seeerl marker="int"><c>int</c></seeerl>, the Erlang interpreter.</p> <p>This module also provides facilities for displaying status information about interpreted processes and break points.</p> @@ -45,7 +45,7 @@ attached manually or automatically.</p> <p>By preference, these functions can be included in module - <seealso marker="stdlib:shell_default"><c>shell_default</c></seealso>. + <seeerl marker="stdlib:shell_default"><c>shell_default</c></seeerl>. By default, they are included in that module.</p> </description> @@ -77,9 +77,9 @@ <desc> <p>Interprets the specified module(s). <c>ii/1</c> interprets the module(s) only at the current node, see - <seealso marker="int#i/1">int:i/1</seealso>. <c>ini/1</c> + <seemfa marker="int#i/1">int:i/1</seemfa>. <c>ini/1</c> interprets the module(s) at all known nodes, see - <seealso marker="int#ni/1">int:ni/1</seealso>.</p> + <seemfa marker="int#ni/1">int:ni/1</seemfa>.</p> </desc> </func> @@ -141,7 +141,7 @@ <desc> <p>Sets when and how to attach to a debugged process automatically, see - <seealso marker="int#auto_attach/0">int:auto_attach/2</seealso>. + <seemfa marker="int#auto_attach/0">int:auto_attach/2</seemfa>. <c>Function</c> defaults to the standard function used by Debugger.</p> </desc> @@ -155,7 +155,7 @@ </type> <desc> <p>Sets how to save call frames in the stack, see - <seealso marker="int#stack_trace/0">int:stack_trace/1</seealso>.</p> + <seemfa marker="int#stack_trace/0">int:stack_trace/1</seemfa>.</p> </desc> </func> @@ -343,7 +343,7 @@ the current variable bindings. The function must return <c>true</c> (break) or <c>false</c> (do not break). To retrieve the value of a variable <c>Var</c>, use - <seealso marker="int#get_binding/2">int:get_binding(Var, Bindings)</seealso>.</p> + <seemfa marker="int#get_binding/2">int:get_binding(Var, Bindings)</seemfa>.</p> </desc> </func> @@ -387,7 +387,7 @@ <section> <title>See Also</title> - <p><seealso marker="int"><c>int(3)</c></seealso></p> + <p><seeerl marker="int"><c>int(3)</c></seeerl></p> </section> </erlref> diff --git a/lib/debugger/doc/src/int.xml b/lib/debugger/doc/src/int.xml index a0078714e6..d0706f2aa2 100644 --- a/lib/debugger/doc/src/int.xml +++ b/lib/debugger/doc/src/int.xml @@ -34,7 +34,7 @@ <p>The Erlang interpreter provides mechanisms for breakpoints and stepwise execution of code. It is primarily intended to be used by Debugger, see the User's Guide and - <seealso marker="debugger"><c>debugger(3)</c></seealso>.</p> + <seeerl marker="debugger"><c>debugger(3)</c></seeerl>.</p> <p>The following can be done from the shell:</p> <list type="bulleted"> @@ -316,7 +316,7 @@ spawn(Module, Name, [Pid | Args])</pre> tail recursive calls. This is the default.</p></item> <tag><c>false</c></tag> - <item><p>Save no information about currentcalls.</p></item> + <item><p>Save no information about current calls.</p></item> </taglist> </desc> </func> @@ -433,7 +433,7 @@ spawn(Module, Name, [Pid | Args])</pre> <p>Sets the conditional test of the breakpoint at <c>Line</c> in <c>Module</c> to <c>Function</c>. The function must fulfill the requirements specified in section - <seealso marker="#int_breakpoints">Breakpoints</seealso>.</p> + <seeerl marker="#int_breakpoints">Breakpoints</seeerl>.</p> </desc> </func> diff --git a/lib/debugger/doc/src/images/interpret.jpg b/lib/debugger/doc/src/interpret.jpg Binary files differindex 030c06fa23..030c06fa23 100644 --- a/lib/debugger/doc/src/images/interpret.jpg +++ b/lib/debugger/doc/src/interpret.jpg diff --git a/lib/debugger/doc/src/introduction.xml b/lib/debugger/doc/src/introduction.xml index 95a42cad09..66a86ff753 100644 --- a/lib/debugger/doc/src/introduction.xml +++ b/lib/debugger/doc/src/introduction.xml @@ -39,7 +39,7 @@ </p> <p>The Erlang interpreter can also be accessed through the interface - module <seealso marker="int"><c>int(3)</c></seealso>. + module <seeerl marker="int"><c>int(3)</c></seeerl>. </p> <warning> diff --git a/lib/debugger/doc/src/images/line_break_dialog.jpg b/lib/debugger/doc/src/line_break_dialog.jpg Binary files differindex 18ac6a9f81..18ac6a9f81 100644 --- a/lib/debugger/doc/src/images/line_break_dialog.jpg +++ b/lib/debugger/doc/src/line_break_dialog.jpg diff --git a/lib/debugger/doc/src/images/monitor.jpg b/lib/debugger/doc/src/monitor.jpg Binary files differindex 32f210cbf2..32f210cbf2 100644 --- a/lib/debugger/doc/src/images/monitor.jpg +++ b/lib/debugger/doc/src/monitor.jpg diff --git a/lib/debugger/doc/src/notes.xml b/lib/debugger/doc/src/notes.xml index 64af47a4fb..5e3f2ce878 100644 --- a/lib/debugger/doc/src/notes.xml +++ b/lib/debugger/doc/src/notes.xml @@ -33,6 +33,43 @@ <p>This document describes the changes made to the Debugger application.</p> +<section><title>Debugger 5.0</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>EEP-52 has been implemented.</p> + <p>In binary matching, the size of the segment to be + matched is now allowed to be a guard expression, and + similarly in map matching the keys can now be guard + expressions. See the Erlang Reference Manual and + Programming Examples for more details.</p> + <p>Language compilers or code generators that generate + Core Erlang code may need to be updated to be compatible + with the compiler in OTP 23. For more details, see the + section Backwards Compatibility in <url + href="http://erlang.org/eeps/eep-0052.html">EEP + 52</url>.</p> + <p> + Own Id: OTP-14708</p> + </item> + <item> + <p>The deprecated <c>erlang:get_stacktrace/0</c> BIF now + returns an empty list instead of a stacktrace. To + retrieve the stacktrace, use the extended try/catch + syntax that was introduced in OTP 21. + <c>erlang:get_stacktrace/0</c> is scheduled for removal + in OTP 24.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-16484</p> + </item> + </list> + </section> + +</section> + <section><title>Debugger 4.2.8</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/debugger/doc/src/images/view.jpg b/lib/debugger/doc/src/view.jpg Binary files differindex 7ffd511eff..7ffd511eff 100644 --- a/lib/debugger/doc/src/images/view.jpg +++ b/lib/debugger/doc/src/view.jpg diff --git a/lib/debugger/src/dbg_ieval.erl b/lib/debugger/src/dbg_ieval.erl index b6703d5d9e..38c2035c5c 100644 --- a/lib/debugger/src/dbg_ieval.erl +++ b/lib/debugger/src/dbg_ieval.erl @@ -693,7 +693,7 @@ expr({'try',Line,Es,CaseCs,CatchCs,[]}, Bs0, Ieval0) -> end catch Class:Reason when CatchCs =/= [] -> - catch_clauses({Class,Reason,[]}, CatchCs, Bs0, Ieval) + catch_clauses({Class,Reason,get_stacktrace()}, CatchCs, Bs0, Ieval) end; expr({'try',Line,Es,CaseCs,CatchCs,As}, Bs0, Ieval0) -> Ieval = Ieval0#ieval{line=Line}, @@ -706,7 +706,7 @@ expr({'try',Line,Es,CaseCs,CatchCs,As}, Bs0, Ieval0) -> end catch Class:Reason when CatchCs =/= [] -> - catch_clauses({Class,Reason,[]}, CatchCs, Bs0, Ieval) + catch_clauses({Class,Reason,get_stacktrace()}, CatchCs, Bs0, Ieval) after seq(As, Bs0, Ieval#ieval{top=false}) end; @@ -905,14 +905,9 @@ expr({dbg,Line,self,[]}, Bs, #ieval{level=Le}) -> Self = get(self), trace(return, {Le,Self}), {value,Self,Bs}; -expr({dbg,Line,get_stacktrace,[]}, Bs, #ieval{level=Le}) -> - trace(bif, {Le,Line,erlang,get_stacktrace,[]}), - Stacktrace = get_stacktrace(), - trace(return, {Le,Stacktrace}), - {value,Stacktrace,Bs}; expr({dbg,Line,raise,As0}, Bs0, #ieval{level=Le}=Ieval0) -> - %% Since erlang:get_stacktrace/0 is emulated, we will - %% need to emulate erlang:raise/3 too so that we can + %% Since stacktraces are emulated, we will + %% need to emulate erlang:raise/3 so that we can %% capture the stacktrace. Ieval = Ieval0#ieval{line=Line}, {[Class,Reason,Stk0]=As,Bs} = eval_list(As0, Bs0, Ieval), @@ -1383,7 +1378,7 @@ catch_clauses(Exception, [{clause,_,[P],G,B}|CatchCs], Bs0, Ieval) -> nomatch -> catch_clauses(Exception, CatchCs, Bs0, Ieval) end; -catch_clauses({Class,Reason,[]}, [], _Bs, _Ieval) -> +catch_clauses({Class,Reason,_}, [], _Bs, _Ieval) -> erlang:Class(Reason). receive_clauses(Cs, Bs0, [Msg|Msgs]) -> @@ -1592,12 +1587,17 @@ match_tuple([], _, _, Bs, _BBs) -> {match,Bs}. match_map([{map_field_exact,_,K0,Pat}|Fs], Map, Bs0, BBs) -> - {value,K,BBs} = expr(K0, BBs, #ieval{}), - case maps:find(K, Map) of - {ok,Value} -> - {match,Bs} = match1(Pat, Value, Bs0, BBs), - match_map(Fs, Map, Bs, BBs); - error -> throw(nomatch) + try guard_expr(K0, BBs) of + {value,K} -> + case Map of + #{K := Value} -> + {match,Bs} = match1(Pat, Value, Bs0, BBs), + match_map(Fs, Map, Bs, BBs); + #{} -> + throw(nomatch) + end + catch _:_ -> + throw(nomatch) end; match_map([], _, Bs, _BBs) -> {match,Bs}. diff --git a/lib/debugger/src/dbg_iload.erl b/lib/debugger/src/dbg_iload.erl index 468f6a809f..d15292d51d 100644 --- a/lib/debugger/src/dbg_iload.erl +++ b/lib/debugger/src/dbg_iload.erl @@ -204,7 +204,7 @@ pattern({tuple,Anno,Ps0}) -> {tuple,ln(Anno),Ps1}; pattern({map,Anno,Fs0}) -> Fs1 = lists:map(fun ({map_field_exact,L,K,V}) -> - {map_field_exact,L,expr(K, false),pattern(V)} + {map_field_exact,L,gexpr(K),pattern(V)} end, Fs0), {map,ln(Anno),Fs1}; pattern({op,_,'-',{integer,Anno,I}}) -> @@ -226,7 +226,7 @@ pattern({bin_element,Anno,Expr0,Size0,Type0}) -> {Size1,Type} = make_bit_type(Anno, Size0, Type0), Expr1 = pattern(Expr0), Expr = coerce_to_float(Expr1, Type0), - Size = pattern(Size1), + Size = expr(Size1, false), {bin_element,ln(Anno),Expr,Size,Type}; %% Evaluate compile-time expressions. pattern({op,_,'++',{nil,_},R}) -> @@ -438,8 +438,6 @@ expr({'fun',Anno,{function,M,F,A}}, _Lc) -> {make_ext_fun,ln(Anno),MFA}; expr({call,Anno,{remote,_,{atom,_,erlang},{atom,_,self}},[]}, _Lc) -> {dbg,ln(Anno),self,[]}; -expr({call,Anno,{remote,_,{atom,_,erlang},{atom,_,get_stacktrace}},[]}, _Lc) -> - {dbg,ln(Anno),get_stacktrace,[]}; expr({call,Anno,{remote,_,{atom,_,erlang},{atom,_,throw}},[_]=As}, _Lc) -> {dbg,ln(Anno),throw,expr_list(As)}; expr({call,Anno,{remote,_,{atom,_,erlang},{atom,_,error}},[_]=As}, _Lc) -> diff --git a/lib/debugger/src/dbg_wx_win.erl b/lib/debugger/src/dbg_wx_win.erl index 4391ad1598..25b76d1739 100644 --- a/lib/debugger/src/dbg_wx_win.erl +++ b/lib/debugger/src/dbg_wx_win.erl @@ -304,7 +304,10 @@ to_string(Integer) when is_integer(Integer) -> integer_to_list(Integer); to_string([]) -> ""; to_string(List) when is_list(List) -> - List; + try unicode:characters_to_list(List) + catch _:_ -> + io_lib:format("~tp",[List]) + end; to_string(Term) -> io_lib:format("~tp",[Term]). diff --git a/lib/debugger/test/Makefile b/lib/debugger/test/Makefile index efb6d9ed8b..0f942923f3 100644 --- a/lib/debugger/test/Makefile +++ b/lib/debugger/test/Makefile @@ -32,6 +32,7 @@ MODULES= \ bs_match_int_SUITE \ bs_match_misc_SUITE \ bs_match_tail_SUITE \ + bs_size_expr_SUITE \ bs_utf_SUITE \ bug_SUITE \ erl_eval_SUITE \ diff --git a/lib/debugger/test/bs_size_expr_SUITE.erl b/lib/debugger/test/bs_size_expr_SUITE.erl new file mode 100644 index 0000000000..864233f282 --- /dev/null +++ b/lib/debugger/test/bs_size_expr_SUITE.erl @@ -0,0 +1,273 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2019. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% %CopyrightEnd% +%% + +-module(bs_size_expr_SUITE). +-compile(nowarn_shadow_vars). + +-export([all/0,suite/0,groups/0,init_per_suite/1, end_per_suite/1, + init_per_group/2,end_per_group/2, + init_per_testcase/2,end_per_testcase/2, + basic/1,size_shadow/1,complex/1, + recv/1,no_match/1]). + +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. + +all() -> + [{group,p}]. + +groups() -> + [{p,[], + [basic, + size_shadow, + complex, + recv, + no_match]}]. + +init_per_suite(Config) -> + test_lib:interpret(?MODULE), + true = lists:member(?MODULE, int:interpreted()), + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> + test_lib:interpret(?MODULE), + Config. + +end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> + ok. + +basic(_Config) -> + <<>> = do_basic(<<1:32>>), + <<"abcd">> = do_basic(<<2:32,"abcd">>), + no_match = do_basic(<<0:32>>), + no_match = do_basic(<<777:32>>), + ok. + +do_basic(Bin) -> + Res = do_basic_1(Bin), + + Res = do_basic_2({tag,Bin}), + Res = do_basic_2([list,Bin]), + 6 = do_basic_2({2,4}), + + Res = do_basic_3(Bin), + Res = do_basic_4(Bin), + + {result,Res} = do_basic_5(Bin), + case Res of + no_match -> + ok; + _ -> + {result,{Res,7777777}} = do_basic_5(<<Bin/binary,7777777:32>>) + end, + + Res. + +do_basic_1(<<Sz:32,Tail:(4*Sz-4)/binary>>) -> + Tail; +do_basic_1(<<_/binary>>) -> + no_match. + +do_basic_2({tag,<<Sz:32,Tail:(4*Sz-4)/binary>>}) -> + Tail; +do_basic_2([list,<<Sz:32,Tail:((Sz-1)*4)/binary>>]) -> + Tail; +do_basic_2({A,B}) when is_integer(A), is_integer(B) -> + A + B; +do_basic_2(_) -> + no_match. + +do_basic_3(Bin) -> + WordSize = id(4), + case Bin of + <<Sz:32,Tail:(WordSize*Sz-WordSize)/binary>> -> + Tail; + _ -> + no_match + end. + +do_basic_4(Bin) -> + WordSize = id(4), + F = fun() -> + case Bin of + <<Sz:32,Tail:(WordSize*Sz-WordSize)/binary>> -> + Tail; + _ -> + no_match + end + end, + F(). + +do_basic_5(Bin) -> + WordSize = id(4), + F = fun() -> + Res = case Bin of + <<Sz:32,Tail:(WordSize*Sz-WordSize)/binary,More:(8*WordSize)>> -> + {Tail,More}; + <<Sz:32,Tail:(WordSize*Sz-WordSize)/binary>> -> + Tail; + _ -> + no_match + end, + {result,Res} + end, + F(). + +size_shadow(_Config) -> + 12345678 = size_shadow_1(), + ok. + +size_shadow_1() -> + L = 8, + Offset = 16, + Fs = [fun(<<L:L,B:(L+16)>>) -> B end, + fun(<<L:L,B:(L+Offset)>>) -> B end, + fun(A) -> + Res = (fun([<<L:L,B:(L+16)>>]) -> B end)([A]), + Res = (fun([<<L:L,B:(L+Offset)>>]) -> B end)([A]) + end, + fun(A) -> + Res = (fun({<<L:L,B:(L+16)>>,<<L:L,B:(L+16)>>}) -> B end)({A,A}), + Res = (fun({<<L:L,B:(L+Offset)>>,<<L:L,B:(L+16)>>}) -> B end)({A,A}), + Res = (fun({<<L:L,B:(L+16)>>,<<L:L,B:(L+Offset)>>}) -> B end)({A,A}), + Res = (fun({<<L:L,B:(L+Offset)>>,<<L:L,B:(L+Offset)>>}) -> B end)({A,A}) + end, + fun(A) -> + <<Size:L,_/bits>> = A, + Inner = fun([L], {#{key1 := <<L:L,B:(L+Offset)>>, + key2 := <<L:L,B:(L+Offset)>>}, L}) -> B end, + Inner([Size], {#{key1 => A,key2 => A},Size}) + end], + size_shadow_apply(Fs, <<16:8, 12345678:32>>). + +size_shadow_apply([F|Fs], Arg) when is_function(F, 1) -> + size_shadow_apply(Fs, Arg, F(Arg)). + +size_shadow_apply([F|Fs], Arg, Res) when is_function(F, 1) -> + Res = F(Arg), + size_shadow_apply(Fs, Arg, Res); +size_shadow_apply([], _, Res) -> + Res. + +-record(r, {a,b,c}). +complex(Config) -> + (fun() -> + Len = length(id(Config)), + Bin = << <<I:13>> || I <- lists:seq(1, Len) >>, + <<Bin:(length(Config))/binary-unit:13>> = Bin + end)(), + + (fun() -> + V = id([a,b,c]), + F = fun(<<V:(bit_size(<<0:(length(V))>>)*8)/signed-integer>>) -> + V; + ({A,B}) -> + A + B + end, + -1 = F(<<-1:(length(V)*8)>>), + 7 = F({3,4}) + end)(), + + (fun() -> + A = a, + B = b, + F = fun(<<A:16,B:16,C:(A+B),D/bits>>) -> + {A,B,C,D}; + (<<A:16,B:16>>) -> + {A,B}; + (<<A:8,B:8>>) -> + {A,B} + end, + {13,21,16#cafebeef,<<"more">>} = F(<<13:16,21:16,16#cafebeef:34,"more">>), + {100,500} = F(<<100:16,500:16>>), + {157,77} = F(<<157:8,77:8>>), + {A,B} + end)(), + + (fun() -> + Two = id(2), + F = fun(a, <<_:(#r.a - Two)/binary,Int:8,_/binary>>) -> Int; + (b, <<_:(#r.b - Two)/binary,Int:8,_/binary>>) -> Int; + (c, <<_:(#r.c - Two)/binary,Int:8,_/binary>>) -> Int + end, + 1 = F(a, <<1,2,3>>), + 2 = F(b, <<1,2,3>>), + 3 = F(c, <<1,2,3>>) + end)(), + + (fun() -> + Bin = <<1,2,3,4>>, + F = fun(R) -> + <<First:(R#r.a)/binary,Tail/binary>> = Bin, + {First,Tail} + end, + {<<>>,<<1,2,3,4>>} = F(#r{a=0}), + {<<1>>,<<2,3,4>>} = F(#r{a=1}), + {<<1,2>>,<<3,4>>} = F(#r{a=2}), + {<<1,2,3>>,<<4>>} = F(#r{a=3}), + {<<1,2,3,4>>,<<>>} = F(#r{a=4}) + end)(), + + ok. + +recv(_Config) -> + R = fun(Msg) -> + self() ! Msg, + Res = receive + <<L,I:(L-1)/unit:8,X:32>> -> {I,X}; + <<L,I:(L-1)/unit:8,X:64>> -> {I,X} + end, + self() ! {tag,[Msg]}, + Res = receive + {tag,[<<L,I:(8*(L-1)),X:32>>]} -> {I,X}; + {tag,[<<L,I:(8*(L-1)),X:64>>]} -> {I,X} + end + end, + {1234,16#deadbeef} = R(<<3,1234:16,16#deadbeef:32>>), + {99,16#cafebeeff00d} = R(<<2,99:8,16#cafebeeff00d:64>>), + ok. + +no_match(_Config) -> + B = id(<<1,2,3,4>>), + no_match = case B of + <<Int:(bit_size(B)-1)>> -> Int; + <<Int:(bit_size(B)*2)>> -> Int; + <<Int:(length(B))>> -> Int; + _ -> no_match + end, + no_match = case B of + <<L:8,Int2:(is_integer(L))>> -> Int2; + <<L:8,Int2:(L+3.0)>> -> Int2; + _ -> no_match + end, + ok. + +id(I) -> + I. diff --git a/lib/debugger/test/exception_SUITE.erl b/lib/debugger/test/exception_SUITE.erl index ef824b00be..506d4d0366 100644 --- a/lib/debugger/test/exception_SUITE.erl +++ b/lib/debugger/test/exception_SUITE.erl @@ -275,67 +275,43 @@ ba_bnot(A) -> {'EXIT', {badarith, _}} = (catch bnot A). stacktrace(Conf) when is_list(Conf) -> - Tag = make_ref(), - {_,Mref} = spawn_monitor(fun() -> exit({Tag,erlang:get_stacktrace()}) end), - {Tag,[]} = receive {'DOWN',Mref,_,_,Info} -> Info end, V = [make_ref()|self()], {value2,{caught1,badarg,[{erlang,abs,[V],_}|_]=St1}} = stacktrace_1({'abs',V}, error, {value,V}), - St1 = erase(stacktrace1), - St1 = erase(stacktrace2), - St1 = erlang:get_stacktrace(), {caught2,{error,badarith},[{?MODULE,my_add,2,_}|_]=St2} = stacktrace_1({'div',{1,0}}, error, {'add',{0,a}}), - [{?MODULE,my_div,2,_}|_] = erase(stacktrace1), - St2 = erase(stacktrace2), - St2 = erlang:get_stacktrace(), {caught2,{error,{try_clause,V}},[{?MODULE,stacktrace_1,3,_}|_]=St3} = stacktrace_1({value,V}, error, {value,V}), - St3 = erase(stacktrace1), - St3 = erase(stacktrace2), - St3 = erlang:get_stacktrace(), {caught2,{throw,V},[{?MODULE,foo,1,_}|_]=St4} = stacktrace_1({value,V}, error, {throw,V}), - [{?MODULE,stacktrace_1,3,_}|_] = erase(stacktrace1), - St4 = erase(stacktrace2), - St4 = erlang:get_stacktrace(), ok. stacktrace_1(X, C1, Y) -> - erase(stacktrace1), - erase(stacktrace2), try try foo(X) of C1 -> value1 catch - C1:D1 -> {caught1,D1,erlang:get_stacktrace()} + C1:D1:S1 -> {caught1,D1,S1} after - put(stacktrace1, erlang:get_stacktrace()), foo(Y) end of V2 -> {value2,V2} catch - C2:D2 -> {caught2,{C2,D2},erlang:get_stacktrace()} - after - put(stacktrace2, erlang:get_stacktrace()) + C2:D2:S2 -> {caught2,{C2,D2},S2} end. nested_stacktrace(Conf) when is_list(Conf) -> V = [{make_ref()}|[self()]], - value1 = - nested_stacktrace_1({{value,{V,x1}},void,{V,x1}}, - {void,void,void}), + value1 = nested_stacktrace_1({{value,{V,x1}},void,{V,x1}}, + {void,void,void}), {caught1, [{?MODULE,my_add,2,_}|_], - value2, - [{?MODULE,my_add,2,_}|_]} = - nested_stacktrace_1({{'add',{V,x1}},error,badarith}, - {{value,{V,x2}},void,{V,x2}}), + value2} = nested_stacktrace_1({{'add',{V,x1}},error,badarith}, + {{value,{V,x2}},void,{V,x2}}), {caught1, [{?MODULE,my_add,2,_}|_], - {caught2,[{erlang,abs,[V],_}|_]}, - [{erlang,abs,[V],_}|_]} = + {caught2,[{erlang,abs,[V],_}|_]}} = nested_stacktrace_1({{'add',{V,x1}},error,badarith}, {{'abs',V},error,badarg}), ok. @@ -344,15 +320,13 @@ nested_stacktrace_1({X1,C1,V1}, {X2,C2,V2}) -> try foo(X1) of V1 -> value1 catch - C1:V1 -> - S1 = erlang:get_stacktrace(), - T2 = - try foo(X2) of - V2 -> value2 - catch - C2:V2 -> {caught2,erlang:get_stacktrace()} + C1:V1:S1 -> + T2 = try foo(X2) of + V2 -> value2 + catch + C2:V2:S2 -> {caught2,S2} end, - {caught1,S1,T2,erlang:get_stacktrace()} + {caught1,S1,T2} end. @@ -363,17 +337,14 @@ raise(Conf) when is_list(Conf) -> try try foo({'div',{1,0}}) catch - error:badarith -> - put(raise, A0 = erlang:get_stacktrace()), + error:badarith:A0 -> + put(raise, A0), erlang:raise(error, badarith, A0) end catch - error:badarith -> - A1 = erlang:get_stacktrace(), + error:badarith:A1 -> A1 = get(raise) end, - A = erlang:get_stacktrace(), - A = get(raise), [{?MODULE,my_div,2,_}|_] = A, %% N = 8, % Must be even @@ -381,19 +352,18 @@ raise(Conf) when is_list(Conf) -> try even(N) catch error:function_clause -> ok end, - B = odd_even(N, []), - B = erlang:get_stacktrace(), %% - C0 = odd_even(N+1, []), - C = lists:sublist(C0, N), - try odd(N+1) - catch error:function_clause -> ok + C = odd_even(N+1, []), + try + odd(N+1) + catch + error:function_clause -> ok end, - C = erlang:get_stacktrace(), - try erlang:raise(error, function_clause, C0) - catch error:function_clause -> ok + try + erlang:raise(error, function_clause, C) + catch + error:function_clause -> ok end, - C = erlang:get_stacktrace(), ok. odd_even(N, R) when is_integer(N), N > 1 -> @@ -436,7 +406,6 @@ my_abs(X) -> abs(X). gunilla(Config) when is_list(Config) -> {throw,kalle} = gunilla_1(), - [] = erlang:get_stacktrace(), ok. gunilla_1() -> diff --git a/lib/debugger/test/int_eval_SUITE_data/stacktrace.erl b/lib/debugger/test/int_eval_SUITE_data/stacktrace.erl index 3380178fdc..591841ada3 100644 --- a/lib/debugger/test/int_eval_SUITE_data/stacktrace.erl +++ b/lib/debugger/test/int_eval_SUITE_data/stacktrace.erl @@ -3,10 +3,15 @@ ?MODULE() -> OldDepth = erlang:system_flag(backtrace_depth, 32), - done = (catch do_try()), - Stk = trim(erlang:get_stacktrace()), - erlang:system_flag(backtrace_depth, OldDepth), - {done,Stk}. + try + do_try() + catch + throw:done:Stk0 -> + Stk = trim(Stk0), + {done,Stk} + after + erlang:system_flag(backtrace_depth, OldDepth) + end. trim([{int_eval_SUITE,_,_,_}|_]) -> []; diff --git a/lib/debugger/test/line_number_SUITE.erl b/lib/debugger/test/line_number_SUITE.erl index 276473b95f..4ad84b5a3b 100644 --- a/lib/debugger/test/line_number_SUITE.erl +++ b/lib/debugger/test/line_number_SUITE.erl @@ -90,8 +90,8 @@ close_calls(Where) -> %Line 86 call2(), %Line 90 call3(), %Line 91 no_crash %Line 92 - catch error:crash -> - erlang:get_stacktrace() %Line 94 + catch error:crash:Stk -> + Stk %Line 94 end. %Line 95 call1() -> %Line 97 diff --git a/lib/debugger/test/map_SUITE.erl b/lib/debugger/test/map_SUITE.erl index 4d8a86f5a2..7c4ded5082 100644 --- a/lib/debugger/test/map_SUITE.erl +++ b/lib/debugger/test/map_SUITE.erl @@ -88,7 +88,10 @@ %% misc t_pdict/1, - t_ets/1 + t_ets/1, + + %% new in OTP 23 + t_key_expressions/1 ]). -include_lib("stdlib/include/ms_transform.hrl"). @@ -150,7 +153,10 @@ all() -> [ %% Other functions t_pdict, - t_ets + t_ets, + + %% new in OTP 23 + t_key_expressions ]. groups() -> []. @@ -2233,6 +2239,48 @@ validate_frequency([{T,C}|Fs],Tf) -> end; validate_frequency([], _) -> ok. +t_key_expressions(_Config) -> + Int = id(42), + #{{tag,Int} := 42} = id(#{{tag,Int} => 42}), + #{{tag,Int+1} := 42} = id(#{{tag,Int+1} => 42}), + #{{a,b} := x, {tag,Int} := 42, Int := 0} = + id(#{{a,b} => x, {tag,Int} => 42, Int => 0}), + + F1 = fun(#{Int + 1 := Val}) -> Val end, + val = F1(#{43 => val}), + {'EXIT',_} = (catch F1(a)), + + F2 = fun(M, X, Y) -> + case M of + #{element(X, Y) := <<Sz:16,Bin:Sz/binary>>} -> + Bin; + #{} -> + not_found; + {A,B} -> + A + B + end + end, + <<"xyz">> = F2(#{b => <<3:16,"xyz">>}, 2, {a,b,c}), + not_found = F2(#{b => <<3:16,"xyz">>}, 999, {a,b,c}), + 13 = F2({6,7}, 1, 2), + + #{<<"Спутник"/utf8>> := 1} = id(#{<<"Спутник"/utf8>> => 1}), + + F3 = fun(Arg) -> + erase(once), + RunOnce = fun(I) -> + undefined = put(once, twice), + id(I) + end, + case RunOnce(Arg) of + #{{tag,<<Int:42>>} := Value} -> Value; + {X,Y} -> X + Y + end + end, + 10 = F3({7,3}), + whatever = F3(#{{tag,<<Int:42>>} => whatever}), + + ok. %% aux diff --git a/lib/debugger/vsn.mk b/lib/debugger/vsn.mk index 06fc743270..8e334a00f5 100644 --- a/lib/debugger/vsn.mk +++ b/lib/debugger/vsn.mk @@ -1 +1 @@ -DEBUGGER_VSN = 4.2.8 +DEBUGGER_VSN = 5.0 |