Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 135250
Collapse All | Expand All

(-)src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java (-20 / +26 lines)
Lines 671-677 Link Here
671
		try {
671
		try {
672
			ICDILocator location = cdiBreakpoint.getLocator();
672
			ICDILocator location = cdiBreakpoint.getLocator();
673
			String file = location.getFile();
673
			String file = location.getFile();
674
			if ( !isEmpty( file ) ) {
674
			if ( !isEmpty( location.getFunction() ) ) {
675
				breakpoint = createFunctionBreakpoint( cdiBreakpoint );
676
			}
677
			else if ( !location.getAddress().equals( BigInteger.ZERO ) ) {
678
				breakpoint = createAddressBreakpoint( cdiBreakpoint );
679
			} else if ( !isEmpty( file ) ) {
675
				Object sourceElement = getSourceElement( file );
680
				Object sourceElement = getSourceElement( file );
676
				String sourceHandle = file;
681
				String sourceHandle = file;
677
				IResource resource = getProject();
682
				IResource resource = getProject();
Lines 682-688 Link Here
682
				else if ( sourceElement instanceof IStorage ) {
687
				else if ( sourceElement instanceof IStorage ) {
683
					sourceHandle = ((IStorage)sourceElement).getFullPath().toOSString();
688
					sourceHandle = ((IStorage)sourceElement).getFullPath().toOSString();
684
					resource = ResourcesPlugin.getWorkspace().getRoot();
689
					resource = ResourcesPlugin.getWorkspace().getRoot();
685
				}
690
				} 
686
				breakpoint = createLineBreakpoint( sourceHandle, resource, cdiBreakpoint );
691
				breakpoint = createLineBreakpoint( sourceHandle, resource, cdiBreakpoint );
687
//				else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
692
//				else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
688
//					breakpoint = createFunctionBreakpoint( cdiBreakpoint );
693
//					breakpoint = createFunctionBreakpoint( cdiBreakpoint );
Lines 691-702 Link Here
691
//					breakpoint = createAddressBreakpoint( cdiBreakpoint );
696
//					breakpoint = createAddressBreakpoint( cdiBreakpoint );
692
//				}
697
//				}
693
			}
698
			}
694
			else if ( !isEmpty( location.getFunction() ) ) {
695
				breakpoint = createFunctionBreakpoint( cdiBreakpoint );
696
			}
697
			else if ( !location.getAddress().equals( BigInteger.ZERO ) ) {
698
				breakpoint = createAddressBreakpoint( cdiBreakpoint );
699
			}
700
		}
699
		}
701
		catch( CDIException e ) {
700
		catch( CDIException e ) {
702
		}
701
		}
Lines 876-893 Link Here
876
		if ( breakpoint instanceof ICAddressBreakpoint )
875
		if ( breakpoint instanceof ICAddressBreakpoint )
877
			return supportsAddressBreakpoint( (ICAddressBreakpoint)breakpoint );
876
			return supportsAddressBreakpoint( (ICAddressBreakpoint)breakpoint );
878
		if ( breakpoint instanceof ICLineBreakpoint ) {
877
		if ( breakpoint instanceof ICLineBreakpoint ) {
879
			try {
878
			/* if this isn't a valid line breakpoint, then GDB will produce an
880
				String handle = breakpoint.getSourceHandle();
879
			 * error message, which is sufficient handling of the problem.
881
				ISourceLocator sl = getSourceLocator();
880
             *
882
				if ( sl instanceof ICSourceLocator )
881
             * Arrghhh... I forget exactly why, but the code below stops address breakpoints
883
					return ( ((ICSourceLocator)sl).findSourceElement( handle ) != null );
882
             * from working correctly.
884
				else if ( sl instanceof CSourceLookupDirector ) {
883
			 */
885
					return ( ((CSourceLookupDirector)sl).contains( breakpoint ) );
884
			return true;
886
				}
885
//			try {
887
			}
886
//				String handle = breakpoint.getSourceHandle();
888
			catch( CoreException e ) {
887
//				ISourceLocator sl = getSourceLocator();
889
				return false;
888
//				if ( sl instanceof ICSourceLocator )
890
			}
889
//					return ( ((ICSourceLocator)sl).findSourceElement( handle ) != null );
890
//				else if (checkCSourceLookupDirector(sl)) {
891
//					return ( ((CSourceLookupDirector)sl).contains( breakpoint ) );
892
//				}
893
//			}
894
//			catch( CoreException e ) {
895
//				return false;
896
//			}
891
		}
897
		}
892
		else {
898
		else {
893
			IProject project = resource.getProject();
899
			IProject project = resource.getProject();
(-)cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java (-11 / +13 lines)
Lines 433-446 Link Here
433
					int line = allMIBreakpoints[i].getLine();
433
					int line = allMIBreakpoints[i].getLine();
434
					String addr = allMIBreakpoints[i].getAddress();
434
					String addr = allMIBreakpoints[i].getAddress();
435
435
436
					if (file != null && file.length() > 0 && line > 0) {
436
					if (function != null && function.length() > 0) {
437
						LineLocation location = createLineLocation (allMIBreakpoints[i].getFile(),
438
								allMIBreakpoints[i].getLine());
439
						// By default new breakpoint are LineBreakpoint
440
						Breakpoint newBreakpoint = new LineBreakpoint(target, type, location, condition);
441
						newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
442
						bList.add(newBreakpoint);
443
					} else if (function != null && function.length() > 0) {
444
						FunctionLocation location = createFunctionLocation(file, function);
437
						FunctionLocation location = createFunctionLocation(file, function);
445
						// By default new breakpoint are LineBreakpoint
438
						// By default new breakpoint are LineBreakpoint
446
						Breakpoint newBreakpoint = new FunctionBreakpoint(target, type, location, condition);
439
						Breakpoint newBreakpoint = new FunctionBreakpoint(target, type, location, condition);
Lines 453-458 Link Here
453
						Breakpoint newBreakpoint = new AddressBreakpoint(target, type, location, condition);
446
						Breakpoint newBreakpoint = new AddressBreakpoint(target, type, location, condition);
454
						newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
447
						newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
455
						bList.add(newBreakpoint);
448
						bList.add(newBreakpoint);
449
					} else if (file != null && file.length() > 0 && line > 0) {
450
						LineLocation location = createLineLocation (allMIBreakpoints[i].getFile(),
451
								allMIBreakpoints[i].getLine());
452
						// By default new breakpoint are LineBreakpoint
453
						Breakpoint newBreakpoint = new LineBreakpoint(target, type, location, condition);
454
						newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
455
						bList.add(newBreakpoint);
456
					}
456
					}
457
				}
457
				}
458
				eventList.add(new MIBreakpointCreatedEvent(miSession, no)); 
458
				eventList.add(new MIBreakpointCreatedEvent(miSession, no)); 
Lines 936-944 Link Here
936
					if (colon != -1) {
936
					if (colon != -1) {
937
						line.append(function);
937
						line.append(function);
938
					} else {
938
					} else {
939
						if (file != null && file.length() > 0) {
939
						// FIX!!! sometimes the file can be the name of the binary(foo.elf)
940
							line.append(file).append(':');
940
						// in which this does not work.
941
						}
941
//						if (file != null && file.length() > 0) {
942
//							line.append(file).append(':');
943
//						}
942
						// GDB does not seem to accept function arguments when
944
						// GDB does not seem to accept function arguments when
943
						// we use file name:
945
						// we use file name:
944
						// (gdb) break file.c:Test(int)
946
						// (gdb) break file.c:Test(int)

Return to bug 135250