Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 71020 - [breakpoints] "Create Tracepoint" action (conditional breakpoint with side-effect)
Summary: [breakpoints] "Create Tracepoint" action (conditional breakpoint with side-ef...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement with 3 votes (vote)
Target Milestone: 4.7 M5   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 28096 98890 110426 179983 200340 315404 375484 386957 502094 (view as bug list)
Depends on: 498433 412982
Blocks: 498469
  Show dependency tree
 
Reported: 2004-07-28 15:48 EDT by Randy Hudson CLA
Modified: 2017-01-25 03:28 EST (History)
16 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2004-07-28 15:48:24 EDT
It would be nice to define a tracepoint which, when hit, would execute a 
snippet which could stream text to the console.

You can simulate this by creating a conditional breakpoint which calls println 
and then returns false.  Performance is not as good as code which has println 
in it.

The benefit is that programmers are less likely to release println() to CVS.
Comment 1 Darin Wright CLA 2004-07-29 09:49:54 EDT
Performance is not as good, since the "condition" is evaluated via JDI calls 
which have a communication overhead. The condition is in interpreted and each 
message send requires a JDI call.

Does the "tracepoint" you are referring to have a direct correlation to 
something in the Java debug architecture, or are you just asking for "faster" 
conditions?
Comment 2 Randy Hudson CLA 2004-07-29 10:33:13 EDT
I'm just asking for a conditional breakpoint which isn't conditional at all.  
It simply executes the code in the "condition", but it never interrupts 
execution.  This is useful for "adding" printlns to code which is loaded as 
binary.  As I mentioned, you can already do this, but it isn't obvious to the 
user and could be sold as a cool feature in Eclipse.
Comment 3 Darin Wright CLA 2004-08-26 11:21:45 EDT
*** Bug 28096 has been marked as a duplicate of this bug. ***
Comment 4 Darin Wright CLA 2004-12-13 15:55:53 EST
Deferred
Comment 5 Darin Wright CLA 2005-06-08 08:50:03 EDT
*** Bug 98890 has been marked as a duplicate of this bug. ***
Comment 6 Xavier Méhaut CLA 2005-06-08 08:54:40 EDT
The explicit "tracepoint" could be nevertheless nice for the user even if we can
do it otherwise.
regards
Xavier
Comment 7 Adam Kiezun CLA 2005-06-08 08:57:55 EDT
unfortunately, until breakpoints can be saved and shared, this would achieve
only a part of its potential
Comment 8 Randy Hudson CLA 2005-06-08 10:09:17 EDT
Adam, this feature is extremely useful whenever you have code loaded as binary 
because it's not your code.  Think of all the times you might use println in 
your own code for debugging, but you can't do the same in someone elses code. I 
don't see contributing these things to CVS as a common use case.
Comment 9 Adam Kiezun CLA 2005-06-08 10:14:03 EDT
I do agree that it would be very good to have this.
My scenario is that I work on 5 different machines so anything that is not
CVSable is of much smaller value for me because I'd have to configure it on each
machine separately (that's why I don't use bookmarks, for example). 

Anyway, understandably postponed at this point. Let's reopen past 3.1.
Comment 10 Alan Gutierrez CLA 2005-09-30 21:08:48 EDT
I'm very interested in this feature and I'm willing to have a go at implementing it.

If not as part of the current debugging facilities, then as a plugin that could be merged later.
Comment 11 Przemyslaw Doe CLA 2005-10-05 21:05:20 EDT
Here are conditional breakpoints mentioned.
How to create such breakpoint programmatically?

It is possible through evaluating the condition to communicate with a 
plugin, that set such a breakpoint programmatically?

I think tracepoints should be able to do this, and it should be able to set 
them on method-entry/exit. At last it should be easy to hide tracepoints from
the user (to not show them to the user and to not allow the user to disable them
by mistake).
Comment 12 Darin Wright CLA 2005-10-05 21:41:48 EDT
A condition is simply an attribute of an IJavaLineBreakpoint (package 
org.eclipse.jdt.debug.core, plug-in org.eclipse.jdt.debug) - see 
set/getCondition.

To create a breakpoint, use the factory methods on JDIDebugModel.
Comment 13 Darin Wright CLA 2005-10-24 12:28:26 EDT
*** Bug 110426 has been marked as a duplicate of this bug. ***
Comment 14 Darin Wright CLA 2007-03-29 11:01:09 EDT
*** Bug 179983 has been marked as a duplicate of this bug. ***
Comment 15 Darin Wright CLA 2007-08-17 10:24:58 EDT
*** Bug 200340 has been marked as a duplicate of this bug. ***
Comment 16 Curtis Windatt CLA 2007-09-21 15:46:28 EDT
Adding helpwanted keyword.  There is definite interest in this bug, but there are no plans to work on this in 3.4.
Comment 17 Eclipse Webmaster CLA 2009-08-30 02:38:45 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 18 Curtis Windatt CLA 2012-08-09 15:18:30 EDT
*** Bug 386957 has been marked as a duplicate of this bug. ***
Comment 19 Michael Rennie CLA 2013-12-06 15:00:53 EST
reopening
Comment 20 Michael Rennie CLA 2013-12-06 15:45:07 EST
*** Bug 375484 has been marked as a duplicate of this bug. ***
Comment 21 Dani Megert CLA 2016-07-25 06:44:58 EDT
We can add a 'Create Tracepoint' action to the context and 'Run' menu. This would create the conditional breakpoint with the text from the 'systrace' template'.
Comment 22 Markus Keller CLA 2016-07-25 06:52:10 EDT
*** Bug 315404 has been marked as a duplicate of this bug. ***
Comment 23 Markus Keller CLA 2016-07-25 08:56:49 EDT
(In reply to Dani Megert from comment #21)
> We can add a 'Create Tracepoint' action to the context and 'Run' menu.

Adapted bug summary to this.

> This
> would create the conditional breakpoint with the text from the 'systrace'
> template'.

See also bug 412982, which should eliminate the need for a "return false;" at the end of the conditional breakpoint.
Comment 24 Markus Keller CLA 2016-07-25 09:31:07 EDT
(In reply to Dani Megert from comment #21)
> [..]  with the text from the 'systrace' template.

Problem is that variables currently don't resolve properly there, see bug 498433.
Comment 25 Sarika Sinha CLA 2016-07-26 20:30:32 EDT
This change request was updated based on a scientific study on how developers debug, in discussion with Daniel Megert, Markus Keller, Sarika Sinha, and Moritz Beller.
Link to the study  -
http://repository.tudelft.nl/islandora/object/uuid%3Abf3325ce-f246-4977-91bc-785f877347b8?collection=education
Comment 26 Sarika Sinha CLA 2016-09-12 02:15:21 EDT
Moving to M4, as M3 is dedicated for Java 9 work.
Comment 27 Sarika Sinha CLA 2016-09-25 01:57:21 EDT
*** Bug 502094 has been marked as a duplicate of this bug. ***
Comment 28 Patrik Suzzi CLA 2016-09-25 15:05:01 EDT
Adding few notes, from dup Bug 502094.

1. It would be good to have print-points, which would be similar to conditional breakpoints, which prints their method + line but do not stop the execution. 

2. It would be nice if each print-point has by default a method customizable by the user, i.e.

  printf("%n printPointMethod:Line")

that should be easy to customize using scoped variables:

  printf("%n printPointMethod:Line %s", variable)

3. We could get great benefits if we could save a set of print points, in order to be shared between developers. 


Adding Andrey in c/c as he refined the bug proposing idea 1.
Comment 29 Sarika Sinha CLA 2016-11-25 03:13:17 EST
We can have a new option under Run, After Toggle Line Breakpoint as 
"Toggle Tracepoint"
It will create a conditional breakpoint , with systrace template like
System.out.println("enclosing_type.enclosing_method()");
After Bug 412982 , Conditional breakpoint will not give any error for void returning conditional blocks, it will assume return false and will not suspend.
Will try to work on bug 498433 as a separate issue to resolve enclosing type and enclosing method properly.

Toggle Tracepoint action on existing tracepoint , will prompt for deleting conditional breakpoint if the conditions have been changed and does not have simple systreace template statement

Conditional breakpoints are available for Line and Method breakpoint, Tracepoint as well will be available at these two places.
Comment 30 Eclipse Genie CLA 2016-12-21 06:07:03 EST
New Gerrit change created: https://git.eclipse.org/r/87541
Comment 31 Eclipse Genie CLA 2016-12-21 06:10:23 EST
New Gerrit change created: https://git.eclipse.org/r/87542
Comment 32 Sarika Sinha CLA 2016-12-21 06:22:41 EST
(In reply to Eclipse Genie from comment #31)
> New Gerrit change created: https://git.eclipse.org/r/87542

This is work in progress patch. Working on 2 more things -

1. Method tracepoint is not available right now, only line tracepoint is available. Will be working on it so that if method name is selected and Toggle Tracepoint menu is selected, it will create a method breakpoint with systrace condition otherwise line breakpoint with condition.
2. Current Action is extending an internal action class from platform debug


Current patch does resolve the enclosing type and method, so systrace generates a resolved println like 	
System.out.println("Testing.test()");
Comment 33 Sarika Sinha CLA 2017-01-03 01:30:22 EST
Method tracepoint is available now, so if the text selection is method name and user selects, Create Tracepoint, method breakpoint will be created with the condition.

Current Action still extends an internal action class from platform debug.
Comment 36 Sarika Sinha CLA 2017-01-24 01:05:52 EST
Thanks Noopur for testing it out!!!

Verified using

Eclipse SDK

Version: Oxygen (4.7)
Build id: I20170123-2000
Comment 37 Sarika Sinha CLA 2017-01-25 03:28:37 EST
Will add in Help.