I have a function which give me a gdb backtrace in my go file something like:
func backtrace(){... fmt.Println ("backtrace details")}
I want expose this function output to qml. How can I do that?
EDIT:
func backtrace(){
output,_:=debug.Send("stack-list-frames")
pay:=output["payload"]
payAssert:=pay.(map[string]interface{})
stack:=payAssert["stack"]
stackAssert:=stack.([]interface{})
nbreFct:=len(stackAssert)
for i:=0; i<=nbreFct-1 ; i++{
stackSepare:=stackAssert[i]
stackSepareAssert:=stackSepare.(map[string]interface{})
frame:=stackSepareAssert["frame"]
frameAssert:=frame.(map[string]interface{})
index := strconv.Itoa(i)
fmt.Println("Frame : ", index)
//list variables by frame
output_variables,_ := debug.Send("stack-list-variables","--thread","1","--frame",index,"--simple-values")
map_variables := output_variables["payload"]
m_variables := map_variables.(map[string]interface{})
variables := m_variables["variables"]
fmt.Println("Variables : ", variables)
fun:=frameAssert["func"]
line:=frameAssert["line"]
level:=frameAssert["level"]
fmt.Println("level : ",level,"function : ",fun ," line : ",line)
}
}
How I can improve my code ouptut to expose the output to qml?