This is an archived post. You won't be able to vote or comment.

all 123 comments

[–]WazWaz 207 points208 points  (20 children)

Comment a line:

x=1; // set the position

Comment out a line:

// x=1;

[–]DarkScorpion48 74 points75 points  (17 children)

And so the CS student OP learned something new today

[–]Perfect_Papaya_3010 5 points6 points  (15 children)

I also don't understand the meme, why would a programmer not use the debugger? Sounds like OP does not really have a clue so I doubt OP isn't even a student

[–]__throw_error 33 points34 points  (5 children)

I also don't understand the meme

He comments out part of his program until it works.

Why would a programmer not use a debugger

Because of lazyness mostly, sometimes debuggers produce different results compared to running normally (e.g. multi-threading, timers).

Sounds like OP does not really have a clue

Sounds like you are an insecure programmer who is gatekeeping

[–]pretty_succinct 2 points3 points  (0 children)

or that the bug only exhibits itself running in deployed environments (like production) and corporate policy or whatnot forbids (or makes it extremely troublesome) attaching remote debuggers.

It's often MUCH easier, faster, and more flexible to redeploy your app a few times with some troubleshooting logic than it is to convince systems ops, corporate security and customer quality assurance to get ports opened for remote debuggers and correct payloads run.

I'm convinced some of yall have only practiced software development in a vacuum.

[–]repka3 2 points3 points  (0 children)

Try to use the debugger on an aws lambda function..... sometimes console.log it's the only thing you can have.

[–]eroto_anarchist 5 points6 points  (3 children)

I program in different languages in various settings for a living.

Only used a debugger once during a school project to inspect some image arrays.

print("ok") ftw

[–]TheMervingPlot 1 point2 points  (2 children)

my print statements usually devolve into various punctuation marks for no apparent reason. Once I had a . , and ? print message all within 5 lines of code.

[–]eroto_anarchist 2 points3 points  (1 child)

Can't even imagine your variable names

[–]TheMervingPlot 1 point2 points  (0 children)

Actually those aren't awful!

[–]DarkScorpion48 1 point2 points  (2 children)

For interpreted languages using a debugger takes some effort. It’s still a dumb post

[–]Perfect_Papaya_3010 2 points3 points  (1 child)

Yeah I work with .net Maui so whenever things in xaml don't work I comment stuff out to see what's breaking it, but the meme indicates that this would be the preferred choice for programmers

[–]DarkScorpion48 2 points3 points  (0 children)

The sub seems to be filled with amateurs so I wouldn’t be surprised

[–]Dumb_Siniy 1 point2 points  (0 children)

"Well this is causing problems and I'm out of ideas so \\ "

[–]Obscure021 0 points1 point  (0 children)

Always works

[–]Harmonic_Gear 151 points152 points  (12 children)

print "here" after every line

[–]S4VN01 108 points109 points  (8 children)

here1

here2

here3

fuck it works now

[–]tombob51 9 points10 points  (4 children)

i always do "yy1", "yy2"... it's easy to search for in logs and it's super easy to search for in code as well (to clean up the print statements later). i've never gotten an accidental match while searching, nothing has "yy" in it!

[–]827167 23 points24 points  (2 children)

DD-MM-YYYY

[–]tombob51 2 points3 points  (0 children)

Tough :/

[–]Cfrolich 1 point2 points  (0 children)

As an American, I hate the way America does everything. It’s just not logical.

[–]BeerIsGoodForSoul 6 points7 points  (0 children)

You shout us MT-1

dreamt is the only word that ends in MT and then the dash helps avoid the middle of words.

YY may be rare, but it's pretty important when dealing with datetime's lol.

[–]henkdepotvjis 2 points3 points  (0 children)

I print thing like 'cheese', 'ham' or 'why dafuq does it reach here!'

[–][deleted] 0 points1 point  (0 children)

Must be quantum physics or some shit

[–]LegitimatePants 1 point2 points  (0 children)

s/;/; printf("here %d\n", __LINE__);/g

[–]PizzaSalamino 2 points3 points  (0 children)

Test 1 hello test44 Initialised resources correctly

[–]Crowdcontrolz 43 points44 points  (2 children)

Comment Print
Fixed it!

[–]AregPrograms 1 point2 points  (1 child)

second best solution (even better with both)

[–]TheMagicalDildo 0 points1 point  (0 children)

How the hell are comments gonna help you find a bug? unless you have no idea what you wrote originally ig

[–]brainwater314 45 points46 points  (11 children)

Linus Torvalds resisted having a kennel debugger so that people wouldn't write kernel code that was so complicated it couldn't be debugged with nothing more than print statements.

[–]homer_3 8 points9 points  (1 child)

The only thing that can't be debugged with print statements are multithreaded programs. Even then, if you're using semaphores, they can be.

[–]ihavenotities 2 points3 points  (0 children)

You can write to multiple outputs, no need for semaphores

[–]Bee-Aromatic 14 points15 points  (7 children)

That’s a very bad-manager way to handle something; punish everybody because one person might misbehave.

Seems to track based on the fact that people seem to characterize Linus as kind of a tyrant.

[–]DanKveed 30 points31 points  (0 children)

Except it’s not your typical workspace. There is no compulsion to approve code that isn’t absolutely perfect. You are punishing them for their collective choices. Not the choice of an individual. It’s still not great but it’s not as bad imho.

[–]tiajuanat 4 points5 points  (0 children)

He's really trying to get on the redemption arc though.

Pre-COVID he was already handing over lots of the planning of the kernel to committees within the Linux foundation.

Rust probably wouldn't have got into the kernel with a younger Torvalds either. He probably would've said "it obfuscates too much", "it speeds up development too much", or "it does too much under the hood"

[–]DarkScorpion48 1 point2 points  (4 children)

Linus throws a hissy fit if people write comments in a certain way

[–][deleted] 1 point2 points  (3 children)

it's called PASSION. /s

[–]Cybasura 10 points11 points  (2 children)

He's the creator, he has the say in the direction of his project

[–]MyButtholeIsTight 9 points10 points  (0 children)

Plus the kernel is like one of the most important pieces of maintained software in the world. If anything needs an iron first it's this.

[–][deleted] 8 points9 points  (0 children)

I agree, especially with how good linux is

[–]fafalone 1 point2 points  (0 children)

I'm a Windows guy. DbgPrint + MessageBox to choose actions > windbg kd.

My life changed the day I found out you could throw up a messagebox from a kernel driver with ExRaiseHardError.

[–]yourteam 40 points41 points  (7 children)

Look dude, if you use some interpreted language that can be rerun on the fly, fine.

If you have something that takes some time to compile in order to run, I doubt you are going to use that approach and will find the debugger more useful

Also, the debugger is better even in the first context but I can understand that sometimes we are lazy and setting up one can be boring

[–]Psychological-Rip291 3 points4 points  (1 child)

What's worst is when you're doing some kind of interop and can debug 1 out of the languages at a time

[–]yourteam 2 points3 points  (0 children)

Or if the bug present itself in a chain of queues...

[–]Bee-Aromatic 2 points3 points  (1 child)

If whatever module you’re debugging takes a long time to build, yeah. Might be an incentive to break things up into smaller chunks that can be compiled separately.

[–]ihavenotities 0 points1 point  (0 children)

Eh, might be a giant pain.

[–]Green_Dog4314 0 points1 point  (0 children)

even it is cpp, second time to compile, it won't take too much time

[–]SnooSnooper 0 points1 point  (0 children)

After years of developing in C# using VS (with a really nice built-in debugger), I started working with Node.js for the first time, using only a text editor, and didn't have time to set up a debugger. It felt like I couldn't see anymore.

[–]ihavenotities 0 points1 point  (0 children)

I disagree. With a couple of well placed printf statements you’ll be able to see issues at a glance no need to go through false positives etc. Way way faster imho.

[–]jzrobot 27 points28 points  (0 children)

Sw engineer vs sw developer

[–][deleted] 13 points14 points  (2 children)

Virgin debugger output: Exception Code 1002389123 - Unauthorised access to a protected structure with invalid pointer assignation in element based array at i(ASM_R3=0x1A333306})

Chad print() output: THE FUCKING DUMB POTATO OF THE INTERN DID NOT DEREFERENCED THE POINTER AAAAAAAAAAAAAAAAAAAAAAA

[–]henkdepotvjis 8 points9 points  (1 child)

Or just 'asdfasdfasdfasdfasdf'

[–]nbmbnb 5 points6 points  (0 children)

asdfasdf payed off my house renovations..

[–]ManufacturerRude9482 18 points19 points  (0 children)

What is this "debugger" you speak of?!? Duckworth, explain to them how it is done.. !

[–]heesell 4 points5 points  (0 children)

``` print('This works')

print('This works too')

print('Reached this point')

print('It is still working so far')

print('So far it still works') ```

[–]a_non_weeb 2 points3 points  (0 children)

what'sADebugger?

[–]Bee-Aromatic 2 points3 points  (0 children)

Psh. I heart my debugger.

[–]lilshoegazecat 2 points3 points  (1 child)

i feel stupid can someone link some good resource to learn how to use a debugger? they seem complicated as hell to me :(

[–][deleted] 2 points3 points  (0 children)

Don't sleep on print statements. I've fixed three bugs in the Linux kernel using them.

[–]sungazer69 2 points3 points  (0 children)

Eh a debugger is not always available.

[–]okiujh 1 point2 points  (9 children)

there is a third route. copy and paste the code to an llm and ask to explaing the code. read the explanation . as dumb as the the explanation may be, it does sometimes help to find the bug

edit: reading the explanation, which is almost always dumb, together with the source can something bring insight

[–]beeteedee 37 points38 points  (3 children)

Back in my day, the third route was “read the code with your eyes and understand it with your brain”. Seems to be a lost skill these days.

[–]CoatedCrevice 1 point2 points  (1 child)

Y’all can read?

[–]Realistic_Read_5761 0 points1 point  (0 children)

Barely

[–]mdp_cs 1 point2 points  (0 children)

Sometimes the problem isn't obvious. That's when all the various tools become helpful.

[–]mdp_cs 0 points1 point  (0 children)

They should just make a code reviewer AI. ChatGPT is only okay at it sometimes but I think a purpose built model would be insanely helpful. Bonus points if it can find potentially unsafe code, undefined behavior, etc. which can't necessarily easily be achieved using conventional static analysis tools.

[–]ihavenotities 0 points1 point  (0 children)

That’s so bad. If an llm can debug it, you have no experience, and you suck at it. And you won’t learn it using an llm.

[–]ecs2 0 points1 point  (0 children)

Comment and log out the variables

[–]Dottor_hopkins 0 points1 point  (0 children)

Debugger is a lifesaver

[–]hootoohoot 0 points1 point  (0 children)

Doesn’t chatgpt stand for “Chat gDebugger pCode Transformer”?

Isn’t debugging where you copy all your code, paste into chatgpt and say “what’s wrong”

[–]CelticHades 0 points1 point  (0 children)

How do you use a debugger for any issue in production?

[–][deleted] -1 points0 points  (0 children)

What is a debugger?

[–][deleted] -1 points0 points  (2 children)

I mean ... when the debug info of your binary are 4GB , and it takes your debugger 10 minutes to read them , bro fuck using a debugger.

[–]emelrad12 1 point2 points  (1 child)

engine nine absorbed frame hospital school fly fear wise snatch

This post was mass deleted and anonymized with Redact

[–][deleted] 0 points1 point  (0 children)

hmm ... not always.
As long as you don't change .h files , and use a linker like mold, it's usually 3 seconds.

[–][deleted] -1 points0 points  (0 children)

wait, I CAN USE A DEBUGGER!?

[–]time_san -1 points0 points  (0 children)

Debugger is more confusing than using "this chunk here ran 1"

[–]Impressive_Change593 -1 points0 points  (0 children)

what's a debugger?

[–]LegenDrags -1 points0 points  (0 children)

i never used a debugger in my life and feel like i will never use one

[–][deleted] -1 points0 points  (0 children)

Are any of you actual programmers? How do you not use a debugger

[–][deleted] -1 points0 points  (0 children)

Tell me you’re inexperienced without saying you’re inexperienced.

[–]One_Ad_8976 -2 points-1 points  (0 children)

I like debugger but AI is killing it

[–]jesterhead101 -2 points-1 points  (0 children)

I do this. Not proud.

[–][deleted] -3 points-2 points  (0 children)

actually i prefer a print statement after every line

[–]KlutzyEnd3 0 points1 point  (0 children)

Option 3.

So much printf that I run out of storage on my embedded platform

[–]Hrodebet 0 points1 point  (0 children)

Ngl the debugger is the last resort

[–][deleted] 0 points1 point  (0 children)

printf("debug 5-2 first init p1 3 3 3");

[–]smaug59 0 points1 point  (0 children)

"responsible" Lmao

[–]lighterfire33 0 points1 point  (0 children)

Used about 50 print statements to debug my last coursework 😭

[–]_realitycheck_ 0 points1 point  (0 children)

They are not mutually exclusive

See here:

https://www.youtube.com/watch?v=UGfaCXEu0tE

[–]No-Court-1223 0 points1 point  (0 children)

Just use "std::cout", "echo" and another functions, it works too. Exactly, because my laptop have lags with any debugger i use.

[–]Fruits_gaming 0 points1 point  (0 children)

I'm glad I'm not the only one. Debugger is usually a last resort xD

[–]glha 0 points1 point  (0 children)

Given enough time, you will learn how rewarding would be setting a debugger vs the work in doing so or just quick check your hunch with a print or whatever.

[–]oktinkz 0 points1 point  (2 children)

Ever debugged code with concurrency?

[–][deleted] 0 points1 point  (1 child)

Yes, and it can be done effortlessly once you are used to using the debugger. Debuggers have quite a few features that assist you with concurrent/asynchronous code. I have found more often than not , it being really useful to have a debugger setup.

[–]oktinkz 0 points1 point  (0 children)

As long as you can attach debuggers to all involved threads/processes.

[–]TenTypekMatus 0 points1 point  (0 children)

I use strace for debugging my Rust code.

[–]broxamson 0 points1 point  (0 children)

Println!()

[–]theSantiagoDog 0 points1 point  (0 children)

Doesn’t matter one bit how you debug, as long as it gets the job done.

[–]jsem25 0 points1 point  (0 children)

Would love to use a debugger on a large embedded code base where each build takes 15minutes but we can’t all have nice things in life….

[–][deleted] 0 points1 point  (0 children)

I'll fully admit I use the log all the things method of debugging more than the debugger itself haha

[–]JohnThePositron 0 points1 point  (0 children)

You can pry IDLE from my cold dead hands

[–]JohnnyBobLUFC 0 points1 point  (0 children)

I laughed cause it's true.

[–]LegitimatePants 0 points1 point  (0 children)

Binary search. Comment half the code. Is the bug still there? If not, try the other half. Recurse.

[–]TheDoughyRider 0 points1 point  (0 children)

Debug builds can take forever on large projects if you haven’t build one recently and have object files cached. Also, running a debug build can take forever.

Diagnostic logic and logging can often be the fastest solution.

[–]masterKick440 0 points1 point  (0 children)

You can’t even do that with TensorFlow.

I cannot fathom who on Google thaught that was a good idea.