can't debug within packages

dennisd

Member
I am trying to run the debugger on my PACKAGE but it will only step through the declaration and setting of variables section. Once it gets to the end of the section and the line before the first procedure, it just runs to completion, even if I have breakpoints set in the first procedure.

I CAN run the debugger on procedures that are not within a package. It steps through those just fine, line by line. I took a procedure that I could step through and put it within a new package by itself and the debugger will no longer step through it.

I have the following system permissions granted:
debug any procedure
debug connect session
execute any procedure
restricted session
unlimited tablespace

Do I need any others set? Is there something special for packages?
 
I debug packages quite often OK. I wonder if you are setting up the test script in the test window correctly? It works different than some other IDE's so it may be confusing if this is the first time. After I got used to it, I found it to be easier than most other IDE's.

Basically, the test script needs to be an anonymous block in the test window that calls your package. Most of the time the test script in the test window just kind of looks like this:

BEGIN
package_to_test.procedure_to_test(:parameter1);
END;

At the bottom, there would be a "parameter1" entry to fill in.

This is how I do it.

1. I have a program window open with the code contents visible.
2. I right-click on a public block name in the code contents and select "Test".
3. A new test window opens with an anonymous block created that calls the public block in your package. The parameters are listed at the bottom for you to fill in.

You can also set it up manually, but usually, I don't need to. I hope that helps.

Mike
 
Yes, that's what I do. I go into the package and right click on the procedure/function and click test. It automatically brings up a test window as you described. I set my parmeters and tell it to step into the package. Thepackage steps through the global variables at the beginning of the package just fine. It gets to the first procedure (the one I want) and never steps into it.
 
My DBA granted another role for the catalog. That allowed us to get into the procedure just once in several tries. We cannot figure out why this would be flaky and not allow us in each time. Ideas?
 
How big is your package?
Are there many comments?

Have you tried to recompile it?

Are there 2 cursors defined that have the same definition? (if yes, could you remove one and try again)

Roeland
 
How big is your package?
- 3600 lines with whitespace and comments.

Are there many comments?
- No, there should be more, IMHO.

Have you tried to recompile it?
- Yes, with the debug info added. Compiles clean.

Are there 2 cursors defined that have the same definition? (if yes, could you remove one and try again)
- There are 4 cursors, all uniquely named.

What's driving us nuts is that it's not consistent. We can get it to go to the first procedure maybe once in 10-20 attempts.
 
I don't have the answer, but here are some things you might look into:

1. In my limited experience of the when the debugger doesn't work, it's because Oracle's debugger has a bug. Maybe search metalink for a bug, or log a TAR?

2. You could get a trial version of another IDE with a debugger to rule out PL/SQL Developer having an issue.

3. You could try it on a smaller package and see if it's a size limit thing?

Good luck,

Mike
 
We don't have an answer either. We are getting assistance from allaroundautomations now.

To address your suggestions, I can use another company's debugger on the same package without problems, so that should cover #1 & #2. The package size isn't a problem. As I said earlier, I CAN run the debugger on procedures that are not within a package. It steps through those just fine, line by line. I took a procedure that I could step through and put it within a new package by itself and the debugger will no longer step through it.
That's the smallest package I can make. Doesn't matter.
Thanks for the suggestions.
 
Unless you're doing it already...

Make sure you "Add debug information" on the package every time before you begin your testing session. If you recompile the package (spec or body) in a different session, you should "Add debug information again".

Note: in order to add debug information, right-click the object in the "Browser" window and select "Add debug information" from the pop-up menu.

Also, if the package is owned by a user other than the one debugging it, you won't get into package's body either. You have to be logged in as the owner of the object in order to debug it (or so I think :) ).
 
Back
Top