Debugger confused!

Anybody else seen this?

I've got a multi-nested if then else, something like

if (cond1)

{

result1

}

else if (cond2)

{

if (cond2a)

{

result2

{

else if (cond2b)

{

result3

}

else {

result 4

}

}

All EXPLICIT braces are there! It executes fine, meeting cond1 and returning

result1. But in the debugger, it meets cond1, goes through result1, THEN on

the next "step over", ends up at result4 !!!!!!!!

I could understand this if the braces weren't explicit....

Does anyone know if this bug has already been found, if not I'll submit it.

Thanks.

[792 byte] By [Frazier,Mark] at [2007-11-25 16:46:40]
# 1

Hi.

This can hardly be caused by a bug in the NetBeans code. I am almost sure

it is JDK that sends bad data to the debugger.

If you decide to report it as a bug, please include the following:

- Do you get incorrect results from the code?

(Or just visualisation of tracing is bad?)

- Which version of JDK do you use?

- What platform are use using (operating system + version)

If you want to help with catching the cause of the problem, try to debug

the same class with jdb ("jdb" is a simple debugger bundled with JDK).

Marian

Frazier, Mark wrote:

> Anybody else seen this?

>

> I've got a multi-nested if then else, something like

>

> if (cond1)

> {

> result1

> }

> else if (cond2)

> {

> if (cond2a)

> {

> result2

> {

> else if (cond2b)

> {

> result3

> }

> else {

> result 4

> }

> }

>

> All EXPLICIT braces are there! It executes fine, meeting cond1 and returning

> result1. But in the debugger, it meets cond1, goes through result1, THEN on

> the next "step over", ends up at result4 !!!!!!!!

>

> I could understand this if the braces weren't explicit....

>

> Does anyone know if this bug has already been found, if not I'll submit it.

>

> Thanks.

Petras,Marian at 2007-7-2 23:25:34 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 2

Frazier, Mark wrote:

> Anybody else seen this?

>

> I've got a multi-nested if then else, something like

>

> if (cond1)

> {

> result1

> }

> else if (cond2)

> {

> if (cond2a)

> {

> result2

> {

> else if (cond2b)

> {

> result3

> }

> else {

> result 4

> }

> }

>

> All EXPLICIT braces are there! It executes fine, meeting cond1 and returning

> result1. But in the debugger, it meets cond1, goes through result1, THEN on

> the next "step over", ends up at result4 !!!!!!!!

One possibility is that this is a compiler "bug" if you will. May be the

compiler is recording the last line to be the line with result4. So when

the method is returning, it stops on that line. Do you see the "result4"

line actually executed? I would think not. In that case, it is most

probably a compiler line number generation bug.

>

> I could understand this if the braces weren't explicit....

>

> Does anyone know if this bug has already been found, if not I'll submit it.

>

> Thanks.

>

Sreeni.

Viswanadha,Sreenivasa at 2007-7-2 23:25:34 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 3

> Sreenivasa Viswanadha wrote:

> Frazier, Mark wrote:

> > Anybody else seen this?

> >

> > I've got a multi-nested if then else, something like

Hi,

Can you tell us what jdk version you are using?

I've got an issue with the deebugger under 1.3.1._02 using Studio (4) where an applet works perfectly well under

execution control, but when in the debugger it misbehaves and cannot connect to a server.

Schuler,Mike at 2007-7-2 23:25:34 > top of Java-index,Archived Forums,Sun ONE Studio 4...
# 4

Sreenivasa Viswanadha wrote:

>

> One possibility is that this is a compiler "bug" if you will. May be the

> compiler is recording the last line to be the line with result4. So when

> the method is returning, it stops on that line. Do you see the "result4"

> line actually executed? I would think not. In that case, it is most

> probably a compiler line number generation bug.

>

Yes, I agree. This is typically problem of compiler. You can see it if

you use javap utility on this compiled file (.class). Line table is

typically crippled. Can you put your sourcefile to JDK bug database?

Jan

Jancura,Jan at 2007-7-2 23:25:34 > top of Java-index,Archived Forums,Sun ONE Studio 4...