]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c
ArmPkg: Apply uncrustify changes
[mirror_edk2.git] / ArmPkg / Library / RvdPeCoffExtraActionLib / RvdPeCoffExtraActionLib.c
index 531cfa1e7b36c44f25e12ac51e95ff7e361cdf8c..6539c01763b516912b168f5a8a603cf34b7cabd4 100644 (file)
@@ -2,13 +2,9 @@
 \r
 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
 Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Portions copyright (c) 2011 - 2012, ARM Ltd. All rights reserved.<BR>\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -23,9 +19,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PrintLib.h>\r
 \r
 /**\r
-  Append string to debugger script file, create file if needed. \r
+  Append string to debugger script file, create file if needed.\r
 \r
-  This library can show up in mulitple places so we need to append the file every time we write to it.\r
+  This library can show up in multiple places so we need to append the file every time we write to it.\r
   For example Sec can use this to load the DXE core, and the DXE core would use this to load all the\r
   other modules. So we have two instances of the library in the system.\r
 \r
@@ -39,25 +35,25 @@ WriteStringToFile (
   )\r
 {\r
   // Working around and issue with the code that is commented out. For now send it to the console.\r
-  // You can copy the console into a file and source the file as a script and you get symbols. \r
-  // This gets you all the symbols except for SEC. To get SEC symbols you need to copy the \r
+  // You can copy the console into a file and source the file as a script and you get symbols.\r
+  // This gets you all the symbols except for SEC. To get SEC symbols you need to copy the\r
   // debug print in the SEC into the debugger manually\r
   SemihostWriteString (Buffer);\r
-/*\r
-  I'm currently having issues with this code crashing the debugger. Seems like it should work.\r
 \r
-  UINT32        SemihostHandle;\r
-  UINT32        SemihostMode = SEMIHOST_FILE_MODE_WRITE | SEMIHOST_FILE_MODE_BINARY | SEMIHOST_FILE_MODE_CREATE;\r
+  /*\r
+    I'm currently having issues with this code crashing the debugger. Seems like it should work.\r
 \r
-  SemihostFileOpen ("c:\rvi_symbols.inc", SemihostMode, &SemihostHandle);\r
-  SemihostFileWrite (SemihostHandle, &Length, Buffer);\r
-  SemihostFileClose (SemihostHandle);\r
- */\r
-}\r
+    UINT32        SemihostHandle;\r
+    UINT32        SemihostMode = SEMIHOST_FILE_MODE_WRITE | SEMIHOST_FILE_MODE_BINARY | SEMIHOST_FILE_MODE_UPDATE;\r
 \r
+    SemihostFileOpen ("c:\rvi_symbols.inc", SemihostMode, &SemihostHandle);\r
+    SemihostFileWrite (SemihostHandle, &Length, Buffer);\r
+    SemihostFileClose (SemihostHandle);\r
+   */\r
+}\r
 \r
 /**\r
-  If the build is done on cygwin the paths are cygpaths. \r
+  If the build is done on cygwin the paths are cygpaths.\r
   /cygdrive/c/tmp.txt vs c:\tmp.txt so we need to convert\r
   them to work with RVD commands\r
 \r
@@ -66,20 +62,20 @@ WriteStringToFile (
 **/\r
 CHAR8 *\r
 DeCygwinPathIfNeeded (\r
-  IN  CHAR8   *Name\r
+  IN  CHAR8  *Name\r
   )\r
 {\r
-  CHAR8   *Ptr;\r
-  UINTN   Index;\r
-  UINTN   Len;\r
-  \r
+  CHAR8  *Ptr;\r
+  UINTN  Index;\r
+  UINTN  Len;\r
+\r
   Ptr = AsciiStrStr (Name, "/cygdrive/");\r
   if (Ptr == NULL) {\r
     return Name;\r
   }\r
-  \r
+\r
   Len = AsciiStrLen (Ptr);\r
-  \r
+\r
   // convert "/cygdrive" to spaces\r
   for (Index = 0; Index < 9; Index++) {\r
     Ptr[Index] = ' ';\r
@@ -88,18 +84,17 @@ DeCygwinPathIfNeeded (
   // convert /c to c:\r
   Ptr[9]  = Ptr[10];\r
   Ptr[10] = ':';\r
-  \r
-  // switch path seperators\r
+\r
+  // switch path separators\r
   for (Index = 11; Index < Len; Index++) {\r
     if (Ptr[Index] == '/') {\r
-      Ptr[Index] = '\\' ;\r
+      Ptr[Index] = '\\';\r
     }\r
   }\r
 \r
   return Name;\r
 }\r
 \r
-\r
 /**\r
   Performs additional actions after a PE/COFF image has been loaded and relocated.\r
 \r
@@ -115,22 +110,24 @@ PeCoffLoaderRelocateImageExtraAction (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
   )\r
 {\r
-  CHAR8 Buffer[256];\r
-  \r
-  AsciiSPrint (Buffer, sizeof(Buffer), "load /a /ni /np %a &0x%08x\n", ImageContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders));\r
+  CHAR8  Buffer[256];\r
+\r
+ #if (__ARMCC_VERSION < 500000)\r
+  AsciiSPrint (Buffer, sizeof (Buffer), "load /a /ni /np \"%a\" &0x%08x\n", ImageContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders));\r
+ #else\r
+  AsciiSPrint (Buffer, sizeof (Buffer), "add-symbol-file %a 0x%08x\n", ImageContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders));\r
+ #endif\r
   DeCygwinPathIfNeeded (&Buffer[16]);\r
\r
+\r
   WriteStringToFile (Buffer, AsciiStrSize (Buffer));\r
 }\r
 \r
-\r
-\r
 /**\r
   Performs additional actions just before a PE/COFF image is unloaded.  Any resources\r
   that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.\r
-  \r
+\r
   If ImageContext is NULL, then ASSERT().\r
-  \r
+\r
   @param  ImageContext  Pointer to the image context structure that describes the\r
                         PE/COFF image that is being unloaded.\r
 \r
@@ -141,10 +138,10 @@ PeCoffLoaderUnloadImageExtraAction (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
   )\r
 {\r
-  CHAR8 Buffer[256];\r
-  \r
-  AsciiSPrint (Buffer, sizeof(Buffer), "unload symbols_only %a\n", ImageContext->PdbPointer);\r
+  CHAR8  Buffer[256];\r
+\r
+  AsciiSPrint (Buffer, sizeof (Buffer), "unload symbols_only \"%a\"\n", ImageContext->PdbPointer);\r
   DeCygwinPathIfNeeded (Buffer);\r
\r
+\r
   WriteStringToFile (Buffer, AsciiStrSize (Buffer));\r
 }\r