This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Migration from RWTools to string - problems [newbie]


Krzysztof,

Well, if your program is crashing, it should be generating a core file
(if not, then you might need to reset your ulimit for core files with
this command: 'ulimit -c unlimited' (without the quotes, of course).  On
newer RedHat systems, the core file will probably be named core.<pid>,
where <pid> is the process ID of the process that died.  Once you have
the core file, you load it into GDB, which can show you the stack trace.
You do that like this:

gdb <path_to_prog> <core_file>

For example, if your program is "myprog", and is in the current
directory, and your core file is simply name "core", then you would load
it into gdb like this:

gdb myprog core

Once you get to GDB's prompt, type "where" and hit return.  This will
show you the stack at the time the program crashed.  Type "quit" to
leave GDB.

Now, for this to really be useful, you will need to have compiled your
program with debugging information using the '-g' compiler switch (just
add it to your command line for compiling and linking).  With that, you
should get the actual line of code that it crashed on, if it crashed on
a line in your program.  Or, if it crashed in another library, or
something, you can see from the stack trace where the function that
crashed was ultimately called from.

If you can't figure out what the stack trace means, try posting it again
to the list.  Someone here will know how to read it.

Good luck,
Lyle

-----Original Message-----
From: Krzysztof.Wisniowski@siemens.com 
	I'm quite positive that I have not tried such a thing since
c_str
returns const char* and modifying that would cause the compiler to
react. I
have no idea about stack tracing, how is that done and by what tools? 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]