Reporting issues and debugging

From Yuma123 Wiki

Jump to: navigation, search

Reporting issues

Issues can be posted at https://github.com/vlvassilev/yuma123/issues

Debugging

Usecase: Debugging the YANG module parser

Example gdb session with tk_dump_chain(pcb->tkc) usecase.

v@lmf:~/yuma123-git/netconf/test/netconfd/ietf-netmod-sub-intf-vlan-model$ rm /tmp/ncxserver.sock ; gdb --args /usr/sbin/netconfd --module=./ietf-interfaces-common@2017-03-13.yang --module=./ietf-interfaces-ethernet-like@2017-03-13.yang --module=./ietf-if-l3-vlan@2017-03-13.yang --module=/usr/share/yuma/modules/ietf/iana-if-type.yang --module=./vlans.yang --module=./composite-match.yang --modpath=./:/usr/share/yuma/modules/ --no-startup --superuser=$USER --log-level=debug4
...
Breakpoint 1, parse_path_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7768
7768	    val1 = NULL;
(gdb) next
7769	    val2 = NULL;
(gdb) next 
7772	    nexttyp = tk_next_typ(pcb->tkc);
(gdb) bt
#0  parse_path_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7772
#1  0x00007ffff7918bae in parse_union_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7881
#2  0x00007ffff7918d71 in parse_unary_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7974
#3  0x00007ffff7918eb9 in parse_multiplicative_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8047
#4  0x00007ffff7919263 in parse_additive_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8209
#5  0x00007ffff791956f in parse_relational_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8352
#6  0x00007ffff79197be in parse_equality_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8477
#7  0x00007ffff7919a7a in parse_and_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8605
#8  0x00007ffff7919c50 in parse_or_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8701
#9  0x00007ffff7919e05 in parse_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8788
#10 0x00007ffff7917f2f in parse_function_call (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7395
#11 0x00007ffff7918703 in parse_primary_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7641
#12 0x00007ffff791888c in parse_filter_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7702
#13 0x00007ffff7918ad6 in parse_path_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7813
#14 0x00007ffff7918bae in parse_union_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7881
#15 0x00007ffff7918d71 in parse_unary_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:7974
#16 0x00007ffff7918eb9 in parse_multiplicative_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8047
#17 0x00007ffff7919263 in parse_additive_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8209
#18 0x00007ffff791956f in parse_relational_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8352
#19 0x00007ffff79197be in parse_equality_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8477
#20 0x00007ffff7919a7a in parse_and_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8605
#21 0x00007ffff7919c50 in parse_or_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8701
#22 0x00007ffff7919e05 in parse_expr (pcb=0x74ed10, res=0x74eec4) at ../../../netconf/src/ncx/xpath1.c:8788
#23 0x00007ffff791a57f in xpath1_validate_expr_ex (mod=0x628bc0, obj=0x74ea40, pcb=0x74ed10, missing_is_error=false) at ../../../netconf/src/ncx/xpath1.c:9111
#24 0x00007ffff7936676 in resolve_when (mod=0x628bc0, when=0x74ed10, obj=0x74ea40) at ../../../netconf/src/ncx/yang_obj.c:5340
#25 0x00007ffff793d86e in resolve_xpath (tkc=0x692860, mod=0x628bc0, datadefQ=0x6d1748) at ../../../netconf/src/ncx/yang_obj.c:9433
#26 0x00007ffff793d954 in resolve_xpath (tkc=0x692860, mod=0x628bc0, datadefQ=0x628cd0) at ../../../netconf/src/ncx/yang_obj.c:9458
#27 0x00007ffff793fd46 in yang_obj_resolve_xpath (tkc=0x692860, mod=0x628bc0, datadefQ=0x628cd0) at ../../../netconf/src/ncx/yang_obj.c:10752
#28 0x00007ffff794763f in parse_yang_module (tkc=0x692860, mod=0x628bc0, pcb=0x6c7320, ptyp=YANG_PT_TOP, wasadded=0x7fffffffdb5b) at ../../../netconf/src/ncx/yang_parse.c:3439
#29 0x00007ffff7948414 in yang_parse_from_filespec (filespec=0x648510 "./ietf-interfaces-common@2017-03-13.yang", pcb=0x6c7320, ptyp=YANG_PT_TOP, isyang=true) at ../../../netconf/src/ncx/yang_parse.c:3902
#30 0x00007ffff78c0e6f in try_module (buff=0x648510 "./ietf-interfaces-common@2017-03-13.yang", bufflen=40, path=0x0, path2=0x0, modname=0x0, revision=0x0, mode=NCXMOD_MODE_FILEYANG, usebuff=true, 
    done=0x7fffffffdc7f, pcb=0x6c7320, ptyp=YANG_PT_TOP) at ../../../netconf/src/ncx/ncxmod.c:461
#31 0x00007ffff78c282a in try_module_filespec (mode=NCXMOD_MODE_FILEYANG, modname=0x68fb80 "./ietf-interfaces-common@2017-03-13.yang", modlen=40, pcb=0x6c7320, ptyp=YANG_PT_TOP, retmod=0x7fffffffdd40)
    at ../../../netconf/src/ncx/ncxmod.c:1836
#32 0x00007ffff78c29b0 in load_module (modname=0x68fb80 "./ietf-interfaces-common@2017-03-13.yang", revision=0x0, pcb=0x6c7320, ptyp=YANG_PT_TOP, retmod=0x7fffffffdd40) at ../../../netconf/src/ncx/ncxmod.c:1917
#33 0x00007ffff78c32e7 in try_load_module (pcb=0x6c7320, ptyp=YANG_PT_TOP, modname=0x68fb80 "./ietf-interfaces-common@2017-03-13.yang", revision=0x0, retmod=0x7fffffffddf8)
    at ../../../netconf/src/ncx/ncxmod.c:2274
#34 0x00007ffff78c3daf in ncxmod_load_module (modname=0x68fb80 "./ietf-interfaces-common@2017-03-13.yang", revision=0x0, savedevQ=0x7ffff7ddbaa8 <agt_profile+168>, retmod=0x7fffffffddf8)
    at ../../../netconf/src/ncx/ncxmod.c:2784
#35 0x00007ffff7b9dc79 in agt_init2 () at ../../../netconf/src/agt/agt.c:820
#36 0x0000000000401204 in cmn_init (argc=11, argv=0x7fffffffe0b8, showver=0x7fffffffdfca, showhelpmode=0x7fffffffdfc4, validate_config_only_mode=0x7fffffffdfc3) at ../../../netconf/src/netconfd/netconfd.c:227
#37 0x000000000040138c in main (argc=11, argv=0x7fffffffe0b8) at ../../../netconf/src/netconfd/netconfd.c:345
(gdb) print *pcb
$3 = {qhdr = {hdr_typ = 0, prev = 0x0, next = 0x0}, tkc = 0x74efe0, 
  exprstr = 0x74eef0 "derived-from-or-self(../if:type,\n\t\t     'ianaift:ethernetCsmacd') or\nderived-from-or-self(../if:type, 'ianaift:sonet') or\nderived-from-or-self(../if:type, 'ianaift:atm') or\nderived-from-or-self(../if:"..., reader = 0x0, source = XP_SRC_YANG, errinfo = {qhdr = {hdr_typ = 0, prev = 0x0, next = 0x0}, descr = 0x0, ref = 0x0, error_app_tag = 0x0, error_message = 0x0, seen = false}, 
  logerrors = true, missing_errors = false, targobj = 0x0, altobj = 0x0, varobj = 0x0, curmode = XP_CM_NONE, obj = 0x74ea40, objmod = 0x628bc0, docroot = 0x63c0f0, val = 0x0, val_docroot = 0x0, 
  doctype = XP_DOC_DATABASE, flags = 0, result = 0x0, context = {qhdr = {hdr_typ = 0, prev = 0x0, next = 0x0}, dblslash = false, position = 0, last = 0, node = {objptr = 0x74ea40, valptr = 0x74ea40}}, 
  orig_context = {qhdr = {hdr_typ = 0, prev = 0x0, next = 0x0}, dblslash = false, position = 0, last = 0, node = {objptr = 0x74ea40, valptr = 0x74ea40}}, getvar_fn = 0x0, cookie = 0x0, varbindQ = {
    hdr_typ = 2727, prev = 0x74ee68, next = 0x74ee68}, functions = 0x7ffff7b7dfc0 <functions>, result_cacheQ = {hdr_typ = 2727, prev = 0x64ac90, next = 0x750410}, resnode_cacheQ = {hdr_typ = 2727, 
    prev = 0x7462a0, next = 0x7462a0}, result_count = 3, resnode_count = 1, parseres = NO_ERR, validateres = NO_ERR, valueres = NO_ERR, tkerr = {mod = 0x628bc0, linenum = 338, linepos = 7}, seen = false}
(gdb) call tk_dump_chain(pcb->tkc)

 line(338.12), tk(1), typ(token string)  val(derived-from-or-self)
 line(338.32), tk(2), typ(left paren)  val(()
 line(338.33), tk(3), typ(range separator)  val(..)
 line(338.35), tk(4), typ(forward slash)  val(/)
 line(338.36), tk(5), typ(prefix qualified ID string)  val(type)
*cur* line(338.43), tk(6), typ(comma)  val(,)
 line(338.65), tk(7), typ(single quoted string)  val(ianaift:ethernetCsmacd)
 line(338.89), tk(8), typ(right paren)  val())
 line(338.91), tk(9), typ(token string)  val(or)
 line(338.93), tk(10), typ(token string)  val(derived-from-or-self)
 line(338.113), tk(11), typ(left paren)  val(()
 line(338.114), tk(12), typ(range separator)  val(..)
 line(338.116), tk(13), typ(forward slash)  val(/)
 line(338.117), tk(14), typ(prefix qualified ID string)  val(type)
 line(338.124), tk(15), typ(comma)  val(,)
 line(338.126), tk(16), typ(single quoted string)  val(ianaift:sonet)
 line(338.141), tk(17), typ(right paren)  val())
 line(338.143), tk(18), typ(token string)  val(or)
 line(338.145), tk(19), typ(token string)  val(derived-from-or-self)
 line(338.165), tk(20), typ(left paren)  val(()
 line(338.166), tk(21), typ(range separator)  val(..)
 line(338.168), tk(22), typ(forward slash)  val(/)
 line(338.169), tk(23), typ(prefix qualified ID string)  val(type)
 line(338.176), tk(24), typ(comma)  val(,)
 line(338.178), tk(25), typ(single quoted string)  val(ianaift:atm)
 line(338.191), tk(26), typ(right paren)  val())
 line(338.193), tk(27), typ(token string)  val(or)
 line(338.195), tk(28), typ(token string)  val(derived-from-or-self)
 line(338.215), tk(29), typ(left paren)  val(()
 line(338.216), tk(30), typ(range separator)  val(..)
 line(338.218), tk(31), typ(forward slash)  val(/)
 line(338.219), tk(32), typ(prefix qualified ID string)  val(type)
 line(338.226), tk(33), typ(comma)  val(,)
 line(338.228), tk(34), typ(single quoted string)  val(ianaift:otnOtu)
 line(338.244), tk(35), typ(right paren)  val())
(gdb)

Personal tools