|LDT/Wireshark: Breakpoints don't work [message #1016374]
||Wed, 06 March 2013 04:48
| jörg kalsbach
Registered: March 2013
I used wireshark and "Lua Attach to Application" with "Local Resolution". Attachment worked fine. Breakpoints were sent and confirmed between DBGp Server and DBGp client. Alas they had no effect. I played with other resolution types to no avail. Specifying the lua script with absolute path in wireshark invocation and returning '"file:///" .. normalize(source)' instead of 'false' in get_abs_file_uri mitigated the problem for me - but possibly introduces other problems.
local function get_abs_file_uri (source)
if source:sub(1,1) == "@" then -- real source file
local sourcepath = source:sub(2)
local normalizedpath = normalize(sourcepath)
if not is_path_absolute(normalizedpath) then
normalizedpath = merge_paths(base_dir, normalizedpath)
else -- dynamic code, stripped bytecode, tail return, ...
return "file:///" .. normalize(source)
IT Beratung Jörg Kalsbach
|Re: LDT/Wireshark: Breakpoints don't work [message #1016842 is a reply to message #1016374]
||Thu, 07 March 2013 16:09
| Julien Desgats
Registered: August 2012
Actually, each time Lua VM loads a chunk of source code, it can optionally give it a source name. By convention, code loaded from files gets "@<filename>" as source name.|
However, when you load code from load, loadstring or lua_load (for C side), you can give the name you want.
The problem is that currently, LDT can only debug code loaded from files so any chunk of code which is loaded from a file (dynamic code is not handled), that's why we look for a "@" char at first position.
So I guess that Wireshark load code from a custom loader for some reason (maybe for security/sandboxing ?) and does not use the "@" convention and set directly path without prefix as source name. So the code is treated as an unknown code and debugger will never break into it.
To be sure can you set something like this in your code :
-- gets the source name of the calling function
If this is the case, it becomes impossible to distinguish file based code from other code. So sadly, your fix would not work in general case. If my thoughts are rights (missing @ prefix), it's more a Wireshark issue and they should stick with Lua convention.
Powered by FUDForum
. Page generated in 0.01962 seconds