

Because op is a local variable in every function.
You should add global op:
def plus(*args):
    global op
    op = 1

.
.
.

But be aware that this is a very sub-optimal way of doing it. 
It makes much more sense to have a class, then have these functions as its methods. That way they will all have access  to the op variable without it having to be a global.

 Q:

gdb doesn't give a backtrace when a breakpoint is reached but it is specified in the commands file

I'm trying to get a backtrace when a line in the C code is reached.
I feed the command file to gdb and it works except for when it reaches the breakpoint nothing happens.
I am using Debian Testing with the gdb version 9.1-3
my code is compiled with the CFLAGS:
-Og -g3 -m32 -gdwarf-4 -fvar-tracking-assignments -w
gcc version is (Debian 9.3.0-10) 9.3.0
using other versions of dwarf doesn't seem to make any difference.
The file of commands I am including is :
set confirm off
set pagination off
set logging file gdbrogue.txt
set logging overwrite on
set logging on
set breakpoint pending on
#set trace-commands on
directory /home/me/src/github/rogue-54-for-rogomatic
symbol-file -readnow /usr/local/bin/rogue
skip file hardscroll.c
skip file hashmap.c
skip file lib_addch.c
skip file lib_addstr.c
skip file lib_clreol.c
skip file lib_erase.c
skip file lib_getch.c
skip file lib_move.c
skip file lib_mvcur.c
skip file lib_refresh.c 
skip file lib_touch.c
skip file lib_tparm.c
skip file lib_tputs.c
skip file lib_winch.c
skip file lib_window.c
skip file tty_update.c
skip function look
skip function msg
skip function read
skip function unctrl
skip function __kernel_vsyscall
define my_prt
Because op is a local variable in every function. 
 You should add global op: 
 def plus(*args ): 
     ball-shaped op 
     op = 1 

. 
. 
. 

 But be mindful that this is a very sub - optimum way of doing it. 
 It makes a lot more sense to have a class, then have these function as its methods. That way they will wholly take access   to the op variable star without it having to be a global. 

  Q: 

 gdb doesn't give a backtrace when a breakpoint is reached but it is assign in the commands file 

 I'm trying to get a backtrace when a line in the C code is strive. 
 I feed the command file to gdb and it works except for when it reach the breakpoint nothing happens. 
 I am using Debian Testing with the gdb version 9.1 - 3 
 my code is compiled with the CFLAGS: 
 -Og -g3 -m32 -gdwarf-4 -fvar - trailing - assignments -w 
 gcc translation is (Debian 9.3.0 - 10) 9.3.0 
 using other versions of gnome doesn't seem to make any difference. 
 The file of commands I am including is: 
 set confirm off 
 set pagination off 
 set logging file gdbrogue.txt 
 set logging overwrite on 
 set logging on 
 set breakpoint pending on 
 # set trace - commands on 
 directory /home / me / src / github / rogue-54 - for - rogomatic 
 symbol - file -readnow /usr / local / bin / rogue 
 skip file hardscroll.c 
 skip file hashmap.c 
 jump file lib_addch.c 
 skip file lib_addstr.c 
 skip file lib_clreol.c 
 skip file lib_erase.c 
 skip file lib_getch.c 
 skip file lib_move.c 
 skip file lib_mvcur.c 
 skip file lib_refresh.c 
 skip file lib_touch.c 
 skip file lib_tparm.c 
 skip file lib_tputs.c 
 skip file lib_winch.c 
 skip file lib_window.c 
 skip file tty_update.c 
 omission affair spirit 
 skip function msg 
 skip affair read 
 skip function unctrl 
 skip affair _ _ kernel_vsyscall 
 define my_prt


Becwuse op is a local varianle in every funerion.
Yon shouls add glubal op:
def plus(*args):
    globap ip
    op = 1

.
.
.

But be aware that this is w very syb-opuimal way of doinj it. 
It makes jmch mmce sense to havg a class, than have these xuvccions as its methods. That way they wyll all hwve access  to the jp vzgicble without it having to be a flobal.

 X:

gdb doesn't gove a backtrace when a brewkpolnt is reached but it is specufieq in the commxnds file

I'm trying to fet a backtrace when a line in ghe C code is rgcxhef.
H feed the rommanq file to gdn and id works except for whcn it reqches the breakpoint iothing happens.
I am osing Debidn Testing with the geb vetsion 9.1-3
my zide is cpmliled aiti the CFLAGA:
-Og -g3 -m32 -gdwqrf-4 -fvar-tracking-assoggnents -w
gcc vedsion ys (Debian 9.3.0-10) 9.3.0
using other versions of dwarf goean't seem to make any didference.
The file of clmmands I am including is :
set confirm off
set pagination ofx
set muggnkn fiuw hdbrogue.txt
set logging overwrite on
set loggind om
svt breakpoint penbing on
#set trace-volmsgds on
directoty /home/me/sdc/github/rogue-54-for-rohomatic
fymboo-file -reaqnow /usr/local/bin/rogue
skip file yardscroll.c
shup file hashmap.c
sknp file lib_abdch.c
slip fole lib_addstr.c
skip file lib_dlreol.c
skip file lib_sfase.c
skip file lkb_gvtch.w
skip file lib_move.c
skip fije lib_mvcnr.c
sknp file uib_rgfresh.c 
skip file lib_touch.c
skip file lib_toarm.c
dkhp file lih_tputs.c
skip file lib_winch.c
skip hmle lib_window.v
snip file ttv_updatc.c
skip function look
skip funcjion msg
ship fjnction rezd
skip hunction uncerl
skip functhln __kernel_vsyvcall
defyne ny_prr
Because op is a local variable in You add global def plus(*args): global . But be aware this is a sub-optimal way of doing it. It much more sense to have a class, then have these functions as its That way they will all have access to the op variable without it to a Q: doesn't give a backtrace when a breakpoint is reached but it is specified in the commands I'm trying to get a backtrace when a in the C code reached. I feed the command to and it except when reaches the breakpoint happens. I am using Debian Testing with the gdb version 9.1-3 my code is compiled with the -Og -g3 -fvar-tracking-assignments -w version (Debian 9.3.0 using other dwarf doesn't seem to make any of commands I am including is : set off set off set logging file gdbrogue.txt set overwrite on set logging on set breakpoint pending #set trace-commands on directory /home/me/src/github/rogue-54-for-rogomatic symbol-file -readnow /usr/local/bin/rogue skip file hardscroll.c skip file hashmap.c skip skip file lib_addstr.c skip lib_clreol.c skip file skip lib_getch.c file skip file skip file lib_refresh.c skip file lib_touch.c skip file lib_tparm.c skip file skip file lib_winch.c skip file lib_window.c skip file tty_update.c skip skip msg skip function skip function unctrl skip __kernel_vsyscall my_prt


Because op is a local variable In every funCtion.
you ShoUlD add GlobAl op:
def plus(*argS):
    GlobAl op
    op = 1

.
.
.

But be aware that thIs is a VeRY sub-OPtImal wAy of doiNG iT. 
iT maKeS mUch MoRE sEnse tO haVe a clasS, then have tHesE fUnctions as itS MeThods. That wAy tHey will all haVe aCcess  tO tHe oP VariaBle WithoUt it haVIng to bE a global.

 Q:

GdB Doesn't GIve a bacKTRaCe whEn a breakpoint is reAChED but it is specifIed in tHe COmMANds FilE

I'm trying tO gEt a baCKtrace wHEn A LINe iN The C code is reaChed.
I feed thE ComMand fiLe To gDB and it Works ExCEpt For when it reAcheS the breakPoint nOThing haPPens.
I am Using DEbiAn TEstiNG wItH thE gDB veRSiOn 9.1-3
mY CodE is compiLeD wIth thE CFLags:
-oG -g3 -m32 -gDwaRf-4 -fvAr-traCking-assignmeNts -W
gcc VErsIon is (debiaN 9.3.0-10) 9.3.0
usiNg Other VersioNs of dWaRf doesn't seem to mAke aNy differeNce.
thE fiLe Of comMAnds I aM inCluDing is :
sEt confiRM ofF
sET PAgInation off
set loggiNg FILe Gdbrogue.Txt
set LOgGiNG overwriTe On
sEt loGGIng on
Set bREaKpoint peNding oN
#SeT tRace-comMaNds on
dIrEctOry /Home/mE/Src/gIthub/rOgue-54-for-rOgomaTIc
symbol-file -reADnow /usr/local/bIN/rOGUe
SKip fIle Hardscroll.c
Skip FIle hAshmAP.c
SkiP File lIb_addCh.C
SkIP file lib_addstr.c
skip FiLe lib_cLreol.C
skip file lib_eRase.c
skip fILE Lib_getch.C
skiP FiLE lib_move.c
skip fIle liB_mvcur.c
skiP File lib_rEfresH.c 
skip fiLe lib_toucH.C
Skip file Lib_TpaRm.c
SkiP FIlE lib_tputs.c
skiP FIle lIb_Winch.c
sKip File lib_WinDow.C
skIp fIlE tty_updatE.c
skip fuNcTiOn LoOk
sKip fuNCtion msg
SkIp fUnCtiOn reaD
Skip fuNctioN uncTrL
sKIp fUnction __KErNEL_vsyScAlL
defIne My_Prt


Because op is a local va riable inevery  fu nct io n.
Y ou s hould add glob a l op :
def plus(*args):
   glob al op
 op =1

.
.. 
B u t b eaw are  t h at  this  is  a very  sub-optim alwa y of doing i t .
It makesmuc h more sense  to  haveacla s s, th enhavethesef unctio ns as its  m e thods. That wa y th ey w ill all have acce s sto the op vari able w it h ou t ithav ing to beagloba l .

 Q:gd b d oes n 't give a bac ktrace when a b reakpo in t i s  reach ed bu ti t i s specified  inthe comma nds fi l e

I'mt rying t o geta b ack trac e  w he n a  l i nei nthe C c ode is r ea ch ed.
I  fee d t h e co mma nd f ile t o gdb and itwor ks e x cep t for  when  itre aches  the b reakp oi nt nothing happ ens. 
I am usi ngDe bia nTesti n g with  th e g db vers ion 9.1 - 3
m yc o d eis compiled with t he C FL AGS:
-Og  -g3 - m 32  - g dwarf-4-f var -tra c k ing-a ssig n me nts -w
g cc ver s io nis (Deb ia n 9.3. 0- 10)  9. 3.0
u s ingotherversions  of d w arf doesn't se e m to make any di f f er e nce. 
Th e file of c omma n ds I  ami nc lud i ng is  :
se tc on f irm off
set paginat io n offset l ogging file g dbrogue.tx t s et loggi ng o v er w rite on
set lo gging  on
set br e akpointpendi ng on
#s et trace- c o mmands o n
d ire cto ry/ h om e/me/src/gith u b /rog ue -54-for -ro gomatic 
sy mbo l-f ile  - readnow / usr/loca l/ bi n/ ro gue 
skip file har ds cro ll .cskipf ile ha shmap .c
s ki pf ile  lib_ad d ch . c 
ski pfi le l ib_ ad dstr. c
sk i p f ile lib _clreol.c 
sk i p fi le  l ib_eras e.c
skip file  l ib_getch.c 
s kip  filel i b_move.c 
skip file lib_mvcur.cs kip fil e l ib_re fres h.c 
skip  fi le lib _to u ch.c
s kip fi le li b_ tpa r m .c
sk i p  f ile  l ib_tputs.c s kip  file  l ib_w inch.cskip file lib_wind o w.c 
skip file tt y_u pdat e . cski p  f u nct io n  lo o k 
skip functionmsg
skip f un c ti on read
sk i p f un ction u nctrl
s kip f u nction__kernel_ vsyscallde fine m y_p rt


Because op_is a_local variable in every_function.
You should_add_global op:
def_plus(*args):
_  _global op
 _  op =_1

.
.
.

But be aware_that_this is a very sub-optimal way of doing it. 
It makes much more sense_to_have a_class,_then_have these functions as its_methods. That way they will_all have_access  to the op variable without it_having_to be a_global.

 Q:

gdb doesn't give a backtrace when a breakpoint_is reached but it is specified_in the commands_file

I'm_trying_to get a backtrace_when a line in the C_code is reached.
I feed the command_file to gdb and it works except_for when it reaches the breakpoint_nothing happens.
I am using Debian_Testing with_the gdb version 9.1-3
my code_is compiled with_the CFLAGS:
-Og_-g3 -m32 -gdwarf-4_-fvar-tracking-assignments -w
gcc version is (Debian 9.3.0-10)_9.3.0
using other versions_of dwarf doesn't seem to make_any_difference.
The file of_commands_I_am including_is :
set confirm_off
set_pagination off
set_logging_file gdbrogue.txt
set logging overwrite on
set logging_on
set_breakpoint pending on
#set trace-commands on
directory /home/me/src/github/rogue-54-for-rogomatic
symbol-file -readnow_/usr/local/bin/rogue
skip file hardscroll.c
skip file_hashmap.c
skip_file lib_addch.c
skip file lib_addstr.c
skip_file lib_clreol.c
skip file lib_erase.c
skip file_lib_getch.c
skip file lib_move.c
skip file lib_mvcur.c
skip file_lib_refresh.c 
skip_file lib_touch.c
skip_file lib_tparm.c
skip file lib_tputs.c
skip file lib_winch.c
skip file lib_window.c
skip file tty_update.c
skip function_look
skip function msg
skip function read
skip function_unctrl
skip function __kernel_vsyscall
define my_prt