1
7
Fork
You've already forked debugger.lua
0

n, f commands don't work #55

Closed
opened 2018年10月30日 10:23:45 +01:00 by TravellingSalesPerson · 2 comments
TravellingSalesPerson commented 2018年10月30日 10:23:45 +01:00 (Migrated from github.com)
Copy link

I am on Ubuntu 18.04 using lua 5.2.4.

While running the tutorial.lua file, the following output occurred (skipping the beginning):

 Now try the 'n' command.
 (n = step to the Next line in the source code)

tutorial.lua:85 in 'tutorial.lua:0'
debugger.lua> n
tutorial.lua:60 in 'func2'
debugger.lua> n
You used the 'n' command.
tutorial.lua:61 in 'func2'
debugger.lua> n
So it's skipping over the lines in func2().
tutorial.lua:65 in 'func2'
debugger.lua> n
tutorial.lua:67 in 'func2'
debugger.lua> n
tutorial.lua:64 in 'f'
debugger.lua> n
... and anything it might call.

But of course, I expected:

 Now try the 'n' command.
 (n = step to the Next line in the source code)

./tutorial.lua:85 in '<./tutorial.lua:0>'
debugger.lua> n
You used the 'n' command.
So it's skipping over the lines in func2().
... and anything it might call.

Thus, it seems like n steps into functions just like s does. Likewise, using f inside a function simply did the same as c instead of stopping right after the function.

I assumed n, f worked in the past, so I used git bisect and found that 4cc1189b23 introduced this error (n, f worked fine before 4cc1189b23).

In particular, this line (line 142 in 4cc1189b23):
return info.source:match('^@[%.%/]') ~= nil
matches only files starting with ./

Then I noticed, that n, f work properly if I run the tutorial with

lua ./tutorial.lua

but not with

lua tutorial.lua

Because the latter does not contain ./ and aforementioned line of code does not find a match.

Maybe the pattern '^@[%.%/]' needs to be adapted? Or is the prefix './' always required?

I am on Ubuntu 18.04 using lua 5.2.4. While running the tutorial.lua file, the following output occurred (skipping the beginning): > Now try the 'n' command. > (n = step to the Next line in the source code) > > tutorial.lua:85 in '<tutorial.lua:0>' > debugger.lua> n > tutorial.lua:60 in 'func2' > debugger.lua> n > You used the 'n' command. > tutorial.lua:61 in 'func2' > debugger.lua> n > So it's skipping over the lines in func2(). > tutorial.lua:65 in 'func2' > debugger.lua> n > tutorial.lua:67 in 'func2' > debugger.lua> n > tutorial.lua:64 in 'f' > debugger.lua> n > ... and anything it might call. But of course, I expected: > Now try the 'n' command. > (n = step to the Next line in the source code) > > ./tutorial.lua:85 in '<./tutorial.lua:0>' > debugger.lua> n > You used the 'n' command. > So it's skipping over the lines in func2(). > ... and anything it might call. Thus, it seems like `n` steps into functions just like `s` does. Likewise, using `f` inside a function simply did the same as `c` instead of stopping right after the function. I assumed `n`, `f` worked in the past, so I used git bisect and found that 4cc1189b23a80 introduced this error (`n`, `f` worked fine before 4cc1189b23a80). In particular, this line (line 142 in 4cc1189b23a80): `return info.source:match('^@[%.%/]') ~= nil` matches only files starting with ./ Then I noticed, that `n`, `f` work properly if I run the tutorial with `lua ./tutorial.lua` but not with `lua tutorial.lua` Because the latter does not contain ./ and aforementioned line of code does not find a match. Maybe the pattern `'^@[%.%/]'` needs to be adapted? Or is the prefix './' always required?
aleclarson commented 2018年10月30日 13:13:04 +01:00 (Migrated from github.com)
Copy link

Good analysis! 👍

I don't remember why I avoided paths like @tutorial.lua. I guess we'll find out.

Fixed by #56. Thanks for opening an issue! ❤️

Good analysis! 👍 I don't remember why I avoided paths like `@tutorial.lua`. I guess we'll find out. Fixed by #56. Thanks for opening an issue! ❤️
TravellingSalesPerson commented 2018年10月30日 14:19:33 +01:00 (Migrated from github.com)
Copy link

Awesome, thank you.

Works like a charm!

Awesome, thank you. Works like a charm!
Sign in to join this conversation.
No Branch/Tag specified
master
no-extras
dev
patch-1
media
simple-term
slembcke
error-hook
standalone
No results found.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slembcke/debugger.lua#55
Reference in a new issue
slembcke/debugger.lua
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?