View Issue Details

IDProjectCategoryView StatusLast Update
0038860FPCDebuggerpublic2021-05-08 19:59
Reporterajax16384 Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
PlatformdarwinOSMacOS 
Product Version3.2.0 
Summary0038860: [FEATURE] lldb formatter for FPC UnicodeString
DescriptionAttached files allow lldb to view freepascal UnicodeString variable content.
Also tested with VSCode + CodeLLDB.
Steps To ReproducePut in $HOME.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

ajax16384

2021-05-05 18:51

reporter  

.lldbinit (44 bytes)   
command script import  ~/work_formatters.py
.lldbinit (44 bytes)   
work_formatters.py (828 bytes)   
import lldb

def UNICODESTRING_SummaryProvider(valobj, dict):
	if valobj.GetValue() != 0:
		s = u'"'
		i = 0
		newchar = -1
		debugger = lldb.debugger
		target = debugger.GetSelectedTarget()
		error = lldb.SBError()
		word_pointer_type = target.FindFirstType("WORD").GetPointerType()
		word_pointer = valobj.Cast(word_pointer_type)
		if not word_pointer.IsValid():
			return '<invalid>'
		while newchar != 0:
			word_val = word_pointer.GetPointeeData(i, 1)
			i = i + 1
			newchar = word_val.GetUnsignedInt16(error, 0)
			if error.fail:
				return '<error>'
			if newchar != 0:
				s = s + chr(newchar)
		s = s + u'"'
	else:
		s = '<nil>'
	return s

def __lldb_init_module(debugger, dict):
	debugger.HandleCommand('type summary add -F work_formatters.UNICODESTRING_SummaryProvider "UNICODESTRING"')
work_formatters.py (828 bytes)   

Florian

2021-05-08 19:59

administrator   ~0130801

What about putting this into a github repository and we link to it from the wiki?

Issue History

Date Modified Username Field Change
2021-05-05 18:51 ajax16384 New Issue
2021-05-05 18:51 ajax16384 File Added: .lldbinit
2021-05-05 18:51 ajax16384 File Added: work_formatters.py
2021-05-08 19:59 Florian Note Added: 0130801