11 Jan, 2016, Rarva.Riendf wrote in the 1st comment:
Votes: 0
The problem a little more detailed.

My code is run and compiled on a 64bit linux, (a redhat install)
I code/compile/run on Fedora 64 bit as well (21 or 23 depending what computer I use with a newer version of GCC and kernel)

What happens:
On the server running the code, there is a memory corruption bug, that I can trigger everytime doing the same thing.
When I finally could detect what triggered it I was quite happy, as I could at last solve it.
Problem is I cannot replicate it locally, and more troublesome, Valgrind detect nothing at all as well.
And that puzzles me. (at first I thought it could be me that screwed something by relying on 64 bit value limitation)

What annoys me is that I only have the command line on the server, and having to learn gdb in command line for just this one bug is not exactly what I want to do (I code in Eclipse, and having the capacity to look at the memory in one windows while clicking to do step by step debug and see the line and all variable at hand has quite spoiled me)

If someone is well versed in GDB the only thing I would need to know to debug is how to monitor a specific value that should not be changed (it is a static array initialied at boot)
the bug always corrupt memory in this place (and others but this one will not crash anything) so I would know wich line of code did it
so I can fix it.
Again in Eclipse, it is as simple as putting an observer on a variable to know when it changes. But that is done in a single click :) (yeah I am taht spoiled)

If someone can help thanx in advance!
12 Jan, 2016, Rarva.Riendf wrote in the 2nd comment:
Votes: 0
hmm guess it is that:


answered to myself as soon as I started looging for it :)
Will be able to answer the mystery next time :)
12 Jan, 2016, Tyche wrote in the 3rd comment:
Votes: 0
Eclipse uses GDB.
To set a watch point on a variable in scope 'foo' do:
(gdb) watch foo
12 Jan, 2016, alteraeon wrote in the 4th comment:
Votes: 0
If you can't figure it out with GDB, I'd recommend recompiling everything with -fsanitize=address instead and look at the stack dump from that. That should tell you the instant the out of bounds memory gets written to. You can use the addr2line program on the command line to dump out the line numbers of the code.
12 Jan, 2016, Rarva.Riendf wrote in the 5th comment:
Votes: 0
>Eclipse uses GDB.

Of course it does, but i did not need to know the comandline till yet. The IDE is there to avoid that.
cannot run Eclipse on the server.

>If you can't figure it out with GDB, I'd recommend recompiling everything with -fsanitize=address

Ah dam! I do it locally when I code, but I forgot to do it on the server! Willl begin by trying that.
12 Jan, 2016, Rarva.Riendf wrote in the 6th comment:
Votes: 0
Bonk self repeteadly……

Valgrind not liking the sanitizing adress stuff , I was actually compiling locally for a long time without the sanitizing stuff.

Funny thing though, is I do not understand why Valgrind did not complain that I was overwriting a static string…(reminded me to change a variable name, MAX_INPUT_LENGTH is way to close to MAX_STRING_LENGTH when you read code:) )

Lesson learned, the sanitizing compile option do not do the same job than valgrind. Better use both.

btw my compile flags now:

DATE=`date +%m%d%Y`
CC = g++
PROF = -ggdb -lcrypt -lpthread -lz -lm -fsanitize=address -fsanitize=undefined
C_FLAGS = -fsanitize=address -fsanitize=undefined -Wall -ansi -Wextra -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wno-format-nonliteral -Wstrict-aliasing -Wsign-promo -Wdisabled-optimization -Wsynth -Wwrite-strings -fstack-protector -Wcomment -Wformat=2 -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wsequence-point -Wsign-compare -Woverloaded-virtual -Wswitch -Wswitch-enum -Wtrigraphs -Wunused -Wvariadic-macros -Wvolatile-register-var -std=c++0x -Wdouble-promotion -Wlogical-op -Wmissing-noreturn -Wunreachable-code -Wuseless-cast -Wno-long-long -Wno-unused-parameter -Wno-suggest-attribute=noreturn $(PROF) -Dlinux
L_FLAGS = -ggdb -lcrypt -lpthread -lz -lm -fsanitize=address -fsanitize=undefined


O_FILES = expression_parser.o mccp.o threadedcommand.o livemaze.o mapmakerv2.o act_comm.o act_info.o act_move.o\
act_obj.o act_wiz.o alias.o fileutils.o anmagic.o anmagic2.o anmagic3.o\
anskills.o bit.o clans.o comm.o const.o color.o craft.o db.o db2.o effects.o\
fight.o flags.o handler.o interp.o note.o magic.o magic2.o mob_comm.o\
mob_prog.o misc.o olc.o olcmem.o olcsave.o recycle.o protocol.o\
save.o skills.o special.o string.o tables.o track.o update.o \
www.o anobjcraft.o event.o
all: $(O_FILES)
$(CC) -o anrun $(O_FILES) $(L_FLAGS)
g++ –version