Skip to content
Snippets Groups Projects
  1. Mar 25, 2020
    • Nat Goodspeed's avatar
      DRTVWR-476: Try to extend stderr redirection to Windows as well. · 07134aae
      Nat Goodspeed authored
      Make the LLError::Settings LLSingleton duplicate the file handle for stderr
      (usually 2) on construction. Make its destructor restore the original target
      for that file handle. Provide a getDupStderr() method to obtain the duplicate
      file handle.
      
      Move Settings declaration up to the top of the file so other code can
      reference it.
      
      Make RecordToFile (the Recorder subclass engaged by LLError::logToFile()),
      instead of duplicating stderr's file handle itself, capture the duplicate
      stderr file handle from Settings to revert stderr redirection on destruction.
      
      Make RecordToStderr (the Recorder subclass engaged by LLError::logToStderr())
      use fdopen() to create an LLFILE* targeting the duplicate file handle from
      Settings. Write output to that instead of to stderr so logToStderr() continues
      to provide output for the user instead of duplicating each line into the log
      file.
      07134aae
    • Nat Goodspeed's avatar
      DRTVWR-476: Try to log stderr output from classic-C libraries. · 7845f73c
      Nat Goodspeed authored
      Some of the libraries we use produce log output to stderr. Such output can be
      informative, but is invisible unless you launch the viewer from a console. In
      particular, it's invisible to anyone trying to diagnose a problem by reading
      someone else's SecondLife.log file.
      
      Make RecordToFile -- the Recorder subclass engaged by LLError::logToFile() --
      redirect STDERR_FILENO to the newly-opened log file so that any subsequent
      writes to stderr (or cerr, for that matter) will be captured in the log file.
      But first duplicate the original stderr file handle, and restore it when
      RecordToFile is destroyed. That way, output written to stderr during the final
      moments of application shutdown should still appear on (console) stderr.
      7845f73c
    • Nat Goodspeed's avatar
      DRTVWR-476: Make test program --debug switch work like LOGTEST=DEBUG. · 6b70493d
      Nat Goodspeed authored
      The comments within indra/test/test.cpp promise that --debug is, in fact, like
      LOGTEST=DEBUG. Until now, that was a lie. LOGTEST=level displayed log output
      on stderr as well as in testprogram.log, while --debug did not.
      
      Add LLError::logToStderr() function, and make initForApplication() (i.e.
      commonInit()) call that instead of instantiating RecordToStderr inline. Also
      call it when test.cpp recognizes --debug switch.
      
      Remove the mFileRecorder, mFixedBufferRecorder and mFileRecorderFileName
      members from SettingsConfig. That tactic doesn't scale.
      
      Instead, add findRecorder<RECORDER>() and removeRecorder<RECORDER>() template
      functions to locate (or remove) a RecorderPtr to an object of the specified
      subclass. Both are based on an underlying findRecorderPos<RECORDER>() template
      function. Since we never expect to manage more than a handful of RecorderPtrs,
      and since access to the deleted members is very much application setup rather
      than any kind of ongoing access, a search loop suffices.
      
      logToFile() uses removeRecorder<RecordToFile>() rather than removing
      mFileRecorder (the only use of mFileRecorder).
      
      logToFixedBuffer() uses removeRecorder<RecordToFixedBuffer>() rather than
      removing mFixedBufferRecorder (the only use of mFixedBufferRecorder).
      
      Make RecordToFile store the filename with which it was instantiated. Add a
      getFilename() method to retrieve it. logFileName() is now based on
      findRecorder<RecordToFile>() instead of mFileRecorderFileName (the only use of
      mFileRecorderFileName).
      
      Make RecordToStderr::mUseANSI a simple bool rather than a three-state enum,
      and set it immediately on construction. Apparently the reason it was set
      lazily was because it consults its own checkANSI() method, and of course
      'this' doesn't acquire the leaf class type until the constructor has completed
      successfully. But since nothing in checkANSI() depends on anything else in
      RecordToStderr, making it static solves that problem.
      6b70493d
    • Brad Kittenbrink's avatar
      Fixed variadic macro usage in LL_ERRS_IF and LL_WARNS_IF and improved... · a6f31e91
      Brad Kittenbrink authored
      Fixed variadic macro usage in LL_ERRS_IF and LL_WARNS_IF and improved LLError::shouldLogToStderr() behavior under xcode.
      a6f31e91
    • Nat Goodspeed's avatar
      DRTVWR-494: Get initialized LLMutexes for very early log calls. · 4c9e90de
      Nat Goodspeed authored
      Use function-static LLMutex instances instead of module-static instances,
      since some log calls are evidently issued before we get around to initializing
      llerror.cpp module-static variables.
      4c9e90de
    • Nat Goodspeed's avatar
      DRTVWR-494: Fix VS LLError::Log::demangle() vulnerability. · 1fc7c994
      Nat Goodspeed authored
      The Windows implementation of demangle() assumed that a "mangled" class name
      produced by typeid(class).name() always starts with the prefix "class ",
      checked for that and removed it. If the mangled name didn't start with that
      prefix, it would emit a debug message and return the full name.
      
      When the class in question is actually a struct, the prefix is "struct "
      instead. But when demangle() was being called before logging had been fully
      initialized, the debug message remarking that it didn't start with "class "
      crashed.
      
      Look for either "class " or "struct " prefix. Remove whichever is found and
      return the rest of the name. If neither is found, only log if logging is
      available.
      1fc7c994
  2. Jan 14, 2019
  3. Nov 29, 2018
  4. Oct 11, 2018
  5. Sep 26, 2018
  6. Sep 19, 2018
  7. Sep 07, 2018
  8. Aug 29, 2018
  9. Aug 28, 2018
  10. Aug 27, 2018
  11. Aug 24, 2018
  12. Aug 17, 2018
  13. Jun 28, 2018
    • Nat Goodspeed's avatar
      DRTVWR-447: Suppress BugSplat UI; auto-fill certain BugSplat data. · cd52724e
      Nat Goodspeed authored
      Direct BugSplat to send crash reports without prompting, on both Windows and
      Mac.
      
      Add a mechanism by which code called after LL_ERRS() can retrieve the fatal
      log message string. (How did the crash logger extract that for Linden crash
      logging?)
      
      Add that fatal message to crash reports on Windows. But as BugsplatMac is
      engaged only on the run _after_ the crash, we no longer have that message in
      memory.
      
      Also add user name and region location to Windows crash reports. On Mac, (a)
      we don't have the information from the previous run and (b) BugsplatMac
      doesn't provide an API to attach that information to the crash report.
      
      Add Mac logging to indicate the success or failure of sending the crash
      report. Add Windows logging to indicate we're about to send.
      cd52724e
  14. Jun 13, 2018
  15. Jun 11, 2018
  16. Jun 07, 2018
  17. Jun 06, 2018
  18. Jul 24, 2017
  19. Jun 20, 2017
  20. Mar 13, 2017
    • Nat Goodspeed's avatar
      DRTVWR-418: Ignore logging that requires resurrecting singletons. · 1a8c8df6
      Nat Goodspeed authored
      The logging subsystem depends on two different LLSingletons for some reason.
      It turns out to be very difficult to completely avoid executing any logging
      calls after the LLSingletonBase::deleteAll(), but we really don't want to
      resurrect those LLSingletons so late in the run for a couple stragglers.
      Introduce LLSingleton::wasDeleted() query method, and use it in logging
      subsystem to simply bypass last-millisecond logging requests.
      1a8c8df6
  21. Mar 09, 2017
  22. Mar 03, 2017
  23. Feb 27, 2017
  24. Oct 11, 2016
  25. Oct 10, 2016
  26. Sep 28, 2016
  27. Sep 17, 2016
    • Nat Goodspeed's avatar
      MAINT-5232: Eliminate pointless string search for "class " prefix. · d0249fb7
      Nat Goodspeed authored
      The Visual C++ runtime produces typeid(MyClass).name() as "class MyClass".
      It's prudent to check for the presence of that prefix before stripping off the
      first six characters, but if the first comparison should ever fail, find()
      would continue searching the rest of the string for "class " -- a search
      guaranteed to fail. Use compare() instead.
      d0249fb7
  28. Sep 15, 2016
    • Nat Goodspeed's avatar
      MAINT-5232: Normalize LLSingleton subclasses. · d2c3c2f9
      Nat Goodspeed authored
      A shocking number of LLSingleton subclasses had public constructors -- and in
      several instances, were being explicitly instantiated independently of the
      LLSingleton machinery. This breaks the new LLSingleton dependency-tracking
      machinery. It seems only fair that if you say you want an LLSingleton, there
      should only be ONE INSTANCE!
      
      Introduce LLSINGLETON() and LLSINGLETON_EMPTY_CTOR() macros. These handle the
      friend class LLSingleton<whatevah>;
      and explicitly declare a private nullary constructor.
      
      To try to enforce the LLSINGLETON() convention, introduce a new pure virtual
      LLSingleton method you_must_use_LLSINGLETON_macro() which is, as you might
      suspect, defined by the macro. If you declare an LLSingleton subclass without
      using LLSINGLETON() or LLSINGLETON_EMPTY_CTOR() in the class body, you can't
      instantiate the subclass for lack of a you_must_use_LLSINGLETON_macro()
      implementation -- which will hopefully remind the coder.
      
      Trawl through ALL LLSingleton subclass definitions, sprinkling in
      LLSINGLETON() or LLSINGLETON_EMPTY_CTOR() as appropriate. Remove all explicit
      constructor declarations, public or private, along with relevant 'friend class
      LLSingleton<myself>' declarations. Where destructors are declared, move them
      into private section as well. Where the constructor was inline but nontrivial,
      move out of class body.
      
      Fix several LLSingleton abuses revealed by making ctors/dtors private:
      
      LLGlobalEconomy was both an LLSingleton and the base class for
      LLRegionEconomy, a non-LLSingleton. (Therefore every LLRegionEconomy instance
      contained another instance of the LLGlobalEconomy "singleton.") Extract
      LLBaseEconomy; LLGlobalEconomy is now a trivial subclass of that.
      LLRegionEconomy, as you might suspect, now derives from LLBaseEconomy.
      
      LLToolGrab, an LLSingleton, was also explicitly instantiated by
      LLToolCompGun's constructor. Extract LLToolGrabBase, explicitly instantiated,
      with trivial subclass LLToolGrab, the LLSingleton instance.
      
      (WARNING: LLToolGrabBase methods have an unnerving tendency to go after
      LLToolGrab::getInstance(). I DO NOT KNOW what should be the relationship
      between the instance in LLToolCompGun and the LLToolGrab singleton instance.)
      
      LLGridManager declared a variant constructor accepting (const std::string&),
      with the comment:
      // initialize with an explicity grid file for testing.
      As there is no evidence of this being called from anywhere, delete it.
      
      LLChicletBar's constructor accepted an optional (const LLSD&). As the LLSD
      parameter wasn't used, and as there is no evidence of it being passed from
      anywhere, delete the parameter.
      
      LLViewerWindow::shutdownViews() was checking LLNavigationBar::
      instanceExists(), then deleting its getInstance() pointer -- leaving a
      dangling LLSingleton instance pointer, a land mine if any subsequent code
      should attempt to reference it. Use deleteSingleton() instead.
      
      ~LLAppViewer() was calling LLViewerEventRecorder::instance() and then
      explicitly calling ~LLViewerEventRecorder() on that instance -- leaving the
      LLSingleton instance pointer pointing to an allocated-but-destroyed instance.
      Use deleteSingleton() instead.
      d2c3c2f9
  29. Sep 03, 2016
    • Nat Goodspeed's avatar
      MAINT-5232: Make LLError::is_available() depend on both LLSingletons. · 4af7e496
      Nat Goodspeed authored
      LLError machinery depends on two different LLSingletons. Its is_available()
      function is primarily for LLSingleton itself to determine whether it is, or is
      not, safe to log. Until both of LLError's LLSingletons have been constructed,
      attempting to log LLSingleton operations could produce infinite recursion.
      4af7e496
  30. Nov 10, 2015
Loading