Search the web
Sign In
New User? Sign Up
mpatrol · mpatrol library discussion group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Embedded program does not run correctly   Message List  
Reply | Forward Message #1100 of 1198 |
RE: [mpatrol] Re: Embedded program does not run correctly

Hi Fahri,

 

You don’t have much physical memory on your chip, so you won’t have very much available to your process after the operating system eats some of it up, although at least it looks from the log file that your program is now running to completion, albeit with errors in free().

 

I would suggest building mpatrol with –DFORMAT=FORMAT_NONE so that you don’t read any symbols from the executable.  Your technique to build with MP_LIBRARYSTACK_SUPPORT is a good one because that will effectively disable mpatrol recording stack tracebacks as well, thus saving some more memory (your attempt to use MP_BUILTINSTACK_SUPPORT probably failed because gcc’s __builtin_frame_address features don’t always work on all architectures, or for more than a number of stack frames).

 

Because you don’t have enough memory to run mpatrol with it recording symbolic stack traces, you need to include mpatrol.h in your source files to get at least some indication of where the allocations come from in the log file.  You may hit a problem with mpatrol.h and the macro overriding of operator new and delete.  I’ve got no idea why “16384” is displaying instead of the function name.  Perhaps gcc’s __PRETTY_FUNCTION__ pseudomacro isn’t working properly?  If you can’t get any of that to work then you can still break at a specific allocation or free in the debugger to see where it is being called from.

 

It’s possible that the errors you’re seeing at the end of the log file are coming from the Elinos glibc freeing up memory that it allocated when the process started.  If the mpatrol library wasn’t fully initialised at that point, it may have allocated such memory from a chunk of static memory just to get things going, hence the messages you’re seeing when the process terminates.  I don’t know anything about Elinos but I did have to do some workarounds like this for Windows, Linux and Tru64 (see line 80 on mpatrol/src/inter.c).

 

Good luck,

 

Graeme.

 


From: mpatrol@yahoogroups.com [mailto:mpatrol@yahoogroups.com] On Behalf Of fsoenmez
Sent: 15 May 2008 14:09
To: mpatrol@yahoogroups.com
Subject: [mpatrol] Re: Embedded program does not run correctly

 

Hi Graeme,
thanks much for your response.
This is our system:

CPU: MPC5200B
RAM: 64 MB = 32 MB RAM + 32 MB Filesystem
OS: Elinos glibc 2.3.4

We translated the mpatrol lib with debuginfo +
MP_BUILTINTSTACK_SUPPORT and note that mpatrol in the function
__mp_getframe (stackinfo * p) -> returnaddresses (p-> addrs, f,
MP_MAXSTACK (line 424) crashed. And if we translated mpatrol lib with
debuginfo without MP_BUILTINTSTACK_SUPPORT, we note that mpatrol in
signals.c: 82 static void signalhandler (int s, int c, struct
sigcontext * n, void * f) crashed. We could translated the lib with
debugging information and MP_LIBRARYSTACK_SUPPORT we get this log entry:
@(#) mpatrol 1.4.8 (02/01/08)
Copyright (C) 1997-2002 Graeme S. Roy

This is free software, and you are welcome to redistribute it under
certain
conditions; see the GNU Library General Public License for details.

For the latest mpatrol release and documentation,
visit http://www.cbmamiga.demon.co.uk/mpatrol.

operating system: UNIX
system variant: Linux
processor architecture: PowerPC
processor word size: 32-bit
object file format: BFD
dynamic linker type: Unknown

Log file generated on Sat Jan 1 00:12:04 2000

read 7968 symbols from CXAppl

ALLOC: operator new (42, 18 bytes, 8 bytes) [16384|-|-|-]

returns 0x10272398

ALLOC: operator new (43, 30 bytes, 8 bytes) [16384|-|-|-]

returns 0x102723B0

FREE: operator delete (0x10272398) [16384|-|-|-]

0x10272398 (18 bytes) {operator new:42:0} [16384|-|-|-]

ALLOC: malloc (44, 376 bytes, 8 bytes) [16384|-|-|-]
....
....
ERROR: [NOTALL]: free: 0x104BC660 has not been allocated
....
ERROR: [NOTALL]: free: 0x104BBB40 has not been allocated
....
system page size: 4096 bytes
default alignment: 8 bytes
overflow size: 0 bytes
overflow byte: 0xAA
allocation byte: 0xFF
free byte: 0x55
allocation stop: 0
reallocation stop: 0
free stop: 0
unfreed abort: 0
small boundary: 32 bytes
medium boundary: 256 bytes
large boundary: 2048 bytes
lower check range: 0
upper check range: 0
check frequency: 1
failure frequency: 0
failure seed: 946685524
prologue function: <unset>
epilogue function: <unset>
handler function: <unset>
log file: mpatrol.log
profiling file: mpatrol.out
tracing file: mpatrol.trace
program filename: CXAppl
symbols read: 7968
autosave count: 0
freed queue size: 0
allocation count: 13107
allocation peak: 1690 (2208295 bytes)
allocation limit: 0 bytes
allocated blocks: 722 (919416 bytes)
marked blocks: 0 (0 bytes)
freed blocks: 0 (0 bytes)
free blocks: 439 (1476744 bytes)
internal blocks: 71 (1163264 bytes)
total heap usage: 3559424 bytes
total compared: 76625 bytes
total located: 40 bytes
total copied: 665124 bytes
total set: 571780 bytes
total warnings: 0
total errors: 10

Square brackets include no right information.

Kind regards & thank you Fahri

--- In mpatrol@yahoogroups.com, "Graeme Roy" <graeme_roy@...> wrote:
>
> Hi,
>
> As long as you don't use the following mpatrol options, then your
> program's heap will be reasonably compact, as you'd expect:
>
> NOFREE, OFLOWSIZE, PAGEALLOC
>
> However, the library will still use quite a lot of memory for its
> internal record-keeping, such as symbolic stack traces, profiling,
> tracing, etc. You don't really have any control over whether mpatrol
> reads symbols or not, but you could always recompile the library to
> disable that, probably saving quite a lot of memory but losing that
> capability. The following options will increase the amount of memory
> mpatrol uses internally:
>
> PROF, TRACE, USEDEBUG
>
> You mention that the program should "log on further and not stop when
> not being loaded completely". Is it stopping because you're running
> out of memory? How much memory do you have available on your embedded
> system? What is the OS that it's running on? Is it an embedded Linux
> such as ucLinux?
>
> Remember that you don't need to log everything from mpatrol. If there
> is an error, mpatrol will log it automatically. If the log file is
> being placed in a ram disk on your system then cutting the size of the
> log file might give you more memory to run your program.
>
> Graeme.
>
> --- In mpatrol@yahoogroups.com, "fsoenmez" <fsoenmez@> wrote:
> >
> > Hi,
> >
> > on our PowerPC we start our software with mpatrol, which creates a
> > very big logfile (105 MB). The memory allocation grows to big (twice
> > as big as usually). The program should log on further and not stop
> > when not being loaded completely.
> >
> > Does anybody have an idea how it can be avoided that the program stops
> > and needs such a big memory allocation?
> > What do you suggest to get an acceptable result?
> >
> > Kind regards & thank you
> >
> > Fahri
> >
>



Fri May 16, 2008 11:11 am

graemeroy
Offline Offline
Send Email Send Email

Forward
Message #1100 of 1198 |
Expand Messages Author Sort by Date

Hi, on our PowerPC we start our software with mpatrol, which creates a very big logfile (105 MB). The memory allocation grows to big (twice as big as usually)....
fsoenmez
Offline Send Email
May 12, 2008
8:20 am

Hi, As long as you don't use the following mpatrol options, then your program's heap will be reasonably compact, as you'd expect: NOFREE, OFLOWSIZE, PAGEALLOC ...
Graeme Roy
graemeroy
Offline Send Email
May 12, 2008
8:46 am

Hi Graeme, thanks much for your response. This is our system: CPU: MPC5200B RAM: 64 MB = 32 MB RAM + 32 MB Filesystem OS: Elinos glibc 2.3.4 We translated the...
fsoenmez
Offline Send Email
May 15, 2008
1:16 pm

Hi Fahri, You don't have much physical memory on your chip, so you won't have very much available to your process after the operating system eats some of it ...
Graeme Roy
graemeroy
Offline Send Email
May 16, 2008
11:11 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help