how to analyze salesforce profiles, roles and permission set?
The Salesforce PermComparator might be the exact tool you need. You can enter in a user, profile, or permission set and compare it to any other.
Roles are a little bit more difficult, as they don't actually have any permissions directly associated with them, they just control sharing. You're going to need to evaluate the sharing criteria on every object that has an OWD of private to figure out exactly how your hierarchy is and is supposed to behave.