Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Listening to DebugEvents(problem)
Listening to DebugEvents [message #903034] Tue, 21 August 2012 17:33 Go to next message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
hi.

i am trying to listen to debug events through implementing the IDebugEventSetListener interface.
this is my implemention of the handleDebugEvent method:
@Override
public void handleDebugEvents(DebugEvent[] events) {
System.out.println("hello");
}
but for some reason after adding my class as debug event listner through the command:
DebugPlugin.getDefault().addDebugEventListener(class name);
for every debug event(like suspend,step into buttons,etc) the handleDebugEvent method is occuring more than one time, can someone explain to me why is this happening and or how to fix it?, thanks.

p.s
i am sorry if i posted in the wrong fourm, so if i did please direct me to the right one.

[Updated on: Tue, 21 August 2012 17:34]

Report message to a moderator

Re: Listening to DebugEvents [message #903218 is a reply to message #903034] Wed, 22 August 2012 14:49 Go to previous messageGo to next message
Michael Rennie is currently offline Michael RennieFriend
Messages: 67
Registered: July 2009
Location: Canada
Member
#handleDebugEvents is called one time for each set of debug events given to the notifier - see DebugPlugin$EventNotifier for more details.

Each event can have a kind and details, so it could appear that there are many events of the same kind (STEP_INTO for example) but they could all have different details.

Also there are some instances where a debug element can fire the same event kind with the same detail more than once. For example consider a RuntimeProcess, just by calling its setAttribute method will fire a CHANGED kind and UNSPECIFIED detail event each time.

Is this maybe what you are seeing? If not, could you paste a trace of the event kind / details you are seeing as duplicated?
Re: Listening to DebugEvents [message #903446 is a reply to message #903034] Thu, 23 August 2012 16:40 Go to previous messageGo to next message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
i printed the output of clicking on the step into button 1 time on a JFrame.


this is the output on the JFrame:

event kind: 1
event kind: 1
event kind: 2
event kind: 2


does it help?
Re: Listening to DebugEvents [message #903661 is a reply to message #903446] Fri, 24 August 2012 18:44 Go to previous messageGo to next message
Michael Rennie is currently offline Michael RennieFriend
Messages: 67
Registered: July 2009
Location: Canada
Member
That tells me that you got two resume and two suspend events. What were the details for the events? Could you run the trace again with a call to DebugEvent.toString() (it will print out the event kind and detail in plain english)?
Re: Listening to DebugEvents [message #903727 is a reply to message #903034] Sat, 25 August 2012 05:57 Go to previous messageGo to next message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
here is the output of the toString method when i clicked the step into button once:

entered the function
toString: DebugEvent[gdb/mi (25/08/12 08:55), RESUME, STEP_INTO]
toString: DebugEvent[1, RESUME, STEP_INTO]
toString: DebugEvent[1, SUSPEND, STEP_END]
entered the function
toString: DebugEvent[gdb/mi (25/08/12 08:55), SUSPEND, UNSPECIFIED]

i printed "entered the function" each time the handleDebugEvent function has been activated.

thanks.
Re: Listening to DebugEvents [message #903968 is a reply to message #903727] Mon, 27 August 2012 13:15 Go to previous messageGo to next message
Michael Rennie is currently offline Michael RennieFriend
Messages: 67
Registered: July 2009
Location: Canada
Member
Looks like it is working fine to me. You are getting a step into event for gdb/m1 (your debug target?) and another one for '1' (the thread?). Its important to note that each debug model element can send their own events at any time.

See the DebugElement#fire*Event methods for more information about sending your own events / finding where events get sent.
Re: Listening to DebugEvents [message #904749 is a reply to message #903034] Wed, 29 August 2012 04:58 Go to previous message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
it seems i fixed the problem by checking the source of the event and his kind, and by that i filtered the debugevents.

thanks.
Previous Topic:Eclipse doesn't deploy web application automatically
Next Topic:unable to open a .bat file through .launch in eclipse
Goto Forum:
  


Current Time: Thu Apr 25 16:06:14 GMT 2024

Powered by FUDForum. Page generated in 0.02064 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top