This gum or another name - wood resin. It's the glue that trees use to heal themselves. When a crack is formed on the trunk, drops of resin appear on the damaged place. First, the resin is liquid, then it gradually turns into a jelly-like substance, then hardens.
I remember when we were kids, we used to eat this glue, ripping it off the branches and trunks of cherry or apricot trees. Strange tart taste of tree sap reminded me of the gum.