You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/24 02:43:08 UTC

[GitHub] [incubator-nuttx] zhuyanlinzyl opened a new pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

zhuyanlinzyl opened a new pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321


   overload constructor of filebuf & ostream in uclibxx
   
   ## Summary
   
   Bug fix in uclibxx initalize
   
   
   
   ## Impact
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1020878493


   > The crash is not happen in my GCC build, When I build same code with CLANG-6.0,
   > 
   > The crash is in ios_base::Init::Init()
   > 
   > _cout_filebuf.openedFor = ios_base::out
   > 
   > The reason is global object `_cout_filebuf` was placed in a difference section in CLANG (which specific section I have forgotten now),
   > 
   > when run _cout_filebuf.openedFor = ios_base::out, It crash on on this section can't be writing.
   
   i investigated a bit.
   
   my observations
   * the access to cerr.mformat crashes because cerr (specifically its vptr) has not been initialized at this point and mformat is a member of the base class, which is using virtual inheritance.
   * gcc seems to produce code which bypasses vtable in this case. it explains why it works with gcc.
   * i consider it a bug of uClibc++.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1019747396


   The crash is not happen in my GCC build,  When I build same code with CLANG-6.0, 
   
   The crash is in ios_base::Init::Init()
   
   _cout_filebuf.openedFor = ios_base::out
   
   The reason is global object `_cout_filebuf`  was placed in a difference section in CLANG (which specific section I have forgotten now),
   
   when run  _cout_filebuf.openedFor = ios_base::out,   It crash on on this section can't be writing.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1020878493


   > The crash is not happen in my GCC build, When I build same code with CLANG-6.0,
   > 
   > The crash is in ios_base::Init::Init()
   > 
   > _cout_filebuf.openedFor = ios_base::out
   > 
   > The reason is global object `_cout_filebuf` was placed in a difference section in CLANG (which specific section I have forgotten now),
   > 
   > when run _cout_filebuf.openedFor = ios_base::out, It crash on on this section can't be writing.
   
   i investigated a bit.
   
   my observations
   * the access to cerr.mformat crashes because cerr (specifically its vptr) has not been initialized at this point and mformat is a member of the base class, which is using virtual inheritance.
   * gcc seems to produce code which bypasses vtable in this case. it explains why it works with gcc.
   * i consider it a bug of uClibc++.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1021129132


   Yes, the correct and elegant approach is pass the initial parameter through constructor, like what we have done in this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1019678364


   @yamt please try this patch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1019703873


   it seems the crash on boot has been fixed by this change.
   ```
   (lldb) target create "./nuttx"
   Current executable set to '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64).
   (lldb) run
   Process 92526 launched: '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64)
   test ofstream===========================
   printf: Starting test_ostream
   printf: Successfully opened /dev/console
   cout: Successfully opened /dev/console
   Writing this to /dev/console
   test iostream===========================
   Hello, this is only a test
   Print an int: 190
   Print a char: d
   test vector=============================
   v1=1 2 3
   Hello World Good Luck 
   test map================================
   test rtti===============================
   extend
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1019715279


   i read the patch but i don't understand how it fixes the crash. can you give me a brief explanation?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5321: libxx:uclibxx: add patch use overload constructor of filebuf & ostream

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5321:
URL: https://github.com/apache/incubator-nuttx/pull/5321#issuecomment-1021129132


   Yes, the correct and elegant approach is pass the initial parameter through constructor, like what we have done in this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org