FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 01-05-2012, 10:00 AM
Shashank Ghoti
 
Default Porting issue from 32-bit to 64 bit

Hi All,

We are porting the application from 32-Bit to 64 Bit and OS is also 64-Bit . All the processes are highly generating core dump because of align problem when we go to 64 bit.

We have run processes using* GDB and found the below problem.


Let's say the class
class demo
{
*** private:
******** int a;
******* char *ptr;
******** int b;
};

GDB shows the object size created is 16 bytes ( 16 bytes memory creation in HEAP)while we go inside the class constructor, the size is shown of the "This pointer" is 24 for this kind of class defined. We think that the problem is due to alignment.*


The problem has gone away if we re-define the class as:
class demo

{
****
private:
******** char *ptr;

** ***** int a;
* ****** int b;

};


But we have many processes and there are lot of files. So it would be taking a lot of time to manually fix it.

Are we missing any compiler flag? OR how to fix it?* We have been trying find out since last two weeks? We don't know.


Thanks
Shashank
Senior Developer

*

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-05-2012, 10:12 AM
Shashank Ghoti
 
Default Porting issue from 32-bit to 64 bit

Hi All,



We are porting the application from 32-Bit to 64 Bit and OS is also 64-Bit .
All the processes are highly generating core dump because of align problem when
we go to 64 bit.



We have run processes using* GDB and found the below problem.



Let's say the class

class demo

{

*** private:

******** int a;

******* char *ptr;

******** int b;

};



GDB shows the object size created is 16 bytes ( 16 bytes memory creation in
HEAP)while we go inside the class constructor, the size is shown of the
"This pointer" is 24 for this kind of class defined. We think that
the problem is due to alignment.*



The problem has gone away if we re-define the class as:

class demo

{

**** private:

******** char *ptr;

** ***** int a;

* ****** int b;

};



But we have many processes and there are lot of files. So it would be taking a
lot of time to manually fix it.

Are we missing any compiler flag? OR how to fix it?* We have been trying
find out since last two weeks? We don't know.





Thanks

Shashank

Senior Developer
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-05-2012, 11:15 AM
Colin Law
 
Default Porting issue from 32-bit to 64 bit

On 5 January 2012 11:00, Shashank Ghoti <shashank.ghoti@gmail.com> wrote:
> Hi All,
>
> We are porting the application from 32-Bit to 64 Bit and OS is also 64-Bit .
> All the processes are highly generating core dump because of align problem
> when we go to 64 bit.
>
> We have run processes using* GDB and found the below problem.
>
> Let's say the class
> class demo
> {
> *** private:
> ******** int a;
> ******* char *ptr;
> ******** int b;
> };
>
> GDB shows the object size created is 16 bytes ( 16 bytes memory creation in
> HEAP)while we go inside the class constructor, the size is shown of the
> "This pointer" is 24 for this kind of class defined. We think that the
> problem is due to alignment.
>
> The problem has gone away if we re-define the class as:
> class demo
> {
> **** private:
> ******** char *ptr;
> ** ***** int a;
> * ****** int b;
> };
>
> But we have many processes and there are lot of files. So it would be taking
> a lot of time to manually fix it.
> Are we missing any compiler flag? OR how to fix it?* We have been trying
> find out since last two weeks? We don't know.

Are you sure that you have compiled everything with the same flags? I
have seen that sort of problem when different files have been compiled
with different options. Another possibility is that the wrong
versions of libraries are being used.

Are you able to replicate the problem you describe above with a very
simple application compiled in the same way.

Colin

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-06-2012, 10:47 AM
Shashank Ghoti
 
Default Porting issue from 32-bit to 64 bit

Thanks guys.

We verified the compiler time flags. It seems OK. We created a
separate program and complie with the same flags then the behavior is
as expected i.e., Proper memory is allocated (shown outside the
class) and same is shown for this pointer(inside the class).
We have used "ldd" to verify the libraries which seems OK to us.

Can you please suggest any other way to verify the wrong libraries
being used? Is there any flag which must be used for 64 bit
compilation?

This is the GCC version, we are using.

$ g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --disable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)



On 1/5/12, Colin Law <clanlaw@googlemail.com> wrote:
> On 5 January 2012 11:00, Shashank Ghoti <shashank.ghoti@gmail.com> wrote:
>> Hi All,
>>
>> We are porting the application from 32-Bit to 64 Bit and OS is also 64-Bit
>> .
>> All the processes are highly generating core dump because of align problem
>> when we go to 64 bit.
>>
>> We have run processes using GDB and found the below problem.
>>
>> Let's say the class
>> class demo
>> {
>> private:
>> int a;
>> char *ptr;
>> int b;
>> };
>>
>> GDB shows the object size created is 16 bytes ( 16 bytes memory creation
>> in
>> HEAP)while we go inside the class constructor, the size is shown of the
>> "This pointer" is 24 for this kind of class defined. We think that the
>> problem is due to alignment.
>>
>> The problem has gone away if we re-define the class as:
>> class demo
>> {
>> private:
>> char *ptr;
>> int a;
>> int b;
>> };
>>
>> But we have many processes and there are lot of files. So it would be
>> taking
>> a lot of time to manually fix it.
>> Are we missing any compiler flag? OR how to fix it? We have been trying
>> find out since last two weeks? We don't know.
>
> Are you sure that you have compiled everything with the same flags? I
> have seen that sort of problem when different files have been compiled
> with different options. Another possibility is that the wrong
> versions of libraries are being used.
>
> Are you able to replicate the problem you describe above with a very
> simple application compiled in the same way.
>
> Colin
>
> --
> ubuntu-users mailing list
> ubuntu-users@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 09:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org