Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lua Development Tools » LDT/Wireshark: Breakpoints don't work(Lua Attach to Application/Breakpoints do not work with Wireshark)
LDT/Wireshark: Breakpoints don't work [message #1016374] Wed, 06 March 2013 09:48 Go to next message
jörg kalsbach is currently offline jörg kalsbachFriend
Messages: 2
Registered: March 2013
Junior Member
Hi all,

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)
local uri
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)
end
return to_file_uri(normalizedpath)
else -- dynamic code, stripped bytecode, tail return, ...
return "file:///" .. normalize(source)
--return false
end
end
#####

BR
Jörg Kalsbach
IT Beratung Jörg Kalsbach
Re: LDT/Wireshark: Breakpoints don't work [message #1016760 is a reply to message #1016374] Thu, 07 March 2013 15:44 Go to previous messageGo to next message
Simon Bernard is currently offline Simon BernardFriend
Messages: 290
Registered: July 2009
Senior Member
Hi,
Thank you for your feedback Wink.

I never use LDT to debug wireshark script, but there is a bug which is perhaps linked to this problem :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=400337

Perhaps we could add wireshark to the list of compatible/VM and precise the problem :
http://wiki.eclipse.org/Koneki/LDT/User_Area/Compatible_Lua_VMs

Re: LDT/Wireshark: Breakpoints don't work [message #1016842 is a reply to message #1016374] Thu, 07 March 2013 21:09 Go to previous message
Julien Desgats is currently offline Julien DesgatsFriend
Messages: 6
Registered: August 2012
Junior Member
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
print(debug.getinfo(1).source)


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.
Previous Topic:Lua and C++ exception: will my scripts be still debuggable?
Next Topic:Debugger broken
Goto Forum:
  


Current Time: Sat Dec 20 16:05:39 GMT 2014

Powered by FUDForum. Page generated in 0.02403 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software