There are basically two ways of defining commands with a *-variant.
Traditional way
\newcommand{\foo}{\@ifstar\@sfoo\@foo}
\newcommand{\@sfoo}{something for the *-version}
\newcommand{\@foo}{something for the plain version}
where \@sfoo and \@foo may have arguments; the names are arbitrary, of course: they are two other commands. Many variations are encountered; here's an example:
\newcommand{\foo}{\@ifstar{\@tempswatrue\@foo}{\@tempswafalse\@foo}}
\newcommand{\@foo}{%
\if@tempswa
we're with the *-version
\else
we're with the plain version
\fi}
\newcommand\chapter{%
<code that's irrelevant for the example>%
\secdef\@chapter\@schapter}
In the second example, the lookup for a following * is delegated to \secdef.
In many cases, \newcommand{\foo}{...} is changed into \DeclareRobustCommand{\foo}{...} to avoid problems with \foo in moving arguments; the auxiliary macros \@sfoo or \@foo can be still defined with \newcommand (or \def, if one prefers).
xparse way
\NewDocumentCommand{\foo}{s...}
{\IfBooleanTF{#1}
{Code for the *-version}
{Code for the plain version}%
}
where ... stands for other argument types, possibly none.
Redefining
If you have \foo defined in one of those ways, saying
\renewcommand{\foo}{bar}
will of course remove any possibility that \foo* works as before, because the new \foo doesn't check for a * following it, which is in any case the key for a *-variant to work.
Thus, if you want to redefine a command with a *-variant, you should know how it was defined in the first place. In the most common case, with \@ifstar choosing between two different commands, just redefine the one you need, so \@foo or \@sfoo. The same applies for the \chapter example, where you can work on \@schapter or \@chapter. It would be more difficult in the \if@tempswa case, but one should know what the intention is.
If you want to redefine \section, then you find yourself in a more complicated situation, then the problem is more difficult; the definition is usually in terms of \@startsection which is the macro doing the \@ifstar test, so the approaches outlined above don't work. In this case a simple way out is to say
\let\latexsection\section
\renewcommand{\section}{\@ifstar{\latexsection*}{\mynewsection}}
and to define \mynewsection for the "non *" case, probably in terms of \latexsection.
Watch out, though, and always check how the command is defined: in case of doubt, the \let should be replaced with \LetLtxMacro from the letltxmacro package.
Redefining xparse based commands should be done with \RenewDocumentCommand and the proper argument types. Don't use \let or \LetLtxMacro in this case.
Just for fun, here are some patches that make glue inserted with \hspace, \vspace or \addvspace "visible". However they are not guaranteed to always work and to give the same breaks.
\usepackage{regexpatch}
\makeatletter
\xpatchcmd{\@hspace}{\hskip}{\leaders\hrule\hskip}{}{}
\xpatchcmd{\@hspacer}{\hskip}{\leaders\hrule\hskip}{}{}
\xpatchcmd*{\@vspace}{\vskip#1}{\leaders\vrule\vskip#1}{}{}
\xpatchcmd*{\@vspacer}{\nobreak\vskip}{\nobreak\leaders\vrule\vskip}{}{}
\xpatchcmd{\addvspace}{\vskip}{\leaders\vrule\vskip}{}{}
\xpatchcmd*{\@xaddvskip}{\vskip\@tempskipb}{\leaders\vrule\vskip\@tempskipb}{}{}
\makeatother
visual-lua-debugpackage. – egreg Feb 18 '13 at 17:16