Eclipse Debugging Filter Unwanted Packages - java

I have been using Eclipse for 2 years for development, but this filter concept I am still struggling to understand during debugging.
I usually debug in remote port mode.
Most of the times, My Eclipse catches the break point/exception in Unwanted Packages [Packages usually from other Sources like Spring, Java ThreadPool etc..] and annoys me by bringing up the debug window.
I would like to configure Eclipse to catch breakpoints in my package only. Just ignore any where else, don't halt them or notify me.

As far as I know we can add package filters for exception breakpoints but for the normal line breakpoints, I think a long way to manually disable one by one will work,
You can look at Eclipse Creating Expression Filter for more information.
This figure provide info ho we can open Java Exception Breakpoint,

I think this should help you:
Window --> Preferences --> Java --> Debug
Uncheck the following:
Suspend exceution on uncaught exceptions
Suspend exceution on compilation errors
Open popup when suspended on exception
Click on Apply & then OK.

Related

Java - Catch all stacktraces

I have an RCP application for which I would like to capture all stacktraces. I am currently using slf4j for my logging mechansim. As an example, if I run my RCP application within eclipse, I can look at the console window and see any stacktraces that have not been explicitly captured by the code. If I export the application and run it outside of eclipse I will not see those stacktraces. I do not wish to tediously change the code to use try/catch blocks (because there is a LOT of code). I would rather tap into whatever mechanism Eclipse uses to do the same thing (It does not put try/catch inside my code, yet it reports it in the console). Is there an easy way to do what Eclipse does inside my RCP code so that when I run it from outside eclipse it shows up in my log files?
I am not familiar with the RCP framework; but normally, you can setup a thread group handler for uncaught exceptions.
In other words: you can define a component that is triggered for each and any uncaught exception. And that component could simply log incoming exceptions.
See here for some example code.

Unable to debug using eclipse debugger

So there is a small java program to add two numbers.
There is one break-point.
I used Debug as -> Java Application.
But still, Step Into, Step Over, Resume, Suspend and Terminate buttons are disabled in my eclipse.
See below:
Debugger recognized the breakpoint at int b = 3 but still the buttons are disabled.
Everything was working fine yesterday.
What should be the cause?
Possibles solutions and cause here.
The commands got disabled, probably from previous customization, (check General -> Keys) but I wouldn't think this can be the only reason to be cause of this issue.
Hope this helps you out.
I have met the same issue and fixed it. The following are the possible solutions:
Make sure that your skip all break point option is disabled
Reset your debug perspective in perspective options.
Make sure to restart eclipse after doing above things

Log message/error at design-time in IntelliJ Idea?

I have had a problem with a custom component I am writing. The issue seems to be a resource not loading properly (not sure why) at design-time.
To track it down I'd like to put in some debug-code that will execute at design-time, and give output in form of some messages.
Is there a log or something similar that can be written to at design-time?
Thanks
There's a really nice trick you can use to add debug statements in IntelliJ without actually changing the code. The answer is to use non-suspending breakpoints.
Add a breakpoint at the necessary point in the code, then right click on it. De-select "Suspend", and then put whatever you want in the "Log evaluated expression" - this will give you access to the fields of the instance.
Run your app in debug mode, and you'll get debugging info in the console without having to manually examine everything.

Why eclipse while debugging access areas that has no break points?

When we debug, breakpoints are set before attaching to the process(even before starting application) and even though there are times that debugger go to places that has not been set to access.
I've checked and not modified the breakpoints list before starting program.
Regards
In eclipse preferences there is Java -> Debug. Check if the option Suspend execution on uncaught exceptions is checked. If that option is checked, the debugger will suspend execution when such an exception is thrown.
My friend who has no SO has solved that issue. There were break points in library that was imported by debugged project.
Those breakpoints are not visible in main project.

How do you debug a Rails application?

Is it possible to debug a Rails application in a similar way to a Java application - setting breakpoints and stepping into the code?
What are the best tools for this?
I have a hybrid Java/Ruby on Rails application which I can run in Eclipse or Netbeans.
I would like to step into some code in this app and try to figure out the cause of a problem I'm having.
In Eclipse if I set a breakpoint in my blog_controller and then choose the 'Debug' button, it seems to use the ruby-debug-ide gem to execute the code but I get this unhelpful output and no option to step into any source:
Fast Debugger (ruby-debug-ide 0.4.5) listens on localhost:56726
./war/WEB-INF/app/controllers/blog_controller.rb:1
C:/Ruby18/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.5/lib/ruby-debug.rb:101:in `debug_load'
C:/Ruby18/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.5/lib/ruby-debug.rb:101:in `debug_program'
C:/Ruby18/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.5/bin/rdebug-ide:82
C:/Ruby18/bin/rdebug-ide:19:in `load'
C:/Ruby18/bin/rdebug-ide:19
Uncaught exception: uninitialized constant ApplicationController
I'm not sure if I'm doing something wrong or if this is all I can expect.
The debugger I use the most is the ruby-debug gem, which is a gdb-esque command line debugger. Once you learn a few commands it is very quick and effective, and provides you with some handy features like being able to fire up irb in the context of your program and make on-the-fly changes.
And being command line based it comes in handy when you need to debug a on a remote server.
You can expect more. I have used Aptana's RadRails version of Eclipse to debug a Rails app as you describe--setting breakpoints and stepping through the code.
You may be doing something wrong. It looks as if it is trying to debug an individual controller file, rather than debugging the Rails app. When I try to execute a controller file from the command line, I get a similar message:
C:\workspace\myapp\app\controllers>ruby users_controller.rb
users_controller.rb:1: uninitialized constant ApplicationController (NameError)
In Aptana RadRails, I choose Run > Debug As > Ruby Application to debug the app.
For the vim users I strongly recomend looking into the vim-ruby-debugger, which fits in great with Tim Pope's rails.vim scripts.
It gives you a handy :Rdebugger command, allows you to set breakpoints and open a split window to display variable values.
maybe not relevant, but I wanted to post somewhere: got the error: "undefined method `run_init_script' for Debugger:Module" running the debugger in rails 2.3.2. Did a sudo gem install ruby-debug and the problem went away.
I'd recommend just setting up breakpoints (I actually just puts to console) for 99% of debugging with RoR - this method is simple and usable across any IDE, so you never need to learn how a new debugger works.
Actually, I had the same problem with Aptana. Run > Debug As > Ruby Application just doesn't work. I finally made the debugger work by going to the Servers tab, and then start the server in debug mode. After that, set some breakpoints and trigger the corresponding action. Hope this helps.
Debugging? That's just knowing where to look in the case of Ruby (and by extension, Rails) most of the time.
The problem in this case is that you probably still have your ApplicationController called application.rb where it should be renamed to application_controller.rb.
Debuggin in rails is simple if you know how to read the error stacktrace!! But if you need to explicitly watch out the values during the runtime then u can use the rails breakpointer.Below is the link to how-to on breakpointer ..hope this helps!!!
http://destiney.com/blog/rails-breakpointer
I can't speak for Eclipse (never worked well for me) or Aptana (not tried) but from experience I can say that both NetBeans and RubyMine will do what you want. I both cases you should probably make sure that the ruby-debug-base and ruby-debug-ide gems are up-to-date: RubyMine in particular didn't work for me until that was done.

Categories