Unexpected `n` behavior within `open(f, ...)`

オープン
#234 コメント 10 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
julia
領域
devtools

調査の方向性

wrapper の例を再現し、si、so、n を使って io.jl:296 に示されているエントリポイント open(f, args) をステップ実行します。観測されたジャンプを n のドキュメントに記載された意味と比較し、そのうえでステップ実行の動作またはそのドキュメントを修正する必要があるかどうかを判断し、焦点を絞った debugger テストで結果を検証します。

索引モデルが issue の本文から書いたものです。

説明

When debugging code such as the following:

function wrapper()                                                                                                                                              
    mktempdir() do dir                                                                                                                                          
        open(joinpath(dir, "test.txt"), "w") do io                                                                                                              
            println(io, "data")                                                                                                                                 
        end                                                                                                                                                     
    end                                                                                                                                                         
end

Using n to enter a do block does not work; I think this might be expected, but I wonder if the docs (which state that n means "step to the next line" should instead say something like "step to the next expression" if that is indeed what it is doing.)

The truly unexpected piece is when trying to navigate within open to get into the println(): after si'ing and so'ing my way until I'm in open(), I am greeted by the following:

1|debug> si
In open(f, args) at io.jl:296
 295  function open(f::Function, args...; kwargs...)
>296      io = open(args...; kwargs...)
 297      try
 298          f(io)
 299      finally
 300          close(io)

About to run: (NamedTuple)()

I then hit n to attempt to jump down to the f(io), but when I hit n I get:

1|debug> n
In open(f, args) at io.jl:296
 295  function open(f::Function, args...; kwargs...)
>296      io = open(args...; kwargs...)
 297      try
 298          f(io)
 299      finally
 300          close(io)

About to run: return

I have somehow just skipped to the end of the open() function, and continuing to step causes me to exit out.

主要言語
Julia
スター
515
フォーク
50
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaDebug/Debugger.jl のほかの issue

JuliaDebug/Debugger.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。