Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/sst/core/impl/interactive/simpleDebug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ SimpleDebugger::cmd_cd(std::vector<std::string>& tokens)
return false;
}

// Check if we are leaving the 'nowatch' object
if ( !obj_->isWatchable() ) {
assert(parent->isWatchable()); // development paranoia check
nowatch_objmap = nullptr;
}

// See if this is the top level component, and if so, set it to nullptr
if ( dynamic_cast<Core::Serialization::ObjectMap*>(base_comp_) == obj_ ) base_comp_ = nullptr;

Expand Down Expand Up @@ -543,6 +549,10 @@ SimpleDebugger::cmd_cd(std::vector<std::string>& tokens)
dynamic_cast<Core::Serialization::ObjectMapDeferred<BaseComponent>*>(obj_);
if ( base_comp ) base_comp_ = base_comp;
}

// Check for highest level non-watchable object map
if ( nullptr == nowatch_objmap && !new_obj->isWatchable() ) nowatch_objmap = new_obj;

return true;
}

Expand Down Expand Up @@ -1253,6 +1263,12 @@ parseAction(std::vector<std::string>& tokens, size_t& index, Core::Serialization
bool
SimpleDebugger::cmd_watch(std::vector<std::string>& tokens)
{

if ( nowatch_objmap ) {
printf("Setting a watchpoint within a container currently not supported\n");
return false;
}

size_t index = 1;
std::string name = "";

Expand All @@ -1268,7 +1284,11 @@ SimpleDebugger::cmd_watch(std::vector<std::string>& tokens)
return false;
}
size_t wpIndex = watch_points_.size();
auto* pt = new WatchPoint(wpIndex, name, c);
#if 0
auto* pt = new WatchPoint(wpIndex, name, c, nowatch_objmap);
#else
auto* pt = new WatchPoint(wpIndex, name, c, nullptr);
#endif

#if 0 // watch variables currently don't trace, but they could automatically
// trace test vars
Expand Down
4 changes: 4 additions & 0 deletions src/sst/core/impl/interactive/simpleDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ class SimpleDebugger : public SST::InteractiveConsole
// Keep a pointer to the ObjectMap for the top level Component
SST::Core::Serialization::ObjectMapDeferred<BaseComponent>* base_comp_ = nullptr;

// Keep a pointer to the ObjectMap for the first container object. Manipulating
// containers can cause internal references to become invalidated requiring a refresh
SST::Core::Serialization::ObjectMap* nowatch_objmap = nullptr;

// Keep track of all the WatchPoints
std::vector<std::pair<WatchPoint*, BaseComponent*>> watch_points_;
bool clear_watchlist();
Expand Down
21 changes: 20 additions & 1 deletion src/sst/core/serialization/objectMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

#include "sst/core/from_string.h"
#include "sst/core/warnmacros.h"
#define SST_INCLUDING_SERIALIZE_H
#include "sst/core/serialization/impl/serialize_utility.h"
#undef SST_INCLUDING_SERIALIZE_H

#include <cassert>
#include <cctype>
Expand All @@ -29,6 +32,8 @@
#include <map>
#include <memory>
#include <ostream>
#include <queue>
#include <stack>
#include <stdexcept>
#include <string>
#include <type_traits>
Expand Down Expand Up @@ -487,6 +492,14 @@ class ObjectMap
*/
virtual bool isContainer() const { return false; }

/**
Check to see if this ObjectMap can be used with watchpoints

@return true if this ObjectMap supports watchpoints, false
otherwise
*/
virtual bool isWatchable() const { return true; }

/**
Destructor. NOTE: delete should not be called directly on
ObjectMaps, rather decRefCount() should be called when the
Expand Down Expand Up @@ -1425,7 +1438,13 @@ class ObjectMapContainer : public ObjectMapWithChildren
explicit ObjectMapContainer(T* addr) :
addr_(addr)
{}
bool isContainer() const final override { return true; }
bool isContainer() const final override { return true; }
bool isWatchable() const final override
{
// This is equivalenet to 'is_adapter_v' defined in serialize_adapter.h
return !(is_same_type_template_v<T, std::stack> || is_same_type_template_v<T, std::queue> ||
is_same_type_template_v<T, std::priority_queue>);
}
std::string getType() const override { return demangle_name(typeid(T).name()); }
void* getAddr() const override { return addr_; }
void refresh() override
Expand Down
2 changes: 2 additions & 0 deletions src/sst/core/timeConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "sst/core/sst_types.h"
#include "sst/core/unitAlgebra.h"

#include <string>

namespace SST {

class TimeLord;
Expand Down
16 changes: 14 additions & 2 deletions src/sst/core/watchPoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ WatchPoint::ShutdownWPAction::invokeAction(WatchPoint* wp)
return;
}

WatchPoint::WatchPoint(size_t index, const std::string& name, Core::Serialization::ObjectMapComparison* obj) :
WatchPoint::WatchPoint(size_t index, const std::string& name, Core::Serialization::ObjectMapComparison* obj,
Core::Serialization::ObjectMap* noWatchObjMap) :
Clock::HandlerBase::AttachPoint(),
Event::HandlerBase::AttachPoint(),
name_(name),
wpIndex(index)
wpIndex(index),
noWatchObjMap_(noWatchObjMap)
{
// TODO explore how we may refresh containers to support watchpoints
assert(noWatchObjMap == nullptr);
addComparison(obj);
}

Expand Down Expand Up @@ -448,6 +452,14 @@ WatchPoint::check()
{
bool result = false;

#if 0
//TODO if (noWatchObjMap_.dirty()...)
if (noWatchObjMap_) {
noWatchObjMap_->refresh();
// TODO update references in watchpoints
}
#endif

if ( cmpObjects_[0]->compare() ) {
result = true;
}
Expand Down
5 changes: 4 additions & 1 deletion src/sst/core/watchPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class WatchPoint : public Clock::HandlerBase::AttachPoint, public Event::Handler
}; // class ShutdownWPAction

// Construction
WatchPoint(size_t index, const std::string& name, Core::Serialization::ObjectMapComparison* obj);
WatchPoint(size_t index, const std::string& name, Core::Serialization::ObjectMapComparison* obj,
Core::Serialization::ObjectMap* noWatchObjMap = nullptr);
~WatchPoint();

// Inherited from both Event and Clock handler AttachPoints.
Expand Down Expand Up @@ -206,6 +207,8 @@ class WatchPoint : public Clock::HandlerBase::AttachPoint, public Event::Handler
HANDLER triggerHandler = HANDLER::NONE;
bool reset_ = false;
WPAction* wpAction;
[[maybe_unused]]
Core::Serialization::ObjectMap* noWatchObjMap_ = nullptr; // TODO

void setBufferReset();
void check();
Expand Down
Loading