public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Migration from RWTools to string - problems [newbie]
@ 2003-09-30 16:38 lrtaylor
  0 siblings, 0 replies; 6+ messages in thread
From: lrtaylor @ 2003-09-30 16:38 UTC (permalink / raw)
  To: Krzysztof.Wisniowski, gcc-help

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? 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Migration from RWTools to string - problems [newbie]
@ 2003-10-01 20:03 lrtaylor
  0 siblings, 0 replies; 6+ messages in thread
From: lrtaylor @ 2003-10-01 20:03 UTC (permalink / raw)
  To: Krzysztof.Wisniowski; +Cc: gcc-help

Actually, if you're interested in knowing what kind of resources your
program is using, I believe there are system calls which will give you
this information, but I'm not sure what they are off the top of my head.
That goes beyond the scope of this list, however, since has it nothing
to do with GCC.  The first place I would look if I were you (and I would
bookmark this page) is docs.sun.com:

http://docs.sun.com/db/coll/45.13

This is the developer collection for Solaris 8 - a good wealth of
information for developing on Solaris.  You might start by looking in
the system interface guide.

Good luck,
Lyle

-----Original Message-----
From: Florian Weimer [mailto:fw@deneb.enyo.de] 

Krzysztof.Wisniowski@siemens.com wrote:

> I am looking for some function to display the free memory, perhaps
that
> would give me any idea what goes wrong in the program, unfortunately I
> cannot find any. Can you give me some hints?
> I am working on SunOS 5.8 with gcc++ 2.95.3.

Compile your application on GNU/Linux on x86 and give valgrind a try.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Migration from RWTools to string - problems [newbie]
  2003-09-29 15:08 Krzysztof.Wisniowski
@ 2003-10-01 19:26 ` Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2003-10-01 19:26 UTC (permalink / raw)
  To: Krzysztof.Wisniowski; +Cc: gcc-help

Krzysztof.Wisniowski@siemens.com wrote:

> I am looking for some function to display the free memory, perhaps that
> would give me any idea what goes wrong in the program, unfortunately I
> cannot find any. Can you give me some hints?
> I am working on SunOS 5.8 with gcc++ 2.95.3.

Compile your application on GNU/Linux on x86 and give valgrind a try.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Migration from RWTools to string - problems [newbie]
@ 2003-09-30  7:32 Krzysztof.Wisniowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof.Wisniowski @ 2003-09-30  7:32 UTC (permalink / raw)
  To: lrtaylor, gcc-help

Hello, and thanks for the reply,
	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? 

Greetings,
Krzysztof

-----Original Message-----
From: lrtaylor@micron.com [mailto:lrtaylor@micron.com] 
Sent: Monday, September 29, 2003 6:37 PM
To: Wisniowski, Krzysztof; gcc-help@gcc.gnu.org
Subject: RE: Migration from RWTools to string - problems [newbie]


Are you attempting to modify the strings using the pointer returned by
c_str()?  If so, DON'T!  Otherwise, normally, calling c_str() several
times should not cause a memory leak or cause your program to crash.
Have you tried looking at the stack trace to see where it is crashing?

Thanks,
Lyle Taylor

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Migration from RWTools to string - problems [newbie]
@ 2003-09-29 16:36 lrtaylor
  0 siblings, 0 replies; 6+ messages in thread
From: lrtaylor @ 2003-09-29 16:36 UTC (permalink / raw)
  To: Krzysztof.Wisniowski, gcc-help

Are you attempting to modify the strings using the pointer returned by
c_str()?  If so, DON'T!  Otherwise, normally, calling c_str() several
times should not cause a memory leak or cause your program to crash.
Have you tried looking at the stack trace to see where it is crashing?

Thanks,
Lyle Taylor

-----Original Message-----
From: Krzysztof.Wisniowski@siemens.com
[mailto:Krzysztof.Wisniowski@siemens.com] 
Sent: Monday, September 29, 2003 9:06 AM
To: gcc-help@gcc.gnu.org
Subject: Migration from RWTools to string - problems [newbie]

Hi all,

	I am trying to adapt a code which uses Rogue Wave libraries for
string manipulation, to use std::string. So far I have managed to
compile
and link the program with little modifications in the source code,
mostly by
replacing the .data() with .c_str() method. The main program consists of
the
for() loop which iterates through the file list, and applies some
calculations to the files data. After the changes I've made the program
completes only one full loop run, the second run almost always ends up
with
"Bus error" or "out of memory" error, all in the random places of the
loop.
Does anyone know if std::string might not entirely free the used
resources,
or do I have to look for something else to blame?
I am looking for some function to display the free memory, perhaps that
would give me any idea what goes wrong in the program, unfortunately I
cannot find any. Can you give me some hints?
I am working on SunOS 5.8 with gcc++ 2.95.3.

Thanks,
Krzysztof

-- 
Krzysztof Wisniowski   | Siemens Sp. z o.o.
ICM N&S SDC NE 3       | Software Design Center
Phone: +48 71 799 2403 | 54A Strzegomska Str.
Fax: +48 71 799 2320   | 53-611 Wroclaw POLAND

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Migration from RWTools to string - problems [newbie]
@ 2003-09-29 15:08 Krzysztof.Wisniowski
  2003-10-01 19:26 ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof.Wisniowski @ 2003-09-29 15:08 UTC (permalink / raw)
  To: gcc-help

Hi all,

	I am trying to adapt a code which uses Rogue Wave libraries for
string manipulation, to use std::string. So far I have managed to compile
and link the program with little modifications in the source code, mostly by
replacing the .data() with .c_str() method. The main program consists of the
for() loop which iterates through the file list, and applies some
calculations to the files data. After the changes I've made the program
completes only one full loop run, the second run almost always ends up with
"Bus error" or "out of memory" error, all in the random places of the loop.
Does anyone know if std::string might not entirely free the used resources,
or do I have to look for something else to blame?
I am looking for some function to display the free memory, perhaps that
would give me any idea what goes wrong in the program, unfortunately I
cannot find any. Can you give me some hints?
I am working on SunOS 5.8 with gcc++ 2.95.3.

Thanks,
Krzysztof

-- 
Krzysztof Wisniowski   | Siemens Sp. z o.o.
ICM N&S SDC NE 3       | Software Design Center
Phone: +48 71 799 2403 | 54A Strzegomska Str.
Fax: +48 71 799 2320   | 53-611 Wroclaw POLAND

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-10-01 20:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-30 16:38 Migration from RWTools to string - problems [newbie] lrtaylor
  -- strict thread matches above, loose matches on Subject: below --
2003-10-01 20:03 lrtaylor
2003-09-30  7:32 Krzysztof.Wisniowski
2003-09-29 16:36 lrtaylor
2003-09-29 15:08 Krzysztof.Wisniowski
2003-10-01 19:26 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).