c++ - GDB and G++ Changing Random Parameters to 0 -
i writing library allow brand new wifi system-on-a-chip (processor cortex-m4) function arduino wifi api, i'm running very weird bug while debugging gdb.
often, parameters passed functions change 0 no reason. example, while testing library, call delay(1000)
, sketch running faster expected. breaking execution @ call of delay revealed in actuality, delay(0)
being called... isn't big of deal, has far worse implications strings. example, passing in string strlen()
causes huge problems. pointer changed (char*) 0x0
, , strlen(0x0)
returns several thousand bytes because null character isn't encountered while.
even worse, implicit this
pointer gets changed 0x0
well, changing value of instance's variables
i've tried can think of. i've switched different development board, i've recompiled code , ide, i've turned off optimization (using -o0
). i'm lost.
why parameters getting changed 0 apparently no reason?
edit so, sounds stack overflow issue (how appropriate), guess easiest fix make local stack larger. i'm compiling arm-none-eabi-g++, command line argument can use make stack larger? matter, default stack size?
Comments
Post a Comment