[rtems-tools commit] rtems-exeinfo.cpp: Restore ostream format

Joel Sherrill joel at rtems.org
Tue Jul 27 18:42:01 UTC 2021


Module:    rtems-tools
Branch:    master
Commit:    e1469279a7a8b7e9bfdd47587bd8a1956752233c
Changeset: http://git.rtems.org/rtems-tools/commit/?id=e1469279a7a8b7e9bfdd47587bd8a1956752233c

Author:    Ryan Long <ryan.long at oarcorp.com>
Date:      Thu Jul 15 11:32:09 2021 -0400

rtems-exeinfo.cpp: Restore ostream format

CID 1503006: Not restoring ostream format
CID 1503007: Not restoring ostream format

Used a variable to store the format of the ostream before any changes,
and copied what was originally there back into the stream before
returning from the function.

Closes #4469

---

 linkers/rtems-exeinfo.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/linkers/rtems-exeinfo.cpp b/linkers/rtems-exeinfo.cpp
index 6e92206..c9bf5b6 100644
--- a/linkers/rtems-exeinfo.cpp
+++ b/linkers/rtems-exeinfo.cpp
@@ -47,11 +47,14 @@
 #include <rld-files.h>
 #include <rld-process.h>
 #include <rld-rtems.h>
+#include <rtems-utils.h>
 
 #ifndef HAVE_KILL
 #define kill(p,s) raise(s)
 #endif
 
+typedef rtems::utils::ostream_guard ostream_guard;
+
 namespace rld
 {
   namespace exeinfo
@@ -366,6 +369,7 @@ namespace rld
        */
 
       rld::strings all_flags;
+      ostream_guard old_state( std::cout );
 
       size_t source_max = 0;
 
@@ -632,6 +636,8 @@ namespace rld
 
     void image::output_tls ()
     {
+      ostream_guard old_state( std::cout );
+
       symbols::symbol* tls_data_begin = symbols.find_global("_TLS_Data_begin");
       symbols::symbol* tls_data_end = symbols.find_global("_TLS_Data_end");
       symbols::symbol* tls_data_size = symbols.find_global("_TLS_Data_size");



More information about the vc mailing list