The once-friendly rivalry between Ted Cruz and Donald Trump is getting edgy as the Texas senator cuts into the business mogul’s lead, setting up a potential showdown in the GOP presidential primary debate Tuesday.

Cruz has largely avoided public attacks on Trump -- likely in part to avoid his withering counter-attacks and also in hopes of gathering Trump supporters should he falter or quit the race.  

Trump has mostly left Cruz alone -- at least until recently, when Cruz apparently criticized him at private fundraisers.

The Texan then pulled ahead in Iowa, according to polls released over the past few days.

“He said it behind my back. Somebody taped that conversation,” Trump said about Cruz on “Fox News Sunday.”

“I don't think he's qualified to be president. …  I don't think he's got the right judgment.”

The latest headlines on the 2016 elections from the biggest name in politics. See Latest Coverage →

Tuesday's debate, hosted by CNN, will be the fourth of 12 sanctioned GOP White House primary debates and the final one of the year.

It also comes less than 50 days before the Iowa Caucus, the first voting in the 2016 election cycle.

Cruz and Trump will be joined on the main stage in Las Vegas by Kentucky Sen. Rand Paul, retired neurosurgeon Ben Carson, Florida Sen. Marco Rubio, former Florida Gov. Jeb Bush, Ohio Gov. John Kasich, former Hewlett Packard CEO Carly Fiorina and New Jersey Gov. Chris Christie.

On Sunday, Trump suggested that Cruz’s tactics on Capitol Hill are devoid of the compromising skills needed to run the country.

“He goes in there … like a bit of a maniac,” Trump said.

“You never get things done that way. You can't walk into the Senate and scream and call people liars and not be able to cajole and get along with people. … That's the problem with Ted.”

When the reports surfaced last week of Cruz at New York fundraisers questioning Trump’s judgement, Cruz promptly tweeted: “The Establishment's only hope: Trump & me in a cage match. Sorry to disappoint.”

And within hours of Trump’s attack Sunday, Cruz responded on Twitter by posting a link to the song “Maniac” from the movie “Flashdance” and writing: "In honor of my friend @realDonaldTrump and good-hearted maniacs everywhere ..."

CNN will also host a debate for the second-tier GOP candidates -- former Arkansas Gov. Mike Huckabee, former Pennsylvania Sen. Rick Santorum, South Carolina Sen. Lindsey Graham and former New York Gov. George Pataki.

The network said Paul squeezed into the main debate “by showing viability in Iowa in a Fox News poll released Sunday morning.”

Christie returns to the main stage, largely because of his strong poll numbers in early-voting state New Hampshire.

Carson last month surged in national polls and briefly held second place behind Trump in Iowa. But his campaign has since plummeted roughly 12 percentage points, from 24.8 to 12.6 percent.

Bush is also looking for a comeback, after being considered the presumptive frontrunner early in the election cycle. However, his campaign has failed to catch fire, despite its infrastructure and fundraising prowess.

Rubio has also improved his poll rankings in recent weeks but is competing with Cruz for essentially the same voters, which could bring fireworks to the debate.

Cruz's national poll numbers didn't reach double-digits until early November, according to a averaging.

But he could indeed win Iowa, considering his support among evangelicals and other social-conservative voters is similar to that of Mike Huckabee and Rick Santorum, who in 2008 and 2012, respectively, won the caucus despite average numbers in national polls.

A Fox News Poll released Sunday showed Cruz edging Trump in Iowa, 28-26 percent among likely caucus-goers. The poll was taken Dec. 7-10 and had a margin of error of 4.5 percentage points.

Cruz has a 10-point lead over Cruz according to a new Des Moines Register/Bloomberg Politics poll, which previously had him trailing Trump in Iowa by 11 percentage points.

And a new Wall Street Journal/NBC News poll shows the freshman senator edging closer to Trump nationally, 22-to-27 percent, after trailing by 15 percentage points in October.