Skip to main content
Known Participant
March 18, 2024
Answered

Assertion failed on Debugging Toolkit startup

  • March 18, 2024
  • 1 reply
  • 427 views

I'm trying to get the @johnrellis Debugging Toolkit working and encountering "assertion failed!" in Debug.lua line 900, which is

local frame = debug.getinfo (thread, i)

I'm not quite sure how to resolve this.  Any help would be appreciated!

Lightroom Classic 13.2

SDK 13.2

 

Code and debugger screenshot below

local Require = require "Require".path("/Users/paul/src/third-party/debuggingtoolkit.lrdevplugin").reload()
local Debug = require "Debug".init()
require "strict.lua"

local LrDialogs = import 'LrDialogs'
local LrApplication = import 'LrApplication'
local LrDevelopController = import 'LrDevelopController'
local LrTasks = import 'LrTasks'

-- Function to get a list of available develop presets
local function getDevelopPresets()
    local folders = {}
    for _, folder in ipairs(LrApplication.developPresetFolders()) do
        local presets = {}
        local folderName = folder.getName()
        for _, preset in ipairs(folder.getDevelopPresets()) do
            folders[folderName] = folder.getDevelopPresets()
        end
    end
    return folders
end

-- Entry point of the plugin
LrTasks.startAsyncTask(Debug.showErrors(function()
    LrDialogs.message("getDevelopPresets", getDevelopPresets(), "info")
end))

 

This topic has been closed for replies.
Correct answer johnrellis

When LR's Lua interpreter encounters an error, by the time the toolkit's Debug or Zerobrane's debugger gets control, the stack has usually been popped! So it's a little tedious to single step until you find the error.

 

In the code above, it's the expression folder.getName() -- it should be folder:getName().  That's a very common mistake, and it always results in assertion failed.

 

I've attached a screen recording of how I debugged that. I set a breakpoint on line 25 and then single-stepped from there.

1 reply

johnrellis
johnrellisCorrect answer
Legend
March 19, 2024

When LR's Lua interpreter encounters an error, by the time the toolkit's Debug or Zerobrane's debugger gets control, the stack has usually been popped! So it's a little tedious to single step until you find the error.

 

In the code above, it's the expression folder.getName() -- it should be folder:getName().  That's a very common mistake, and it always results in assertion failed.

 

I've attached a screen recording of how I debugged that. I set a breakpoint on line 25 and then single-stepped from there.

PaulWaldoAuthor
Known Participant
March 21, 2024

Thank you @johnrellis, that was very helpful.  I am debugging now!