[CLI] List command bugs fixed:
authorOleg Lekarev <o.lekarev@samsung.com>
Tue, 14 Mar 2023 09:55:51 +0000 (12:55 +0300)
committerGleb Balykov/Advanced System SW Lab /SRR/Staff Engineer/Samsung Electronics <g.balykov@samsung.com>
Tue, 14 Mar 2023 17:26:19 +0000 (20:26 +0300)
1. No output for uncompressed source files.
2. Garbage output after the end of source file.
3. Incorrect line counter work at the bottom of source file.

src/managed/SymbolReader.cs
src/protocols/cliprotocol.cpp
src/protocols/sourcestorage.cpp

index ad2523fd587439c9aeb8ccb364672e0f2ecbb354..fe0b35fad1b717d13d2a01a1a23fed9b83c42c78 100644 (file)
@@ -1553,6 +1553,10 @@ namespace NetCoreDbg
 
                 stream = decompressed;
             }
+            else
+            {
+                docSize = bytes.Length - sizeof(int);
+            }
             return stream;
         }
     }
index aea0c50fd19ce3bb6143968d76b9d98e6af003ef..5b2ca2f57b127281c9a7f0c19e6737ec7cdc591f 100644 (file)
@@ -1486,6 +1486,8 @@ HRESULT CLIProtocol::doCommand<CommandTag::List>(const std::vector<std::string>
                 else
                     printf("   %d\t%s\n", line,  toPrint);
             }
+            else
+                break; // end of file
         }
         m_sourceLine = line;
     }
index a371289bd8578495a8fe186e764163d2f72b8937..2342fdbb89ea344368fc9b6845133f3b2567b22e 100644 (file)
@@ -60,7 +60,7 @@ namespace netcoredbg
         sf->text = fileBuff;
 
         sf->lines.push_back(NULL); // The lines count begins from 1, the 0th line is empty
-        for(char* bufptr = sf->text; bufptr <= sf->text + fileLen; )
+        for(char* bufptr = sf->text; bufptr < sf->text + fileLen; )
         {
             sf->lines.push_back(bufptr);
             while(*bufptr != '\r')