Skip to content

perl5db.pl: handling of undefined watch_expressions in _DB__handle_watch_expressions() #22207

@hexcoder-

Description

@hexcoder-

(This is just an observation, not necessarily a bug.)

perl5db.pl as of commit c60ffc1

Module: perl5db.pl

Description

Reviewing the code for _DB__handle_watch_expressions()

sub _DB__handle_watch_expressions

I found that using join here
my ($val) = join( "', '", DB::eval(@_) );

makes $val always defined, since join always returns a (possibly empty) defined string.

Then in the following line

$val = ( ( defined $val ) ? "'$val'" : 'undef' );

the false branch is never applied.

So maybe watchpoint expressions with result "undefined" are not reported correctly.

======================
My main motivation for looking here, was the behavior of watchpoints with regard to package scope changes.

In my application I had
my %hash;
along with some imported modules.

When my hash was populated completely (and should be constant afterwards), I wanted to see where and when $hash{'myEntry'} changed unexpectedly. But using a watchpoint w $hash{'myEntry'} in the debugger led to a lot of unwanted breaks: each time the package/module scope changed the visibility of %hash changed also, of course.

How these visibility changes can be ignored in watchpoint breaks, I do not not know yet (should this be another bug report?).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions