Ticket #10334: 10334.patch

File 10334.patch, 1.0 KB (added by anevilyak, 10 years ago)
  • src/apps/debugger/types/ValueLocation.h

    diff --git a/src/apps/debugger/types/ValueLocation.h b/src/apps/debugger/types/ValueLocation.h
    index ede62a8..57c0c0f 100644
    a b struct ValuePieceLocation {  
    4343    {
    4444    }
    4545
     46    ValuePieceLocation(const ValuePieceLocation& other)
     47    {
     48        Copy(other);
     49    }
     50
    4651    ~ValuePieceLocation()
    4752    {
    48         if (value != NULL)
     53        if (value != NULL) {
     54            printf("ValueLocation %p freeing value %p\n", this, value);
    4955            free(value);
     56        }
     57    }
     58
     59    ValuePieceLocation& operator=(const ValuePieceLocation& other)
     60    {
     61        Copy(other);
     62        return *this;
     63    }
     64
     65
     66    bool Copy(const ValuePieceLocation& other)
     67    {
     68        memcpy(this, &other, sizeof(ValuePieceLocation));
     69        if (type == VALUE_PIECE_LOCATION_IMPLICIT) {
     70            void* tempValue = malloc(size);
     71            if (tempValue == NULL) {
     72                type = VALUE_PIECE_LOCATION_INVALID;
     73                return false;
     74            }
     75
     76            memcpy(tempValue, value, other.size);
     77            value = tempValue;
     78        }
     79
     80        return true;
    5081    }
    5182
    5283    bool IsValid() const